diff options
Diffstat (limited to 'java/sca/modules/assembly-xml/src/main')
2 files changed, 21 insertions, 1 deletions
diff --git a/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java b/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java index d47059bac5..b20a788027 100644 --- a/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java +++ b/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java @@ -994,6 +994,8 @@ public class CompositeProcessor extends BaseAssemblyProcessor implements StAXArt //for this that is resolved, the specified intents and policysets are safe in the //component and not lost implementation = resolveImplementation(implementation, resolver); + + validatePropertyTypes(component, implementation); component.setImplementation(implementation); } @@ -1019,6 +1021,24 @@ public class CompositeProcessor extends BaseAssemblyProcessor implements StAXArt } // end try } + /** + * ASM50036: The property type specified for the property element of a component MUST be + * compatible with the type of the property with the same @name declared in the component + * type of the implementation used by the component. + */ + private void validatePropertyTypes(Component component, Implementation implementation) { + for (Property cp : component.getProperties()) { + Property ip = implementation.getProperty(cp.getName()); + if (cp != null && ip != null && cp.getXSDType() != null && ip.getXSDType() != null) { + if (!cp.getXSDType().equals(ip.getXSDType())) { + // FIXME: how to test for incompatible instead of not equal + // TODO: TUSCANY-3236, should be error not warning + warning("IncompatiblePropertyType", component, component.getName(), cp.getName()); + } + } + } + } + public QName getArtifactType() { return COMPOSITE_QNAME; } diff --git a/java/sca/modules/assembly-xml/src/main/resources/assembly-xml-validation-messages.properties b/java/sca/modules/assembly-xml/src/main/resources/assembly-xml-validation-messages.properties index 94e462fc96..5a633ff22e 100644 --- a/java/sca/modules/assembly-xml/src/main/resources/assembly-xml-validation-messages.properties +++ b/java/sca/modules/assembly-xml/src/main/resources/assembly-xml-validation-messages.properties @@ -28,4 +28,4 @@ ContributionReadException = ContributionReadException occured due to : {0} ContributionWriteException = ContributionWriteException occured due to : {0} XMLStreamException = XMLStreamException occured due to : {0} DuplicateCompositeName = [ASM_6001] More than one composite with the same name {0} found in contribution {1} - +IncompatiblePropertyType = [ASM_5036] Component {0} property {1} type is not compatible with implementation property type |