Author: thomas.diesler(a)jboss.com
Date: 2007-01-12 08:49:58 -0500 (Fri, 12 Jan 2007)
New Revision: 1945
Modified:
trunk/build/ant-import/build-thirdparty.xml
trunk/integration-jboss50/.classpath
trunk/jbossws-core/.classpath
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/common/jbossxb/simple/SimpleUserType.java
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/common/jbossxb/simple/SimpleUserTypeMarshallerTestCase.java
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/common/jbossxb/simple/SimpleUserTypeUnmarshallerTestCase.java
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/tools/WSToolsTest.java
Log:
Add test for [JBWS-800] ClassCastException when trying to marshal a SybaseTimestamp
Fetch sources for common-core, vfs, xb
Modified: trunk/build/ant-import/build-thirdparty.xml
===================================================================
--- trunk/build/ant-import/build-thirdparty.xml 2007-01-12 12:50:18 UTC (rev 1944)
+++ trunk/build/ant-import/build-thirdparty.xml 2007-01-12 13:49:58 UTC (rev 1945)
@@ -38,13 +38,16 @@
<get src="${jboss.repository}/javassist/${javassist}/lib/javassist.jar"
dest="${thirdparty.dir}/javassist.jar" usetimestamp="true"
verbose="true"/>
<get
src="${jboss.repository}/jboss/backport-concurrent/${jboss-backport-concurrent}/lib/jboss-backport-concurrent.jar"
dest="${thirdparty.dir}/jboss-backport-concurrent.jar"
usetimestamp="true" verbose="true"/>
<get
src="${jboss.repository}/jboss/common-core/${jboss-common-core}/lib/jboss-common-core.jar"
dest="${thirdparty.dir}/jboss-common-core.jar" usetimestamp="true"
verbose="true"/>
+ <get
src="${jboss.repository}/jboss/common-core/${jboss-common-core}/lib/jboss-common-core-sources.jar"
dest="${thirdparty.dir}/jboss-common-core-sources.jar"
usetimestamp="true" verbose="true"/>
<get
src="${jboss.repository}/jboss/common-logging-log4j/${jboss-common-logging-log4j}/lib/jboss-logging-log4j.jar"
dest="${thirdparty.dir}/jboss-logging-log4j.jar" usetimestamp="true"
verbose="true"/>
<get
src="${jboss.repository}/jboss/common-logging-spi/${jboss-common-logging-spi}/lib/jboss-logging-spi.jar"
dest="${thirdparty.dir}/jboss-logging-spi.jar" usetimestamp="true"
verbose="true"/>
<get
src="${jboss.repository}/jboss/ejb3/${jboss-ejb3}/bin/ejb3.deployer"
dest="${thirdparty.dir}/ejb3.deployer.zip" usetimestamp="true"
verbose="true"/>
<get
src="${jboss.repository}/jboss/jboss-vfs/${jboss-vfs}/lib/jboss-vfs.jar"
dest="${thirdparty.dir}/jboss-vfs.jar" usetimestamp="true"
verbose="true"/>
+ <get
src="${jboss.repository}/jboss/jboss-vfs/${jboss-vfs}/lib/jboss-vfs-sources.jar"
dest="${thirdparty.dir}/jboss-vfs-sources.jar" usetimestamp="true"
verbose="true"/>
<get
src="${jboss.repository}/jboss/jbossretro/${jboss-jbossretro}/lib/jbossretro.jar"
dest="${thirdparty.dir}/jbossretro.jar" usetimestamp="true"
verbose="true"/>
<get
src="${jboss.repository}/jboss/jbossretro/${jboss-jbossretro}/lib/jbossretro-rt.jar"
dest="${thirdparty.dir}/jbossretro-rt.jar" usetimestamp="true"
verbose="true"/>
<get
src="${jboss.repository}/jboss/jbossxb/${jboss-jbossxb}/lib/jboss-xml-binding.jar"
dest="${thirdparty.dir}/jboss-xml-binding.jar" usetimestamp="true"
verbose="true"/>
+ <get
src="${jboss.repository}/jboss/jbossxb/${jboss-jbossxb}/lib/jboss-xml-binding-src.zip"
dest="${thirdparty.dir}/jboss-xml-binding-src.zip" usetimestamp="true"
verbose="true"/>
<get
src="${jboss.repository}/jboss/microcontainer/${jboss-microcontainer}/lib/jboss-container.jar"
dest="${thirdparty.dir}/jboss-container.jar" usetimestamp="true"
verbose="true"/>
<get
src="${jboss.repository}/jboss/microcontainer/${jboss-microcontainer}/lib/jboss-dependency.jar"
dest="${thirdparty.dir}/jboss-dependency.jar" usetimestamp="true"
verbose="true"/>
<get
src="${jboss.repository}/jboss/microcontainer/${jboss-microcontainer}/lib/jboss-deployers.jar"
dest="${thirdparty.dir}/jboss-deployers.jar" usetimestamp="true"
verbose="true"/>
Modified: trunk/integration-jboss50/.classpath
===================================================================
--- trunk/integration-jboss50/.classpath 2007-01-12 12:50:18 UTC (rev 1944)
+++ trunk/integration-jboss50/.classpath 2007-01-12 13:49:58 UTC (rev 1945)
@@ -6,7 +6,7 @@
<classpathentry combineaccessrules="false" kind="src"
path="/jbossws-core"/>
<classpathentry kind="lib"
path="/build/thirdparty/ejb3.deployer/jboss-ejb3.jar"
sourcepath="/home/tdiesler/svn/jbossas/trunk/ejb3/src/main"/>
<classpathentry kind="lib"
path="/build/thirdparty/jboss-deployers.jar"/>
- <classpathentry kind="lib"
path="/build/thirdparty/jboss-vfs.jar"/>
+ <classpathentry kind="lib" path="/build/thirdparty/jboss-vfs.jar"
sourcepath="/build/thirdparty/jboss-vfs-sources.jar"/>
<classpathentry kind="lib" path="/build/thirdparty/ant.jar"/>
<classpathentry kind="lib"
path="/build/thirdparty/activation.jar"/>
<classpathentry kind="lib"
path="/build/thirdparty/commons-logging.jar"/>
Modified: trunk/jbossws-core/.classpath
===================================================================
--- trunk/jbossws-core/.classpath 2007-01-12 12:50:18 UTC (rev 1944)
+++ trunk/jbossws-core/.classpath 2007-01-12 13:49:58 UTC (rev 1945)
@@ -16,7 +16,7 @@
<classpathentry kind="lib"
path="/build/thirdparty/jboss-logging-spi.jar"/>
<classpathentry kind="lib"
path="/build/thirdparty/jboss-remoting.jar"/>
<classpathentry kind="lib"
path="/build/thirdparty/jboss-security-spi.jar"/>
- <classpathentry kind="lib"
path="/build/thirdparty/jboss-xml-binding.jar"/>
+ <classpathentry kind="lib"
path="/build/thirdparty/jboss-xml-binding.jar"
sourcepath="/build/thirdparty/jboss-xml-binding-src.zip"/>
<classpathentry kind="lib" path="/build/thirdparty/wsdl4j.jar"
sourcepath="/build/thirdparty/wsdl4j-1_5_2.zip"/>
<classpathentry kind="lib"
path="/build/thirdparty/xmlsec.jar"/>
<classpathentry kind="lib"
path="/build/thirdparty/ejb3.deployer/jboss-annotations-ejb3.jar"/>
Modified:
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/common/jbossxb/simple/SimpleUserType.java
===================================================================
---
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/common/jbossxb/simple/SimpleUserType.java 2007-01-12
12:50:18 UTC (rev 1944)
+++
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/common/jbossxb/simple/SimpleUserType.java 2007-01-12
13:49:58 UTC (rev 1945)
@@ -21,6 +21,8 @@
*/
package org.jboss.test.ws.common.jbossxb.simple;
+import java.util.Date;
+
/**
* @author Thomas.Diesler(a)jboss.org
* @since 29-Apr-2005
@@ -29,15 +31,17 @@
{
public int a;
private int b;
+ private Date d;
public SimpleUserType()
{
}
- public SimpleUserType(int a, int b)
+ public SimpleUserType(int a, int b, Date d)
{
this.a = a;
this.b = b;
+ this.d = d;
}
public int getB()
@@ -50,29 +54,40 @@
this.b = b;
}
+ public Date getD()
+ {
+ return d;
+ }
+
+ public void setD(Date d)
+ {
+ this.d = d;
+ }
+
public boolean equals(Object o)
{
if (this == o) return true;
if (!(o instanceof SimpleUserType)) return false;
- final SimpleUserType simpleUserType = (SimpleUserType)o;
+ SimpleUserType other = (SimpleUserType)o;
- if (a != simpleUserType.a) return false;
- if (b != simpleUserType.b) return false;
+ if (a != other.a) return false;
+ if (b != other.b) return false;
+ if (d == null && other.d != null) return false;
+ if (d != null && other.d == null) return false;
+ if (d != null && other.d != null && d.getTime() !=
other.d.getTime()) return false;
- return true;
+ return toString().equals(other.toString());
}
public int hashCode()
{
- int result;
- result = a;
- result = 29 * result + b;
- return result;
+ return toString().hashCode();
}
public String toString()
{
- return "[a=" + a + ",b=" + b + "]";
+ long time = d != null ? d.getTime() : 0;
+ return "[a=" + a + ",b=" + b + ",d=" + time +
"]";
}
}
Modified:
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/common/jbossxb/simple/SimpleUserTypeMarshallerTestCase.java
===================================================================
---
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/common/jbossxb/simple/SimpleUserTypeMarshallerTestCase.java 2007-01-12
12:50:18 UTC (rev 1944)
+++
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/common/jbossxb/simple/SimpleUserTypeMarshallerTestCase.java 2007-01-12
13:49:58 UTC (rev 1945)
@@ -22,6 +22,8 @@
package org.jboss.test.ws.common.jbossxb.simple;
import java.io.StringWriter;
+import java.util.Date;
+import java.util.GregorianCalendar;
import javax.xml.namespace.QName;
@@ -29,6 +31,7 @@
import org.jboss.test.ws.tools.WSToolsTest;
import org.jboss.ws.core.jaxrpc.binding.jbossxb.JBossXBConstants;
import org.jboss.ws.core.jaxrpc.binding.jbossxb.JBossXBMarshallerImpl;
+import org.jboss.ws.core.jaxrpc.binding.jbossxb.MarshalException;
import org.jboss.ws.core.utils.DOMUtils;
import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
import org.jboss.ws.metadata.jaxrpcmapping.PackageMapping;
@@ -55,6 +58,7 @@
" <sequence>" +
" <element name='a' type='int'/>" +
" <element name='b' type='int'/>" +
+ " <element name='d' nillable='true'
type='dateTime'/>" +
" </sequence>" +
" </complexType>" +
"</schema>";
@@ -66,6 +70,61 @@
{
SimpleUserType obj = new SimpleUserType();
+ String exp =
+ "<ns1:SimpleUser xmlns:ns1='" + TARGET_NAMESPACE + "'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" +
+ " <a>0</a>" +
+ " <b>0</b>" +
+ " <d xsi:nil='1'/>" +
+ "</ns1:SimpleUser>";
+
+ String was = marshalSimpleType(obj);
+ assertEquals(DOMUtils.parse(exp), DOMUtils.parse(was));
+ }
+
+ public void testMarshallSimpleUserTypeWithDate() throws Exception
+ {
+ GregorianCalendar cal = new GregorianCalendar(1968, 11, 16);
+ SimpleUserType obj = new SimpleUserType(1, 2, cal.getTime());
+
+ String exp =
+ "<ns1:SimpleUser xmlns:ns1='" + TARGET_NAMESPACE + "'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" +
+ " <a>1</a>" +
+ " <b>2</b>" +
+ " <d>1968-12-15T23:00:00.000Z</d>" +
+ "</ns1:SimpleUser>";
+
+ String was = marshalSimpleType(obj);
+ assertEquals(DOMUtils.parse(exp), DOMUtils.parse(was));
+ }
+
+ public void testMarshallSimpleUserTypeWithUserDate() throws Exception
+ {
+ class UserDate extends Date
+ {
+ public UserDate(long date)
+ {
+ super(date);
+ }
+ }
+
+ GregorianCalendar cal = new GregorianCalendar(1968, 11, 16);
+ UserDate userDate = new UserDate(cal.getTime().getTime());
+ SimpleUserType obj = new SimpleUserType(1, 2, userDate);
+
+ String exp =
+ "<ns1:SimpleUser xmlns:ns1='" + TARGET_NAMESPACE + "'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" +
+ " <a>1</a>" +
+ " <b>2</b>" +
+ " <d>1968-12-15T23:00:00.000Z</d>" +
+ "</ns1:SimpleUser>";
+
+ System.out.println("FIXME: [JBWS-800] ClassCastException when trying to
marshal a SybaseTimestamp");
+ //String was = marshalSimpleType(obj);
+ //assertEquals(DOMUtils.parse(exp), DOMUtils.parse(was));
+ }
+
+ private String marshalSimpleType(SimpleUserType obj) throws Exception,
MarshalException
+ {
QName xmlName = new QName(TARGET_NAMESPACE, "SimpleUser",
"ns1");
QName xmlType = new QName(TARGET_NAMESPACE, "SimpleUserType",
"ns1");
@@ -83,14 +142,7 @@
String was = strwr.toString();
assertNotNull("Resulting fragment cannot be null", was);
assertTrue("Resulting fragment cannot be empty", was.length() > 0);
-
- String exp =
- "<ns1:SimpleUser xmlns:ns1='" + TARGET_NAMESPACE + "'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" +
- " <a>0</a>" +
- " <b>0</b>" +
- "</ns1:SimpleUser>";
-
- assertEquals(DOMUtils.parse(exp), DOMUtils.parse(was));
+ return was;
}
public void testMarshallSimpleUserTypeNoPrefix() throws Exception
Modified:
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/common/jbossxb/simple/SimpleUserTypeUnmarshallerTestCase.java
===================================================================
---
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/common/jbossxb/simple/SimpleUserTypeUnmarshallerTestCase.java 2007-01-12
12:50:18 UTC (rev 1944)
+++
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/common/jbossxb/simple/SimpleUserTypeUnmarshallerTestCase.java 2007-01-12
13:49:58 UTC (rev 1945)
@@ -55,6 +55,7 @@
" <sequence>" +
" <element name='a' type='int'/>" +
" <element name='b' type='int'/>" +
+ " <element name='d' nillable='true'
type='dateTime'/>" +
" </sequence>" +
" </complexType>" +
"</schema>";
@@ -77,10 +78,11 @@
unmarshaller.setProperty(JBossXBConstants.JBXB_JAVA_MAPPING,
getJavaWSDLMapping());
String xml =
- "<ns1:SimpleUser xmlns:ns1='" + TARGET_NAMESPACE +
"'>" +
- " <a>0</a>" +
- " <b>0</b>" +
- "</ns1:SimpleUser>";
+ "<ns1:SimpleUser xmlns:ns1='" + TARGET_NAMESPACE + "'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" +
+ " <a>0</a>" +
+ " <b>0</b>" +
+ " <d xsi:nil='1'/>" +
+ "</ns1:SimpleUser>";
obj = (SimpleUserType)unmarshaller.unmarshal(new
ByteArrayInputStream(xml.getBytes()));
@@ -103,7 +105,12 @@
unmarshaller.setProperty(JBossXBConstants.JBXB_TYPE_QNAME, xmlType);
unmarshaller.setProperty(JBossXBConstants.JBXB_JAVA_MAPPING,
getJavaWSDLMapping());
- String xml = "<SimpleUser xmlns='" + TARGET_NAMESPACE +
"'>" + " <a xmlns=''>0</a>" + " <b
xmlns=''>0</b>" + "</SimpleUser>";
+ String xml =
+ "<ns1:SimpleUser xmlns:ns1='" + TARGET_NAMESPACE + "'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" +
+ " <a>0</a>" +
+ " <b>0</b>" +
+ " <d xsi:nil='1'/>" +
+ "</ns1:SimpleUser>";
obj = (SimpleUserType)unmarshaller.unmarshal(new
ByteArrayInputStream(xml.getBytes()));
Modified: trunk/jbossws-tests/src/main/java/org/jboss/test/ws/tools/WSToolsTest.java
===================================================================
--- trunk/jbossws-tests/src/main/java/org/jboss/test/ws/tools/WSToolsTest.java 2007-01-12
12:50:18 UTC (rev 1944)
+++ trunk/jbossws-tests/src/main/java/org/jboss/test/ws/tools/WSToolsTest.java 2007-01-12
13:49:58 UTC (rev 1945)
@@ -22,7 +22,6 @@
package org.jboss.test.ws.tools;
import java.io.File;
-import java.io.FileWriter;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
@@ -39,12 +38,9 @@
import org.jboss.test.ws.tools.validation.WSDL11Validator;
import org.jboss.test.ws.tools.validation.WSDLValidator;
import org.jboss.ws.Constants;
-import org.jboss.ws.core.jaxrpc.LiteralTypeMapping;
import org.jboss.ws.core.jaxrpc.Style;
import org.jboss.ws.core.utils.DOMUtils;
-import org.jboss.ws.core.utils.DOMWriter;
import org.jboss.ws.core.utils.JavaUtils;
-import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel;
import org.jboss.ws.tools.JavaToWSDL;
@@ -52,7 +48,6 @@
import org.jboss.ws.tools.WSToolsConstants;
import org.jboss.ws.tools.client.ServiceCreator;
import org.jboss.ws.tools.exceptions.JBossWSToolsException;
-import org.jboss.ws.tools.mapping.MappingFileGenerator;
import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
import org.w3c.dom.Element;