Debian Codegraph @

test/wsdl/arrays/PersonalInfoBookServiceTestCase.java

raw
1 /**
2 * PersonalInfoBookServiceTestCase.java
3 *
4 * This file was auto-generated from WSDL
5 * by the Apache Axis Wsdl2java emitter.
6 */
7
8 package test.wsdl.arrays;
9
10 import java.util.Vector;
11
12 public class PersonalInfoBookServiceTestCase extends junit.framework.TestCase {
13 public PersonalInfoBookServiceTestCase(String name) {
14 super(name);
15 }
16
17
18
19 public void testPersonalInfoBook() throws Exception {
20
21 // Set up some testcase values
22 String name = "Joe Geek";
23 String[] movies = new String[] { "Star Trek", "A.I." };
24 String[] hobbies= new String[] { "programming", "reading about programming" };
25 Vector pets = new Vector();
26 pets.add(new String("Byte"));
27 pets.add(new String("Nibbles"));
28 //String[] pets = new String[] { "Byte", "Nibbles" };
29 int[] id = new int[] { 0, 0, 7 };
30 int id2 = 123;
31 String[] foods = new String[] { "Cheeze Whiz", "Jolt Cola" };
32 byte[] nickName = new byte[] { (byte)'g', (byte)'e',
33 (byte)'e', (byte)'k'};
34 PersonalInfo pi = new PersonalInfo();
35 pi.setName(name);
36 pi.setFavoriteMovies(movies);
37 pi.setHobbies(hobbies);
38 pi.setPets(pets);
39 pi.setId(id);
40 pi.setId2(id2);
41 pi.setFoods(foods);
42 pi.setNickName(nickName);
43
44 // Get the stub and set Session
45 test.wsdl.arrays.PersonalInfoBook binding;
46 binding = new PersonalInfoBookServiceLocator().getPersonalInfoBook();
47 assertTrue("binding is null", binding != null);
48 ((PersonalInfoBookSOAPBindingStub) binding).setMaintainSession (true);
49
50 // Add the name and personal info for Joe Geek
51 binding.addEntry(name, pi);
52
53 // Now get the personal info and check validity
54 test.wsdl.arrays.PersonalInfo value = null;
55 value = binding.getPersonalInfoFromName(name);
56 assertTrue("Name is corrupted " + value,
57 value.getName().equals(pi.getName()));
58 assertTrue("Movies are corrupted " + value,
59 value.getFavoriteMovies()[1].equals(pi.getFavoriteMovies()[1]));
60 assertTrue("Hobbies are corrupted " + value,
61 value.getHobbies()[1].equals(pi.getHobbies()[1]));
62 assertTrue("Pets are corrupted " + value,
63 value.getPets().elementAt(1).equals(pi.getPets().elementAt(1)));
64 assertTrue("Id is corrupted " + value,
65 value.getId()[0] == 0 && value.getId()[1] == 0 && value.getId()[2] == 7);
66 assertTrue("Id2 is corrupted " + value,
67 value.getId2() == pi.getId2());
68 assertTrue("Food are corrupted " + value,
69 value.getFoods(1).equals(pi.getFoods(1)));
70 assertTrue("Nickname is corrupted " + value,
71 value.getNickName()[1] == pi.getNickName()[1]);
72
73 Vector value2 = null;
74 value2 = binding.getPetsFromName(name);
75 assertTrue("PetsFromName is broken " + value2,
76 value2.elementAt(1).equals(pi.getPets().elementAt(1)));
77
78 int[] value3 = null;
79 value3 = binding.getIDFromName(name);
80 assertTrue("getIDFromName is brokent " + value3,
81 value3[0] == 0 && value3[1] == 0 && value3[2] == 7);
82
83 int value4 = -3;
84 value4 = binding.getID2FromName(name);
85 assertTrue("getID2FromName is brokent " + value4,
86 value4 == pi.getId2());
87 }
88 }
89