KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > axis > wsi > scm > retailer > RetailerServiceTestCase


1 /**
2  * RetailerServiceTestCase.java
3  *
4  * This file was auto-generated from WSDL
5  * by the Apache Axis 1.2alpha Jan 15, 2004 (11:28:11 EST) WSDL2Java emitter.
6  */

7
8 package org.apache.axis.wsi.scm.retailer;
9
10 public class RetailerServiceTestCase extends junit.framework.TestCase {
11     public RetailerServiceTestCase(java.lang.String JavaDoc name) {
12         super(name);
13     }
14
15     /* FIXME: RUNTIME WSDL broken.
16     public void testRetailerPortWSDL() throws Exception {
17         javax.xml.rpc.ServiceFactory serviceFactory = javax.xml.rpc.ServiceFactory.newInstance();
18         java.net.URL url = new java.net.URL(new org.apache.axis.wsi.scm.retailer.RetailerServiceLocator().getRetailerPortAddress() + "?WSDL");
19         javax.xml.rpc.Service service = serviceFactory.createService(url, new org.apache.axis.wsi.scm.retailer.RetailerServiceLocator().getServiceName());
20         assertTrue(service != null);
21     }
22     */

23
24     public void test1RetailerPortGetCatalog() throws Exception JavaDoc {
25         org.apache.axis.wsi.scm.retailer.RetailerSoapBindingStub binding;
26         try {
27             binding = (org.apache.axis.wsi.scm.retailer.RetailerSoapBindingStub)
28                           new org.apache.axis.wsi.scm.retailer.RetailerServiceLocator().getRetailerPort();
29         }
30         catch (javax.xml.rpc.ServiceException JavaDoc jre) {
31             if(jre.getLinkedCause()!=null)
32                 jre.getLinkedCause().printStackTrace();
33             throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
34         }
35         assertNotNull("binding is null", binding);
36
37         // Time out after a minute
38
binding.setTimeout(60000);
39
40         // Test operation
41
org.apache.axis.wsi.scm.retailer.catalog.CatalogType catalog = null;
42         catalog = binding.getCatalog();
43         // TBD - validate results
44

45         assertNotNull("catalog is null", catalog);
46
47         org.apache.axis.wsi.scm.retailer.catalog.CatalogItem[] items = catalog.getItem();
48
49         assertTrue(items.length > 0);
50
51         for (int i = 0; i < items.length; i++) {
52             System.out.println("------------------");
53             System.out.println(items[i].getName());
54             System.out.println(items[i].getBrand());
55         }
56     }
57
58     public void test2RetailerPortSubmitOrder() throws Exception JavaDoc {
59         org.apache.axis.wsi.scm.retailer.RetailerSoapBindingStub binding;
60         try {
61             binding = (org.apache.axis.wsi.scm.retailer.RetailerSoapBindingStub)
62                           new org.apache.axis.wsi.scm.retailer.RetailerServiceLocator().getRetailerPort();
63         }
64         catch (javax.xml.rpc.ServiceException JavaDoc jre) {
65             if(jre.getLinkedCause()!=null)
66                 jre.getLinkedCause().printStackTrace();
67             throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
68         }
69         assertNotNull("binding is null", binding);
70
71         // Time out after a minute
72
binding.setTimeout(60000);
73
74         // Test operation
75
try {
76             org.apache.axis.wsi.scm.retailer.order.PartsOrderResponseType value = null;
77             value = binding.submitOrder(new org.apache.axis.wsi.scm.retailer.order.PartsOrderType(), new org.apache.axis.wsi.scm.retailer.order.CustomerDetailsType(), new org.apache.axis.wsi.scm.configuration.ConfigurationType());
78         }
79         catch (org.apache.axis.wsi.scm.retailer.order.InvalidProductCodeType e1) {
80             throw new junit.framework.AssertionFailedError("InvalidProductCode Exception caught: " + e1);
81         }
82         catch (org.apache.axis.wsi.scm.retailer.BadOrderFault e2) {
83             throw new junit.framework.AssertionFailedError("BadOrder Exception caught: " + e2);
84         }
85         catch (org.apache.axis.wsi.scm.configuration.ConfigurationFaultType e3) {
86             throw new junit.framework.AssertionFailedError("ConfigurationFault Exception caught: " + e3);
87         }
88             // TBD - validate results
89
}
90
91 }
92
Popular Tags