Search in sources :

Example 1 with AxisConfiguration

use of org.apache.axis2.engine.AxisConfiguration in project wso2-axis2-transports by wso2.

the class AxisTestClientContext method setUp.

@Setup
@SuppressWarnings("unused")
private void setUp(TransportDescriptionFactory tdf, AxisTestClientContextConfigurator[] configurators) throws Exception {
    cfgCtx = ConfigurationContextFactory.createConfigurationContext(new CustomAxisConfigurator());
    AxisConfiguration axisCfg = cfgCtx.getAxisConfiguration();
    TransportOutDescription trpOutDesc = tdf.createTransportOutDescription();
    axisCfg.addTransportOut(trpOutDesc);
    sender = trpOutDesc.getSender();
    sender.init(cfgCtx, trpOutDesc);
    boolean useListener = false;
    for (AxisTestClientContextConfigurator configurator : configurators) {
        if (configurator.isTransportListenerRequired()) {
            useListener = true;
            break;
        }
    }
    TransportInDescription trpInDesc;
    if (useListener) {
        trpInDesc = tdf.createTransportInDescription();
    } else {
        trpInDesc = null;
    }
    for (AxisTestClientContextConfigurator configurator : configurators) {
        configurator.setupTransport(trpInDesc, trpOutDesc);
    }
    if (useListener) {
        listenerManager = new ListenerManager();
        listenerManager.init(cfgCtx);
        cfgCtx.setTransportManager(listenerManager);
        listenerManager.addListener(trpInDesc, false);
        listenerManager.start();
    }
}
Also used : AxisConfiguration(org.apache.axis2.engine.AxisConfiguration) CustomAxisConfigurator(org.apache.axis2.transport.CustomAxisConfigurator) TransportInDescription(org.apache.axis2.description.TransportInDescription) TransportOutDescription(org.apache.axis2.description.TransportOutDescription) ListenerManager(org.apache.axis2.engine.ListenerManager) Setup(org.apache.axis2.transport.testkit.tests.Setup)

Example 2 with AxisConfiguration

use of org.apache.axis2.engine.AxisConfiguration in project wso2-axis2-transports by wso2.

the class UDPTest method getClientCfgCtx.

public ConfigurationContext getClientCfgCtx() throws Exception {
    ConfigurationContext cfgCtx = ConfigurationContextFactory.createConfigurationContext(new CustomAxisConfigurator());
    AxisConfiguration axisCfg = cfgCtx.getAxisConfiguration();
    axisCfg.engageModule("addressing");
    TransportInDescription trpInDesc = new TransportInDescription("udp");
    trpInDesc.setReceiver(new UDPListener());
    axisCfg.addTransportIn(trpInDesc);
    TransportOutDescription trpOutDesc = new TransportOutDescription("udp");
    trpOutDesc.setSender(new UDPSender());
    axisCfg.addTransportOut(trpOutDesc);
    return cfgCtx;
}
Also used : ConfigurationContext(org.apache.axis2.context.ConfigurationContext) AxisConfiguration(org.apache.axis2.engine.AxisConfiguration) CustomAxisConfigurator(org.apache.axis2.transport.CustomAxisConfigurator) TransportInDescription(org.apache.axis2.description.TransportInDescription) TransportOutDescription(org.apache.axis2.description.TransportOutDescription)

Example 3 with AxisConfiguration

use of org.apache.axis2.engine.AxisConfiguration in project wso2-axis2-transports by wso2.

the class AbstractTransportTest method getClientCfgCtx.

/**
 * Get the default axis2 configuration context for a client
 * @return
 * @throws Exception
 */
protected ConfigurationContext getClientCfgCtx() throws Exception {
    AxisConfiguration axisCfg = new AxisConfiguration();
    ConfigurationContext cfgCtx = new ConfigurationContext(axisCfg);
    return cfgCtx;
}
Also used : AxisConfiguration(org.apache.axis2.engine.AxisConfiguration) ConfigurationContext(org.apache.axis2.context.ConfigurationContext)

Example 4 with AxisConfiguration

