tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sl...@apache.org
Subject svn commit: r1170598 - in /tuscany/sca-java-2.x/trunk: modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/ modules/implementation-java-runtime/src/main/java/...
Date Wed, 14 Sep 2011 13:16:40 GMT
Author: slaws
Date: Wed Sep 14 13:16:39 2011
New Revision: 1170598

URL: http://svn.apache.org/viewvc?rev=1170598&view=rev
Log:
TUSCANY-3937 - Further fixes on top of Michael's patch to get the properties itest working.
Mainly,  builder changes to ignore null types (generated for non-JAXB pojos), update Node2JAXB
to report validation errors so things don't go wrong silently, ensure default XMLType doesn't
get updated, correct properties test to match OASIS, put properties test in the build.

Added:
    tuscany/sca-java-2.x/trunk/testing/itest/properties/src/main/resources/noNamespace.xsd
Modified:
    tuscany/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java
    tuscany/sca-java-2.x/trunk/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/Node2JAXB.java
    tuscany/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/databinding/PropertyDataTypeProcessor.java
    tuscany/sca-java-2.x/trunk/testing/itest/pom.xml
    tuscany/sca-java-2.x/trunk/testing/itest/properties/src/main/java/mysca/test/myservice/impl/MyServiceImpl.java
    tuscany/sca-java-2.x/trunk/testing/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponentImpl.java
    tuscany/sca-java-2.x/trunk/testing/itest/properties/src/main/resources/PropertyTest.composite
    tuscany/sca-java-2.x/trunk/testing/itest/properties/src/main/resources/fileProperty.txt
    tuscany/sca-java-2.x/trunk/testing/itest/properties/src/main/resources/foo.xsd
    tuscany/sca-java-2.x/trunk/testing/itest/properties/src/main/resources/manyValuesFileProperty.txt
    tuscany/sca-java-2.x/trunk/testing/itest/properties/src/main/resources/rcProps.txt
    tuscany/sca-java-2.x/trunk/testing/itest/properties/src/test/java/org/apache/tuscany/sca/itest/PropertyTestCase.java

Modified: tuscany/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java?rev=1170598&r1=1170597&r2=1170598&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java
Wed Sep 14 13:16:39 2011
@@ -80,6 +80,7 @@ import org.apache.tuscany.sca.interfaced
 import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
 import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
 import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
+import org.apache.tuscany.sca.interfacedef.util.JavaXMLMapper;
 import org.apache.tuscany.sca.interfacedef.util.XMLType;
 import org.apache.tuscany.sca.monitor.Monitor;
 import org.apache.tuscany.sca.policy.ExtensionType;
