Author: keith Date: Mon Jun 23 22:16:06 2008 New Revision: 18582 URL: http://wso2.org/svn/browse/wso2?view=rev&revision=18582
Log: Fixing Test failures with regard to dateTime params Modified: trunk/mashup/java/modules/integration/test/org/wso2/mashup/integration/SchemaIntegrationTest.java Modified: trunk/mashup/java/modules/integration/test/org/wso2/mashup/integration/SchemaIntegrationTest.java URL: http://wso2.org/svn/browse/wso2/trunk/mashup/java/modules/integration/test/org/wso2/mashup/integration/SchemaIntegrationTest.java?rev=18582&r1=18581&r2=18582&view=diff ============================================================================== --- trunk/mashup/java/modules/integration/test/org/wso2/mashup/integration/SchemaIntegrationTest.java (original) +++ trunk/mashup/java/modules/integration/test/org/wso2/mashup/integration/SchemaIntegrationTest.java Mon Jun 23 22:16:06 2008 @@ -23,9 +23,12 @@ import org.apache.axis2.client.Options; import org.apache.axis2.client.ServiceClient; import org.apache.axis2.databinding.types.HexBinary; +import org.apache.axis2.databinding.utils.ConverterUtil; import javax.xml.stream.XMLStreamException; +import javax.xml.namespace.QName; import java.io.ByteArrayInputStream; +import java.util.Calendar; public class SchemaIntegrationTest extends IntegrationTestSuite implements IntegrationTestConstants { @@ -84,11 +87,11 @@ } public void testEchoJSdate() throws Exception { - testEcho("echoJSdate", dateTimeParam); + testEchoDate("echoJSdate", dateTimeParam); } public void testEchoJSDate() throws Exception { - testEcho("echoJSDate", dateTimeParam); + testEchoDate("echoJSDate", dateTimeParam); } public void testEchoStringArray() throws Exception { @@ -317,7 +320,7 @@ } public void testEchoXSdateTime() throws Exception { - testEcho("echoXSdateTime", dateTimeParam); + testEchoDate("echoXSdateTime", dateTimeParam); } // todo to be fixed // public void testEchoXSdate() throws Exception { @@ -456,6 +459,23 @@ result.getFirstElement().getText()); } + private void testEchoDate (String opName, String param) throws XMLStreamException, AxisFault { + String str = "<" + opName + ">" + + "<param>" + param + "</param>" + + "</" + opName + ">"; + StAXOMBuilder staxOMBuilder = new StAXOMBuilder(new ByteArrayInputStream(str.getBytes())); + OMElement payload = staxOMBuilder.getDocumentElement(); + Options options = new Options(); + options.setTo(schemaTestEPR); + options.setTimeOutInMilliSeconds(10000000); + sender.setOptions(options); + OMElement result = sender.sendReceive(payload); + String resultString = result.getFirstElement().getText(); + Calendar calendar = ConverterUtil.convertToDateTime(param); + Calendar resultCalendar = ConverterUtil.convertToDateTime(resultString); + TestCase.assertEquals(calendar.getTimeInMillis(), resultCalendar.getTimeInMillis()); + } + public void testReturnInfinity() throws Exception { Options options = new Options(); options.setTo(schemaTestEPR); @@ -579,6 +599,12 @@ options.setTimeOutInMilliSeconds(10000); sender.setOptions(options); OMElement result = sender.sendReceive(payload); + OMElement innerElement = result.getFirstChildWithName(new QName("", "simple3")); + Calendar calendar = ConverterUtil.convertToDateTime(dateTimeParam); + Calendar resultCalendar = ConverterUtil.convertToDateTime(innerElement.getText()); + innerElement.detach(); + TestCase.assertEquals(calendar.getTimeInMillis(), resultCalendar.getTimeInMillis()); + TestCase.assertEquals( "<ws:echoComplexCompositionsResponse xmlns:ws=\"http://services.mashup.wso2.org/schemaTest?xsd\">" + "<simple1>testParam</simple1>" + @@ -597,7 +623,6 @@ "<item js:type=\"xml\" xsi:type=\"xs:anyType\"><test>just some text</test></item>" + "</anotherNested>" + "</ws:echoComplexCompositionsResponseTypecomplex2Type>" + - "<simple3>2007-08-27T10:20:30.040+00:00</simple3>" + "<simple4>true</simple4>" + "</ws:echoComplexCompositionsResponse>", result.toString()); _______________________________________________ Mashup-dev mailing list [email protected] http://www.wso2.org/cgi-bin/mailman/listinfo/mashup-dev
