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