Search in sources :

Example 1 with ProcessController

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();
    }
}
Also used : Axis2BackEndServerController(org.apache.synapse.samples.framework.Axis2BackEndServerController) SynapseProcessController(org.apache.synapse.samples.framework.SynapseProcessController) ProcessController(org.apache.synapse.samples.framework.ProcessController) ArrayList(java.util.ArrayList)

Example 2 with ProcessController

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;
}
Also used : SynapseProcessController(org.apache.synapse.samples.framework.SynapseProcessController) ProcessController(org.apache.synapse.samples.framework.ProcessController) QName(javax.xml.namespace.QName) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) OMElement(org.apache.axiom.om.OMElement)

Example 3 with ProcessController

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");
    }
}
Also used : SynapseProcessController(org.apache.synapse.samples.framework.SynapseProcessController) ProcessController(org.apache.synapse.samples.framework.ProcessController)

Aggregations

ProcessController (org.apache.synapse.samples.framework.ProcessController)3 SynapseProcessController (org.apache.synapse.samples.framework.SynapseProcessController)3 ArrayList (java.util.ArrayList)2 Iterator (java.util.Iterator)1 QName (javax.xml.namespace.QName)1 OMElement (org.apache.axiom.om.OMElement)1 Axis2BackEndServerController (org.apache.synapse.samples.framework.Axis2BackEndServerController)1