handlertracker.java
来自「Java有关XML编程需要用到axis 的源代码 把里面bin下的包导入相应」· Java 代码 · 共 60 行
JAVA
60 行
package test.wsdl.jaxrpchandlereval;import java.util.*;public class HandlerTracker { private static List clientHandlers; private static List serverHandlers; public static void init() { clientHandlers = new ArrayList(); serverHandlers = new ArrayList(); } public static void addClientHandler(String s) { clientHandlers.add(s); } public static void addServerHandler(String s) { serverHandlers.add(s); } public static void assertClientHandlerOrder(String[] arr) throws Exception { assertHandlerOrder(clientHandlers, arr); } public static void assertServerHandlerOrder(String[] arr) throws Exception { assertHandlerOrder(serverHandlers, arr); } public static void assertHandlerOrder(List handlers, String[] expected) throws Exception { String[] actual = new String[handlers.size()]; handlers.toArray(actual); System.out.print("excepted order:"); for (int i = 0; i < expected.length; i++) { System.out.print(expected[i] + " "); } System.out.println("\n"); System.out.print("actual order:"); for (int i = 0; i < actual.length; i++) { System.out.print(actual[i] + " "); } System.out.println("\n"); if (expected.length != actual.length) { throw new Exception("Handler length not match"); } System.out.println("\n"); for (int i = 0; i < expected.length; i++) { if (!expected[i].equals(actual[i])) { throw new Exception("Handler order not match : expected = " + expected[i] + ", actual = " + actual[i]); } } return; }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?