| 1 |
package test.wsdl.wrapperHolder2; |
| 2 |
|
| 3 |
import javax.xml.rpc.holders.ByteArrayHolder; |
| 4 |
import javax.xml.rpc.holders.LongWrapperHolder; |
| 5 |
|
| 6 |
public class ExampleSoapTestCase extends junit.framework.TestCase { |
| 7 |
public ExampleSoapTestCase(java.lang.String name) { |
| 8 |
super(name); |
| 9 |
} |
| 10 |
|
| 11 |
public void testWrapperHolder2WSDL() throws Exception { |
| 12 |
javax.xml.rpc.ServiceFactory serviceFactory = javax.xml.rpc.ServiceFactory.newInstance(); |
| 13 |
java.net.URL url = new java.net.URL(new test.wsdl.wrapperHolder2.DoExample_ServiceLocator().getWrapperHolder2Address() + "?WSDL"); |
| 14 |
javax.xml.rpc.Service service = serviceFactory.createService(url, new test.wsdl.wrapperHolder2.DoExample_ServiceLocator().getServiceName()); |
| 15 |
assertTrue(service != null); |
| 16 |
} |
| 17 |
|
| 18 |
public void test1WrapperHolder2DoExample() throws Exception { |
| 19 |
test.wsdl.wrapperHolder2.ExampleSoapStub binding; |
| 20 |
try { |
| 21 |
binding = (test.wsdl.wrapperHolder2.ExampleSoapStub) |
| 22 |
new test.wsdl.wrapperHolder2.DoExample_ServiceLocator().getWrapperHolder2(); |
| 23 |
} |
| 24 |
catch (javax.xml.rpc.ServiceException jre) { |
| 25 |
if(jre.getLinkedCause()!=null) |
| 26 |
jre.getLinkedCause().printStackTrace(); |
| 27 |
throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre); |
| 28 |
} |
| 29 |
assertNotNull("binding is null", binding); |
| 30 |
|
| 31 |
// Time out after a minute |
| 32 |
binding.setTimeout(60000); |
| 33 |
|
| 34 |
byte[][] in1 = new byte[][] { |
| 35 |
{ (byte) 0xbe, (byte) 0xef, (byte) 0xcc }, |
| 36 |
{ (byte) 0xee, (byte) 0xff, (byte) 0xaa }, |
| 37 |
}; |
| 38 |
Long in2 = new Long(3); |
| 39 |
holders.ByteArrayArrayHolder val1 = new holders.ByteArrayArrayHolder(); |
| 40 |
test.wsdl.wrapperHolder2.holders.OutArrayHolder val2 = new test.wsdl.wrapperHolder2.holders.OutArrayHolder(); |
| 41 |
holders.IntArrayWrapperHolder val3 = new holders.IntArrayWrapperHolder(); |
| 42 |
holders.IntArrayHolder val4 = new holders.IntArrayHolder(); |
| 43 |
holders.ByteArrayHolder val5 = new holders.ByteArrayHolder(); |
| 44 |
|
| 45 |
// Test operation |
| 46 |
binding.doExample(in1, in2, val1, val2, val3, val4, val5); |
| 47 |
|
| 48 |
assertEquals("Unexpected value for holders.ByteArrayArrayHolder", |
| 49 |
byteArrayAsList(in1[0]), byteArrayAsList(val1.value[0])); |
| 50 |
assertEquals("Unexpected value for test.wsdl.WrapperHolder.holders.OutArrayHolder", |
| 51 |
val2.value[0], 1); |
| 52 |
assertEquals("Unexpected value for holders.IntArrayWrapperHolder", |
| 53 |
val3.value[0].intValue(), 4); |
| 54 |
assertEquals("Unexpected value for holders.IntArrayHolder", |
| 55 |
val4.value[0], 6); |
| 56 |
assertEquals("Unexpected value for holders.ByteArrayHolder", |
| 57 |
val5.value[0], (byte)0x9); |
| 58 |
} |
| 59 |
|
| 60 |
private static java.util.List byteArrayAsList(final byte[] a) { |
| 61 |
return new java.util.AbstractList() { |
| 62 |
public Object get(int i) { |
| 63 |
return new Byte(a[i]); |
| 64 |
} |
| 65 |
public int size() { |
| 66 |
return a.length; |
| 67 |
} |
| 68 |
public Object set(int i, Object o) { |
| 69 |
byte oldVal = a[i]; |
| 70 |
a[i] = ((Byte) o).byteValue(); |
| 71 |
return new Byte(oldVal); |
| 72 |
} |
| 73 |
}; |
| 74 |
} |
| 75 |
} |