Search in sources :

Example 1 with CustomAxisConfigurator

use of org.apache.axis2.transport.CustomAxisConfigurator 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 CustomAxisConfigurator

use of org.apache.axis2.transport.CustomAxisConfigurator 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)

Aggregations

TransportInDescription (org.apache.axis2.description.TransportInDescription)2 TransportOutDescription (org.apache.axis2.description.TransportOutDescription)2 AxisConfiguration (org.apache.axis2.engine.AxisConfiguration)2 CustomAxisConfigurator (org.apache.axis2.transport.CustomAxisConfigurator)2 ConfigurationContext (org.apache.axis2.context.ConfigurationContext)1 ListenerManager (org.apache.axis2.engine.ListenerManager)1 Setup (org.apache.axis2.transport.testkit.tests.Setup)1