use of org.apache.synapse.samples.framework.ProcessController in project wso2-synapse by wso2.
the class MediatorTestCase method doCleanup.
/**
* shutting down servers, cleaning temp files
*/
private void doCleanup() {
if (synapseController != null) {
log.debug("Stopping Synapse");
synapseController.stopProcess();
}
List<ProcessController> removed = new ArrayList<ProcessController>();
for (ProcessController bsc : backendServerControllers) {
if (bsc instanceof Axis2BackEndServerController) {
log.info("Stopping Server: " + bsc.getServerName());
bsc.stopProcess();
removed.add(bsc);
}
}
for (ProcessController bsc : removed) {
backendServerControllers.remove(bsc);
}
for (ProcessController bsc : backendServerControllers) {
log.info("Stopping Server: " + bsc.getServerName());
bsc.stopProcess();
}
}
use of org.apache.synapse.samples.framework.ProcessController in project wso2-synapse by wso2.
the class MediatorTestCase method initBackEndServersConfigInfo.
/**
* Reads and initializes backend server specific configuration information from descriptor
*
* @param config Sample descriptor
* @return a List of ProcessController instances
*/
private List<ProcessController> initBackEndServersConfigInfo(OMElement config) {
log.debug("Initializing configuration information for backend servers...");
List<ProcessController> controllers = new ArrayList<ProcessController>();
OMElement backendServersConfig = config.getFirstChildWithName(new QName(SampleConfigConstants.TAG_BE_SERVER_CONF));
if (backendServersConfig == null) {
log.warn("No backend servers defined");
return null;
}
Iterator backendServers = backendServersConfig.getChildElements();
while (backendServers.hasNext()) {
OMElement backendServer = (OMElement) backendServers.next();
ProcessController controller = SynapseTestUtils.createController(backendServer);
if (controller != null) {
controllers.add(controller);
} else {
log.error("Unrecognized backend server configuration: " + backendServer.getLocalName());
return null;
}
}
return controllers;
}
use of org.apache.synapse.samples.framework.ProcessController in project wso2-synapse by wso2.
the class MediatorTestCase method setUp.
/**
* Executed before this test case. That means, this will be executed before each test.
* Loads all configuration info and starts the servers.
*/
public void setUp() {
// Start backend servers
for (ProcessController controller : backendServerControllers) {
if (!controller.startProcess()) {
doCleanup();
fail("Error starting the server: " + controller.getServerName());
}
}
// Start Synapse
if (!synapseController.startProcess()) {
doCleanup();
fail("Error starting synapse server");
}
}
Aggregations