Methods Summary |
---|
public void | NotestListTimeZones()this isnt a test, it is here to list timezones
String ids[] = TimeZone.getAvailableIDs();
for (int i = 9; i < ids.length; i++) {
System.out.println(ids[i]);
}
|
public void | NotestTimeLocal()test local time costs
deserializeCalendar(TimeZone.getDefault());
|
private java.lang.String | calcGMTOffset(java.util.Calendar cal)calculate the offset from GMT of the current time zone.
If the underlying time zone of the calendar contains historical
summer time information, the offset will be corrected for summertime
if the date of the calendar is a summertime date
int msecOffset = cal.get(Calendar.ZONE_OFFSET) +
cal.get(Calendar.DST_OFFSET);
int hourOffset = Math.abs(msecOffset / MILLISECONDS_IN_HOUR);
String offsetString = msecOffset > 0 ? "+" : "-";
offsetString += hourOffset >= 10 ? "" + hourOffset : "0" + hourOffset;
offsetString += ":";
int minOffset = Math.abs(msecOffset % MILLISECONDS_IN_HOUR) / MILLISECONDS_IN_MINUTE;
if (minOffset == 0) {
offsetString += "00";
}
else {
offsetString += minOffset >= 10 ? "" + minOffset : "0" + minOffset;
}
return offsetString;
|
private void | deserializeCalendar(java.util.TimeZone tz)
deserializeCalendar(2004, 1, 1, tz);
deserializeCalendar(2004, 7, 1, tz);
|
private void | deserializeCalendar(int year, int month, int day, java.util.TimeZone tz)
Calendar date = Calendar.getInstance();
date.set(Calendar.YEAR, year);
date.set(Calendar.MONTH, month);
date.set(Calendar.DAY_OF_MONTH, day);
date.set(Calendar.HOUR_OF_DAY, 12);
date.set(Calendar.MINUTE, 01);
date.set(Calendar.SECOND, 30);
date.set(Calendar.MILLISECOND, 150);
date.setTimeZone(tz);
Time time = new Time(date);
String offset = calcGMTOffset(date);
//diagnostics string
String comment=" [time="+time.toString()+"; tz="+tz.getDisplayName()
+"; offset="+offset+"]";
deserialize("<result xsi:type=\"xsd:time\">" +
"12:01:30.150" + offset +
"</result>",
time,
false,
comment);
|
public static void | main()
TestDeser2001 deser=new TestDeser2001("");
deser.testTimeUKWinter();
|
public void | testAnyURI()
org.apache.axis.types.URI uri = new URI("urn:this-is-a-test");
deserialize("<result xsi:type=\"xsd:anyURI\">urn:this-is-a-test</result>",
uri);
uri = new URI("http", "www.macromedia.com", "/testing", "query=1", null);
deserialize("<result xsi:type=\"xsd:anyURI\">http://www.macromedia.com/testing?query=1</result>",
uri);
|
public void | testArrayWithNilInt()
ArrayList list = new ArrayList(4);
list.add(new Integer(1));
list.add(null);
list.add(new Integer(3));
deserialize("<result xsi:type=\"soapenc:Array\" " +
"soapenc:arrayType=\"xsd:int[3]\"> " +
"<item xsi:type=\"xsd:int\">1</item>" +
"<item xsi:nil=\"true\"/>" +
"<item xsi:type=\"xsd:int\">3</item>" +
"</result>",
list, true);
|
public void | testArrayWithNilString()
ArrayList list = new ArrayList(4);
list.add("abc");
list.add(null);
list.add("def");
deserialize("<result xsi:type=\"soapenc:Array\" " +
"soapenc:arrayType=\"xsd:string[3]\"> " +
"<item xsi:type=\"xsd:string\">abc</item>" +
"<item xsi:nil=\"true\"/>" +
"<item xsi:type=\"xsd:string\">def</item>" +
"</result>",
list, true);
|
public void | testBase64()
deserialize("<result xsi:type=\"xsd:base64Binary\">QmFzZTY0</result>",
"Base64".getBytes());
|
public void | testBase64Null()
deserialize("<result xsi:type=\"xsd:base64Binary\"></result>",
new byte[0]);
|
public void | testDateTZ()
Calendar date = Calendar.getInstance();
date.set(1999, 04, 31, 0, 0, 0);
date.set(Calendar.MILLISECOND,0);
deserialize("<result xsi:type=\"xsd:date\">" +
"1999-05-31" +
"</result>",
date.getTime());
|
public void | testDateTimeTZ()
Calendar date = Calendar.getInstance();
date.set(1999,04,31,12,01,30);
date.set(Calendar.MILLISECOND,150);
deserialize("<result xsi:type=\"xsd:dateTime\">" +
"1999-05-31T12:01:30.150" + calcGMTOffset(date) +
"</result>",
date);
|
public void | testDateTimeZ()
Calendar date = Calendar.getInstance();
date.set(1999,04,31,12,01,30);
date.setTimeZone(TimeZone.getTimeZone("GMT"));
date.set(Calendar.MILLISECOND,150);
deserialize("<result xsi:type=\"xsd:dateTime\">" +
"1999-05-31T12:01:30.150Z" +
"</result>",
date);
|
public void | testDay()
org.apache.axis.types.Day ym = new Day(15);
deserialize("<result xsi:type=\"xsd:gDay\">---15</result>",
ym);
|
public void | testDuration()
org.apache.axis.types.Duration ym = new Duration(false, 2, 3, 8, 8, 1, 3.3);
deserialize("<result xsi:type=\"xsd:duration\">P2Y3M8DT8H1M3.3S</result>",
ym);
org.apache.axis.types.Duration ym2 = new Duration(true, 2, 3, 8, 8, 1, 3.3);
deserialize("<result xsi:type=\"xsd:duration\">-P2Y3M8DT8H1M3.3S</result>",
ym2);
|
public void | testHex()
deserialize("<result xsi:type=\"xsd:hexBinary\">50A9</result>",
new HexBinary("50A9"),true);
|
public void | testHexNull()
deserialize("<result xsi:type=\"xsd:hexBinary\"></result>",
new HexBinary(""),true);
|
public void | testMapWithNils()
HashMap m = new HashMap();
m.put(null, new Boolean("false"));
m.put("hi", null);
deserialize("<result xsi:type=\"xmlsoap:Map\" " +
"xmlns:xmlsoap=\"http://xml.apache.org/xml-soap\"> " +
"<item>" +
"<key xsi:nil=\"true\"/>" +
"<value xsi:type=\"xsd:boolean\">false</value>" +
"</item><item>" +
"<key xsi:type=\"xsd:string\">hi</key>" +
"<value xsi:nil=\"true\"/>" +
"</item>" +
"</result>",
m);
|
public void | testMinDate()Test deserialization of Date responses
Calendar date = Calendar.getInstance();
date.set(1999, 04, 31, 0, 0, 0);
date.set(Calendar.MILLISECOND,0);
deserialize("<result xsi:type=\"xsd:date\">" +
"1999-05-31" +
"</result>",
date.getTime());
|
public void | testMinDateTime()Test deserialization of dateTime (Calendar) responses
Calendar date = Calendar.getInstance();
date.set(1999,04,31, 12, 01, 30);
date.setTimeZone(TimeZone.getTimeZone("GMT"));
date.set(Calendar.MILLISECOND,0);
deserialize("<result xsi:type=\"xsd:dateTime\">" +
"1999-05-31T12:01:30Z" +
"</result>",
date);
|
public void | testMonth()
org.apache.axis.types.Month ym = new Month(8);
deserialize("<result xsi:type=\"xsd:gMonth\">--08--</result>",
ym);
|
public void | testMonthDay()
org.apache.axis.types.MonthDay ym = new MonthDay(8, 5);
deserialize("<result xsi:type=\"xsd:gMonthDay\">--08-05</result>",
ym);
|
public void | testNCName()
deserialize("<result xsi:type=\"xsd:NCName\">_Atlanta.Braves</result>",
new NCName("_Atlanta.Braves"),true);
|
public void | testNMToken()
deserialize("<result xsi:type=\"xsd:NMTOKEN\">_A.B.C.1-2-3</result>",
new NMToken("_A.B.C.1-2-3"),true);
|
public void | testName()
deserialize("<result xsi:type=\"xsd:Name\">:Braves</result>",
new Name(":Braves"),true);
|
public void | testNegativeInteger()
deserialize("<result xsi:type=\"xsd:negativeInteger\">-12345678901234567890</result>",
new NegativeInteger("-12345678901234567890"), true);
|
public void | testNilSOAPBoolean()
deserialize("<result xsi:type=\"soapenc:boolean\" xsi:nil=\"true\" />",
null);
|
public void | testNonNegativeInteger()
deserialize("<result xsi:type=\"xsd:nonNegativeInteger\">12345678901234567890</result>",
new NonNegativeInteger("12345678901234567890"), true);
|
public void | testNonPositiveInteger()
deserialize("<result xsi:type=\"xsd:nonPositiveInteger\">-12345678901234567890</result>",
new NonPositiveInteger("-12345678901234567890"), true);
|
public void | testNormalizedString()
deserialize("<result xsi:type=\"xsd:normalizedString\">abcdefg</result>",
new NormalizedString("abcdefg"),true);
|
public void | testPositiveInteger()
deserialize("<result xsi:type=\"xsd:positiveInteger\">12345678901234567890</result>",
new PositiveInteger("12345678901234567890"), true);
|
public void | testQName()
deserialize("<result xsi:type=\"xsd:QName\" xmlns:qns=\"namespace\">qns:localPart</result>", new QName("namespace", "localPart"), true);
|
public void | testTimeUK()
deserializeCalendar(TimeZone.getTimeZone("Europe/London"));
|
public void | testTimeUKSummer()
deserializeCalendar(TimeZone.getTimeZone("GMT+1:00"));
|
public void | testTimeUKWinter()
deserializeCalendar(TimeZone.getTimeZone("GMT+0:00"));
|
public void | testTimeZ()Test the xsd:Time deserialization
Calendar date = Calendar.getInstance();
date.set(Calendar.HOUR_OF_DAY, 12);
date.set(Calendar.MINUTE, 01);
date.set(Calendar.SECOND, 30);
date.set(Calendar.MILLISECOND,150);
date.setTimeZone(TimeZone.getTimeZone("GMT"));
Time time = new Time(date);
deserialize("<result xsi:type=\"xsd:time\">" +
"12:01:30.150Z" +
"</result>",
time);
|
public void | testTimeZoneLogicWorks()this test is here to track down odd behaviour on one system related to these TZ tests
TimeZone tz=TimeZone.getTimeZone("GMT");
//assertEquals(0,tz.getDSTSavings());
assertEquals(0,tz.getRawOffset());
Time time=new Time("12:01:30.150+00:00");
String timeVal=time.toString();
assertEquals("12:01:30.150Z",timeVal);
|
public void | testToken()
deserialize("<result xsi:type=\"xsd:token\">abcdefg</result>",
new Token("abcdefg"),true);
|
public void | testUnsignedByte()
deserialize("<result xsi:type=\"xsd:unsignedByte\">103</result>",
new UnsignedByte(103),true);
|
public void | testUnsignedInt()
deserialize("<result xsi:type=\"xsd:unsignedInt\">101</result>",
new UnsignedInt(101),true);
|
public void | testUnsignedLong()
deserialize("<result xsi:type=\"xsd:unsignedLong\">100</result>",
new UnsignedLong(100),true);
|
public void | testUnsignedShort()
deserialize("<result xsi:type=\"xsd:unsignedShort\">102</result>",
new UnsignedShort(102),true);
|
public void | testYear()
org.apache.axis.types.Year ym = new Year(2002);
deserialize("<result xsi:type=\"xsd:gYear\">2002</result>",
ym);
|
public void | testYearMonth()
org.apache.axis.types.YearMonth ym = new YearMonth(2002, 8);
deserialize("<result xsi:type=\"xsd:gYearMonth\">2002-08</result>",
ym);
|