1 16 17 23 24 package test.wsdl.interop3.groupE.client; 25 26 import junit.framework.AssertionFailedError; 27 28 import java.net.URL ; 29 30 public class InteropTestRpcEncServiceTestCase extends junit.framework.TestCase { 31 public static URL url; 32 33 public InteropTestRpcEncServiceTestCase(String name) { 34 super(name); 35 } 36 public void testInteropTestRpcEncEchoString() { 37 InteropTestRpcEnc binding; 38 try { 39 if (url == null) { 40 binding = new InteropTestRpcEncServiceLocator().getInteropTestRpcEnc(); 41 } else { 42 binding = new InteropTestRpcEncServiceLocator().getInteropTestRpcEnc(url); 43 } 44 } catch (javax.xml.rpc.ServiceException jre) { 45 throw new AssertionFailedError("JAX-RPC ServiceException caught: " + jre); 46 } 47 assertTrue("binding is null", binding != null); 48 49 try { 50 String input = "a string"; 51 String value = binding.echoString(input); 52 if (!value.equals(input)) { 53 throw new AssertionFailedError("String echo failed"); 54 } 55 } 56 catch (java.rmi.RemoteException re) { 57 throw new AssertionFailedError("Remote Exception caught: " + re); 58 } 59 } 60 61 public void testInteropTestRpcEncEchoStringArray() { 62 InteropTestRpcEnc binding; 63 try { 64 if (url == null) { 65 binding = new InteropTestRpcEncServiceLocator().getInteropTestRpcEnc(); 66 } else { 67 binding = new InteropTestRpcEncServiceLocator().getInteropTestRpcEnc(url); 68 } 69 } 70 catch (javax.xml.rpc.ServiceException jre) { 71 throw new AssertionFailedError("JAX-RPC ServiceException caught: " + jre); 72 } 73 assertTrue("binding is null", binding != null); 74 75 try { 76 String [] input = {"string 1", "string 2"}; 77 String [] value = binding.echoStringArray(input); 78 79 boolean equal = true; 80 if (input.length != value.length) { 81 equal = false; 82 } else { 83 for (int i = 0; i < value.length; i++) { 84 if (!input[i].equals(value[i])) { 85 equal = false; 86 } 87 } 88 } 89 if (!equal) { 90 throw new AssertionFailedError("StringArray echo failed"); 91 } 92 } 93 catch (java.rmi.RemoteException re) { 94 throw new AssertionFailedError("Remote Exception caught: " + re); 95 } 96 } 97 98 public void testInteropTestRpcEncEchoStruct() { 99 InteropTestRpcEnc binding; 100 try { 101 if (url == null) { 102 binding = new InteropTestRpcEncServiceLocator().getInteropTestRpcEnc(); 103 } else { 104 binding = new InteropTestRpcEncServiceLocator().getInteropTestRpcEnc(url); 105 } 106 } 107 catch (javax.xml.rpc.ServiceException jre) { 108 throw new AssertionFailedError("JAX-RPC ServiceException caught: " + jre); 109 } 110 assertTrue("binding is null", binding != null); 111 112 try { 113 SOAPStruct input = new SOAPStruct(); 114 input.setVarFloat(3.142f); 115 input.setVarInt(3); 116 input.setVarString("Pi"); 117 SOAPStruct value = binding.echoStruct(input); 118 if (value.getVarFloat() != input.getVarFloat() || 119 value.getVarInt() != input.getVarInt() || 120 !value.getVarString().equals(input.getVarString())) { 121 throw new AssertionFailedError("Struct echo failed"); 122 } 123 } 124 catch (java.rmi.RemoteException re) { 125 throw new AssertionFailedError("Remote Exception caught: " + re); 126 } 127 } 128 129 public void testInteropTestRpcEncEchoVoid() { 130 InteropTestRpcEnc binding; 131 try { 132 if (url == null) { 133 binding = new InteropTestRpcEncServiceLocator().getInteropTestRpcEnc(); 134 } else { 135 binding = new InteropTestRpcEncServiceLocator().getInteropTestRpcEnc(url); 136 } 137 } 138 catch (javax.xml.rpc.ServiceException jre) { 139 throw new AssertionFailedError("JAX-RPC ServiceException caught: " + jre); 140 } 141 assertTrue("binding is null", binding != null); 142 143 try { 144 binding.echoVoid(); 145 } 146 catch (java.rmi.RemoteException re) { 147 throw new AssertionFailedError("Remote Exception caught: " + re); 148 } 149 } 150 151 } 152 153 | Popular Tags |