Debian Codegraph @

test/wsdl/jaxrpchandlereval/HandlerTracker.java

raw
1 package test.wsdl.jaxrpchandlereval;
2
3 import java.util.*;
4
5 public class HandlerTracker {
6 private static List clientHandlers;
7 private static List serverHandlers;
8
9 public static void init() {
10 clientHandlers = new ArrayList();
11 serverHandlers = new ArrayList();
12 }
13
14 public static void addClientHandler(String s) {
15 clientHandlers.add(s);
16 }
17
18 public static void addServerHandler(String s) {
19 serverHandlers.add(s);
20 }
21
22 public static void assertClientHandlerOrder(String[] arr) throws Exception {
23 assertHandlerOrder(clientHandlers, arr);
24 }
25
26 public static void assertServerHandlerOrder(String[] arr) throws Exception {
27 assertHandlerOrder(serverHandlers, arr);
28 }
29
30 public static void assertHandlerOrder(List handlers, String[] expected) throws Exception {
31 String[] actual = new String[handlers.size()];
32 handlers.toArray(actual);
33
34 System.out.print("excepted order:");
35 for (int i = 0; i < expected.length; i++) {
36 System.out.print(expected[i] + " ");
37 }
38 System.out.println("\n");
39
40 System.out.print("actual order:");
41 for (int i = 0; i < actual.length; i++) {
42 System.out.print(actual[i] + " ");
43 }
44 System.out.println("\n");
45
46 if (expected.length != actual.length) {
47 throw new Exception("Handler length not match");
48 }
49
50 System.out.println("\n");
51 for (int i = 0; i < expected.length; i++) {
52 if (!expected[i].equals(actual[i])) {
53 throw new Exception("Handler order not match : expected = " + expected[i] + ", actual = " + actual[i]);
54 }
55 }
56 return;
57 }
58
59 }