Debian Codegraph @

test/encoding/TestDeser1999.java

raw
1 package test.encoding;
2
3 import org.apache.axis.Constants;
4
5 import java.util.ArrayList;
6 import java.util.HashMap;
7
8 /**
9 * Test deserialization of SOAP responses
10 */
11 public class TestDeser1999 extends TestDeser {
12
13 public TestDeser1999(String name) {
14 super(name, Constants.URI_1999_SCHEMA_XSI,
15 Constants.URI_1999_SCHEMA_XSD);
16 }
17
18 public void testMapWithNulls() throws Exception {
19 HashMap m = new HashMap();
20 m.put(null, new Boolean("false"));
21 m.put("hi", null);
22 // Test map with nulls and
23 // Test type references to the default namespace.
24 deserialize("<result xsi:type=\"xmlsoap:Map\" " +
25 "xmlns:xmlsoap=\"http://xml.apache.org/xml-soap\"> " +
26 "<item>" +
27 "<key xsi:null=\"true\"/>" +
28 "<value xsi:type=\"boolean\" xmlns=\"" +
29 Constants.URI_1999_SCHEMA_XSD +
30 "\">false</value>" +
31 "</item><item>" +
32 "<key xsi:type=\"string\" xmlns=\"" +
33 Constants.URI_1999_SCHEMA_XSD +
34 "\">hi</key>" +
35 "<value xsi:null=\"true\"/>" +
36 "</item>" +
37 "</result>",
38 m);
39 }
40
41 public void testArrayWithNullInt() throws Exception {
42 ArrayList list = new ArrayList(4);
43 list.add(new Integer(1));
44 list.add(null);
45 list.add(new Integer(3));
46 deserialize("<result xsi:type=\"soapenc:Array\" " +
47 "soapenc:arrayType=\"xsd:int[3]\"> " +
48 "<item xsi:type=\"xsd:int\">1</item>" +
49 "<item xsi:null=\"true\"/>" +
50 "<item xsi:type=\"xsd:int\">3</item>" +
51 "</result>",
52 list, true);
53 }
54
55 public void testArrayWithNullString() throws Exception {
56 ArrayList list = new ArrayList(4);
57 list.add("abc");
58 list.add(null);
59 list.add("def");
60 deserialize("<result xsi:type=\"soapenc:Array\" " +
61 "soapenc:arrayType=\"xsd:string[3]\"> " +
62 "<item xsi:type=\"xsd:string\">abc</item>" +
63 "<item xsi:null=\"true\"/>" +
64 "<item xsi:type=\"xsd:string\">def</item>" +
65 "</result>",
66 list, true);
67 }
68
69 public void testNullSOAPBoolean() throws Exception {
70 deserialize("<result xsi:type=\"soapenc:boolean\" xsi:null=\"true\" />",
71 null);
72 }
73 }