1 7 8 package test.wsdl.adaptive; 9 10 import java.util.Arrays ; 11 12 public class AdaptiveServiceTestCase extends junit.framework.TestCase { 13 public AdaptiveServiceTestCase(java.lang.String name) { 14 super(name); 15 } 16 17 public void testAdaptiveWSDL() throws Exception { 18 javax.xml.rpc.ServiceFactory serviceFactory = javax.xml.rpc.ServiceFactory.newInstance(); 19 java.net.URL url = new java.net.URL (new test.wsdl.adaptive.AdaptiveServiceLocator().getAdaptiveAddress() + "?WSDL"); 20 javax.xml.rpc.Service service = serviceFactory.createService(url, new test.wsdl.adaptive.AdaptiveServiceLocator().getServiceName()); 21 assertTrue(service != null); 22 } 23 24 public void test1AdaptiveGetServiceDescription() throws Exception { 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 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 binding.setTimeout(60000); 39 40 java.lang.String value = null; 42 value = binding.getServiceDescription(); 43 } 45 46 public void test2AdaptiveRankResources() throws Exception { 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 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 binding.setTimeout(60000); 61 62 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 assertTrue(value.length > 0); 67 assertEquals(value[0].getId(), "Adaptive #1"); 68 java.lang.Object [] collection = value[0].getProperties().getCollection(); 69 assertTrue(collection.length > 0); 70 assertTrue(Arrays.equals(collection, new String []{"A","B","C"})); 71 } 72 73 public void test3AdaptiveEstimateTransferTime() throws Exception { 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 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 binding.setTimeout(60000); 88 89 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 } 94 95 public void test4AdaptiveLogDataTransfer() throws Exception { 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 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 binding.setTimeout(60000); 110 111 binding.logDataTransfer(new test.wsdl.adaptive.types.ResourceInfo(), new test.wsdl.adaptive.types.ResourceInfo(), 0, java.util.Calendar.getInstance(), java.util.Calendar.getInstance()); 113 } 115 116 public void test5AdaptiveEstimateUsage() throws Exception { 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 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 binding.setTimeout(60000); 131 132 java.lang.String value = null; 134 value = binding.estimateUsage(true, new test.wsdl.adaptive.types.ResourceInfo(), new java.lang.String (), 0, java.util.Calendar.getInstance(), java.util.Calendar.getInstance()); 135 } 137 138 public void test6AdaptiveEstimateMultipleUsage() throws Exception { 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 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 binding.setTimeout(60000); 153 154 java.lang.String [][] value = null; 156 value = binding.estimateMultipleUsage(true, new test.wsdl.adaptive.types.ResourceInfo[0], new java.lang.String [0], 0, java.util.Calendar.getInstance(), java.util.Calendar.getInstance()); 157 } 159 160 public void test7AdaptiveEstimateNetworkGraph() throws Exception { 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 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 binding.setTimeout(60000); 175 176 java.lang.String [][] value = null; 178 value = binding.estimateNetworkGraph(true, new test.wsdl.adaptive.types.ResourceInfo[0], 0, java.util.Calendar.getInstance(), java.util.Calendar.getInstance()); 179 } 181 182 } 183 | Popular Tags |