diff options
Diffstat (limited to '')
5 files changed, 30 insertions, 26 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 ffffd06404..ef039818cc 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 @@ -1019,8 +1019,6 @@ public class CompositeProcessor extends BaseAssemblyProcessor implements StAXArt //component and not lost implementation = resolveImplementation(implementation, resolver); - validatePropertyTypes(component, implementation); - component.setImplementation(implementation); } @@ -1045,24 +1043,6 @@ 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/org/apache/tuscany/sca/assembly/xml/assembly-xml-validation-messages.properties b/java/sca/modules/assembly-xml/src/main/resources/org/apache/tuscany/sca/assembly/xml/assembly-xml-validation-messages.properties index fe29a3be28..f12e94d968 100644 --- a/java/sca/modules/assembly-xml/src/main/resources/org/apache/tuscany/sca/assembly/xml/assembly-xml-validation-messages.properties +++ b/java/sca/modules/assembly-xml/src/main/resources/org/apache/tuscany/sca/assembly/xml/assembly-xml-validation-messages.properties @@ -29,4 +29,3 @@ ContributionResolveException = ContributionResolveException 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 diff --git a/java/sca/modules/assembly/src/main/resources/org/apache/tuscany/sca/assembly/builder/assembly-validation-messages.properties b/java/sca/modules/assembly/src/main/resources/org/apache/tuscany/sca/assembly/builder/assembly-validation-messages.properties index f1294c4e12..020707b838 100644 --- a/java/sca/modules/assembly/src/main/resources/org/apache/tuscany/sca/assembly/builder/assembly-validation-messages.properties +++ b/java/sca/modules/assembly/src/main/resources/org/apache/tuscany/sca/assembly/builder/assembly-validation-messages.properties @@ -71,4 +71,6 @@ IntentNotFound = Intent {0} is not defined in SCA definitions PolicySetNotFound = PolicySet {0} is not defined in SCA definitions MutuallyExclusiveIntents = [POL40009] Intent {0} and {1} are mutually exclusive PropertyXpathExpressionReturnedNull = The property XPath expression for component {0} property {1} expression {2} did not match anything in the source property -PropertyHasManyValues = The property component {0} property {1} has many values but its "many" attribute is set to false
\ No newline at end of file +PropertyHasManyValues = The property component {0} property {1} has many values but its "many" attribute is set to false +PropertXSDTypesDontMatch = [ASM_5036] The property component {0} property {1} has XSD type {2} while its component type property has the XSD type {3} +PropertXSDElementsDontMatch = [ASM_5036] The property component {0} property {1} has XSD element {2} while its component type property has the XSD element {3}
\ No newline at end of file diff --git a/java/sca/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java b/java/sca/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java index 76d5a850d1..971a64c91b 100644 --- a/java/sca/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java +++ b/java/sca/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java @@ -568,8 +568,6 @@ public class ComponentBuilderImpl { componentTypeProperty.setValue(componentProperty.getValue()); } - - // Check that a component property does not override the // many attribute if (!componentTypeProperty.isMany() && componentProperty.isMany()) { @@ -601,6 +599,31 @@ public class ComponentBuilderImpl { component.getName(), componentProperty.getName()); } + + // check that the types specified in the component type and component property match + if ( componentProperty.getXSDElement() != null && + !componentProperty.getXSDElement().equals(componentTypeProperty.getXSDElement())){ + Monitor.error(monitor, + this, + Messages.ASSEMBLY_VALIDATION, + "PropertXSDElementsDontMatch", + component.getName(), + componentProperty.getName(), + componentProperty.getXSDElement().toString(), + componentTypeProperty.getXSDElement().toString()); + } + + if ( componentProperty.getXSDType() != null && + !componentProperty.getXSDType().equals(componentTypeProperty.getXSDType())){ + Monitor.error(monitor, + this, + Messages.ASSEMBLY_VALIDATION, + "PropertXSDTypesDontMatch", + component.getName(), + componentProperty.getName(), + componentProperty.getXSDType().toString(), + componentTypeProperty.getXSDType().toString()); + } } } diff --git a/java/sca/otest/newlayout/tuscany-test-runner/src/test/resources/tuscany-oasis-sca-tests-errors.properties b/java/sca/otest/newlayout/tuscany-test-runner/src/test/resources/tuscany-oasis-sca-tests-errors.properties index e6d3b205cf..b830911614 100644 --- a/java/sca/otest/newlayout/tuscany-test-runner/src/test/resources/tuscany-oasis-sca-tests-errors.properties +++ b/java/sca/otest/newlayout/tuscany-test-runner/src/test/resources/tuscany-oasis-sca-tests-errors.properties @@ -32,10 +32,10 @@ ASM_5023=OASIS issue opened ASM_5024=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TestComponent1, Reference: Reference1] - Composite {http://docs.oasis-open.org/ns/opencsa/sca/200903} Component TestComponent1 Reference Reference1 must not specify endpoints using both target attribute and with binding uri attribute ASM_5027=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TestComponent1] - Duplicate component property name: Component = TestComponent1 Property = serviceName ASM_5028=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TestComponent1] - Property not found for component property: Component = TestComponent1 Property = randomName -ASM_5029=TUSCANY-3231 +ASM_5029=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TestComponent1] - The property component TestComponent1 property complexType has many values but its "many" attribute is set to false ASM_5030=org.oasisopen.sca.ServiceRuntimeException: [Contribution: ASM_5030, Artifact: Test_ASM_5030.composite] - ASM50033: value attribute exists for the property element ASM_5035=org.apache.tuscany.sca.contribution.processor.ContributionReadException: Error: property has both @type and @element attribute values - complexType -ASM_5036=Unknown error message - need to determine the correct error message for this testcase +ASM_5036=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TEST_ASM_5036Component1] - [ASM_5036] The property component TEST_ASM_5036Component1 property complexType has XSD type {http://docs.oasis-open.org/ns/opencsa/scatests/200903}ComplexType2 while its component type property has the XSD type {http://docs.oasis-open.org/ns/opencsa/scatests/200903}ComplexType1 ASM_5037=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TEST_ASM_5037Component1] - Property not found for component property: Component = TEST_ASM_5037Component1 Property = bogusName ASM_6016=Unknown error message - need to determine the correct error message for this testcase ASM_6020=Unknown error message - need to determine the correct error message for this testcase |