1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178
|
package test.wsdl.interop3.import2;
import test.wsdl.interop3.import2.definitions.SoapInteropImport2PortType;
import test.wsdl.interop3.import2.xsd.SOAPStruct;
import java.net.URL;
/*
<!-- SOAP Builder's round III web services -->
<!-- interoperability testing: import2 -->
<!-- (see http://www.whitemesa.net/r3/plan.html) -->
<!-- Step 1. Start with predefined WSDL -->
<!-- Step 2. Generate client from predefined WSDL -->
<!-- Step 3. Test generated client against -->
<!-- pre-built server -->
<!-- Step 4. Generate server from predefined WSDL -->
<!-- Step 5. Test generated client against -->
<!-- generated server -->
<!-- Step 6. Generate second client from -->
<!-- generated server's WSDL (some clients -->
<!-- can do this dynamically) -->
<!-- Step 7. Test second generated client against -->
<!-- generated server -->
<!-- Step 8. Test second generated client against -->
<!-- pre-built server -->
*/
public class Import2TestCase extends junit.framework.TestCase {
public static URL url;
public Import2TestCase(String name) {
super(name);
}
public void testStep3() {
SoapInteropImport2PortType binding;
try {
if (url == null) {
binding = new Import2Locator().getSoapInteropImport2Port();
} else {
binding = new Import2Locator().getSoapInteropImport2Port(url);
}
}
catch (javax.xml.rpc.ServiceException jre) {
throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
}
assertTrue("binding is null", binding != null);
try {
SOAPStruct value = new SOAPStruct();
value.setVarString("import2 string");
value.setVarInt(5);
value.setVarFloat(4.5F);
SOAPStruct result = binding.echoStruct(value);
assertEquals("String members didn't match", value.getVarString(), result.getVarString());
assertEquals("int members didn't match", value.getVarInt(), result.getVarInt());
//assertEquals("float members didn't match", value.getVarFloat(), result.getVarFloat());
}
catch (java.rmi.RemoteException re) {
throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re);
}
}
/* doesn't work yet
public void testStep8() {
SoapInteropImport2PortType binding;
try {
binding = new SoapInteropImport2PortTypeServiceLocator().getSoapInteropImport2Port(new java.net.URL("http://mssoapinterop.org/stkV3/wsdl/import2.wsdl"));
}
catch (Throwable t) {
throw new junit.framework.AssertionFailedError("Throwable caught: " + t);
}
assertTrue("binding is null", binding != null);
try {
SOAPStruct value = null;
value = binding.echoStruct(new SOAPStruct());
}
catch (java.rmi.RemoteException re) {
throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re);
}
}
*/
/*
Not working right now.
public void testAbsoluteStep3() {
test.wsdl.interop3.absimport2.definitions.SoapInteropImport2PortType binding;
try {
binding = new test.wsdl.interop3.absimport2.Import2Locator().getSoapInteropImport2Port();
}
catch (javax.xml.rpc.ServiceException jre) {
throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
}
assertTrue("binding is null", binding != null);
try {
test.wsdl.interop3.absimport2.xsd.SOAPStruct value = null;
value = binding.echoStruct(new test.wsdl.interop3.absimport2.xsd.SOAPStruct());
}
catch (java.rmi.RemoteException re) {
throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re);
}
}
public void testAbsoluteStep5() {
test.wsdl.interop3.absimport2.definitions.SoapInteropImport2PortType binding;
try {
binding = new test.wsdl.interop3.absimport2.Import2Locator().getSoapInteropImport2Port(new java.net.URL("http://localhost:8080/axis/services/SoapInteropImport2Port"));
}
catch (Throwable t) {
throw new junit.framework.AssertionFailedError("Throwable caught: " + t);
}
assertTrue("binding is null", binding != null);
try {
test.wsdl.interop3.absimport2.xsd.SOAPStruct value = null;
value = binding.echoStruct(new test.wsdl.interop3.absimport2.xsd.SOAPStruct());
}
catch (java.rmi.RemoteException re) {
throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re);
}
}
public void testAbsoluteStep7() {
test.wsdl.interop3.absimport2.step6.definitions.SoapInteropImport2PortType binding;
try {
binding = new test.wsdl.interop3.absimport2.step6.definitions.SoapInteropImport2PortTypeServiceLocator().getSoapInteropImport2Port();
}
catch (javax.xml.rpc.ServiceException jre) {
throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
}
assertTrue("binding is null", binding != null);
try {
test.wsdl.interop3.absimport2.step6.xsd.SOAPStruct value = null;
value = binding.echoStruct(new test.wsdl.interop3.absimport2.step6.xsd.SOAPStruct());
}
catch (java.rmi.RemoteException re) {
throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re);
}
}
*/
/* doesn't work yet
public void testAbsoluteStep8() {
SoapInteropImport2PortType binding;
try {
binding = new SoapInteropImport2PortTypeServiceLocator().getSoapInteropImport2Port(new java.net.URL("http://mssoapinterop.org/stkV3/wsdl/import2.wsdl"));
}
catch (Throwable t) {
throw new junit.framework.AssertionFailedError("Throwable caught: " + t);
}
assertTrue("binding is null", binding != null);
try {
SOAPStruct value = null;
value = binding.echoStruct(new SOAPStruct());
}
catch (java.rmi.RemoteException re) {
throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re);
}
}
*/
public static void main(String[] args) {
if (args.length == 1) {
try {
url = new URL(args[0]);
} catch (Exception e) {
}
}
junit.textui.TestRunner.run(new junit.framework.TestSuite(Import2TestCase.class));
} // main
}
|