summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/assembly-xml/src/test
diff options
context:
space:
mode:
authorbdaniel <bdaniel@13f79535-47bb-0310-9956-ffa450edef68>2010-07-26 04:15:06 +0000
committerbdaniel <bdaniel@13f79535-47bb-0310-9956-ffa450edef68>2010-07-26 04:15:06 +0000
commit12ed7f1d0e2458a90ee4e6486c7f078562883c64 (patch)
tree8d93d6e1d67a329a4a533c719f9aaab88b296d6e /sca-java-2.x/trunk/modules/assembly-xml/src/test
parente3f9d63e80f5f60deccbd4ebf88bcb214e7c5710 (diff)
TUSCANY-3630 Add externalAttachment processor
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@979147 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/assembly-xml/src/test')
-rw-r--r--sca-java-2.x/trunk/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/policy/xml/ReadDocumentTestCase.java21
-rw-r--r--sca-java-2.x/trunk/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/policy/xml/test_definitions.xml2
2 files changed, 23 insertions, 0 deletions
diff --git a/sca-java-2.x/trunk/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/policy/xml/ReadDocumentTestCase.java b/sca-java-2.x/trunk/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/policy/xml/ReadDocumentTestCase.java
index 231bdfd516..b91308cfb0 100644
--- a/sca-java-2.x/trunk/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/policy/xml/ReadDocumentTestCase.java
+++ b/sca-java-2.x/trunk/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/policy/xml/ReadDocumentTestCase.java
@@ -46,6 +46,7 @@ import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
import org.apache.tuscany.sca.policy.BindingType;
import org.apache.tuscany.sca.policy.ExtensionType;
+import org.apache.tuscany.sca.policy.ExternalAttachment;
import org.apache.tuscany.sca.policy.ImplementationType;
import org.apache.tuscany.sca.policy.Intent;
import org.apache.tuscany.sca.policy.IntentMap;
@@ -72,6 +73,8 @@ public class ReadDocumentTestCase {
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 Map<QName, ExternalAttachment> attachmentsTable = new Hashtable<QName, ExternalAttachment>();
+
private static final String scaNamespace = "http://docs.oasis-open.org/ns/opencsa/sca/200912";
private static final String namespace = "http://test";
@@ -86,6 +89,7 @@ public class ReadDocumentTestCase {
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");
+ private static final QName testPolicySetOne = new QName(namespace, "TestPolicySetOne");
@Before
public void setUp() throws Exception {
@@ -136,6 +140,9 @@ public class ReadDocumentTestCase {
} else if (artifact instanceof ImplementationType) {
ImplementationType implType = (ImplementationType)artifact;
implTypesTable.put(implType.getType(), implType);
+ } else if ( artifact instanceof ExternalAttachment) {
+ ExternalAttachment attachment = (ExternalAttachment)artifact;
+ attachmentsTable.put(attachment.getPolicySets().get(0).getName(), attachment);
}
if (artifact != null) {
@@ -172,6 +179,10 @@ public class ReadDocumentTestCase {
assertNotNull(bindingTypesTable.get(wsBinding));
assertEquals(implTypesTable.size(), 1);
assertNotNull(implTypesTable.get(javaImpl));
+
+ // Test external attachments
+ assertEquals(1, attachmentsTable.size());
+ assertNotNull(attachmentsTable.get(policySetTable.get(testPolicySetOne).getName()));
}
private int getNumberOfQualifiedPolicies(PolicySet policySet) {
@@ -218,6 +229,10 @@ public class ReadDocumentTestCase {
assertNull(javaImplType.getAlwaysProvidedIntents().get(0).getDescription());
assertNull(javaImplType.getMayProvidedIntents().get(0).getDescription());
+ ExternalAttachment attachment = attachmentsTable.values().iterator().next();
+ PolicySet psOne = policySetTable.get(testPolicySetOne);
+ assertEquals(psOne, attachment.getPolicySets().get(0));
+
List<Intent> intents = new ArrayList<Intent>(intentTable.values());
for (Intent intent : intents) {
@@ -241,6 +256,10 @@ public class ReadDocumentTestCase {
for (ExtensionType implType : implTypesTable.values()) {
staxProcessor.resolve(implType, resolver, context);
}
+
+ for ( ExternalAttachment ea : attachmentsTable.values()) {
+ staxProcessor.resolve(ea, resolver, context);
+ }
//testing if policy intents have been linked have property been linked up
assertNotNull(profileIntent.getRequiredIntents().get(0).getDescription());
@@ -268,6 +287,8 @@ public class ReadDocumentTestCase {
assertNotNull(javaImplType.getAlwaysProvidedIntents().get(0).getDescription());
assertNotNull(javaImplType.getMayProvidedIntents().get(0).getDescription());
+
+
}
private boolean isRealizedBy(PolicySet policySet, Intent intent) {
diff --git a/sca-java-2.x/trunk/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/policy/xml/test_definitions.xml b/sca-java-2.x/trunk/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/policy/xml/test_definitions.xml
index a262b00345..aea941a78f 100644
--- a/sca-java-2.x/trunk/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/policy/xml/test_definitions.xml
+++ b/sca-java-2.x/trunk/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/policy/xml/test_definitions.xml
@@ -201,4 +201,6 @@
</description>
</intent>
+ <externalAttachment policySets="test:TestPolicySetOne" attachTo="IntentRefs('test:testIntentOne')"/>
+
</definitions> \ No newline at end of file