summaryrefslogtreecommitdiffstats
path: root/branches/2.0-M2/modules/policy-xml/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'branches/2.0-M2/modules/policy-xml/src/test')
-rw-r--r--branches/2.0-M2/modules/policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/PolicyXPathFunctionResolverTestCase.java132
-rw-r--r--branches/2.0-M2/modules/policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/ReadDocumentTestCase.java295
-rw-r--r--branches/2.0-M2/modules/policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/TestPolicyProcessor.java82
-rw-r--r--branches/2.0-M2/modules/policy-xml/src/test/resources/org/apache/tuscany/sca/policy/xml/Calculator.composite49
-rw-r--r--branches/2.0-M2/modules/policy-xml/src/test/resources/org/apache/tuscany/sca/policy/xml/test_definitions.xml203
5 files changed, 0 insertions, 761 deletions
diff --git a/branches/2.0-M2/modules/policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/PolicyXPathFunctionResolverTestCase.java b/branches/2.0-M2/modules/policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/PolicyXPathFunctionResolverTestCase.java
deleted file mode 100644
index e954f1ebe4..0000000000
--- a/branches/2.0-M2/modules/policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/PolicyXPathFunctionResolverTestCase.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.policy.xml;
-
-import java.util.Collections;
-import java.util.Iterator;
-
-import javax.xml.namespace.NamespaceContext;
-import javax.xml.xpath.XPath;
-import javax.xml.xpath.XPathConstants;
-import javax.xml.xpath.XPathExpression;
-import javax.xml.xpath.XPathFactory;
-
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.w3c.dom.NodeList;
-import org.xml.sax.InputSource;
-
-/**
- *
- */
-public class PolicyXPathFunctionResolverTestCase {
- private static XPath xpath;
-
- /**
- * @throws java.lang.Exception
- */
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- XPathFactory factory = XPathFactory.newInstance();
- xpath = factory.newXPath();
- xpath.setNamespaceContext(new NamespaceContextImpl());
- xpath.setXPathFunctionResolver(new PolicyXPathFunctionResolver(xpath.getNamespaceContext()));
- }
-
- @Test
- public void testIntentsRef() throws Exception {
- InputSource xml = new InputSource(getClass().getResourceAsStream("Calculator.composite"));
- // Test the rewrite of xpath so that the self:node() is passed into the SCA function
- XPathExpression exp = xpath.compile("//sca:composite/sca:component[sca:IntentRefs('sca:confidentiality', self::node())]");
- Object result = exp.evaluate(xml, XPathConstants.NODESET);
- Assert.assertTrue(result instanceof NodeList);
- NodeList nodes = (NodeList)result;
- // Assert.assertEquals(1, nodes.getLength());
- }
-
- @Test
- public void testURIRef() throws Exception {
- InputSource xml = new InputSource(getClass().getResourceAsStream("Calculator.composite"));
- XPathExpression exp = xpath.compile("sca:composite/sca:component[sca:URIRef('AddServiceComponent')]");
- Object result = exp.evaluate(xml, XPathConstants.NODESET);
- Assert.assertTrue(result instanceof NodeList);
- NodeList nodes = (NodeList)result;
- // Assert.assertEquals(1, nodes.getLength());
- }
-
- @Test
- public void testInterfaceRef() throws Exception {
- InputSource xml = new InputSource(getClass().getResourceAsStream("Calculator.composite"));
- XPathExpression exp = xpath.compile("//sca:composite/sca:component/sca:service[sca:InterfaceRef('AddService')]");
- Object result = exp.evaluate(xml, XPathConstants.NODESET);
- Assert.assertTrue(result instanceof NodeList);
- NodeList nodes = (NodeList)result;
- // Assert.assertEquals(1, nodes.getLength());
- }
-
- @Test
- public void testOperationRef() throws Exception {
- InputSource xml = new InputSource(getClass().getResourceAsStream("Calculator.composite"));
- XPathExpression exp = xpath.compile("//sca:composite/sca:component/sca:reference[sca:OperationRef('AddService/add')]");
- Object result = exp.evaluate(xml, XPathConstants.NODESET);
- Assert.assertTrue(result instanceof NodeList);
- NodeList nodes = (NodeList)result;
- // Assert.assertEquals(1, nodes.getLength());
- }
-
-
- /**
- * @throws java.lang.Exception
- */
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- }
-
- private static class NamespaceContextImpl implements NamespaceContext {
-
- private static final String SCA11_NS = "http://docs.oasis-open.org/ns/opencsa/sca/200903";
-
- public String getNamespaceURI(String prefix) {
- if ("sca".equals(prefix)) {
- return SCA11_NS;
- } else {
- return null;
- }
- }
-
- public String getPrefix(String namespaceURI) {
- if (SCA11_NS.equals(namespaceURI)) {
- return "sca";
- }
- return null;
- }
-
- public Iterator getPrefixes(String namespaceURI) {
- if (SCA11_NS.equals(namespaceURI)) {
- return Collections.singleton("sca").iterator();
- }
- return null;
- }
-
- }
-
-}
diff --git a/branches/2.0-M2/modules/policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/ReadDocumentTestCase.java b/branches/2.0-M2/modules/policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/ReadDocumentTestCase.java
deleted file mode 100644
index 0d0f945e43..0000000000
--- a/branches/2.0-M2/modules/policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/ReadDocumentTestCase.java
+++ /dev/null
@@ -1,295 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.policy.xml;
-
-import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.InputStream;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.resolver.DefaultModelResolver;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.monitor.DefaultMonitorFactory;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.MonitorFactory;
-import org.apache.tuscany.sca.policy.BindingType;
-import org.apache.tuscany.sca.policy.ExtensionType;
-import org.apache.tuscany.sca.policy.ImplementationType;
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.IntentMap;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.Qualifier;
-import org.apache.tuscany.sca.policy.impl.ImplementationTypeImpl;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * Test reading SCA XML assembly documents.
- *
- * @version $Rev: 551296 $ $Date: 2007-06-28 01:18:35 +0530 (Thu, 28 Jun 2007) $
- */
-public class ReadDocumentTestCase {
-
- private ModelResolver resolver;
- private StAXArtifactProcessor<Object> staxProcessor;
- private Monitor monitor;
-
- private static final QName elementToProcess =
- new QName("http://docs.oasis-open.org/ns/opencsa/sca/200903", "implementationType");
-
- private Map<QName, Intent> intentTable = new Hashtable<QName, Intent>();
- private Map<QName, PolicySet> policySetTable = new Hashtable<QName, PolicySet>();
- private Map<QName, BindingType> bindingTypesTable = new Hashtable<QName, BindingType>();
- private Map<QName, ImplementationType> implTypesTable = new Hashtable<QName, ImplementationType>();
- private static final String scaNamespace = "http://docs.oasis-open.org/ns/opencsa/sca/200903";
- private static final String namespace = "http://test";
-
- private static final QName confidentiality = new QName(namespace, "confidentiality");
- private static final QName integrity = new QName(namespace, "integrity");
- private static final QName messageProtection = new QName(namespace, "messageProtection");
- private static final QName confidentiality_transport = new QName(namespace, "confidentiality.transport");
- private static final QName confidentiality_message = new QName(namespace, "confidentiality.message");
- private static final QName secureReliablePolicy = new QName(namespace, "SecureReliablePolicy");
- private static final QName secureMessagingPolicies = new QName(namespace, "SecureMessagingPolicies");
- private static final QName securityPolicy = new QName(namespace, "SecurityPolicy");
- private static final QName basicAuthMsgProtSecurity = new QName(namespace, "BasicAuthMsgProtSecurity");
- private static final QName wsBinding = new QName(scaNamespace, "binding.ws");
- private static final QName javaImpl = new QName(scaNamespace, "implementation.java");
-
- @Before
- public void setUp() throws Exception {
- DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
- resolver = new DefaultModelResolver();
- XMLInputFactory inputFactory = XMLInputFactory.newInstance();
- // Create a monitor
- UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
- MonitorFactory monitorFactory = new DefaultMonitorFactory();
- if (monitorFactory != null) {
- monitor = monitorFactory.createMonitor();
- utilities.addUtility(monitorFactory);
- }
- StAXArtifactProcessorExtensionPoint staxProcessors =
- extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
- staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, monitor);
- staxProcessors.addArtifactProcessor(new TestPolicyProcessor());
-
- URL url = getClass().getResource("test_definitions.xml");
- InputStream urlStream = url.openStream();
- XMLStreamReader reader = inputFactory.createXMLStreamReader(urlStream);
- reader.next();
-
- //position on the right element qname to get processed
- while (reader.hasNext()) {
- reader.next();
- int event = reader.getEventType();
- if (event == START_ELEMENT && reader.getName().equals(elementToProcess)) {
- break;
- }
- }
- while (true) {
- int event = reader.getEventType();
- switch (event) {
- case START_ELEMENT: {
- Object artifact = staxProcessor.read(reader);
- if (artifact instanceof PolicySet) {
- PolicySet policySet = (PolicySet)artifact;
- policySet.setName(new QName(namespace, policySet.getName().getLocalPart()));
- policySetTable.put(policySet.getName(), policySet);
- } else if (artifact instanceof Intent) {
- Intent intent = (Intent)artifact;
- intent.setName(new QName(namespace, intent.getName().getLocalPart()));
- intentTable.put(intent.getName(), intent);
- for (Intent i : intent.getQualifiedIntents()) {
- i.setName(new QName(namespace, i.getName().getLocalPart()));
- intentTable.put(i.getName(), i);
- resolver.addModel(i);
- }
- } else if (artifact instanceof BindingType) {
- BindingType bindingType = (BindingType)artifact;
- bindingTypesTable.put(bindingType.getType(), bindingType);
- } else if (artifact instanceof ImplementationTypeImpl) {
- ImplementationType implType = (ImplementationType)artifact;
- implTypesTable.put(implType.getType(), implType);
- }
-
- if (artifact != null) {
- resolver.addModel(artifact);
- }
-
- break;
- }
- }
- if (reader.hasNext()) {
- reader.next();
- } else {
- break;
- }
- }
- urlStream.close();
- }
-
- @Test
- public void testReadSCADefinitions() throws Exception {
- assertNotNull(intentTable.get(confidentiality));
- assertNotNull(intentTable.get(messageProtection));
- assertNotNull(intentTable.get(confidentiality_transport));
- assertTrue(intentTable.get(confidentiality).getDescription().length() > 0);
-
- assertNotNull(policySetTable.get(secureReliablePolicy));
- assertTrue(policySetTable.get(secureReliablePolicy).getProvidedIntents().size() == 2);
- assertTrue(policySetTable.get(secureReliablePolicy).getPolicies().size() == 2);
-
- assertNotNull(policySetTable.get(secureMessagingPolicies));
- assertEquals(2, policySetTable.get(secureMessagingPolicies).getIntentMaps().get(0).getQualifiers().get(0).getPolicies().size());
-
- assertEquals(bindingTypesTable.size(), 1);
- assertNotNull(bindingTypesTable.get(wsBinding));
- assertEquals(implTypesTable.size(), 1);
- assertNotNull(implTypesTable.get(javaImpl));
- }
-
- private int getNumberOfQualifiedPolicies(PolicySet policySet) {
- int count = 0;
- for(IntentMap intentMap: policySet.getIntentMaps()) {
- for(Qualifier q: intentMap.getQualifiers()) {
- count += q.getPolicies().size();
- }
- }
- return count;
- }
-
- @Test
- public void testResolution() throws Exception {
- assertTrue(!intentTable.get(messageProtection).getRequiredIntents().isEmpty());
- Intent profileIntent = intentTable.get(new QName(namespace, "messageProtection"));
- assertNull(profileIntent.getRequiredIntents().get(0).getDescription());
-
- QName confidentiality_transport = new QName(namespace, "confidentiality.transport");
- assertTrue(intentTable.get(confidentiality_transport) instanceof Intent);
- Intent qualifiedIntent = (Intent)intentTable.get(new QName(namespace, "confidentiality.transport"));
- assertNull(qualifiedIntent.getDescription());
- assertNotNull(qualifiedIntent.getQualifiableIntent().getDescription());
-
- PolicySet secureReliablePolicySet = policySetTable.get(secureReliablePolicy);
- PolicySet secureMessagingPolicySet = policySetTable.get(secureMessagingPolicies);
- PolicySet securityPolicySet = policySetTable.get(securityPolicy);
-
- assertEquals(secureReliablePolicySet.getProvidedIntents().get(1).getName(), integrity);
- assertNull(secureReliablePolicySet.getProvidedIntents().get(1).getDescription());
- assertTrue(secureMessagingPolicySet.isUnresolved());
- assertEquals(2, getNumberOfQualifiedPolicies(securityPolicySet));
-
- //testing to ensure that inclusion of referred policy sets has not happened
- PolicySet basicAuthMsgProtSecurityPolicySet = policySetTable.get(basicAuthMsgProtSecurity);
- assertTrue(basicAuthMsgProtSecurityPolicySet.getPolicies().isEmpty());
- assertTrue(basicAuthMsgProtSecurityPolicySet.getIntentMaps().isEmpty());
-
- ExtensionType wsBindingType = bindingTypesTable.get(wsBinding);
- assertNull(wsBindingType.getAlwaysProvidedIntents().get(0).getDescription());
- assertNull(wsBindingType.getMayProvidedIntents().get(0).getDescription());
-
- ExtensionType javaImplType = implTypesTable.get(javaImpl);
- assertNull(javaImplType.getAlwaysProvidedIntents().get(0).getDescription());
- assertNull(javaImplType.getMayProvidedIntents().get(0).getDescription());
-
- List<Intent> intents = new ArrayList<Intent>(intentTable.values());
-
- for (Intent intent : intents) {
- staxProcessor.resolve(intent, resolver);
- }
-
- for (PolicySet policySet : policySetTable.values()) {
- if (policySet.getReferencedPolicySets().isEmpty())
- staxProcessor.resolve(policySet, resolver);
- }
-
- for (PolicySet policySet : policySetTable.values()) {
- if (!policySet.getReferencedPolicySets().isEmpty())
- staxProcessor.resolve(policySet, resolver);
- }
-
- for (ExtensionType bindingType : bindingTypesTable.values()) {
- staxProcessor.resolve(bindingType, resolver);
- }
-
- for (ExtensionType implType : implTypesTable.values()) {
- staxProcessor.resolve(implType, resolver);
- }
-
- //testing if policy intents have been linked have property been linked up
- assertNotNull(profileIntent.getRequiredIntents().get(0).getDescription());
- assertNotNull(qualifiedIntent.getQualifiableIntent().getDescription());
- assertEquals(secureReliablePolicySet.getProvidedIntents().get(1).getName(), integrity);
- assertNotNull(secureReliablePolicySet.getProvidedIntents().get(1).getDescription());
-
- //testing if policysets have been properly linked up with intents
- assertFalse(secureMessagingPolicySet.isUnresolved());
- assertTrue(isRealizedBy(secureMessagingPolicySet, intentTable.get(confidentiality)));
- assertTrue(isRealizedBy(secureMessagingPolicySet, intentTable.get(confidentiality_transport)));
-
- //testing if intent maps have been properly mapped to policies
- assertFalse(securityPolicySet.isUnresolved());
- assertTrue(isRealizedBy(securityPolicySet, intentTable.get(confidentiality)));
- assertTrue(isRealizedBy(securityPolicySet, intentTable.get(confidentiality_message)));
-
- //testing for inclusion of referred policysets
- assertFalse(basicAuthMsgProtSecurityPolicySet.getPolicies().isEmpty());
- assertFalse(basicAuthMsgProtSecurityPolicySet.getIntentMaps().isEmpty());
- assertTrue(isRealizedBy(basicAuthMsgProtSecurityPolicySet, intentTable.get(confidentiality_transport)));
-
- assertNotNull(wsBindingType.getAlwaysProvidedIntents().get(0).getDescription());
- assertNotNull(wsBindingType.getMayProvidedIntents().get(0).getDescription());
-
- assertNotNull(javaImplType.getAlwaysProvidedIntents().get(0).getDescription());
- assertNotNull(javaImplType.getMayProvidedIntents().get(0).getDescription());
- }
-
- private boolean isRealizedBy(PolicySet policySet, Intent intent) {
- if (intent.getName().getLocalPart().indexOf('.') == -1) {
- return policySet.getProvidedIntents().contains(intent);
- }
- for (IntentMap map : policySet.getIntentMaps()) {
- for (Qualifier q : map.getQualifiers()) {
- if (q.getIntent().equals(intent)) {
- return true;
- }
- }
- }
- return false;
- }
-}
diff --git a/branches/2.0-M2/modules/policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/TestPolicyProcessor.java b/branches/2.0-M2/modules/policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/TestPolicyProcessor.java
deleted file mode 100644
index 6887cd1b42..0000000000
--- a/branches/2.0-M2/modules/policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/TestPolicyProcessor.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.policy.xml;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.contribution.processor.ContributionReadException;
-import org.apache.tuscany.sca.contribution.processor.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.processor.ContributionWriteException;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.policy.PolicyExpression;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class TestPolicyProcessor implements StAXArtifactProcessor<PolicyExpression> {
-
- public QName getArtifactType() {
- return new QName("http://schemas.xmlsoap.org/ws/2004/09/policy", "PolicyAttachment");
- }
-
- public PolicyExpression read(XMLStreamReader arg0) throws ContributionReadException, XMLStreamException {
- return new MockPolicyImplOne();
- }
-
- public void write(PolicyExpression arg0, XMLStreamWriter arg1) throws ContributionWriteException, XMLStreamException {
- }
-
- public Class<PolicyExpression> getModelType() {
- // TODO Auto-generated method stub
- return PolicyExpression.class;
- }
-
- public void resolve(PolicyExpression arg0, ModelResolver arg1) throws ContributionResolveException {
-
- }
-
- public class MockPolicyImplOne implements PolicyExpression {
- public <T> T getPolicy() {
- return null;
- }
-
- public void setName(QName name) {
- }
-
- public <T> void setPolicy(T policy) {
- }
-
- public QName getName() {
- return new QName("http://schemas.xmlsoap.org/ws/2004/09/policy", "PolicyAttachment");
- }
-
- public boolean isUnresolved() {
- return false;
- }
-
- public void setUnresolved(boolean unresolved) {
- }
-
- }
-}
diff --git a/branches/2.0-M2/modules/policy-xml/src/test/resources/org/apache/tuscany/sca/policy/xml/Calculator.composite b/branches/2.0-M2/modules/policy-xml/src/test/resources/org/apache/tuscany/sca/policy/xml/Calculator.composite
deleted file mode 100644
index 3ade69523c..0000000000
--- a/branches/2.0-M2/modules/policy-xml/src/test/resources/org/apache/tuscany/sca/policy/xml/Calculator.composite
+++ /dev/null
@@ -1,49 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200903"
- targetNamespace="http://sample"
- xmlns:sample="http://sample"
- name="Calculator">
-
- <component name="CalculatorServiceComponent" requires="sca:confidentiality">
- <implementation.java class="calculator.CalculatorServiceImpl"/>
- <reference name="addService" target="AddServiceComponent" />
- <reference name="subtractService" target="SubtractServiceComponent" />
- <reference name="multiplyService" target="MultiplyServiceComponent" />
- <reference name="divideService" target="DivideServiceComponent" />
- </component>
-
- <component name="AddServiceComponent">
- <implementation.java class="calculator.AddServiceImpl"/>
- </component>
-
- <component name="SubtractServiceComponent">
- <implementation.java class="calculator.SubtractServiceImpl"/>
- </component>
-
- <component name="MultiplyServiceComponent">
- <implementation.java class="calculator.MultiplyServiceImpl"/>
- </component>
-
- <component name="DivideServiceComponent">
- <implementation.java class="calculator.DivideServiceImpl"/>
- </component>
-
-</composite>
diff --git a/branches/2.0-M2/modules/policy-xml/src/test/resources/org/apache/tuscany/sca/policy/xml/test_definitions.xml b/branches/2.0-M2/modules/policy-xml/src/test/resources/org/apache/tuscany/sca/policy/xml/test_definitions.xml
deleted file mode 100644
index 911833550f..0000000000
--- a/branches/2.0-M2/modules/policy-xml/src/test/resources/org/apache/tuscany/sca/policy/xml/test_definitions.xml
+++ /dev/null
@@ -1,203 +0,0 @@
-<?xml version="1.0" encoding="ASCII"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<definitions xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200903" targetNamespace="http://test"
- xmlns:test="http://test" xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200903">
-
- <!-- Extension Types Metadata -->
- <implementationType type="sca:implementation.java" alwaysProvides="test:logging" mayProvide="test:tracing" />
- <bindingType type="sca:binding.ws" alwaysProvides="test:confidentiality" mayProvide="test:integrity" />
-
- <!-- Intents and Policysets to assume targetnamespace -->
- <intent name="TestIntentOne" constrains="sca:binding">
- <description>
- Test Intent
- </description>
- </intent>
-
- <intent name="TestIntentTwo" constrains="sca:binding" requires="test:TestIntentOne">
- <description>
- Protect messages from unauthorized reading or modification
- </description>
- </intent>
-
- <policySet name="TestPolicySetOne" provides="test:TestIntentOne" appliesTo="sca:binding.ws"
- xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200903" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
- <wsp:PolicyAttachment>
- <!-- policy expression and policy subject for
- "basic authentication" -->
- </wsp:PolicyAttachment>
- <wsp:PolicyAttachment>
- <!-- policy expression and policy subject for
- "reliability" -->
- </wsp:PolicyAttachment>
- </policySet>
-
- <!-- POLICY SETS -->
- <policySet name="SecureReliablePolicy" provides="test:confidentiality.transport test:integrity" appliesTo="sca:binding.ws"
- xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200903" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
- <wsp:PolicyAttachment>
- <!-- policy expression and policy subject for
- "basic authentication" -->
- </wsp:PolicyAttachment>
- <wsp:PolicyAttachment>
- <!-- policy expression and policy subject for
- "reliability" -->
- </wsp:PolicyAttachment>
- </policySet>
-
- <policySet name="SecureMessagingPolicies" provides="test:confidentiality" appliesTo="binding.ws"
- xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200903" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
- <intentMap provides="test:confidentiality" default="transport">
- <qualifier name="transport">
- <wsp:PolicyAttachment>
- <!-- policy expression and policy subject for "transport" alternative -->
- </wsp:PolicyAttachment>
- <wsp:PolicyAttachment>...</wsp:PolicyAttachment>
- </qualifier>
- <qualifier name="message">
- <wsp:PolicyAttachment>
- <!-- policy expression and policy subject for "message" alternative" -->
- </wsp:PolicyAttachment>
- </qualifier>
- </intentMap>
- </policySet>
-
- <policySet name="SecurityPolicy" provides="test:confidentiality" appliesTo="binding.ws"
- xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200903" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
- <intentMap provides="test:confidentiality" default="message">
- <qualifier name="message">
- <wsp:PolicyAttachment>
- <!-- policy attachment for body encryption -->
- </wsp:PolicyAttachment>
- </qualifier>
- <qualifier name="transport">
- <wsp:PolicyAttachment>
- <!-- policy attachment for transport encryption -->
- </wsp:PolicyAttachment>
- </qualifier>
- </intentMap>
- </policySet>
-
- <policySet name="BasicAuthMsgProtSecurity" provides="test:authentication test:confidentiality" appliesTo="binding.ws"
- xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200903">
- <policySetReference name="test:AuthenticationPolicies" />
- <policySetReference name="test:ConfidentialityPolicies" />
- </policySet>
-
- <policySet name="AuthenticationPolicies" provides="test:authentication" appliesTo="binding.ws"
- xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200903" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
- <wsp:PolicyAttachment>
- <!-- policy expression and policy subject for "basic
- authentication" -->
- </wsp:PolicyAttachment>
- </policySet>
-
- <policySet name="ConfidentialityPolicies" provides="test:confidentiality" appliesTo="binding.ws"
- xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200903" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
- <intentMap provides="test:confidentiality" default="transport">
- <qualifier name="transport">
- <wsp:PolicyAttachment>
- <!-- policy expression and policy subject for "transport"
- alternative -->
- </wsp:PolicyAttachment>
- <wsp:PolicyAttachment>...</wsp:PolicyAttachment>
- </qualifier>
- <qualifier name="message">
- <wsp:PolicyAttachment>
- <!-- policy expression and policy subject for "message"
- alternative" -->
- ...
- </wsp:PolicyAttachment>
- </qualifier>
- </intentMap>
- </policySet>
-
- <policySet name="SecureWSPolicy" provides="test:confidentiality" appliesTo="sca:binding.ws"
- xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200903" xmlns:sp="http://schemas.xmlsoap.org/ws/2002/12/secext"
- xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
- <wsp:Policy>
- <wsp:ExactlyOne>
- <wsp:All>
- <sp:SecurityToken>
- <sp:TokenType>sp:X509v3</sp:TokenType>
- </sp:SecurityToken>
- <sp:UsernameToken />
- <sp:SignedParts />
- <sp:EncryptedParts>
- <sp:Body />
- </sp:EncryptedParts>
- <sp:TransportBinding>
- <sp:IncludeTimeStamp />
- </sp:TransportBinding>
- </wsp:All>
- </wsp:ExactlyOne>
- </wsp:Policy>
- </policySet>
-
- <!-- profile intent -->
- <intent name="reliableMessageProtection" constrains="sca:binding" requires="test:messageProtection">
- <description>
- Protect messages from unauthorized reading or modification
- </description>
- </intent>
-
- <intent name="messageProtection" constrains="sca:binding" requires="test:confidentiality test:integrity">
- <description>
- Protect messages from unauthorized reading or modification
- </description>
- </intent>
-
- <!-- simple intent -->
- <intent name="confidentiality" constrains="sca:binding">
- <description>
- Communitcation thro this binding must prevent
- unauthorized users from reading the messages.
- </description>
- <qualifier name="transport" />
- <qualifier name="message" default="true" />
- </intent>
-
- <intent name="integrity" constrains="sca:binding">
- <description>
- Communitcation thro this binding must prevent
- unauthorized modification of the messages.
- </description>
- </intent>
-
- <intent name="authentication" constrains="sca:binding">
- <description>
- Communitcation thro this binding required
- Authentication.
- </description>
- </intent>
-
- <intent name="logging" constrains="sca:implementation">
- <description>
- All messages to and from this implementation must be logged
- </description>
- </intent>
-
- <intent name="tracing" constrains="sca:implementation.java">
- <description>
- Need to figure out some description for this
- </description>
- </intent>
-
-</definitions> \ No newline at end of file