1 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 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 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 test.wsdl.arrays.PersonalInfoBook binding; 46 binding = new PersonalInfoBookServiceLocator().getPersonalInfoBook(); 47 assertTrue("binding is null", binding != null); 48 ((PersonalInfoBookSOAPBindingStub) binding).setMaintainSession (true); 49 50 binding.addEntry(name, pi); 52 53 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 90 | Popular Tags |