FileDocCategorySizeDatePackage
JAXRPCHandlerTestCase.javaAPI DocApache Axis 1.44680Sat Apr 22 18:57:26 BST 2006test.wsdl.jaxrpchandler

JAXRPCHandlerTestCase

public class JAXRPCHandlerTestCase extends TestCase

Fields Summary
private static boolean
_roundtrip
private static int
_faultRoundtrip
Constructors Summary
public JAXRPCHandlerTestCase()
Default constructor for use as service

		super("JAXRPCHandlerTest");
	
public JAXRPCHandlerTestCase(String name)

		super(name);
	
Methods Summary
public static voidcompleteRoundtrip()


	    
		_roundtrip = true;
	
public voiddoTestClientUndeploy()

		String[] args1 = { "client", "test/wsdl/jaxrpchandler/undeploy.wsdd"};
		Admin.main(args1);
	
public voiddoTestDeploy()

		String[] args = { "test/wsdl/jaxrpchandler/server_deploy.wsdd"};
		AdminClient.main(args);
		String[] args1 = { "client", "test/wsdl/jaxrpchandler/client_deploy.wsdd"};
		Admin.main(args1);
	
public voiddoTestServerUndeploy()

		String[] args = { "test/wsdl/jaxrpchandler/undeploy.wsdd"};
		AdminClient.main(args);
	
public floatgetQuote(java.net.URL url, boolean runJAXRPCHandler)

		StockQuoteService  service = new StockQuoteServiceLocator();
		if (runJAXRPCHandler) {
			HandlerRegistry hr = service.getHandlerRegistry();
			java.util.List lhi = new java.util.Vector();
			test.wsdl.jaxrpchandler.ClientHandler mh = new test.wsdl.jaxrpchandler.ClientHandler();
			Class myhandler = mh.getClass();
			HandlerInfo hi = new HandlerInfo(myhandler,null,null);
			lhi.add(hi);
			hr.setHandlerChain(new QName("","jaxrpchandler"),lhi);
		}

		float res;

		StockQuote sq = service.getjaxrpchandler(url);
		res = sq.getQuote("XXX");

		return res;
	
public floatgetQuoteFail(java.net.URL url, boolean runJAXRPCHandler)

		StockQuoteService  service = new StockQuoteServiceLocator();
		if (runJAXRPCHandler) {
			HandlerRegistry hr = service.getHandlerRegistry();
			java.util.List lhi = new java.util.Vector();
			test.wsdl.jaxrpchandler.ClientHandler mh = new test.wsdl.jaxrpchandler.ClientHandler();
			Class myhandler = mh.getClass();
			HandlerInfo hi = new HandlerInfo(myhandler,null,null);
			lhi.add(hi);
			hr.setHandlerChain(new QName("","jaxrpchandler"),lhi);
		}

		float res;

		StockQuote sq = service.getjaxrpchandler(url);
		res = sq.getQuote("fail");

		return res;
	
public voidgoFail(java.lang.String[] args)

		Options opts = new Options( args );
		args = opts.getRemainingArgs();

		URL url = new URL(opts.getURL());
		String user = opts.getUser();
		String passwd = opts.getPassword();
		System.out.println("Fail URL is " + url);

		_faultRoundtrip = 0;
		doTestDeploy();
		try {
			float val = getQuoteFail(url, true);
		} catch (Exception e) {
			// catch and ignore the exception
		}

		assertTrue("Expected setting for config-based handlers should be 3"
			  + " (1 Request Client Handler increment, passed in header to Server Handler "
			  + " 1 Fault Server Handler increment, passed back in header to Response Client Handler "
			  + " 1 Response Client Handler increment)",
			  _faultRoundtrip == 3);

		doTestClientUndeploy();
		doTestServerUndeploy();

	
public voidgoStockQuote(java.lang.String[] args)

		Options opts = new Options( args );
		args = opts.getRemainingArgs();

		URL url = new URL(opts.getURL());
		String user = opts.getUser();
		String passwd = opts.getPassword();
		System.out.println("URL is " + url);

		_roundtrip = false;
		doTestDeploy();
		float val = getQuote(url,false);
		assertEquals("Stock price is not the expected 55.25 +/- 0.01", val, 55.25, 0.01);
		assertTrue("Expected setting for config-based handlers should be true", _roundtrip == true);
		doTestClientUndeploy();
		_roundtrip = false;
		val = getQuote(url,true);
		assertEquals("Stock price is not the expected 55.25 +/- 0.01", val, 55.25, 0.01);
		assertTrue("Expected setting for programmatic-based handlers should be true", _roundtrip == true);
		doTestServerUndeploy();

	
public static voidmain(java.lang.String[] args)

		JAXRPCHandlerTestCase test = new JAXRPCHandlerTestCase("test");
		test.goStockQuote(args);
		test.goFail(args);
	
public static voidsetFaultRoundtrip(int faultCount)

		_faultRoundtrip = faultCount;
	
public voidtestHandleFail()

	    String[] args = {};
	    goFail(args);
	
public voidtestStockQuote()

	    String[] args = {};
	    goStockQuote(args);