1 7 8 package test.wsdl.query; 9 10 public class QueryTestServiceTestCase extends junit.framework.TestCase { 11 public QueryTestServiceTestCase(java.lang.String name) { 12 super(name); 13 } 14 15 public void testQueryTestWSDL() throws Exception { 16 javax.xml.rpc.ServiceFactory serviceFactory = javax.xml.rpc.ServiceFactory.newInstance(); 17 java.net.URL url = new java.net.URL (new test.wsdl.query.QueryTestServiceLocator().getQueryTestAddress() + "?WSDL"); 18 javax.xml.rpc.Service service = serviceFactory.createService(url, new test.wsdl.query.QueryTestServiceLocator().getServiceName()); 19 assertTrue(service != null); 20 } 21 22 23 public void test2QueryTestEchoQuery() throws Exception { 24 test.wsdl.query.QueryTestBindingStub binding; 25 try { 26 binding = (test.wsdl.query.QueryTestBindingStub) 27 new test.wsdl.query.QueryTestServiceLocator().getQueryTest(); 28 } 29 catch (javax.xml.rpc.ServiceException jre) { 30 if(jre.getLinkedCause()!=null) 31 jre.getLinkedCause().printStackTrace(); 32 throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre); 33 } 34 assertNotNull("binding is null", binding); 35 36 binding.setTimeout(60000); 38 39 test.wsdl.query.QueryBean inQuery = new QueryBean(); 41 String [] columns = new String [] {"first", "last", "number"}; 42 Object [][] data = new Object [][] { {new String ("Joe"), new String ("Blow"), new Integer (3)}, 43 {new String ("John"), new String ("Doe"), new Integer (2)} }; 44 inQuery.setColumnList(columns); 45 inQuery.setData(data); 46 47 QueryBean outQuery = binding.echoQuery(inQuery); 48 assertNotNull("return value is null", outQuery); 49 String [] outCols = outQuery.getColumnList(); 50 assertNotNull("column list is null", outCols); 51 assertEquals("column value #1 doesn't match", columns[0], outCols[0]); 52 assertEquals("column value #2 doesn't match", columns[1], outCols[1]); 53 assertEquals("column value #3 doesn't match", columns[2], outCols[2]); 54 Object [][] outData = outQuery.getData(); 55 assertNotNull("data arrayt is null", outData); 56 assertEquals("data value 0,0 doesn't match", data[0][0], outData[0][0]); 57 assertEquals("data value 0,1 doesn't match", data[0][1], outData[0][1]); 58 assertEquals("data value 0,2 doesn't match", data[0][2], outData[0][2]); 59 assertEquals("data value 1,0 doesn't match", data[1][0], outData[1][0]); 60 assertEquals("data value 1,1 doesn't match", data[1][1], outData[1][1]); 61 assertEquals("data value 1,2 doesn't match", data[1][2], outData[1][2]); 62 } 63 64 87 88 } 89 | Popular Tags |