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
|
/**
* PolymorphismTest_ServiceTestCase.java
*
* This file was auto-generated from WSDL
* by the Apache Axis WSDL2Java emitter.
*/
package test.wsdl.polymorphism;
public class PolymorphismTest_ServiceTestCase extends junit.framework.TestCase {
public PolymorphismTest_ServiceTestCase(String name) {
super(name);
}
public void testPolymorphismTestWSDL() throws Exception {
javax.xml.rpc.ServiceFactory serviceFactory = javax.xml.rpc.ServiceFactory.newInstance();
java.net.URL url = new java.net.URL(new test.wsdl.polymorphism.PolymorphismTest_ServiceLocator().getPolymorphismTestAddress() + "?WSDL");
javax.xml.rpc.Service service = serviceFactory.createService(url, new test.wsdl.polymorphism.PolymorphismTest_ServiceLocator().getServiceName());
assertTrue(service != null);
}
public void test1PolymorphismTestGetBAsA() {
test.wsdl.polymorphism.PolymorphismTest_PortType binding;
try {
binding = new test.wsdl.polymorphism.PolymorphismTest_ServiceLocator().getPolymorphismTest();
}
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.polymorphism.A value = null;
// Passing false here gets us a "B"
value = binding.getBAsA(false);
// Check out the return value for correctness.
assertTrue("Return value wasn't a 'B'!", value instanceof B);
B myB = (B)value;
assertEquals("B field didn't match",
PolymorphismTestSoapImpl.B_TEXT,
myB.getB());
assertEquals("A field didn't match",
PolymorphismTestSoapImpl.A_TEXT,
myB.getA());
}
catch (java.rmi.RemoteException re) {
throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re);
}
}
public void test1PolymorphismTestGetCAsA() {
test.wsdl.polymorphism.PolymorphismTest_PortType binding;
try {
binding = new test.wsdl.polymorphism.PolymorphismTest_ServiceLocator().getPolymorphismTest();
}
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.polymorphism.A value = null;
// Passing true here gets us a "C" on the server side, but since
// there's no type mapping for that we should just get the "A"
// part.
value = binding.getBAsA(true);
// Check out the return value for correctness.
assertTrue("Return value wasn't an 'A'!", value instanceof A);
assertEquals("A field didn't match",
PolymorphismTestSoapImpl.A_TEXT,
value.getA());
}
catch (java.rmi.RemoteException re) {
throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re);
}
}
}
|