axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r789498 - in /webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema: ./ anytype/ choice/ group/ innerChoice/ innerparticles/ particlemaxoccurs/ union2/
Date Mon, 29 Jun 2009 23:48:15 GMT
Author: veithen
Date: Mon Jun 29 23:48:14 2009
New Revision: 789498

URL: http://svn.apache.org/viewvc?rev=789498&view=rev
Log:
ADB tests: increased the test coverage by using testSerializeDeserialize instead of serializeDeserialize+assertions
(for test cases where the bean->XML->bean transformation is not the identity transformation).

Modified:
    webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/AbstractTestCase.java
    webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/anytype/AnyTypeTest.java
    webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/choice/ChoiceTest.java
    webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/group/GroupTest.java
    webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/innerChoice/InnerChoiceTest.java
    webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/innerparticles/InnerParticlesTest.java
    webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/particlemaxoccurs/ParticalMaxOccursTest.java
    webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/union2/Union2Test.java

Modified: webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/AbstractTestCase.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/AbstractTestCase.java?rev=789498&r1=789497&r2=789498&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/AbstractTestCase.java
(original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/AbstractTestCase.java
Mon Jun 29 23:48:14 2009
@@ -24,7 +24,6 @@
 import java.beans.Introspector;
 import java.beans.PropertyDescriptor;
 import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.StringReader;
@@ -193,49 +192,54 @@
      * @throws Exception
      */
     public static void testSerializeDeserialize(ADBBean bean) throws Exception {
-        testSerializeDeserialize1(bean);
-        testSerializeDeserialize2(bean);
+        testSerializeDeserialize(bean, bean);
+    }
+    
+    public static void testSerializeDeserialize(ADBBean bean, ADBBean expectedResult) throws
Exception {
+        testSerializeDeserialize1(bean, expectedResult);
+        testSerializeDeserialize2(bean, expectedResult);
         
         // TODO: this badly fails for many of the test cases => there are still issues
to solve!!!
-//        testSerializeDeserialize3(bean);
+//        testSerializeDeserialize3(bean, expectedResult);
         
-        testSerializeDeserialize4(bean);
+        testSerializeDeserialize4(bean, expectedResult);
     }
     
     // Deserialization approach 1: use an XMLStreamReader produced by the StAX parser.
-    private static void testSerializeDeserialize1(ADBBean bean) throws Exception {
+    private static void testSerializeDeserialize1(ADBBean bean, ADBBean expectedResult) throws
Exception {
         Class<? extends ADBBean> beanClass = bean.getClass();
         QName qname = getADBBeanQName(beanClass);
         OMElement omElement = bean.getOMElement(qname, OMAbstractFactory.getOMFactory());
         String omElementString = omElement.toStringWithConsume();
-        assertBeanEquals(bean, parse(beanClass,
+        System.out.println(omElementString);
+        assertBeanEquals(expectedResult, parse(beanClass,
                 StAXUtils.createXMLStreamReader(new StringReader(omElementString))));
     }
     
     // Deserialization approach 2: use an Axiom tree with caching. In this case the
     // XMLStreamReader implementation is OMStAXWrapper and we test interoperability
     // between ADB and Axiom's OMStAXWrapper.
-    private static void testSerializeDeserialize2(ADBBean bean) throws Exception {
+    private static void testSerializeDeserialize2(ADBBean bean, ADBBean expectedResult) throws
Exception {
         Class<? extends ADBBean> beanClass = bean.getClass();
         QName qname = getADBBeanQName(beanClass);
         OMElement omElement = bean.getOMElement(qname, OMAbstractFactory.getOMFactory());
         String omElementString = omElement.toStringWithConsume();
         OMElement omElement2 = new StAXOMBuilder(StAXUtils.createXMLStreamReader(
                 new StringReader(omElementString))).getDocumentElement();
-        assertBeanEquals(bean, parse(beanClass, omElement2.getXMLStreamReader()));
+        assertBeanEquals(expectedResult, parse(beanClass, omElement2.getXMLStreamReader()));
     }
     
     // Deserialization approach 3: use the pull parser produced by ADB.
-    private static void testSerializeDeserialize3(ADBBean bean) throws Exception {
+    private static void testSerializeDeserialize3(ADBBean bean, ADBBean expectedResult) throws
Exception {
         Class<? extends ADBBean> beanClass = bean.getClass();
         QName qname = getADBBeanQName(beanClass);
-        assertBeanEquals(bean, parse(beanClass, bean.getPullParser(qname)));
+        assertBeanEquals(expectedResult, parse(beanClass, bean.getPullParser(qname)));
     }
     
     // Approach 4: Serialize the bean as the child of an element that declares a default
namespace.
     // If ADB behaves correctly, this should not have any impact. A failure here may be an
indication
     // of an incorrect usage of XMLStreamWriter#writeStartElement(String).
-    private static void testSerializeDeserialize4(ADBBean bean) throws Exception {
+    private static void testSerializeDeserialize4(ADBBean bean, ADBBean expectedResult) throws
Exception {
         Class<? extends ADBBean> beanClass = bean.getClass();
         QName qname = getADBBeanQName(beanClass);
         StringWriter sw = new StringWriter();
@@ -246,7 +250,7 @@
         writer.writeEndElement();
         writer.flush();
         OMElement omElement3 = new StAXOMBuilder(StAXUtils.createXMLStreamReader(new StringReader(sw.toString()))).getDocumentElement();
-        assertBeanEquals(bean, parse(beanClass, omElement3.getFirstElement().getXMLStreamReader()));
+        assertBeanEquals(expectedResult, parse(beanClass, omElement3.getFirstElement().getXMLStreamReader()));
     }
     
     /**

Modified: webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/anytype/AnyTypeTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/anytype/AnyTypeTest.java?rev=789498&r1=789497&r2=789498&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/anytype/AnyTypeTest.java
(original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/anytype/AnyTypeTest.java
Mon Jun 29 23:48:14 2009
@@ -63,8 +63,10 @@
         TestAnyTypeElement3 testAnyTypeElement = new TestAnyTypeElement3();
         testAnyTypeElement.setParam1(null);
 
-        TestAnyTypeElement3 result = (TestAnyTypeElement3)serializeDeserialize(testAnyTypeElement);
-        assertEquals(result.getParam1()[0],null);
+        TestAnyTypeElement3 expectedResult = new TestAnyTypeElement3();
+        expectedResult.setParam1(new Object[] { null });
+        
+        testSerializeDeserialize(testAnyTypeElement, expectedResult);
     }
 
     public void testAnyTypeElement3_3() throws Exception {
@@ -91,8 +93,9 @@
         TestAnyTypeElement4 testAnyTypeElement = new TestAnyTypeElement4();
         testAnyTypeElement.setParam1(new Object[]{"test",null});
 
-        TestAnyTypeElement4 result = (TestAnyTypeElement4)serializeDeserialize(testAnyTypeElement);
-        assertEquals(result.getParam1()[0],"test");
+        TestAnyTypeElement4 expectedResult = new TestAnyTypeElement4();
+        expectedResult.setParam1(new Object[] { "test" });
+        testSerializeDeserialize(testAnyTypeElement, expectedResult);
     }
 
 
@@ -106,8 +109,9 @@
         TestAnyTypeElement5 testAnyTypeElement = new TestAnyTypeElement5();
         testAnyTypeElement.setParam1(null);
 
-        TestAnyTypeElement5 result = (TestAnyTypeElement5)serializeDeserialize(testAnyTypeElement);
-        assertEquals(result.getParam1()[0],null);
+        TestAnyTypeElement5 expectedResult = new TestAnyTypeElement5();
+        expectedResult.setParam1(new Object[] { null });
+        testSerializeDeserialize(testAnyTypeElement, expectedResult);
     }
 
     public void testAnyTypeElement5_3() throws Exception {

Modified: webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/choice/ChoiceTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/choice/ChoiceTest.java?rev=789498&r1=789497&r2=789498&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/choice/ChoiceTest.java
(original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/choice/ChoiceTest.java
Mon Jun 29 23:48:14 2009
@@ -28,7 +28,8 @@
         testChoice.setChoice1("test 2");
         testChoice.setChoice2(5);
         
-        TestChoice newTestChoice = (TestChoice)serializeDeserialize(testChoice);
-        assertEquals(5, newTestChoice.getChoice2());
+        TestChoice expectedResult = new TestChoice();
+        expectedResult.setChoice2(5);
+        testSerializeDeserialize(testChoice, expectedResult);
     }
 }

Modified: webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/group/GroupTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/group/GroupTest.java?rev=789498&r1=789497&r2=789498&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/group/GroupTest.java
(original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/group/GroupTest.java
Mon Jun 29 23:48:14 2009
@@ -62,8 +62,10 @@
         testChoiceGroup.setChoiceParam1("choiceParam1");
         testGroupChoiceElement.setTestChoiceGroup(testChoiceGroup);
 
-        TestChoiceGroupElement result = (TestChoiceGroupElement)serializeDeserialize(testGroupChoiceElement);
-        assertEquals(result.getTestChoiceGroup().getChoiceParam1(),"choiceParam1");
+        TestChoiceGroupElement expectedResult = new TestChoiceGroupElement();
+        expectedResult.setTestChoiceGroup(testChoiceGroup);
+        
+        testSerializeDeserialize(testGroupChoiceElement, expectedResult);
     }
 
     public void testNestedChoiceGroupElement() throws Exception {
@@ -81,8 +83,17 @@
 
         testChoiceNestedGroupElement.setTestChoiceNestedGroup(testChoiceNestedGroup);
 
-        TestChoiceNestedGroupElement result = (TestChoiceNestedGroupElement)serializeDeserialize(testChoiceNestedGroupElement);
-        assertEquals(result.getTestChoiceNestedGroup().getTestChoiceGroup().getChoiceParam1(),"choiceParam1");
+        TestChoiceNestedGroupElement expectedResult = new TestChoiceNestedGroupElement();
+        TestChoiceNestedGroup expectedChoiceNestedGroup = new TestChoiceNestedGroup();
+
+        TestChoiceGroup expectedChoiceGroup = new TestChoiceGroup();
+        expectedChoiceGroup.setChoiceParam1("choiceParam1");
+
+        expectedChoiceNestedGroup.setTestChoiceGroup(expectedChoiceGroup);
+
+        expectedResult.setTestChoiceNestedGroup(expectedChoiceNestedGroup);
+        
+        testSerializeDeserialize(testChoiceNestedGroupElement, expectedResult);
     }
 
      public void testAttributeGroup() throws Exception {

Modified: webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/innerChoice/InnerChoiceTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/innerChoice/InnerChoiceTest.java?rev=789498&r1=789497&r2=789498&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/innerChoice/InnerChoiceTest.java
(original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/innerChoice/InnerChoiceTest.java
Mon Jun 29 23:48:14 2009
@@ -19,16 +19,10 @@
 
 package org.apache.axis2.schema.innerChoice;
 
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.util.StAXUtils;
-import org.apache.axis2.databinding.utils.writer.MTOMAwareXMLSerializer;
-import org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter;
 import org.apache.axis2.schema.AbstractTestCase;
 
 import test.axis2.apache.org.*;
 
-import javax.xml.stream.XMLStreamWriter;
-
 public class InnerChoiceTest extends AbstractTestCase {
 
     public void testInnerChoice1() throws Exception {
@@ -41,17 +35,15 @@
         TestInnerSequence1Choice_type0.setChoice2(5);
         testSequence.setTestInnerSequence1Choice_type0(TestInnerSequence1Choice_type0);
 
-        TestInnerSequence1 result = (TestInnerSequence1)serializeDeserialize(testSequence);
-        assertEquals(result.getSequence1(), "test sequence");
-        assertEquals(result.getSequence2(), 3);
-        assertEquals(result.getTestInnerSequence1Choice_type0().getChoice2(), 5);
-
-        // writtig result back
-        XMLStreamWriter xmlStreamWriter = StAXUtils.createXMLStreamWriter(System.out);
-        MTOMAwareXMLStreamWriter mtomAwareXMLStreamWriter = new MTOMAwareXMLSerializer(xmlStreamWriter);
-        result.serialize(new javax.xml.namespace.QName("org.apache.axis2.test", "TestInnerSequence1",
"foo")
-                , OMAbstractFactory.getSOAP11Factory(), mtomAwareXMLStreamWriter);
-        xmlStreamWriter.flush();
+        TestInnerSequence1 expectedSequence = new TestInnerSequence1();
+        expectedSequence.setSequence1("test sequence");
+        expectedSequence.setSequence2(3);
+
+        TestInnerSequence1Choice_type0 expectedTestInnerSequence1Choice_type0 = new TestInnerSequence1Choice_type0();
+        expectedTestInnerSequence1Choice_type0.setChoice2(5);
+        expectedSequence.setTestInnerSequence1Choice_type0(expectedTestInnerSequence1Choice_type0);
+        
+        testSerializeDeserialize(testSequence, expectedSequence);
     }
 
     public void testInnerChoice21() throws Exception {

Modified: webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/innerparticles/InnerParticlesTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/innerparticles/InnerParticlesTest.java?rev=789498&r1=789497&r2=789498&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/innerparticles/InnerParticlesTest.java
(original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/innerparticles/InnerParticlesTest.java
Mon Jun 29 23:48:14 2009
@@ -46,10 +46,14 @@
         testInnerParticle2.setTestInnerParticle2Choice_type0(testInnerParticle2Choice_type1);
         testInnerParticle2.setParam4("Param4");
 
-        TestInnerParticle2 result = (TestInnerParticle2)serializeDeserialize(testInnerParticle2);
-        assertEquals(result.getParam1(), "Param1");
-        assertEquals(result.getTestInnerParticle2Choice_type0().getParam3(), "Param3");
-        assertEquals(result.getParam4(), "Param4");
+        TestInnerParticle2 expectedResult = new TestInnerParticle2();
+        expectedResult.setParam1("Param1");
+        TestInnerParticle2Choice_type0 expectedInnerParticle2Choice_type1 = new TestInnerParticle2Choice_type0();
+        expectedInnerParticle2Choice_type1.setParam3("Param3");
+        expectedResult.setTestInnerParticle2Choice_type0(expectedInnerParticle2Choice_type1);
+        expectedResult.setParam4("Param4");
+        
+        testSerializeDeserialize(testInnerParticle2, expectedResult);
     }
 
     public void testInnerParticle31() throws Exception {
@@ -68,8 +72,12 @@
         testInnerParticle3Choice_type1.setParam3("Param3");
         testInnerParticle3.setTestInnerParticle3Choice_type0(testInnerParticle3Choice_type1);
 
-        TestInnerParticle3 result = (TestInnerParticle3)serializeDeserialize(testInnerParticle3);
-        assertEquals(result.getTestInnerParticle3Choice_type0().getParam3(), "Param3");
+        TestInnerParticle3 expectedResult = new TestInnerParticle3();
+        TestInnerParticle3Choice_type0 expectedInnerParticle3Choice_type1 = new TestInnerParticle3Choice_type0();
+        expectedInnerParticle3Choice_type1.setParam3("Param3");
+        expectedResult.setTestInnerParticle3Choice_type0(expectedInnerParticle3Choice_type1);
+
+        testSerializeDeserialize(testInnerParticle3, expectedResult);
     }
 
     public void testInnerParticle33() throws Exception {
@@ -82,8 +90,13 @@
         testInnerParticle3.setTestInnerParticle3Choice_type0(testInnerParticle3Choice_type1);
         testInnerParticle3.setParam4("Param4");
 
-        TestInnerParticle3 result = (TestInnerParticle3)serializeDeserialize(testInnerParticle3);
-        assertEquals(result.getParam4(), "Param4");
+        TestInnerParticle3 expectedResult = new TestInnerParticle3();
+        TestInnerParticle3Choice_type0 expectedInnerParticle3Choice_type1 = new TestInnerParticle3Choice_type0();
+        // TODO: it is a bit surprising that this property is not null; may be a bug
+        expectedResult.setTestInnerParticle3Choice_type0(expectedInnerParticle3Choice_type1);
+        expectedResult.setParam4("Param4");
+        
+        testSerializeDeserialize(testInnerParticle3, expectedResult);
     }
 
     public void testInnerParticle41() throws Exception {
@@ -146,11 +159,20 @@
         testInnterParticleExtensionParentComplexTypeChoice_type0.setParam1("param1");
         testInnterParticleExtensionParentComplexTypeChoice_type0.setParam2("param2");
 
-        TestInnterParticleExtension result = (TestInnterParticleExtension)serializeDeserialize(testInnterParticleExtension);
-        assertTrue(result.getTestInnterParticleExtension() instanceof TestInnterParticleExtensionChildComplexType);
-        TestInnterParticleExtensionChildComplexType resultComplexType =
-                (TestInnterParticleExtensionChildComplexType) result.getTestInnterParticleExtension();
-        assertEquals(resultComplexType.getTestInnterParticleExtensionParentComplexTypeChoice_type0().getParam2(),"param2");
+        
+        TestInnterParticleExtension expectedTestInnterParticleExtension = new TestInnterParticleExtension();
+
+        TestInnterParticleExtensionChildComplexType expectedTestInnterParticleExtensionChildComplexType
=
+                new TestInnterParticleExtensionChildComplexType();
+        expectedTestInnterParticleExtension.setTestInnterParticleExtension(expectedTestInnterParticleExtensionChildComplexType);
+
+        TestInnterParticleExtensionParentComplexTypeChoice_type0 expectedTestInnterParticleExtensionParentComplexTypeChoice_type0
=
+                new TestInnterParticleExtensionParentComplexTypeChoice_type0();
+        expectedTestInnterParticleExtensionChildComplexType.setTestInnterParticleExtensionParentComplexTypeChoice_type0(expectedTestInnterParticleExtensionParentComplexTypeChoice_type0);
+
+        expectedTestInnterParticleExtensionParentComplexTypeChoice_type0.setParam2("param2");
+        
+        testSerializeDeserialize(testInnterParticleExtension, expectedTestInnterParticleExtension);
     }
 
     public void testTestComplexTypeElement() throws Exception {
@@ -166,7 +188,14 @@
         TestComplexTypeSequence_type0 testComplexTypeSequence_type0 = new TestComplexTypeSequence_type0();
         testComplexType.setTestComplexTypeSequence_type0(testComplexTypeSequence_type0);
 
-        TestComplexTypeElement result = (TestComplexTypeElement)serializeDeserialize(testComplexTypeElement);
-        assertEquals(result.getTestComplexTypeElement().getTestElement().getParam(),"param");
+
+        TestComplexTypeElement expectedTestComplexTypeElement = new TestComplexTypeElement();
+
+        TestComplexType expectedTestComplexType = new TestComplexType();
+        expectedTestComplexTypeElement.setTestComplexTypeElement(expectedTestComplexType);
+
+        expectedTestComplexType.setTestElement(testElement_type0);
+        
+        testSerializeDeserialize(testComplexTypeElement, expectedTestComplexTypeElement);
     }
 }

Modified: webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/particlemaxoccurs/ParticalMaxOccursTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/particlemaxoccurs/ParticalMaxOccursTest.java?rev=789498&r1=789497&r2=789498&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/particlemaxoccurs/ParticalMaxOccursTest.java
(original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/particlemaxoccurs/ParticalMaxOccursTest.java
Mon Jun 29 23:48:14 2009
@@ -80,15 +80,25 @@
 
         testParticalMaxOccursType3.setTestParticalSequenceMaxOccursType3Sequence(testSequences);
 
-        TestParticalSequenceMaxOccurs3 result = (TestParticalSequenceMaxOccurs3)serializeDeserialize(testParticalMaxOccures3);
-        TestParticalSequenceMaxOccursType3Sequence[] resultSequences =
-                result.getTestParticalSequenceMaxOccurs3().getTestParticalSequenceMaxOccursType3Sequence();
-        assertEquals(resultSequences[0].getParm2()[0], "Param111");
-        assertEquals(resultSequences[0].getParm2()[1], null);
-        assertEquals(resultSequences[0].getParm2()[2], "Param113");
-        assertEquals(resultSequences[1].getParm1()[0], "Param121");
-        assertEquals(resultSequences[1].getParm1()[1], "Param122");
-        assertEquals(resultSequences[1].getParm1()[2], null);
+
+        TestParticalSequenceMaxOccurs3 expectedTestParticalMaxOccures3 = new TestParticalSequenceMaxOccurs3();
+        TestParticalSequenceMaxOccursType3 expectedTestParticalMaxOccursType3 = new TestParticalSequenceMaxOccursType3();
+        expectedTestParticalMaxOccures3.setTestParticalSequenceMaxOccurs3(expectedTestParticalMaxOccursType3);
+
+        TestParticalSequenceMaxOccursType3Sequence[] expectedTestSequences = new TestParticalSequenceMaxOccursType3Sequence[2];
+
+        expectedTestSequences[0] = new TestParticalSequenceMaxOccursType3Sequence();
+        expectedTestSequences[0].setParm1(new String[]{null});
+        expectedTestSequences[0].setParm2(new String[]{"Param111", null, "Param113"});
+
+        expectedTestSequences[1] = new TestParticalSequenceMaxOccursType3Sequence();
+        expectedTestSequences[1].setParm1(new String[]{"Param121", "Param122", null});
+        expectedTestSequences[1].setParm2(new String[]{null});
+
+        expectedTestParticalMaxOccursType3.setTestParticalSequenceMaxOccursType3Sequence(expectedTestSequences);
+        
+        
+        testSerializeDeserialize(testParticalMaxOccures3, expectedTestParticalMaxOccures3);
     }
 
     public void testParticleSequenceMaxOccurs4() throws Exception {

Modified: webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/union2/Union2Test.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/union2/Union2Test.java?rev=789498&r1=789497&r2=789498&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/union2/Union2Test.java
(original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/union2/Union2Test.java
Mon Jun 29 23:48:14 2009
@@ -21,7 +21,9 @@
 
 import org.apache.axis2.schema.AbstractTestCase;
 
+import java.util.Calendar;
 import java.util.Date;
+import java.util.GregorianCalendar;
 
 public class Union2Test extends AbstractTestCase {
 
@@ -56,12 +58,21 @@
 
     public void testFuzzDateType() throws Exception {
         TestFuzzyDateType testFuzzyDateType = new TestFuzzyDateType();
-
         FuzzyDateType fuzzyDateType = new FuzzyDateType();
         fuzzyDateType.setObject(new Date());
-
         testFuzzyDateType.setTestFuzzyDateType(fuzzyDateType);
 
-        TestFuzzyDateType result = (TestFuzzyDateType)serializeDeserialize(testFuzzyDateType);
+        // java.util.Date maps to xs:date, so we expect to loose the time information
+        TestFuzzyDateType expectedResult = new TestFuzzyDateType();
+        FuzzyDateType expectedFuzzyDateType = new FuzzyDateType();
+        Calendar cal = new GregorianCalendar();
+        cal.set(Calendar.HOUR_OF_DAY, 0);
+        cal.set(Calendar.MINUTE, 0);
+        cal.set(Calendar.SECOND, 0);
+        cal.set(Calendar.MILLISECOND, 0);
+        expectedFuzzyDateType.setObject(cal.getTime());
+        expectedResult.setTestFuzzyDateType(expectedFuzzyDateType);
+        
+        testSerializeDeserialize(testFuzzyDateType, expectedResult);
     }
 }



Mime
View raw message