summaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
Diffstat (limited to 'java')
-rw-r--r--java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java28
-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, 29 insertions, 0 deletions
diff --git a/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java b/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java
index 5b143e0db8..ed62e0a406 100644
--- a/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java
+++ b/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java
@@ -459,6 +459,34 @@ public class PolicySetProcessor extends BaseStAXArtifactProcessor implements StA
// FIXME: How to resolve the policies?
}
}
+ // validate that the intent map has a qualifier for each
+ // intent qualifier. The above code has already checked that the
+ // qualifiers that are there are resolved
+ Intent providedIntent = intentMap.getProvidedIntent();
+ if (intentMap.getQualifiers().size() != providedIntent.getQualifiedIntents().size()){
+ String missingQualifiers = "";
+ for (Intent loopQualifiedIntent : providedIntent.getQualifiedIntents()){
+ boolean found = false;
+ for (Qualifier loopQualifier : intentMap.getQualifiers()){
+ if (loopQualifier.getIntent().getName().equals(loopQualifiedIntent.getName())){
+ found = true;
+ break;
+ }
+ }
+ if (!found){
+ missingQualifiers += loopQualifiedIntent.getName().getLocalPart() + " ";
+ }
+ }
+ if (missingQualifiers.length() > 0){
+ Monitor.error(context.getMonitor(),
+ this,
+ Messages.RESOURCE_BUNDLE,
+ "IntentMapMissingQualifiers",
+ policySet.getName().toString(),
+ providedIntent.getName().getLocalPart(),
+ missingQualifiers);
+ }
+ }
}
}
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 012ff1c471..b61f004b32 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
@@ -46,3 +46,4 @@ MultipleDefaultQualifiers = [POL30004] Intent {0} has more than one qualifier ma
QualifierIsNotUnique = [POL30005] The intent {0} has more than one qualifier with the name {1}
ProfileIntentNameWithPeriod = [POL30006] The profile intent name {0} must not have the character "." in it
IntentMapIsNotUnique = [POL30010] The policy set {0} has more than one intent map with the name {1}
+IntentMapMissingQualifiers = [POL30020] The policy set {0} intent map {1} has missing qualifiers: {2} The intent map qualifiers must match the provided intent qualifiers.