@@ -97,7 +98,7 @@ import org.xml.sax.InputSource;
 public class ComponentBuilderImpl {
     protected static final String SCA11_NS = "http://docs.oasis-open.org/ns/opencsa/sca/200912";
     protected static final String BINDING_SCA = "binding.sca";
-    protected static final QName BINDING_SCA_QNAME = new QName(SCA11_NS, BINDING_SCA);
+    protected static final QName BINDING_SCA_QNAME = new QName(SCA11_NS, BINDING_SCA);  
 
     private CompositeComponentTypeBuilderImpl componentTypeBuilder;
     protected ComponentPolicyBuilderImpl policyBuilder;
@@ -348,6 +349,16 @@ public class ComponentBuilderImpl {
             // configure the property value based on the @file attribute
             processPropertyFileAttribute(component, componentProperty, monitor);
             
+            // Check that a type or element are specified
+            if (componentProperty.getXSDElement() == null && componentProperty.getXSDType()
== null) {
+                Monitor.error(monitor, 
+                              this, 
+                              Messages.ASSEMBLY_VALIDATION, 
+                              "NoTypeForComponentProperty", 
+                              component.getName(), 
+                              componentProperty.getName());
+            }
+            
             // Check that a value is supplied
             if (componentProperty.isMustSupply() && !isPropertyValueSet(componentProperty))
{
                 Monitor.error(monitor, 
@@ -560,6 +571,13 @@ public class ComponentBuilderImpl {
             
             if (property != null) {
                 componentProperty.setProperty(property);
+                // copy the types up if not specified at the component level 
+                if (componentProperty.getXSDElement() == null){
+                    componentProperty.setXSDElement(property.getXSDElement());
+                }
+                if (componentProperty.getXSDType() == null){
+                    componentProperty.setXSDType(property.getXSDType());
+                }
             } else {
                 Monitor.error(monitor,
                               this,
@@ -640,19 +658,10 @@ public class ComponentBuilderImpl {
             if (componentProperty.getXSDElement() == null) {
                 componentProperty.setXSDElement(componentTypeProperty.getXSDElement());
             }
-
-            // Check that a type or element are specified
-            if (componentProperty.getXSDElement() == null && componentProperty.getXSDType()
== null) {
-                Monitor.error(monitor, 
-                              this, 
-                              Messages.ASSEMBLY_VALIDATION, 
-                              "NoTypeForComponentProperty", 
-                              component.getName(), 
-                              componentProperty.getName());
-            }
             
             // check that the types specified in the component type and component property
match
             if ( componentProperty.getXSDElement() != null &&
+                 componentTypeProperty.getXSDElement() != null &&
                  !componentProperty.getXSDElement().equals(componentTypeProperty.getXSDElement())){
                 Monitor.error(monitor, 
                               this, 
@@ -665,7 +674,8 @@ public class ComponentBuilderImpl {
             }
             
             if ( componentProperty.getXSDType() != null &&
-                    !componentProperty.getXSDType().equals(componentTypeProperty.getXSDType())){
+                 componentTypeProperty.getXSDType() != null &&                 
+                 !componentProperty.getXSDType().equals(componentTypeProperty.getXSDType())){
                 Monitor.error(monitor, 
                               this, 
                               Messages.ASSEMBLY_VALIDATION, 
@@ -840,6 +850,12 @@ public class ComponentBuilderImpl {
 	
 	                if (node != null) {
 	                    componentProperty.setValue(node);
+	                    if(componentProperty.getXSDElement() == null){
+	                        componentProperty.setXSDElement(sourceProp.getXSDElement());
+	                    }
+                       if(componentProperty.getXSDType() == null){
+                            componentProperty.setXSDType(sourceProp.getXSDType());
+                        }
 	                } else {
 	                    Monitor.warning(monitor,
 	                                    this,

Modified: tuscany/sca-java-2.x/trunk/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/Node2JAXB.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/Node2JAXB.java?rev=1170598&r1=1170597&r2=1170598&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/Node2JAXB.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/Node2JAXB.java
Wed Sep 14 13:16:39 2011
@@ -20,6 +20,8 @@ package org.apache.tuscany.sca.databindi
 
 import javax.xml.bind.JAXBContext;
 import javax.xml.bind.Unmarshaller;
+import javax.xml.bind.ValidationEvent;
+import javax.xml.bind.util.ValidationEventCollector;
 
 import org.apache.tuscany.sca.core.ExtensionPointRegistry;
 import org.apache.tuscany.sca.databinding.PullTransformer;
@@ -34,12 +36,14 @@ import org.w3c.dom.Node;
  */
 public class Node2JAXB extends BaseTransformer<Node, Object> implements PullTransformer<Node,
Object> {
     private JAXBContextHelper contextHelper;
+    private ValidationEventCollector validationEventCollector = new ValidationEventCollector();
     
     public Node2JAXB(ExtensionPointRegistry registry) {
         contextHelper = JAXBContextHelper.getInstance(registry);
     }
 
     public Object transform(Node source, TransformationContext context) {
+        Object response = null;
         if (source == null)
             return null;
         try {
@@ -48,12 +52,27 @@ public class Node2JAXB extends BaseTrans
             Object result;
             // TUSCANY-3791
             synchronized(source){
+                /* some debug code
+                System.setProperty("jaxb.debug", "true");
+                unmarshaller.setListener(new DebugListener());
+                */
+                validationEventCollector.reset();
+                unmarshaller.setEventHandler(validationEventCollector);
                 result = unmarshaller.unmarshal(source, JAXBContextHelper.getJavaType(context.getTargetDataType()));
             }
-            return JAXBContextHelper.createReturnValue(jaxbContext, context.getTargetDataType(),
result);
+            response = JAXBContextHelper.createReturnValue(jaxbContext, context.getTargetDataType(),
result);
         } catch (Exception e) {
             throw new TransformationException(e);
         }
+        
+        if (validationEventCollector.hasEvents()){
+            String validationErrors = "";
+            for(ValidationEvent event : validationEventCollector.getEvents()){
+                validationErrors += "Event: " + event.getMessage() + " ";
+            }
+            throw new TransformationException(validationErrors);
+        }
+        return response;
     }
 
     @Override
@@ -75,5 +94,16 @@ public class Node2JAXB extends BaseTrans
     public String getTargetDataBinding() {
         return JAXBDataBinding.NAME;
     }
-
+    
+    /* some debug code
+    class DebugListener extends Unmarshaller.Listener {
+        public void beforeUnmarshal(Object target, Object parent) {
+            
+        }
+        
+        public void afterUnmarshal(Object target, Object parent) {
+            
+        }
+    }
+    */
 }

Modified: tuscany/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/databinding/PropertyDataTypeProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/databinding/PropertyDataTypeProcessor.java?rev=1170598&r1=1170597&r2=1170598&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/databinding/PropertyDataTypeProcessor.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/databinding/PropertyDataTypeProcessor.java
Wed Sep 14 13:16:39 2011
@@ -19,6 +19,8 @@
 
 package org.apache.tuscany.sca.implementation.java.databinding;
 
+import javax.xml.namespace.QName;
+
 import org.apache.tuscany.sca.assembly.Property;
 import org.apache.tuscany.sca.core.ExtensionPointRegistry;
 import org.apache.tuscany.sca.core.UtilityExtensionPoint;
@@ -65,13 +67,16 @@ public class PropertyDataTypeProcessor e
             JavaElementImpl element = type.getPropertyMembers().get(name);
             introspect(property, element);
             DataType dt = property.getDataType();
-            if (dt.getLogical() instanceof XMLType) {
-                XMLType xmlType = (XMLType)dt.getLogical();
+            Object logical = dt.getLogical();
+            if (logical instanceof XMLType &&
+                logical != XMLType.UNKNOWN) {
+                XMLType xmlType = (XMLType)logical;
                 property.setXSDType(xmlType.getTypeName());
                 property.setXSDElement(xmlType.getElementName());
             } else {
                 Class<?> baseType = JavaIntrospectionHelper.getBaseType(element.getType(),
element.getGenericType());
-                property.setXSDType(JavaXMLMapper.getXMLType(baseType));
+                QName typeName = JavaXMLMapper.getXMLType(baseType);                   
+                property.setXSDType(typeName);
             }
         }
         super.visitEnd(clazz, type);

Modified: tuscany/sca-java-2.x/trunk/testing/itest/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/testing/itest/pom.xml?rev=1170598&r1=1170597&r2=1170598&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/testing/itest/pom.xml (original)
+++ tuscany/sca-java-2.x/trunk/testing/itest/pom.xml Wed Sep 14 13:16:39 2011
@@ -76,9 +76,7 @@
                 <module>policy</module>
                 <module>policies</module>
                 <module>policy-transaction</module>  
-<!-- wait until databinding-sdo is in
                 <module>properties</module>
--->
                 <module>recursive-multi-level</module>
                 <module>references</module>
                 <module>scaclient-api</module>

Modified: tuscany/sca-java-2.x/trunk/testing/itest/properties/src/main/java/mysca/test/myservice/impl/MyServiceImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/testing/itest/properties/src/main/java/mysca/test/myservice/impl/MyServiceImpl.java?rev=1170598&r1=1170597&r2=1170598&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/testing/itest/properties/src/main/java/mysca/test/myservice/impl/MyServiceImpl.java
(original)
+++ tuscany/sca-java-2.x/trunk/testing/itest/properties/src/main/java/mysca/test/myservice/impl/MyServiceImpl.java
Wed Sep 14 13:16:39 2011
@@ -37,10 +37,10 @@ import org.oasisopen.sca.annotation.Serv
 @Service(MyService.class)
 public class MyServiceImpl implements MyService {
 
-    @Property(name = "location")
+    @Property(name = "location", required=false)
     protected String location = "RTP";
 
-    @Property(name = "year")
+    @Property(name = "year", required=false)
     protected String year = "2006";
 
     @ComponentName

Modified: tuscany/sca-java-2.x/trunk/testing/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponentImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/testing/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponentImpl.java?rev=1170598&r1=1170597&r2=1170598&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/testing/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponentImpl.java
(original)
+++ tuscany/sca-java-2.x/trunk/testing/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponentImpl.java
Wed Sep 14 13:16:39 2011
@@ -35,7 +35,6 @@ public class PropertyComponentImpl imple
     @Context
     protected ComponentContext context;
 
-    @Property
     protected ComplexPropertyBean complexPropertyOne;
 
     @Property
@@ -78,6 +77,11 @@ public class PropertyComponentImpl imple
     public String getYear() {
         return year;
     }
+    
+    @Property
+    public void setComplexPropertyOne(ComplexPropertyBean complexPropertyOne){
+        this.complexPropertyOne = complexPropertyOne;
+    }
 
     public ComplexPropertyBean getComplexPropertyOne() {
         //System.out.println(complexPropertyOne);

Modified: tuscany/sca-java-2.x/trunk/testing/itest/properties/src/main/resources/PropertyTest.composite
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/testing/itest/properties/src/main/resources/PropertyTest.composite?rev=1170598&r1=1170597&r2=1170598&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/testing/itest/properties/src/main/resources/PropertyTest.composite
(original)
+++ tuscany/sca-java-2.x/trunk/testing/itest/properties/src/main/resources/PropertyTest.composite
Wed Sep 14 13:16:39 2011
@@ -43,13 +43,13 @@
         </value>
     </property>
 
-    <property name="moreComplex" type="foo:MyMoreComplexType">
-        <value>
+    <property name="moreComplex" type="MyMoreComplexType">
+        <value xmlns="">
             <numberSetArray>
                 <integerNumber>1</integerNumber>
                 <floatNumber>11</floatNumber>
                 <doubleNumber>111</doubleNumber>
-            </numberSetArray>
+            </numberSetArray>           
             <numberSetArray>
                 <integerNumber>2</integerNumber>
                 <floatNumber>22</floatNumber>
@@ -68,12 +68,12 @@
                 <integerNumber>54</integerNumber>
                 <floatNumber>158.68</floatNumber>
                 <doubleNumber>369.04</doubleNumber>
-            </numberSet>
+            </numberSet>           
         </value>
     </property>
     
-    <property name="complexFoo" type="foo:MyMoreComplexType">
-        <value>
+    <property name="complexFoo" type="MyMoreComplexType">
+        <value xmlns="">
             <stringArray>TestString_3</stringArray>
             <stringArray>TestString_4</stringArray>
             <intArray>100</intArray>
@@ -114,15 +114,15 @@
         <property name="nosource">aValue</property>
         <property name="fileProperty" file="fileProperty.txt"/>
         <property name="manyValuesFileProperty" many="true" file="manyValuesFileProperty.txt"/>
-        <property name="nonFileProperty"  file="fileProperty.txt" source="$complex/foo:c"/>
+        <property name="nonFileProperty" source="$complex/foo:c"/>
         <property name="two" source="$number">25</property>
     </component>
 
     <component name="PropertyComponent">
         <implementation.java class="org.apache.tuscany.sca.itest.PropertyComponentImpl"/>
         <property name="complexPropertyOne" source="$moreComplex"></property>
-        <property name="complexPropertyTwo" type="foo:MyMoreComplexType">
-            <value>
+        <property name="complexPropertyTwo" type="MyMoreComplexType">
+            <value xmlns="">
                 <stringArray>TestString_1</stringArray>
                 <stringArray>TestString_2</stringArray>
                 <intArray>10</intArray>
@@ -150,7 +150,7 @@
             </value>
         </property>
         <property name="complexPropertyThree" element="foo:PropertyThreeElement">
-            <PropertyThreeElement xmlns="http://foo">
+            <PropertyThreeElement xmlns="">
                 <stringArray>TestElementString_1</stringArray>
                 <stringArray>TestElementString_2</stringArray>
                 <intArray>10</intArray>
@@ -177,8 +177,8 @@
                 </numberSet>
             </PropertyThreeElement>
         </property>
-        <property name="complexPropertyFour" element="foo:PropertyFourElement" many="true">
-            <PropertyFourElement xmlns="http://foo">
+        <property name="complexPropertyFour" element="PropertyFourElement" many="true">
+            <PropertyFourElement xmlns="">
                 <integerNumber>1</integerNumber>
                 <floatNumber>11.11</floatNumber>
                 <doubleNumber>111.111</doubleNumber>
@@ -188,7 +188,7 @@
                     <doubleNumber>11111.11111</doubleNumber>
                 </numberSet>
             </PropertyFourElement>
-            <PropertyFourElement xmlns="http://foo">
+            <PropertyFourElement xmlns="">
                 <integerNumber>2</integerNumber>
                 <floatNumber>22.22</floatNumber>
                 <doubleNumber>222.222</doubleNumber>
@@ -198,7 +198,7 @@
                     <doubleNumber>22222.22222</doubleNumber>
                 </numberSet>
             </PropertyFourElement>
-            <PropertyFourElement xmlns="http://foo">
+            <PropertyFourElement xmlns="">
                 <integerNumber>3</integerNumber>
                 <floatNumber>33.33</floatNumber>
                 <doubleNumber>333.333</doubleNumber>

Modified: tuscany/sca-java-2.x/trunk/testing/itest/properties/src/main/resources/fileProperty.txt
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/testing/itest/properties/src/main/resources/fileProperty.txt?rev=1170598&r1=1170597&r2=1170598&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/testing/itest/properties/src/main/resources/fileProperty.txt
(original)
+++ tuscany/sca-java-2.x/trunk/testing/itest/properties/src/main/resources/fileProperty.txt
Wed Sep 14 13:16:39 2011
@@ -17,5 +17,6 @@
  * specific language governing permissions and limitations
  * under the License.
 -->
-
-<filePropertyTest>fileValue</filePropertyTest>
\ No newline at end of file
+<values xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912">
+    <value>fileValue</value>
+</values>
\ No newline at end of file

Modified: tuscany/sca-java-2.x/trunk/testing/itest/properties/src/main/resources/foo.xsd
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/testing/itest/properties/src/main/resources/foo.xsd?rev=1170598&r1=1170597&r2=1170598&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/testing/itest/properties/src/main/resources/foo.xsd (original)
+++ tuscany/sca-java-2.x/trunk/testing/itest/properties/src/main/resources/foo.xsd Wed Sep
14 13:16:39 2011
@@ -37,4 +37,5 @@
             </xsd:element>
         </xsd:sequence>
     </xsd:complexType>
+    
  </xsd:schema>
\ No newline at end of file

Modified: tuscany/sca-java-2.x/trunk/testing/itest/properties/src/main/resources/manyValuesFileProperty.txt
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/testing/itest/properties/src/main/resources/manyValuesFileProperty.txt?rev=1170598&r1=1170597&r2=1170598&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/testing/itest/properties/src/main/resources/manyValuesFileProperty.txt
(original)
+++ tuscany/sca-java-2.x/trunk/testing/itest/properties/src/main/resources/manyValuesFileProperty.txt
Wed Sep 14 13:16:39 2011
@@ -17,9 +17,9 @@
  * specific language governing permissions and limitations
  * under the License.
 -->
-<value>
+<values xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912">
     <manyFilePropertyValues>fileValueOne</manyFilePropertyValues>
     <manyFilePropertyValues>fileValueTwo</manyFilePropertyValues>
     <manyFilePropertyValues>fileValueThree</manyFilePropertyValues>
     <manyFilePropertyValues>fileValueFour</manyFilePropertyValues>
-</value>
\ No newline at end of file
+</values>
\ No newline at end of file

Added: tuscany/sca-java-2.x/trunk/testing/itest/properties/src/main/resources/noNamespace.xsd
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/testing/itest/properties/src/main/resources/noNamespace.xsd?rev=1170598&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/testing/itest/properties/src/main/resources/noNamespace.xsd
(added)
+++ tuscany/sca-java-2.x/trunk/testing/itest/properties/src/main/resources/noNamespace.xsd
Wed Sep 14 13:16:39 2011
@@ -0,0 +1,47 @@
+<!--
+    * Licensed to the Apache Software Foundation (ASF) under one
+    * or more contributor license agreements.  See the NOTICE file
+    * distributed with this work for additional information
+    * regarding copyright ownership.  The ASF licenses this file
+    * to you under the Apache License, Version 2.0 (the
+    * "License"); you may not use this file except in compliance
+    * with the License.  You may obtain a copy of the License at
+    * 
+    *   http://www.apache.org/licenses/LICENSE-2.0
+    * 
+    * Unless required by applicable law or agreed to in writing,
+    * software distributed under the License is distributed on an
+    * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    * KIND, either express or implied.  See the License for the
+    * specific language governing permissions and limitations
+    * under the License.    
+-->
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+            elementFormDefault="unqualified">
+    
+    <xsd:complexType name="NumberSetType">
+        <xsd:sequence>
+            <xsd:element name="integerNumber"  type="xsd:int"/>
+            <xsd:element name="floatNumber"  type="xsd:float"/>
+            <xsd:element name="doubleNumber"  type="xsd:double"/>
+        </xsd:sequence>
+    </xsd:complexType>
+    
+    <xsd:complexType name="MyMoreComplexType">
+        <xsd:choice maxOccurs="unbounded">
+            <xsd:element name="numberSetArray"  type="NumberSetType" />
+            <xsd:element name="stringArray"  type="xsd:string" />
+            <xsd:element name="intArray"  type="xsd:int" />
+            <xsd:element name="integerNumber"  type="xsd:int" />
+            <xsd:element name="floatNumber"  type="xsd:float" />
+            <xsd:element name="doubleNumber"  type="xsd:double" />
+            <xsd:element name="doubleArray"  type="xsd:double" />
+            <xsd:element name="numberSet"  type="NumberSetType"/>
+        </xsd:choice>
+    </xsd:complexType>
+    
+    <xsd:element name="PropertyThreeElement" type="MyMoreComplexType"/>
+    
+    <xsd:element name="PropertyFourElement" type="MyMoreComplexType"/>    
+    
+ </xsd:schema>
\ No newline at end of file

Modified: tuscany/sca-java-2.x/trunk/testing/itest/properties/src/main/resources/rcProps.txt
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/testing/itest/properties/src/main/resources/rcProps.txt?rev=1170598&r1=1170597&r2=1170598&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/testing/itest/properties/src/main/resources/rcProps.txt (original)
+++ tuscany/sca-java-2.x/trunk/testing/itest/properties/src/main/resources/rcProps.txt Wed
Sep 14 13:16:39 2011
@@ -16,7 +16,10 @@
  * specific language governing permissions and limitations
  * under the License.
 -->
-<MyRCProps xmlns="http://test.sca.jaxb/rcprops">
-    <AInt>20</AInt>
-    <BInteger>20</BInteger>
-</MyRCProps>
+
+<values xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912">
+	<MyRCProps xmlns="http://test.sca.jaxb/rcprops">
+	    <AInt>20</AInt>
+	    <BInteger>20</BInteger>
+	</MyRCProps>
+</values>

Modified: tuscany/sca-java-2.x/trunk/testing/itest/properties/src/test/java/org/apache/tuscany/sca/itest/PropertyTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/testing/itest/properties/src/test/java/org/apache/tuscany/sca/itest/PropertyTestCase.java?rev=1170598&r1=1170597&r2=1170598&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/testing/itest/properties/src/test/java/org/apache/tuscany/sca/itest/PropertyTestCase.java
(original)
+++ tuscany/sca-java-2.x/trunk/testing/itest/properties/src/test/java/org/apache/tuscany/sca/itest/PropertyTestCase.java
Wed Sep 14 13:16:39 2011
@@ -284,7 +284,7 @@ public class PropertyTestCase {
         ComplexPropertyBean propBean = propertyService.getComplexPropertyTwo();
         assertNotNull(propBean);
         assertEquals(10, propBean.intArray[0]);
-        assertEquals((float)22, propBean.numberSetArray[1].floatNumber);
+        assertEquals((float)22, propBean.numberSetArray[1].floatNumber, 0.1);
     }
 
     /**
@@ -299,7 +299,7 @@ public class PropertyTestCase {
         ComplexPropertyBean propBean = propertyService.getComplexPropertyThree();
         assertNotNull(propBean);
         assertEquals("TestElementString_1", propBean.stringArray[0]);
-        assertEquals((float)22, propBean.numberSetArray[1].floatNumber);
+        assertEquals((float)22, propBean.numberSetArray[1].floatNumber, 0.1);
     }
 
     /**
@@ -314,7 +314,7 @@ public class PropertyTestCase {
         Object[] propBeanCollection = propertyService.getComplexPropertyFour().toArray();
         assertNotNull(propBeanCollection);
         assertEquals(1, ((ComplexPropertyBean)propBeanCollection[0]).getIntegerNumber());
-        assertEquals(222.222, ((ComplexPropertyBean)propBeanCollection[1]).getDoubleNumber());
+        assertEquals(222.222, ((ComplexPropertyBean)propBeanCollection[1]).getDoubleNumber(),
0.1);
         assertEquals(33, ((ComplexPropertyBean)propBeanCollection[2]).getNumberSet().getIntegerNumber());
     }
 



Mime
View raw message