Author: jason.greene(a)jboss.com
Date: 2007-01-31 17:36:40 -0500 (Wed, 31 Jan 2007)
New Revision: 2226
Modified:
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/common/jbossxb/simple/SimpleUserTypeMarshallerTestCase.java
Log:
Fix broken date tests
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-31
22:19:17 UTC (rev 2225)
+++
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/common/jbossxb/simple/SimpleUserTypeMarshallerTestCase.java 2007-01-31
22:36:40 UTC (rev 2226)
@@ -24,6 +24,7 @@
import java.io.StringWriter;
import java.util.Date;
import java.util.GregorianCalendar;
+import java.util.TimeZone;
import javax.xml.namespace.QName;
@@ -83,18 +84,27 @@
public void testMarshallSimpleUserTypeWithDate() throws Exception
{
- GregorianCalendar cal = new GregorianCalendar(1968, 11, 16);
- SimpleUserType obj = new SimpleUserType(1, 2, cal.getTime());
+ TimeZone tz = TimeZone.getDefault();
+ TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
+ try
+ {
+ 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 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-16T00:00:00.000Z</d>" +
+ "</ns1:SimpleUser>";
- String was = marshalSimpleType(obj);
- assertEquals(DOMUtils.parse(exp), DOMUtils.parse(was));
+ String was = marshalSimpleType(obj);
+ assertEquals(DOMUtils.parse(exp), DOMUtils.parse(was));
+ }
+ finally
+ {
+ TimeZone.setDefault(tz);
+ }
}
public void testMarshallSimpleUserTypeWithUserDate() throws Exception
@@ -106,21 +116,29 @@
super(date);
}
}
-
- GregorianCalendar cal = new GregorianCalendar(1968, 11, 16);
- UserDate userDate = new UserDate(cal.getTime().getTime());
- SimpleUserType obj = new SimpleUserType(1, 2, userDate);
+ TimeZone tz = TimeZone.getDefault();
+ TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
+ try
+ {
+ 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));
+ 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-16T00: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));
+ }
+ finally
+ {
+ TimeZone.setDefault(tz);
+ }
}
private String marshalSimpleType(SimpleUserType obj) throws Exception,
MarshalException