1 16 package test; 17 18 import junit.framework.TestCase; 19 import org.apache.axis.client.Call; 20 import org.apache.axis.client.Service; 21 import org.apache.axis.configuration.BasicServerConfig; 22 import org.apache.axis.configuration.SimpleProvider; 23 import org.apache.axis.constants.Style; 24 import org.apache.axis.constants.Use; 25 import org.apache.axis.handlers.soap.SOAPService; 26 import org.apache.axis.providers.java.RPCProvider; 27 import org.apache.axis.server.AxisServer; 28 import org.apache.axis.transport.local.LocalTransport; 29 import org.apache.axis.Handler; 30 31 47 public class GenericLocalTest extends TestCase { 48 protected AxisServer server; 49 protected SimpleProvider config; 50 protected LocalTransport transport; 51 protected SOAPService service = null; 52 53 public GenericLocalTest(String s) { 54 super(s); 55 } 56 57 63 protected void setUp() throws Exception { 64 setUp(true); 65 } 66 67 73 protected void setUp(boolean deploy) throws Exception { 74 super.setUp(); 75 config = new BasicServerConfig(); 76 server = new AxisServer(config); 77 transport = new LocalTransport(server); 78 79 if (deploy) 80 deploy(); 81 } 82 83 88 public Call getCall() { 89 Call call = new Call(new Service()); 90 call.setTransport(transport); 91 return call; 92 } 93 94 97 public void deploy() { 98 deploy("service", this.getClass(), Style.RPC); 99 } 100 101 112 public void deploy(String serviceName, Class target, Style style) { 113 String className = target.getName(); 114 115 service = new SOAPService(new RPCProvider()); 116 service.setStyle(style); 117 118 service.setOption("className", className); 119 service.setOption("allowedMethods", "*"); 120 121 config.deployService(serviceName, service); 122 transport.setRemoteService(serviceName); 123 } 124 125 public void deploy(String serviceName, Class target, Style style, Use use) { 126 String className = target.getName(); 127 128 service = new SOAPService(new RPCProvider()); 129 service.setStyle(style); 130 service.setUse(use); 131 132 service.setOption("className", className); 133 service.setOption("allowedMethods", "*"); 134 135 config.deployService(serviceName, service); 136 transport.setRemoteService(serviceName); 137 } 138 145 public void deploy(String serviceName, Handler handler) { 146 service = new SOAPService(handler); 147 148 config.deployService(serviceName, service); 149 transport.setRemoteService(serviceName); 150 } 151 } | Popular Tags |