summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/testing/itest/properties/src
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2011-09-14 13:16:39 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2011-09-14 13:16:39 +0000
commit9d7c57a0e1c12472126c0888ef238c00d93e9001 (patch)
treebe6c90453a62a63174113e3615981e1346a2bc55 /sca-java-2.x/trunk/testing/itest/properties/src
parentf0581d45620443a18a263018a49432f26c9027e2 (diff)
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.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1170598 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r--sca-java-2.x/trunk/testing/itest/properties/src/main/java/mysca/test/myservice/impl/MyServiceImpl.java4
-rw-r--r--sca-java-2.x/trunk/testing/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponentImpl.java6
-rw-r--r--sca-java-2.x/trunk/testing/itest/properties/src/main/resources/PropertyTest.composite28
-rw-r--r--sca-java-2.x/trunk/testing/itest/properties/src/main/resources/fileProperty.txt5
-rw-r--r--sca-java-2.x/trunk/testing/itest/properties/src/main/resources/foo.xsd1
-rw-r--r--sca-java-2.x/trunk/testing/itest/properties/src/main/resources/manyValuesFileProperty.txt4
-rw-r--r--sca-java-2.x/trunk/testing/itest/properties/src/main/resources/noNamespace.xsd47
-rw-r--r--sca-java-2.x/trunk/testing/itest/properties/src/main/resources/rcProps.txt11
-rw-r--r--sca-java-2.x/trunk/testing/itest/properties/src/test/java/org/apache/tuscany/sca/itest/PropertyTestCase.java6
9 files changed, 84 insertions, 28 deletions
diff --git a/sca-java-2.x/trunk/testing/itest/properties/src/main/java/mysca/test/myservice/impl/MyServiceImpl.java b/sca-java-2.x/trunk/testing/itest/properties/src/main/java/mysca/test/myservice/impl/MyServiceImpl.java
index 7b44ef02e4..80e1a0d0ca 100644
--- a/sca-java-2.x/trunk/testing/itest/properties/src/main/java/mysca/test/myservice/impl/MyServiceImpl.java
+++ b/sca-java-2.x/trunk/testing/itest/properties/src/main/java/mysca/test/myservice/impl/MyServiceImpl.java
@@ -37,10 +37,10 @@ import org.oasisopen.sca.annotation.Service;
@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
diff --git a/sca-java-2.x/trunk/testing/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponentImpl.java b/sca-java-2.x/trunk/testing/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponentImpl.java
index 64ca749e9f..27b686bf14 100644
--- a/sca-java-2.x/trunk/testing/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponentImpl.java
+++ b/sca-java-2.x/trunk/testing/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponentImpl.java
@@ -35,7 +35,6 @@ public class PropertyComponentImpl implements PropertyComponent {
@Context
protected ComponentContext context;
- @Property
protected ComplexPropertyBean complexPropertyOne;
@Property
@@ -78,6 +77,11 @@ public class PropertyComponentImpl implements PropertyComponent {
public String getYear() {
return year;
}
+
+ @Property
+ public void setComplexPropertyOne(ComplexPropertyBean complexPropertyOne){
+ this.complexPropertyOne = complexPropertyOne;
+ }
public ComplexPropertyBean getComplexPropertyOne() {
//System.out.println(complexPropertyOne);
diff --git a/sca-java-2.x/trunk/testing/itest/properties/src/main/resources/PropertyTest.composite b/sca-java-2.x/trunk/testing/itest/properties/src/main/resources/PropertyTest.composite
index 7c834d5e0b..d89c1f82e0 100644
--- a/sca-java-2.x/trunk/testing/itest/properties/src/main/resources/PropertyTest.composite
+++ b/sca-java-2.x/trunk/testing/itest/properties/src/main/resources/PropertyTest.composite
@@ -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>
diff --git a/sca-java-2.x/trunk/testing/itest/properties/src/main/resources/fileProperty.txt b/sca-java-2.x/trunk/testing/itest/properties/src/main/resources/fileProperty.txt
index 7e932622ce..71d0c25730 100644
--- a/sca-java-2.x/trunk/testing/itest/properties/src/main/resources/fileProperty.txt
+++ b/sca-java-2.x/trunk/testing/itest/properties/src/main/resources/fileProperty.txt
@@ -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
diff --git a/sca-java-2.x/trunk/testing/itest/properties/src/main/resources/foo.xsd b/sca-java-2.x/trunk/testing/itest/properties/src/main/resources/foo.xsd
index 6831f66cec..5bf3e5f52a 100644
--- a/sca-java-2.x/trunk/testing/itest/properties/src/main/resources/foo.xsd
+++ b/sca-java-2.x/trunk/testing/itest/properties/src/main/resources/foo.xsd
@@ -37,4 +37,5 @@
</xsd:element>
</xsd:sequence>
</xsd:complexType>
+
</xsd:schema> \ No newline at end of file
diff --git a/sca-java-2.x/trunk/testing/itest/properties/src/main/resources/manyValuesFileProperty.txt b/sca-java-2.x/trunk/testing/itest/properties/src/main/resources/manyValuesFileProperty.txt
index e037537d7d..3b58d863df 100644
--- a/sca-java-2.x/trunk/testing/itest/properties/src/main/resources/manyValuesFileProperty.txt
+++ b/sca-java-2.x/trunk/testing/itest/properties/src/main/resources/manyValuesFileProperty.txt
@@ -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
diff --git a/sca-java-2.x/trunk/testing/itest/properties/src/main/resources/noNamespace.xsd b/sca-java-2.x/trunk/testing/itest/properties/src/main/resources/noNamespace.xsd
new file mode 100644
index 0000000000..f416ccc241
--- /dev/null
+++ b/sca-java-2.x/trunk/testing/itest/properties/src/main/resources/noNamespace.xsd
@@ -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
diff --git a/sca-java-2.x/trunk/testing/itest/properties/src/main/resources/rcProps.txt b/sca-java-2.x/trunk/testing/itest/properties/src/main/resources/rcProps.txt
index 052c291fd0..07f4b4807a 100644
--- a/sca-java-2.x/trunk/testing/itest/properties/src/main/resources/rcProps.txt
+++ b/sca-java-2.x/trunk/testing/itest/properties/src/main/resources/rcProps.txt
@@ -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>
diff --git a/sca-java-2.x/trunk/testing/itest/properties/src/test/java/org/apache/tuscany/sca/itest/PropertyTestCase.java b/sca-java-2.x/trunk/testing/itest/properties/src/test/java/org/apache/tuscany/sca/itest/PropertyTestCase.java
index eb217600db..0106d8a665 100644
--- a/sca-java-2.x/trunk/testing/itest/properties/src/test/java/org/apache/tuscany/sca/itest/PropertyTestCase.java
+++ b/sca-java-2.x/trunk/testing/itest/properties/src/test/java/org/apache/tuscany/sca/itest/PropertyTestCase.java
@@ -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());
}