1 16 17 package test.wsdl.multiref; 18 19 import org.apache.axis.utils.Options; 20 import test.wsdl.multiref.holders.NodeHolder; 21 22 import java.net.URL ; 23 24 25 30 public class Main { 31 32 public static void main (String [] args) throws Exception { 33 Options opts = new Options(args); 34 35 MultiRefTestService service = new MultiRefTestServiceLocator(); 36 opts.setDefaultURL( service.getMultiRefTestAddress() ); 37 URL serviceURL = new URL (opts.getURL()); 38 if (serviceURL == null) 39 serviceURL = new URL (service.getMultiRefTestAddress()); 40 41 MultiRefTest remoteTest = service.getMultiRefTest(serviceURL); 42 43 Node t = new Node(); 46 t.setData(0); 47 Node l = new Node(); 48 l.setData(1); 49 Node r = new Node(); 50 r.setData(2); 51 t.setLeft(l); 52 t.setRight(r); 53 NodeHolder holder = new NodeHolder(t); 54 55 int rc = remoteTest.testSimpleTree(holder); 57 if (rc == 0) { 58 } else { 60 System.err.println("Failed testSimpleTree 1"); 61 throw new Exception ("Failed testSimpleTree 1 with "+rc); 62 } 63 rc = remoteTest.testSimpleTree(holder); 66 if (rc == 0) { 67 } else { 69 System.err.println("Failed testSimpleTree 2"); 70 throw new Exception ("Failed testSimpleTree 2 with "+rc); 71 } 72 73 t = new Node(); 76 t.setData(0); 77 l = new Node(); 78 l.setData(1); 79 r = new Node(); 80 r.setData(2); 81 t.setLeft(l); 82 t.setRight(r); 83 84 Node d = new Node(); 85 d.setData(3); 86 t.getLeft().setRight(d); 87 t.getRight().setLeft(d); 88 holder = new NodeHolder(t); 89 90 rc = remoteTest.testDiamond(holder); 92 if (rc == 0) { 93 } else { 95 System.err.println("Failed testDiamond 1"); 96 throw new Exception ("Failed testDiamond 1 with "+rc); 97 } 98 rc = remoteTest.testDiamond(holder); 101 if (rc == 0) { 102 } else { 104 System.err.println("Failed testDiamond 2"); 105 throw new Exception ("Failed testDiamond 2 with "+rc); 106 } 107 108 t = new Node(); 111 t.setData(0); 112 l = new Node(); 113 l.setData(1); 114 r = new Node(); 115 r.setData(2); 116 t.setLeft(l); 117 t.setRight(r); 118 119 l.setLeft(t); 120 l.setRight(t); 121 r.setLeft(t); 122 r.setRight(t); 123 124 holder = new NodeHolder(t); 125 126 rc = remoteTest.testLoop(holder); 128 if (rc == 0) { 129 } else { 131 System.err.println("Failed testLoop 1"); 132 throw new Exception ("Failed testLoop 1 with "+rc); 133 } 134 rc = remoteTest.testLoop(holder); 137 if (rc == 0) { 138 } else { 140 System.err.println("Failed testLoop 2"); 141 throw new Exception ("Failed testLoop 2 with "+rc); 142 } 143 144 t = new Node(); 149 t.setData(0); 150 l = new Node(); 151 l.setData(1); 152 r = new Node(); 153 r.setData(1); 154 t.setLeft(l); 155 t.setRight(r); 156 157 l.setLeft(t); 158 l.setRight(t); 159 r.setLeft(t); 160 r.setRight(t); 161 162 holder = new NodeHolder(t); 163 164 rc = remoteTest.testLoop(holder); 166 if (rc == 0) { 167 } else { 169 System.err.println("Failed testLoop 1B"); 170 throw new Exception ("Failed testLoop 1B with "+rc); 171 } 172 rc = remoteTest.testLoop(holder); 175 if (rc == 0) { 176 } else { 178 System.err.println("Failed testLoop 2B"); 179 throw new Exception ("Failed testLoop 2B with "+rc); 180 } 181 182 t = new Node(); 185 t.setData(0); 186 NodeHolder holder1 = new NodeHolder(t); 187 NodeHolder holder2 = new NodeHolder(t); 188 189 rc = remoteTest.testSameArgs(holder1, holder2); 191 if (rc == 0) { 192 } else { 194 System.err.println("Failed testSameArgs 1"); 195 throw new Exception ("Failed testSameArgs 1 with "+rc); 196 } 197 rc = remoteTest.testSameArgs(holder1,holder2); 200 if (rc == 0) { 201 } else { 203 System.err.println("Failed testSameArgs 2"); 204 throw new Exception ("Failed testSameArgs 2 with "+rc); 205 } 206 207 Node t1 = new Node(); 210 t1.setData(0); 211 Node t2 = new Node(); 212 t2.setData(1); 213 Node s = new Node(); 214 s.setData(1); 215 t1.setRight(s); 216 t2.setLeft(s); 217 holder1 = new NodeHolder(t1); 218 holder2 = new NodeHolder(t2); 219 220 rc = remoteTest.testArgsRefSameNode(holder1, holder2); 222 if (rc == 0) { 223 } else { 225 System.err.println("Failed testArgsRefSameNode 1"); 226 throw new Exception ("Failed testArgsRefSameNode 1 with "+rc); 227 } 228 rc = remoteTest.testArgsRefSameNode(holder1,holder2); 231 if (rc == 0) { 232 } else { 234 System.err.println("Failed testArgsRefSameNode 2"); 235 throw new Exception ("Failed testArgsRefSameNode 2 with "+rc); 236 } 237 t1 = new Node(); 240 t1.setData(0); 241 t2 = new Node(); 242 t2.setData(1); 243 t2.setLeft(t1); 244 t2.setRight(t1); 245 t1.setRight(t2); 246 t1.setLeft(t2); 247 holder1 = new NodeHolder(t1); 248 holder2 = new NodeHolder(t2); 249 250 rc = remoteTest.testArgsRefEachOther(holder1, holder2); 252 if (rc == 0) { 253 } else { 255 System.err.println("Failed testArgsRefEachOther 1"); 256 throw new Exception ("Failed testArgsRefEachOther 1 with "+rc); 257 } 258 rc = remoteTest.testArgsRefEachOther(holder1,holder2); 261 if (rc == 0) { 262 } else { 264 System.err.println("Failed testArgsRefEachOther 2"); 265 throw new Exception ("Failed testArgsRefEachOther 2 with "+rc); 266 } 267 268 t = new Node(); 271 t.setData(0); 272 t.setLeft(t); 273 t.setRight(t); 274 holder = new NodeHolder(t); 275 276 rc = remoteTest.testSelfRef(holder); 278 if (rc == 0) { 279 } else { 281 System.err.println("Failed testSelfRef 1"); 282 throw new Exception ("Failed testSelfRef 1 with "+rc); 283 } 284 rc = remoteTest.testSelfRef(holder); 287 if (rc == 0) { 288 } else { 290 System.err.println("Failed testSelfRef 2"); 291 throw new Exception ("Failed testSelfRef 2 with "+rc); 292 } 293 294 return; 295 } 296 } 297 298 | Popular Tags |