You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by sl...@apache.org on 2009/10/09 19:59:58 UTC

svn commit: r823643 - in /tuscany/java/sca: modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ modules/assembly-xml/src/main/resources/org/apache/tuscany/sca/assembly/xml/ modules/assembly/src/main/resources/org/apache/tuscany/sca/...

Author: slaws
Date: Fri Oct  9 17:59:57 2009
New Revision: 823643

URL: http://svn.apache.org/viewvc?rev=823643&view=rev
Log:
TUSCANY-3258 raise an error when a component property type doesn't match the component type property type. This may need to be looked at further if we decide to consider if the types are compatible. 

Modified:
    tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
    tuscany/java/sca/modules/assembly-xml/src/main/resources/org/apache/tuscany/sca/assembly/xml/assembly-xml-validation-messages.properties
    tuscany/java/sca/modules/assembly/src/main/resources/org/apache/tuscany/sca/assembly/builder/assembly-validation-messages.properties
    tuscany/java/sca/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java
    tuscany/java/sca/otest/newlayout/tuscany-test-runner/src/test/resources/tuscany-oasis-sca-tests-errors.properties

Modified: tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java?rev=823643&r1=823642&r2=823643&view=diff
==============================================================================
--- tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java (original)
+++ tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java Fri Oct  9 17:59:57 2009
@@ -1019,8 +1019,6 @@
                     //component and not lost
                     implementation = resolveImplementation(implementation, resolver);
 
-                    validatePropertyTypes(component, implementation);
-
                     component.setImplementation(implementation);
                 }
 
@@ -1045,24 +1043,6 @@
         } // 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;
     }

Modified: tuscany/java/sca/modules/assembly-xml/src/main/resources/org/apache/tuscany/sca/assembly/xml/assembly-xml-validation-messages.properties
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/assembly-xml/src/main/resources/org/apache/tuscany/sca/assembly/xml/assembly-xml-validation-messages.properties?rev=823643&r1=823642&r2=823643&view=diff
==============================================================================
--- tuscany/java/sca/modules/assembly-xml/src/main/resources/org/apache/tuscany/sca/assembly/xml/assembly-xml-validation-messages.properties (original)
+++ tuscany/java/sca/modules/assembly-xml/src/main/resources/org/apache/tuscany/sca/assembly/xml/assembly-xml-validation-messages.properties Fri Oct  9 17:59:57 2009
@@ -29,4 +29,3 @@
 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

Modified: tuscany/java/sca/modules/assembly/src/main/resources/org/apache/tuscany/sca/assembly/builder/assembly-validation-messages.properties
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/assembly/src/main/resources/org/apache/tuscany/sca/assembly/builder/assembly-validation-messages.properties?rev=823643&r1=823642&r2=823643&view=diff
==============================================================================
--- tuscany/java/sca/modules/assembly/src/main/resources/org/apache/tuscany/sca/assembly/builder/assembly-validation-messages.properties (original)
+++ tuscany/java/sca/modules/assembly/src/main/resources/org/apache/tuscany/sca/assembly/builder/assembly-validation-messages.properties Fri Oct  9 17:59:57 2009
@@ -71,4 +71,6 @@
 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

Modified: tuscany/java/sca/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java?rev=823643&r1=823642&r2=823643&view=diff
==============================================================================
--- tuscany/java/sca/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java (original)
+++ tuscany/java/sca/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java Fri Oct  9 17:59:57 2009
@@ -568,8 +568,6 @@
                 componentTypeProperty.setValue(componentProperty.getValue());
             }
 
-
-
             // Check that a component property does not override the
             // many attribute
             if (!componentTypeProperty.isMany() && componentProperty.isMany()) {
@@ -601,6 +599,31 @@
                               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());                
+            }            
         }
     }
 

Modified: tuscany/java/sca/otest/newlayout/tuscany-test-runner/src/test/resources/tuscany-oasis-sca-tests-errors.properties
URL: http://svn.apache.org/viewvc/tuscany/java/sca/otest/newlayout/tuscany-test-runner/src/test/resources/tuscany-oasis-sca-tests-errors.properties?rev=823643&r1=823642&r2=823643&view=diff
==============================================================================
--- tuscany/java/sca/otest/newlayout/tuscany-test-runner/src/test/resources/tuscany-oasis-sca-tests-errors.properties (original)
+++ tuscany/java/sca/otest/newlayout/tuscany-test-runner/src/test/resources/tuscany-oasis-sca-tests-errors.properties Fri Oct  9 17:59:57 2009
@@ -32,10 +32,10 @@
 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