1 package test.wsdl.interop3.rpcEnc; 2 3 4 import test.wsdl.interop3.rpcEnc.xsd.SOAPStruct; 5 6 import java.net.URL ; 7 8 27 28 public class RpcEncTestCase extends junit.framework.TestCase { 29 static URL url; 30 31 public RpcEncTestCase(String name) { 32 super(name); 33 } 34 35 protected void setUp() throws Exception { 36 } 37 38 public void testStep3() throws Exception { 39 WSDLInteropTestRpcEncPortType binding; 40 try { 41 if (url != null) { 42 binding = new WSDLInteropTestRpcEncServiceLocator().getWSDLInteropTestRpcEncPort(url); 43 } else { 44 binding = new WSDLInteropTestRpcEncServiceLocator().getWSDLInteropTestRpcEncPort(); 45 } 46 } 47 catch (javax.xml.rpc.ServiceException jre) { 48 throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre); 49 } 50 assertNotNull("binding is null", binding); 51 52 String str = "Hello there!"; 53 String [] strArray = new String [] { "1", "two", "trois" }; 54 55 assertEquals("echoString results differ", binding.echoString(str), str); 56 57 String [] resArray = binding.echoStringArray(strArray); 58 assertEquals("String array lengths differ", 59 strArray.length, 60 resArray.length); 61 for (int i = 0; i < strArray.length; i++) { 62 assertEquals("Array members at index " + i + " differ", 63 strArray[i], 64 resArray[i]); 65 } 66 67 SOAPStruct struct = new SOAPStruct(); 68 struct.setVarFloat(3.14159F); 69 struct.setVarInt(69); 70 struct.setVarString("Struct-o-rama"); 71 72 assertTrue("Structs weren't equal", 73 struct.equals(binding.echoStruct(struct))); 74 } 75 76 77 78 public static void main(String [] args) { 79 if (args.length == 1) { 80 try { 81 url = new URL (args[0]); 82 } catch (Exception e) { 83 } 84 } 85 86 junit.textui.TestRunner.run(new junit.framework.TestSuite(RpcEncTestCase.class)); 87 } } 89 90 | Popular Tags |