summaryrefslogtreecommitdiffstats
path: root/java/sca/modules
diff options
context:
space:
mode:
authorlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2008-07-08 23:04:16 +0000
committerlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2008-07-08 23:04:16 +0000
commit755737f1cef0f827f6c87c3d55560adebdb776f0 (patch)
tree2cba3090f524805b9e7a75efd06b2168b44b57d0 /java/sca/modules
parenta54ec2b53c3e478c61bc5c71548321ba33017773 (diff)
TUSCANY-2354 - Applying a slightly modified version of Ram's patch to get a sucessful build
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@675018 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules')
-rw-r--r--java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/definitions.xml9
-rw-r--r--java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/WSSecurityAuthentication.composite4
-rw-r--r--java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/definitions.xml12
-rw-r--r--java/sca/modules/definitions-xml/src/main/java/org/apache/tuscany/sca/definitions/xml/SCADefinitionsProcessor.java43
-rw-r--r--java/sca/modules/definitions-xml/src/test/resources/org/apache/tuscany/sca/definitions/test_definitions.xml5
-rw-r--r--java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicyIntentProcessor.java46
-rw-r--r--java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java15
-rw-r--r--java/sca/modules/policy-xml/src/main/resources/policy-xml-validation-messages.properties3
-rw-r--r--java/sca/modules/policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/ReadDocumentTestCase.java46
-rw-r--r--java/sca/modules/policy-xml/src/test/resources/org/apache/tuscany/sca/policy/xml/test_definitions.xml5
10 files changed, 131 insertions, 57 deletions
diff --git a/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/definitions.xml b/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/definitions.xml
index 75d0dc717c..871e889835 100644
--- a/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/definitions.xml
+++ b/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/definitions.xml
@@ -23,15 +23,6 @@
xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0">
<!-- WS Security POLICY SETS -->
- <!-- A policyset that uses WS Policy -->
- <sca:intent name="wsAuthentication"
- constrains="sca:binding.ws">
- <description>
- Communitcation thro this binding required Authentication.
- </description>
- </sca:intent>
-
- <!-- WS Security POLICY SETS -->
<sca:policySet name="wsAuthenticationPolicy"
provides="sca:authentication"
appliesTo="//sca:binding.ws"
diff --git a/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/WSSecurityAuthentication.composite b/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/WSSecurityAuthentication.composite
index 2a22a0905d..75b073c03a 100644
--- a/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/WSSecurityAuthentication.composite
+++ b/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/WSSecurityAuthentication.composite
@@ -27,7 +27,7 @@
so for this composite the service is: http://localhost:8085/myExplicitURI
-->
- <service name="helloWorld" promote="HelloWorldService" policySets="tuscany:wsSecurityPolicyForAuthentication">
+ <service name="helloWorld" promote="HelloWorldService" policySets="tuscany:wsAuthenticationPolicy">
<interface.wsdl interface="http://helloworld-om-uri#wsdl.interface(HelloWorld)" />
<binding.ws wsdlElement="http://helloworld-om-uri#wsdl.port(HelloWorldService/HelloWorldSoapPort)" />
</service>
@@ -41,7 +41,7 @@
<reference name="helloWorldWS" />
</component>
- <reference name="helloWorldWS" promote="HelloWorldComponent/helloWorldWS" policySets="tuscany:wsSecurityPolicyForAuthentication">
+ <reference name="helloWorldWS" promote="HelloWorldComponent/helloWorldWS" policySets="tuscany:wsAuthenticationPolicy">
<interface.wsdl interface="http://helloworld-om-uri#wsdl.interface(HelloWorld)" />
<binding.ws wsdlElement="http://helloworld-om-uri#wsdl.binding(HelloWorldSoapBinding)"
uri="http://localhost:8085/myExplicitURI"/>
diff --git a/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/definitions.xml b/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/definitions.xml
index 200400f0b5..8f7135e767 100644
--- a/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/definitions.xml
+++ b/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/definitions.xml
@@ -21,20 +21,12 @@
targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0"
xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0">
-
- <sca:intent name="wsAuthentication"
- constrains="sca:binding.ws">
- <description>
- Communitcation thro this binding required Authentication.
- </description>
- </sca:intent>
<!-- WS Security POLICY SETS -->
<!-- A policyset that uses WS Policy -->
- <sca:policySet name="wsSecurityPolicyForAuthentication"
+ <sca:policySet name="wsAuthenticationPolicy"
provides="sca:authentication"
- appliesTo="sca:binding.ws"
- >
+ appliesTo="sca:binding.ws">
<wsp:Policy wsu:Id="UTOverTransport"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
diff --git a/java/sca/modules/definitions-xml/src/main/java/org/apache/tuscany/sca/definitions/xml/SCADefinitionsProcessor.java b/java/sca/modules/definitions-xml/src/main/java/org/apache/tuscany/sca/definitions/xml/SCADefinitionsProcessor.java
index 6958501922..7709a9577e 100644
--- a/java/sca/modules/definitions-xml/src/main/java/org/apache/tuscany/sca/definitions/xml/SCADefinitionsProcessor.java
+++ b/java/sca/modules/definitions-xml/src/main/java/org/apache/tuscany/sca/definitions/xml/SCADefinitionsProcessor.java
@@ -22,6 +22,9 @@ package org.apache.tuscany.sca.definitions.xml;
import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+import java.util.List;
+import java.util.ArrayList;
+
import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamException;
@@ -40,6 +43,7 @@ import org.apache.tuscany.sca.definitions.impl.SCADefinitionsImpl;
import org.apache.tuscany.sca.policy.Intent;
import org.apache.tuscany.sca.policy.IntentAttachPointType;
import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.ProfileIntent;
import org.apache.tuscany.sca.policy.QualifiedIntent;
import org.apache.tuscany.sca.monitor.Monitor;
@@ -173,12 +177,28 @@ public class SCADefinitionsProcessor extends BaseStAXArtifactProcessor implement
// start by adding all of the top level artifacts into the resolver as there
// are many cross artifact references in a definitions file and we don't want
// to be dependent on the order things appear
+
+ List<Intent> simpleIntents = new ArrayList<Intent>();
+ List<ProfileIntent> profileIntents = new ArrayList<ProfileIntent>();
+ List<QualifiedIntent> qualifiedIntents = new ArrayList<QualifiedIntent>();
+ List<PolicySet> simplePolicySets = new ArrayList<PolicySet>();
+ List<PolicySet> referredPolicySets = new ArrayList<PolicySet>();
for (Intent policyIntent : scaDefns.getPolicyIntents()) {
- resolver.addModel(policyIntent);
- }
+ if (policyIntent instanceof ProfileIntent)
+ profileIntents.add((ProfileIntent)policyIntent);
+ else if (policyIntent instanceof QualifiedIntent)
+ qualifiedIntents.add((QualifiedIntent)policyIntent);
+ else simpleIntents.add(policyIntent);
+
+ resolver.addModel(policyIntent);
+ }
for (PolicySet policySet : scaDefns.getPolicySets()) {
+ if (policySet.getReferencedPolicySets().isEmpty())
+ simplePolicySets.add(policySet);
+ else referredPolicySets.add(policySet);
+
resolver.addModel(policySet);
}
@@ -193,15 +213,20 @@ public class SCADefinitionsProcessor extends BaseStAXArtifactProcessor implement
// now resolve everything to ensure that any references between
// artifacts are satisfied
- for (int count = 0, size = scaDefns.getPolicyIntents().size(); count < size; count++) {
- Intent intent = scaDefns.getPolicyIntents().get(count);
- extensionProcessor.resolve(intent, resolver);
- }
+ for (Intent policyIntent : simpleIntents)
+ extensionProcessor.resolve(policyIntent, resolver);
- for (int count = 0, size = scaDefns.getPolicySets().size(); count < size; count++) {
- PolicySet policySet = scaDefns.getPolicySets().get(count);
+ for (ProfileIntent policyIntent : profileIntents)
+ extensionProcessor.resolve(policyIntent, resolver);
+
+ for (QualifiedIntent policyIntent : qualifiedIntents)
+ extensionProcessor.resolve(policyIntent, resolver);
+
+ for (PolicySet policySet : simplePolicySets)
extensionProcessor.resolve(policySet, resolver);
- }
+
+ for (PolicySet policySet : referredPolicySets)
+ extensionProcessor.resolve(policySet, resolver);
for (int count = 0, size = scaDefns.getBindingTypes().size(); count < size; count++) {
IntentAttachPointType bindingType = scaDefns.getBindingTypes().get(count);
diff --git a/java/sca/modules/definitions-xml/src/test/resources/org/apache/tuscany/sca/definitions/test_definitions.xml b/java/sca/modules/definitions-xml/src/test/resources/org/apache/tuscany/sca/definitions/test_definitions.xml
index e01a29863a..6750944697 100644
--- a/java/sca/modules/definitions-xml/src/test/resources/org/apache/tuscany/sca/definitions/test_definitions.xml
+++ b/java/sca/modules/definitions-xml/src/test/resources/org/apache/tuscany/sca/definitions/test_definitions.xml
@@ -30,8 +30,7 @@
<!-- Intents and Policysets to assume targetnamespace -->
<intent name="TestIntentOne"
- constrains="sca:binding"
- >
+ constrains="sca:binding">
<description>
Test Intent
</description>
@@ -39,7 +38,7 @@
<intent name="TestIntentTwo"
constrains="sca:binding"
- requires="TestIntentOne">
+ requires="test:TestIntentOne">
<description>
Protect messages from unauthorized reading or modification
</description>
diff --git a/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicyIntentProcessor.java b/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicyIntentProcessor.java
index 109090ccab..33e88663ee 100644
--- a/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicyIntentProcessor.java
+++ b/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicyIntentProcessor.java
@@ -247,10 +247,24 @@ abstract class PolicyIntentProcessor<T extends Intent> extends BaseStAXArtifactP
for (Intent requiredIntent : policyIntent.getRequiredIntents()) {
if (requiredIntent.isUnresolved()) {
Intent resolvedRequiredIntent = resolver.resolveModel(Intent.class, requiredIntent);
- if (resolvedRequiredIntent != null) {
+ // At this point, when the required intent is not resolved, it does not mean
+ // its undeclared, chances are that their dependency are not resolved yet.
+ // Lets try to resolve them first.
+ if (resolvedRequiredIntent.isUnresolved()) {
+ if (resolvedRequiredIntent instanceof ProfileIntent) {
+ if ((((ProfileIntent)resolvedRequiredIntent).getRequiredIntents()).contains(policyIntent)) {
+ error("CyclicReferenceFound", resolver, requiredIntent, policyIntent);
+ return;
+ }
+ resolveDependent(resolvedRequiredIntent, resolver);
+ }
+ }
+
+ if (!resolvedRequiredIntent.isUnresolved()) {
requiredIntents.add(resolvedRequiredIntent);
} else {
error("RequiredIntentNotFound", resolver, requiredIntent, policyIntent);
+ return;
//throw new ContributionResolveException("Required Intent - " + requiredIntent
//+ " not found for ProfileIntent " + policyIntent);
}
@@ -270,19 +284,36 @@ abstract class PolicyIntentProcessor<T extends Intent> extends BaseStAXArtifactP
Intent qualifiableIntent = policyIntent.getQualifiableIntent();
if (qualifiableIntent.isUnresolved()) {
Intent resolvedQualifiableIntent = resolver.resolveModel(Intent.class, qualifiableIntent);
-
- if (resolvedQualifiableIntent != null) {
+ // At this point, when the qualifiable intent is not resolved, it does not mean
+ // its undeclared, chances are that their dependency are not resolved yet.
+ // Lets try to resolve them first.
+ if (resolvedQualifiableIntent.isUnresolved()) {
+ if (resolvedQualifiableIntent instanceof QualifiedIntent) {
+ resolveDependent(resolvedQualifiableIntent, resolver);
+ }
+ }
+
+ if (!resolvedQualifiableIntent.isUnresolved()) {
policyIntent.setQualifiableIntent(resolvedQualifiableIntent);
} else {
error("QualifiableIntentNotFound", resolver, qualifiableIntent, policyIntent);
//throw new ContributionResolveException("Qualifiable Intent - " + qualifiableIntent
//+ " not found for QualifiedIntent " + policyIntent);
- }
-
+ }
}
}
}
+ public void resolveDependent(Intent policyIntent, ModelResolver resolver) throws ContributionResolveException {
+ if (policyIntent instanceof ProfileIntent)
+ resolveProfileIntent((ProfileIntent)policyIntent, resolver);
+
+ if (policyIntent instanceof QualifiedIntent)
+ resolveQualifiedIntent((QualifiedIntent)policyIntent, resolver);
+
+ resolveContrainedArtifacts(policyIntent, resolver);
+ }
+
public void resolve(T policyIntent, ModelResolver resolver) throws ContributionResolveException {
if (policyIntent instanceof ProfileIntent) {
resolveProfileIntent((ProfileIntent)policyIntent, resolver);
@@ -360,11 +391,12 @@ abstract class PolicyIntentProcessor<T extends Intent> extends BaseStAXArtifactP
List<Intent> excludedIntents = new ArrayList<Intent>();
for (Intent excludedIntent : policyIntent.getExcludedIntents()) {
if (excludedIntent.isUnresolved()) {
- Intent resolvedExcludedIntent = resolver.resolveModel(Intent.class, excludedIntent);
- if (resolvedExcludedIntent != null) {
+ Intent resolvedExcludedIntent = resolver.resolveModel(Intent.class, excludedIntent);
+ if (!resolvedExcludedIntent.isUnresolved()) {
excludedIntents.add(resolvedExcludedIntent);
} else {
error("ExcludedIntentNotFound", resolver, excludedIntent, policyIntent);
+ return;
//throw new ContributionResolveException("Excluded Intent " + excludedIntent
//+ " not found for intent " + policyIntent);
}
diff --git a/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java b/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java
index b6f33aa677..e19099a2f3 100644
--- a/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java
+++ b/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java
@@ -371,13 +371,13 @@ public class PolicySetProcessor extends BaseStAXArtifactProcessor implements StA
for (Intent providedIntent : policySet.getProvidedIntents()) {
if (providedIntent.isUnresolved()) {
Intent resolvedProvidedIntent = resolver.resolveModel(Intent.class, providedIntent);
- if (resolvedProvidedIntent != null) {
+ if (!resolvedProvidedIntent.isUnresolved()) {
providedIntents.add(resolvedProvidedIntent);
} else {
error("ProvidedIntentNotFound", policySet, providedIntent, policySet);
+ return;
//throw new ContributionResolveException("Provided Intent - " + providedIntent
//+ " not found for PolicySet " + policySet);
-
}
} else {
providedIntents.add(providedIntent);
@@ -394,11 +394,11 @@ public class PolicySetProcessor extends BaseStAXArtifactProcessor implements StA
Intent mappedIntent = entry.getKey();
if (mappedIntent.isUnresolved()) {
Intent resolvedMappedIntent = resolver.resolveModel(Intent.class, mappedIntent);
-
- if (resolvedMappedIntent != null) {
+ if (!resolvedMappedIntent.isUnresolved()) {
mappedPolicies.put(resolvedMappedIntent, entry.getValue());
} else {
error("MappedIntentNotFound", policySet, mappedIntent, policySet);
+ return;
//throw new ContributionResolveException("Mapped Intent - " + mappedIntent
//+ " not found for PolicySet " + policySet);
}
@@ -417,10 +417,11 @@ public class PolicySetProcessor extends BaseStAXArtifactProcessor implements StA
for (PolicySet referredPolicySet : policySet.getReferencedPolicySets()) {
if (referredPolicySet.isUnresolved()) {
PolicySet resolvedReferredPolicySet = resolver.resolveModel(PolicySet.class, referredPolicySet);
- if (resolvedReferredPolicySet != null) {
+ if (!resolvedReferredPolicySet.isUnresolved()) {
referredPolicySets.add(resolvedReferredPolicySet);
} else {
error("ReferredPolicySetNotFound", policySet, referredPolicySet, policySet);
+ return;
//throw new ContributionResolveException("Referred PolicySet - " + referredPolicySet
//+ "not found for PolicySet - " + policySet);
}
@@ -453,9 +454,9 @@ public class PolicySetProcessor extends BaseStAXArtifactProcessor implements StA
//resolve the policy attachments
resolvePolicies(policySet, resolver);
- if ( !policySet.isUnresolved() ) {
+ /*if ( !policySet.isUnresolved() ) {
resolver.addModel(policySet);
- }
+ }*/
}
}
}
diff --git a/java/sca/modules/policy-xml/src/main/resources/policy-xml-validation-messages.properties b/java/sca/modules/policy-xml/src/main/resources/policy-xml-validation-messages.properties
index d8eb214c15..60c73d5354 100644
--- a/java/sca/modules/policy-xml/src/main/resources/policy-xml-validation-messages.properties
+++ b/java/sca/modules/policy-xml/src/main/resources/policy-xml-validation-messages.properties
@@ -33,4 +33,5 @@ UnrecognizedIntentAttachPointType = Unrecognized IntentAttachPointType - {0}
RequiredAttributeMissing = Required attribute {0} missing from BindingType Definition
AlwaysProvidedIntentNotFound = Always Provided Intent - {0} not found for ExtensionType {1}
MayProvideIntentNotFound = May Provide Intent - {0} not found for ExtensionType {1}
-ContributionReadException = ContributionReadException occured due to: {0} \ No newline at end of file
+ContributionReadException = ContributionReadException occured due to: {0}
+CyclicReferenceFound = Cyclic reference detected in required attributes of ProfileIntents {0} and {1} \ No newline at end of file
diff --git a/java/sca/modules/policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/ReadDocumentTestCase.java b/java/sca/modules/policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/ReadDocumentTestCase.java
index b2e16f97e7..60de55a0d9 100644
--- a/java/sca/modules/policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/ReadDocumentTestCase.java
+++ b/java/sca/modules/policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/ReadDocumentTestCase.java
@@ -23,7 +23,9 @@ import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
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;
@@ -38,6 +40,10 @@ import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtens
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.MonitorFactory;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.impl.DefaultMonitorFactoryImpl;
import org.apache.tuscany.sca.policy.Intent;
import org.apache.tuscany.sca.policy.IntentAttachPointType;
import org.apache.tuscany.sca.policy.PolicySet;
@@ -55,7 +61,7 @@ public class ReadDocumentTestCase extends TestCase {
private ModelResolver resolver;
private StAXArtifactProcessor<Object> staxProcessor;
-
+ private Monitor monitor;
private Map<QName, Intent> intentTable = new Hashtable<QName, Intent>();
private Map<QName, PolicySet> policySetTable = new Hashtable<QName, PolicySet>();
@@ -82,8 +88,15 @@ public class ReadDocumentTestCase extends TestCase {
DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
resolver = new DefaultModelResolver();
XMLInputFactory inputFactory = XMLInputFactory.newInstance();
+ // Create a monitor
+ UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
+ MonitorFactory monitorFactory = new DefaultMonitorFactoryImpl();
+ if (monitorFactory != null) {
+ monitor = monitorFactory.createMonitor();
+ utilities.addUtility(monitorFactory);
+ }
StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
- staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, null);
+ staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, monitor);
staxProcessors.addArtifactProcessor(new TestPolicyProcessor());
URL url = getClass().getResource("test_definitions.xml");
@@ -187,12 +200,35 @@ public class ReadDocumentTestCase extends TestCase {
assertNull(javaImplType.getAlwaysProvidedIntents().get(0).getDescription());
assertNull(javaImplType.getMayProvideIntents().get(0).getDescription());
- for ( Intent intent : intentTable.values() ) {
+ List<Intent> simpleIntents = new ArrayList<Intent>();
+ List<ProfileIntent> profileIntents = new ArrayList<ProfileIntent>();
+ List<QualifiedIntent> qualifiedIntents = new ArrayList<QualifiedIntent>();
+
+ for (Intent intent : intentTable.values()) {
+ if (intent instanceof ProfileIntent)
+ profileIntents.add((ProfileIntent)intent);
+ else if (intent instanceof QualifiedIntent)
+ qualifiedIntents.add((QualifiedIntent)intent);
+ else simpleIntents.add(intent);
+ }
+
+ for (Intent intent : simpleIntents)
+ staxProcessor.resolve(intent, resolver);
+
+ for (ProfileIntent intent : profileIntents)
staxProcessor.resolve(intent, resolver);
+
+ for (QualifiedIntent intent : qualifiedIntents)
+ staxProcessor.resolve(intent, resolver);
+
+ for ( PolicySet policySet : policySetTable.values() ) {
+ if (policySet.getReferencedPolicySets().isEmpty())
+ staxProcessor.resolve(policySet, resolver);
}
for ( PolicySet policySet : policySetTable.values() ) {
- staxProcessor.resolve(policySet, resolver);
+ if (!policySet.getReferencedPolicySets().isEmpty())
+ staxProcessor.resolve(policySet, resolver);
}
for ( IntentAttachPointType bindingType : bindingTypesTable.values() ) {
@@ -203,8 +239,6 @@ public class ReadDocumentTestCase extends TestCase {
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());
diff --git a/java/sca/modules/policy-xml/src/test/resources/org/apache/tuscany/sca/policy/xml/test_definitions.xml b/java/sca/modules/policy-xml/src/test/resources/org/apache/tuscany/sca/policy/xml/test_definitions.xml
index e01a29863a..6750944697 100644
--- a/java/sca/modules/policy-xml/src/test/resources/org/apache/tuscany/sca/policy/xml/test_definitions.xml
+++ b/java/sca/modules/policy-xml/src/test/resources/org/apache/tuscany/sca/policy/xml/test_definitions.xml
@@ -30,8 +30,7 @@
<!-- Intents and Policysets to assume targetnamespace -->
<intent name="TestIntentOne"
- constrains="sca:binding"
- >
+ constrains="sca:binding">
<description>
Test Intent
</description>
@@ -39,7 +38,7 @@
<intent name="TestIntentTwo"
constrains="sca:binding"
- requires="TestIntentOne">
+ requires="test:TestIntentOne">
<description>
Protect messages from unauthorized reading or modification
</description>