summaryrefslogtreecommitdiffstats
path: root/java/sca/modules/assembly-xml
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2009-11-11 15:35:43 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2009-11-11 15:35:43 +0000
commit815e37e687668f4122a5ace455c2d88a4b922775 (patch)
treec689b2104af4d1ab92a01da2a70904f5cfc4a18f /java/sca/modules/assembly-xml
parent844b0a83737307b3974c42fd88cbbe70b496e23a (diff)
Add test for non-unique intent qualifier - POL-3005
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@834913 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/assembly-xml')
-rw-r--r--java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/policy/xml/IntentProcessor.java14
-rw-r--r--java/sca/modules/assembly-xml/src/main/resources/org/apache/tuscany/sca/policy/xml/policy-xml-validation-messages.properties1
2 files changed, 14 insertions, 1 deletions
diff --git a/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/policy/xml/IntentProcessor.java b/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/policy/xml/IntentProcessor.java
index 49960cf6e8..12767ed55c 100644
--- a/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/policy/xml/IntentProcessor.java
+++ b/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/policy/xml/IntentProcessor.java
@@ -159,7 +159,19 @@ public class IntentProcessor extends BaseStAXArtifactProcessor implements StAXAr
intent.getName().toString());
}
}
- intent.getQualifiedIntents().add(qualified);
+
+ // check that the qualifier is unique
+ if ( !intent.getQualifiedIntents().contains(qualified)){
+ intent.getQualifiedIntents().add(qualified);
+ } else {
+ Monitor.error(context.getMonitor(),
+ this,
+ Messages.RESOURCE_BUNDLE,
+ "QualifierIsNotUnique",
+ intent.getName().toString(),
+ qualifierName);
+ }
+
qualified.setQualifiableIntent(intent);
current = qualified;
}
diff --git a/java/sca/modules/assembly-xml/src/main/resources/org/apache/tuscany/sca/policy/xml/policy-xml-validation-messages.properties b/java/sca/modules/assembly-xml/src/main/resources/org/apache/tuscany/sca/policy/xml/policy-xml-validation-messages.properties
index 6fb369f73f..105158b986 100644
--- a/java/sca/modules/assembly-xml/src/main/resources/org/apache/tuscany/sca/policy/xml/policy-xml-validation-messages.properties
+++ b/java/sca/modules/assembly-xml/src/main/resources/org/apache/tuscany/sca/policy/xml/policy-xml-validation-messages.properties
@@ -43,4 +43,5 @@ IntentMapProvidesMissing = Required attribute "provides" missing for IntentMap i
QualifierNameMissing = Required attribute "name" missing for qualifier definition in PolicySet : {0}
ConstrainedTypeNotFound = Unable to find the extension type {0} constrained by intent: {1}
MultipleDefaultQualifiers = [POL30004] Intent {0} has more than one qualifier marked as the default qualifier
+QualifierIsNotUnique = [POL30005] The intent {0} has more than one qualifier with the name {1}