use of org.apache.axis2.engine.AxisConfiguration in project wso2-axis2-transports by wso2.

the class AxisTestEndpointContext method setUp.

@Setup
@SuppressWarnings("unused")
private void setUp(TransportDescriptionFactory tdf, AxisTestEndpointContextConfigurator[] configurators) throws Exception {
    server = new UtilsTransportServer();
    TransportOutDescription trpOutDesc = tdf.createTransportOutDescription();
    trpInDesc = tdf.createTransportInDescription();
    server.addTransport(trpInDesc, trpOutDesc);
    for (AxisTestEndpointContextConfigurator configurator : configurators) {
        configurator.setupTransport(trpInDesc, trpOutDesc);
    }
    ConfigurationContext cfgCtx = server.getConfigurationContext();
    cfgCtx.setContextRoot("/");
    cfgCtx.setServicePath("services");
    AxisConfiguration axisConfiguration = server.getAxisConfiguration();
    server.start();
}
Also used : ConfigurationContext(org.apache.axis2.context.ConfigurationContext) AxisConfiguration(org.apache.axis2.engine.AxisConfiguration) UtilsTransportServer(org.apache.axis2.transport.UtilsTransportServer) TransportOutDescription(org.apache.axis2.description.TransportOutDescription) Setup(org.apache.axis2.transport.testkit.tests.Setup)

Example 5 with AxisConfiguration

use of org.apache.axis2.engine.AxisConfiguration in project wso2-axis2-transports by wso2.

the class ContentTypeRuleTest method setUp.

@Override
public void setUp() throws Exception {
    AxisConfiguration axisCfg = new AxisConfiguration();
    ConfigurationContext cfgCtx = new ConfigurationContext(axisCfg);
    AxisService service = new AxisService();
    InputStream in = ContentTypeRuleTest.class.getResourceAsStream(getName() + ".xml");
    try {
        OMElement element = new StAXOMBuilder(in).getDocumentElement();
        new ServiceBuilder(cfgCtx, service).populateService(element);
    } finally {
        in.close();
    }
    ruleSet = ContentTypeRuleFactory.parse(service.getParameter("test"));
}
Also used : AxisConfiguration(org.apache.axis2.engine.AxisConfiguration) ConfigurationContext(org.apache.axis2.context.ConfigurationContext) InputStream(java.io.InputStream) AxisService(org.apache.axis2.description.AxisService) OMElement(org.apache.axiom.om.OMElement) StAXOMBuilder(org.apache.axiom.om.impl.builder.StAXOMBuilder) ServiceBuilder(org.apache.axis2.deployment.ServiceBuilder)

Aggregations

AxisConfiguration (org.apache.axis2.engine.AxisConfiguration)120 ConfigurationContext (org.apache.axis2.context.ConfigurationContext)94 SynapseConfiguration (org.apache.synapse.config.SynapseConfiguration)59 Axis2SynapseEnvironment (org.apache.synapse.core.axis2.Axis2SynapseEnvironment)49 Parameter (org.apache.axis2.description.Parameter)46 Test (org.junit.Test)46 SynapseEnvironment (org.apache.synapse.core.SynapseEnvironment)45 OMElement (org.apache.axiom.om.OMElement)31 AxisService (org.apache.axis2.description.AxisService)28 MessageContext (org.apache.synapse.MessageContext)19 TransportOutDescription (org.apache.axis2.description.TransportOutDescription)15 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)14 Axis2MessageContext (org.apache.synapse.core.axis2.Axis2MessageContext)13 AxisFault (org.apache.axis2.AxisFault)12 AddressEndpoint (org.apache.synapse.endpoints.AddressEndpoint)12 ArrayList (java.util.ArrayList)11 MessageContext (org.apache.axis2.context.MessageContext)11 NativeWorkerPool (org.apache.axis2.transport.base.threads.NativeWorkerPool)11 WorkerPool (org.apache.axis2.transport.base.threads.WorkerPool)11 ServiceContext (org.apache.axis2.context.ServiceContext)10