/** * Tests starting a proxy service without proving an axis configuration. The proxy service should not start by this. */ public void testStartWithoutAxisConfiguration() { SynapseConfiguration synCfg = new SynapseConfiguration(); synCfg.setAxisConfiguration(null); ProxyService proxyService = new ProxyService("TestStartWithoutAxisConfigurationProxy"); proxyService.start(synCfg); Assert.assertFalse("Proxy service is running without axis configuration", proxyService.isRunning()); proxyService.stop(synCfg); }
/** * Tests starting a proxy service with correct axis configuration provided. * * @throws Exception if an exception occurs while configuring the axis configuration */ public void testStart() throws Exception { String proxyServiceName = "TestStartProxy"; SynapseConfiguration synCfg = new SynapseConfiguration(); AxisConfiguration axisCfg = new AxisConfiguration(); SynapseEnvironment synEnv = new Axis2SynapseEnvironment(new ConfigurationContext(axisCfg), synCfg); axisCfg.addParameter(SynapseConstants.SYNAPSE_ENV, synEnv); synCfg.setAxisConfiguration(axisCfg); ProxyService proxyService = new ProxyService(proxyServiceName); AxisService axisServiceForActivation = new AxisService(); axisServiceForActivation.setName(proxyServiceName); axisCfg.addToAllServicesMap(axisServiceForActivation); proxyService.setTargetInLineInSequence(new SequenceMediator()); proxyService.setTargetInLineOutSequence(new SequenceMediator()); proxyService.setTargetInLineFaultSequence(new SequenceMediator()); proxyService.start(synCfg); Assert.assertTrue("Underlying Axis service is not activated", axisServiceForActivation.isActive()); Assert.assertTrue("Proxy service is not running", proxyService.isRunning()); proxyService.stop(synCfg); }