KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > wsdl > adaptive > AdaptiveServiceTestCase


1 /**
2  * AdaptiveServiceTestCase.java
3  *
4  * This file was auto-generated from WSDL
5  * by the Apache Axis WSDL2Java emitter.
6  */

7
8 package test.wsdl.adaptive;
9
10 import java.util.Arrays JavaDoc;
11
12 public class AdaptiveServiceTestCase extends junit.framework.TestCase {
13     public AdaptiveServiceTestCase(java.lang.String JavaDoc name) {
14         super(name);
15     }
16
17     public void testAdaptiveWSDL() throws Exception JavaDoc {
18         javax.xml.rpc.ServiceFactory JavaDoc serviceFactory = javax.xml.rpc.ServiceFactory.newInstance();
19         java.net.URL JavaDoc url = new java.net.URL JavaDoc(new test.wsdl.adaptive.AdaptiveServiceLocator().getAdaptiveAddress() + "?WSDL");
20         javax.xml.rpc.Service JavaDoc service = serviceFactory.createService(url, new test.wsdl.adaptive.AdaptiveServiceLocator().getServiceName());
21         assertTrue(service != null);
22     }
23
24     public void test1AdaptiveGetServiceDescription() throws Exception JavaDoc {
25         test.wsdl.adaptive.AdaptiveInterfaceBindingStub binding;
26         try {
27             binding = (test.wsdl.adaptive.AdaptiveInterfaceBindingStub)
28                           new test.wsdl.adaptive.AdaptiveServiceLocator().getAdaptive();
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
java.lang.String JavaDoc value = null;
42         value = binding.getServiceDescription();
43         // TBD - validate results
44
}
45
46     public void test2AdaptiveRankResources() throws Exception JavaDoc {
47         test.wsdl.adaptive.AdaptiveInterfaceBindingStub binding;
48         try {
49             binding = (test.wsdl.adaptive.AdaptiveInterfaceBindingStub)
50                           new test.wsdl.adaptive.AdaptiveServiceLocator().getAdaptive();
51         }
52         catch (javax.xml.rpc.ServiceException JavaDoc jre) {
53             if(jre.getLinkedCause()!=null)
54                 jre.getLinkedCause().printStackTrace();
55             throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
56         }
57         assertNotNull("binding is null", binding);
58
59         // Time out after a minute
60
binding.setTimeout(60000);
61
62         // Test operation
63
test.wsdl.adaptive.types.ResourceInfo[] value = null;
64         value = binding.rankResources(new test.wsdl.adaptive.types.ResourceInfo[0], new test.wsdl.adaptive.types.ApplicationInfo());
65         // TBD - validate results
66
assertTrue(value.length > 0);
67         assertEquals(value[0].getId(), "Adaptive #1");
68         java.lang.Object JavaDoc[] collection = value[0].getProperties().getCollection();
69         assertTrue(collection.length > 0);
70         assertTrue(Arrays.equals(collection, new String JavaDoc[]{"A","B","C"}));
71     }
72
73     public void test3AdaptiveEstimateTransferTime() throws Exception JavaDoc {
74         test.wsdl.adaptive.AdaptiveInterfaceBindingStub binding;
75         try {
76             binding = (test.wsdl.adaptive.AdaptiveInterfaceBindingStub)
77                           new test.wsdl.adaptive.AdaptiveServiceLocator().getAdaptive();
78         }
79         catch (javax.xml.rpc.ServiceException JavaDoc jre) {
80             if(jre.getLinkedCause()!=null)
81                 jre.getLinkedCause().printStackTrace();
82             throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
83         }
84         assertNotNull("binding is null", binding);
85
86         // Time out after a minute
87
binding.setTimeout(60000);
88
89         // Test operation
90
int[] value = null;
91         value = binding.estimateTransferTime(true, new test.wsdl.adaptive.types.ResourceInfo(), new test.wsdl.adaptive.types.ResourceInfo[0], 0, java.util.Calendar.getInstance());
92         // TBD - validate results
93
}
94
95     public void test4AdaptiveLogDataTransfer() throws Exception JavaDoc {
96         test.wsdl.adaptive.AdaptiveInterfaceBindingStub binding;
97         try {
98             binding = (test.wsdl.adaptive.AdaptiveInterfaceBindingStub)
99                           new test.wsdl.adaptive.AdaptiveServiceLocator().getAdaptive();
100         }
101         catch (javax.xml.rpc.ServiceException JavaDoc jre) {
102             if(jre.getLinkedCause()!=null)
103                 jre.getLinkedCause().printStackTrace();
104             throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
105         }
106         assertNotNull("binding is null", binding);
107
108         // Time out after a minute
109
binding.setTimeout(60000);
110
111         // Test operation
112
binding.logDataTransfer(new test.wsdl.adaptive.types.ResourceInfo(), new test.wsdl.adaptive.types.ResourceInfo(), 0, java.util.Calendar.getInstance(), java.util.Calendar.getInstance());
113         // TBD - validate results
114
}
115
116     public void test5AdaptiveEstimateUsage() throws Exception JavaDoc {
117         test.wsdl.adaptive.AdaptiveInterfaceBindingStub binding;
118         try {
119             binding = (test.wsdl.adaptive.AdaptiveInterfaceBindingStub)
120                           new test.wsdl.adaptive.AdaptiveServiceLocator().getAdaptive();
121         }
122         catch (javax.xml.rpc.ServiceException JavaDoc jre) {
123             if(jre.getLinkedCause()!=null)
124                 jre.getLinkedCause().printStackTrace();
125             throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
126         }
127         assertNotNull("binding is null", binding);
128
129         // Time out after a minute
130
binding.setTimeout(60000);
131
132         // Test operation
133
java.lang.String JavaDoc value = null;
134         value = binding.estimateUsage(true, new test.wsdl.adaptive.types.ResourceInfo(), new java.lang.String JavaDoc(), 0, java.util.Calendar.getInstance(), java.util.Calendar.getInstance());
135         // TBD - validate results
136
}
137
138     public void test6AdaptiveEstimateMultipleUsage() throws Exception JavaDoc {
139         test.wsdl.adaptive.AdaptiveInterfaceBindingStub binding;
140         try {
141             binding = (test.wsdl.adaptive.AdaptiveInterfaceBindingStub)
142                           new test.wsdl.adaptive.AdaptiveServiceLocator().getAdaptive();
143         }
144         catch (javax.xml.rpc.ServiceException JavaDoc jre) {
145             if(jre.getLinkedCause()!=null)
146                 jre.getLinkedCause().printStackTrace();
147             throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
148         }
149         assertNotNull("binding is null", binding);
150
151         // Time out after a minute
152
binding.setTimeout(60000);
153
154         // Test operation
155
java.lang.String JavaDoc[][] value = null;
156         value = binding.estimateMultipleUsage(true, new test.wsdl.adaptive.types.ResourceInfo[0], new java.lang.String JavaDoc[0], 0, java.util.Calendar.getInstance(), java.util.Calendar.getInstance());
157         // TBD - validate results
158
}
159
160     public void test7AdaptiveEstimateNetworkGraph() throws Exception JavaDoc {
161         test.wsdl.adaptive.AdaptiveInterfaceBindingStub binding;
162         try {
163             binding = (test.wsdl.adaptive.AdaptiveInterfaceBindingStub)
164                           new test.wsdl.adaptive.AdaptiveServiceLocator().getAdaptive();
165         }
166         catch (javax.xml.rpc.ServiceException JavaDoc jre) {
167             if(jre.getLinkedCause()!=null)
168                 jre.getLinkedCause().printStackTrace();
169             throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
170         }
171         assertNotNull("binding is null", binding);
172
173         // Time out after a minute
174
binding.setTimeout(60000);
175
176         // Test operation
177
java.lang.String JavaDoc[][] value = null;
178         value = binding.estimateNetworkGraph(true, new test.wsdl.adaptive.types.ResourceInfo[0], 0, java.util.Calendar.getInstance(), java.util.Calendar.getInstance());
179         // TBD - validate results
180
}
181
182 }
183
Popular Tags