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 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200
|
/**
* DataTypesTestCase.java
*
* This file was auto-generated from WSDL
* by the Apache Axis Wsdl2java emitter.
*/
package test.wsdl.datatypes;
import javax.xml.namespace.QName;
public class DataTypesTestCase extends junit.framework.TestCase {
public DataTypesTestCase(String name) {
super(name);
}
public void test1DataTypesSoapSayHello() {
DataTypes_PortType binding;
try {
binding = new DataTypes_ServiceLocator().getDataTypes();
}
catch (javax.xml.rpc.ServiceException jre) {
throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
}
assertTrue("binding is null", binding != null);
try {
java.lang.String value = null;
value = binding.sayHello();
assertTrue("sayHello should be \"Hello World!\", but instead is " + value, "Hello World!".equals(value));
}
catch (java.rmi.RemoteException re) {
throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re);
}
}
public void test2DataTypesSoapSayHelloName() {
DataTypes_PortType binding;
try {
binding = new DataTypes_ServiceLocator().getDataTypes();
}
catch (javax.xml.rpc.ServiceException jre) {
throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
}
assertTrue("binding is null", binding != null);
try {
java.lang.String value = null;
value = binding.sayHelloName(new java.lang.String("Axis"));
assertTrue("sayHelloName should be \"Hello Axis\", but instead is " + value, "Hello Axis".equals(value));
}
catch (java.rmi.RemoteException re) {
throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re);
}
}
public void test3DataTypesSoapGetIntArray() {
DataTypes_PortType binding;
try {
binding = new DataTypes_ServiceLocator().getDataTypes();
}
catch (javax.xml.rpc.ServiceException jre) {
throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
}
assertTrue("binding is null", binding != null);
try {
ArrayOfInt value = null;
value = binding.getIntArray();
int[] array = value.get_int();
assertTrue("getIntArray size should be 5, instead is " + array.length, array.length == 5);
for(int i=0;i<array.length;i++) {
assertTrue("getIntArray[" + i + "] should be " + (i * 10) + ", instead is " + array[i], array[i] == i * 10);
}
}
catch (java.rmi.RemoteException re) {
throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re);
}
}
public void test4DataTypesSoapGetMode() {
DataTypes_PortType binding;
try {
binding = new DataTypes_ServiceLocator().getDataTypes();
}
catch (javax.xml.rpc.ServiceException jre) {
throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
}
assertTrue("binding is null", binding != null);
try {
Mode value = null;
value = binding.getMode();
assertTrue("getMode should be Off, instead it is " + value.toString(), "Off".equals(value.toString()));
}
catch (java.rmi.RemoteException re) {
throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re);
}
}
public void test5DataTypesSoapGetOrder() {
DataTypes_PortType binding;
try {
binding = new DataTypes_ServiceLocator().getDataTypes();
}
catch (javax.xml.rpc.ServiceException jre) {
throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
}
assertTrue("binding is null", binding != null);
try {
Order value = null;
value = binding.getOrder();
assertTrue("getOrder.getOrderID should be 323232, instead it is " + value.getOrderID(), value.getOrderID() == 323232);
assertTrue("getOrder.getPrice should be 34.5, instead it is " + value.getPrice(), value.getPrice() == 34.5);
}
catch (java.rmi.RemoteException re) {
throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re);
}
}
public void test6DataTypesSoapGetOrders() {
DataTypes_PortType binding;
try {
binding = new DataTypes_ServiceLocator().getDataTypes();
}
catch (javax.xml.rpc.ServiceException jre) {
throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
}
assertTrue("binding is null", binding != null);
try {
ArrayOfOrder value = null;
value = binding.getOrders();
Order[] orders = value.getOrder();
assertTrue("getOrders size should be 2, instead is " + orders.length, orders.length == 2);
for(int i=0;i<orders.length;i++) {
if (i == 0) {
assertTrue("getOrders[0].getOrderID should be 323232, instead it is " + orders[i].getOrderID(), orders[i].getOrderID() == 323232);
assertTrue("getOrders[0].getPrice should be 34.5, instead it is " + orders[i].getPrice(), orders[i].getPrice() == 34.5);
}
else if (i == 1) {
assertTrue("getOrders[1].getOrderID should be 645645, instead it is " + orders[i].getOrderID(), orders[i].getOrderID() == 645645);
assertTrue("getOrders[1].getPrice should be 99.4, instead it is " + orders[i].getPrice(), orders[i].getPrice() == 99.4);
}
}
}
catch (java.rmi.RemoteException re) {
throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re);
}
}
public void test7DataTypesSoapGetSimpleList() {
DataTypes_PortType binding;
try {
binding = new DataTypes_ServiceLocator().getDataTypes();
}
catch (javax.xml.rpc.ServiceException jre) {
throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
}
assertTrue("binding is null", binding != null);
try {
java.lang.String[] inputList = new java.lang.String[3];
inputList[0] = "one";
inputList[1] = "two";
inputList[2] = "three";
java.lang.String[] outputList = binding.getSimpleList(inputList);
assertTrue("outputList[0] should be \"one_response\", but instead is " + outputList[0],
"one_response".equals(outputList[0]));
assertTrue("outputList[1] should be \"two_response\", but instead is " + outputList[1],
"two_response".equals(outputList[1]));
assertTrue("outputList[2] should be \"three_response\", but instead is " + outputList[2],
"three_response".equals(outputList[2]));
}
catch (java.rmi.RemoteException re) {
throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re);
}
}
public void test5DataTypesGetUsageType() throws Exception {
DataTypes_PortType binding;
try {
binding = new DataTypes_ServiceLocator().getDataTypes();
}
catch (javax.xml.rpc.ServiceException jre) {
if(jre.getLinkedCause()!=null)
jre.getLinkedCause().printStackTrace();
throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
}
assertNotNull("binding is null", binding);
// Test operation
UsageType value = null;
value = binding.getUsageType();
System.out.println(value);
assertEquals(value.getValue(), new QName("http://schemas.xmlsoap.org/ws/2002/12/policy","Required"));
// TBD - validate results
}
}
|