1 7 8 10 package org.jboss.test.jbossnet.wsr; 11 12 import com.ibm.wsdl.factory.WSDLFactoryImpl; 13 import junit.framework.Test; 14 import org.jboss.test.jbossnet.JBossNetTestBase; 15 import org.xml.sax.InputSource ; 16 17 import javax.wsdl.Definition; 18 import javax.wsdl.factory.WSDLFactory; 19 import javax.wsdl.xml.WSDLReader; 20 import javax.xml.namespace.QName ; 21 import javax.xml.rpc.Service ; 22 import java.io.InputStream ; 23 import java.net.URL ; 24 25 31 public class WSRUnitTestCase extends JBossNetTestBase 32 { 33 private QName ADDRESS_SERVICE = new QName ("http://test.jboss.org/samples/AddressBook", "AddressBookService"); 34 35 public WSRUnitTestCase(String name) 37 { 38 super(name); 39 } 40 41 42 Address address; 43 AddressBook book; 44 45 46 public void setUp() throws Exception 47 { 48 super.setUp(); 49 50 Phone phone = new Phone(); 51 phone.setExchange("(0)6897"); 52 phone.setNumber("6666"); 53 phone.setAreaCode(49); 54 StateType state = StateType.fromString("TX"); 55 address = new Address(); 56 address.setStreetNum(42); 57 address.setStreetName("Milky Way"); 58 address.setCity("Galactic City"); 59 address.setZip(2121); 60 address.setState(state); 61 address.setPhoneNumber(phone); 62 63 URL wsdlURI = new URL (SERVICES_LOCATION + "/AddressBook?wsdl"); 64 Service service = createService(wsdlURI, ADDRESS_SERVICE, true); 65 66 book = (AddressBook)service.getPort(AddressBook.class); 67 } 68 69 70 protected String getAxisConfiguration() 71 { 72 return "jbossnet/wsr/client/client-config.wsdd"; 73 } 74 75 76 public void testAddress() throws Exception 77 { 78 book.addEntry("George", address); 79 Address retAddress = book.getAddressFromName("George"); 80 assertEquals("Comparing addresses", address, retAddress); 81 } 82 83 84 public static Test suite() throws Exception 85 { 86 return getDeploySetup(WSRUnitTestCase.class, "jbossnet-wsr.wsr"); 87 } 88 } | Popular Tags |