01: /**
02: * RetailerServiceTestCase.java
03: *
04: * This file was auto-generated from WSDL
05: * by the Apache Axis 1.2alpha Jan 15, 2004 (11:28:11 EST) WSDL2Java emitter.
06: */package org.apache.axis.wsi.scm.retailer;
07:
08: public class RetailerServiceTestCase extends junit.framework.TestCase {
09: public RetailerServiceTestCase(java.lang.String name) {
10: super (name);
11: }
12:
13: /* FIXME: RUNTIME WSDL broken.
14: public void testRetailerPortWSDL() throws Exception {
15: javax.xml.rpc.ServiceFactory serviceFactory = javax.xml.rpc.ServiceFactory.newInstance();
16: java.net.URL url = new java.net.URL(new org.apache.axis.wsi.scm.retailer.RetailerServiceLocator().getRetailerPortAddress() + "?WSDL");
17: javax.xml.rpc.Service service = serviceFactory.createService(url, new org.apache.axis.wsi.scm.retailer.RetailerServiceLocator().getServiceName());
18: assertTrue(service != null);
19: }
20: */
21:
22: public void test1RetailerPortGetCatalog() throws Exception {
23: org.apache.axis.wsi.scm.retailer.RetailerSoapBindingStub binding;
24: try {
25: binding = (org.apache.axis.wsi.scm.retailer.RetailerSoapBindingStub) new org.apache.axis.wsi.scm.retailer.RetailerServiceLocator()
26: .getRetailerPort();
27: } catch (javax.xml.rpc.ServiceException jre) {
28: if (jre.getLinkedCause() != null)
29: jre.getLinkedCause().printStackTrace();
30: throw new junit.framework.AssertionFailedError(
31: "JAX-RPC ServiceException caught: " + jre);
32: }
33: assertNotNull("binding is null", binding);
34:
35: // Time out after a minute
36: binding.setTimeout(60000);
37:
38: // Test operation
39: org.apache.axis.wsi.scm.retailer.catalog.CatalogType catalog = null;
40: catalog = binding.getCatalog();
41: // TBD - validate results
42:
43: assertNotNull("catalog is null", catalog);
44:
45: org.apache.axis.wsi.scm.retailer.catalog.CatalogItem[] items = catalog
46: .getItem();
47:
48: assertTrue(items.length > 0);
49:
50: for (int i = 0; i < items.length; i++) {
51: System.out.println("------------------");
52: System.out.println(items[i].getName());
53: System.out.println(items[i].getBrand());
54: }
55: }
56:
57: public void test2RetailerPortSubmitOrder() throws Exception {
58: org.apache.axis.wsi.scm.retailer.RetailerSoapBindingStub binding;
59: try {
60: binding = (org.apache.axis.wsi.scm.retailer.RetailerSoapBindingStub) new org.apache.axis.wsi.scm.retailer.RetailerServiceLocator()
61: .getRetailerPort();
62: } catch (javax.xml.rpc.ServiceException jre) {
63: if (jre.getLinkedCause() != null)
64: jre.getLinkedCause().printStackTrace();
65: throw new junit.framework.AssertionFailedError(
66: "JAX-RPC ServiceException caught: " + jre);
67: }
68: assertNotNull("binding is null", binding);
69:
70: // Time out after a minute
71: binding.setTimeout(60000);
72:
73: // Test operation
74: try {
75: org.apache.axis.wsi.scm.retailer.order.PartsOrderResponseType value = null;
76: value = binding
77: .submitOrder(
78: new org.apache.axis.wsi.scm.retailer.order.PartsOrderType(),
79: new org.apache.axis.wsi.scm.retailer.order.CustomerDetailsType(),
80: new org.apache.axis.wsi.scm.configuration.ConfigurationType());
81: } catch (org.apache.axis.wsi.scm.retailer.order.InvalidProductCodeType e1) {
82: throw new junit.framework.AssertionFailedError(
83: "InvalidProductCode Exception caught: " + e1);
84: } catch (org.apache.axis.wsi.scm.retailer.BadOrderFault e2) {
85: throw new junit.framework.AssertionFailedError(
86: "BadOrder Exception caught: " + e2);
87: } catch (org.apache.axis.wsi.scm.configuration.ConfigurationFaultType e3) {
88: throw new junit.framework.AssertionFailedError(
89: "ConfigurationFault Exception caught: " + e3);
90: }
91: // TBD - validate results
92: }
93:
94: }
|