Search in sources :

Example 1 with AxisTestClientConfigurator

use of org.apache.axis2.transport.testkit.axis2.client.AxisTestClientConfigurator in project wso2-axis2-transports by wso2.

the class AxisTestClient method send.

protected MessageContext send(ClientOptions options, AxisMessage message, QName operationQName, boolean block, String resultMessageLabel) throws Exception {
    OperationClient mepClient = serviceClient.createClient(operationQName);
    MessageContext mc = new MessageContext();
    mc.setProperty(Constants.Configuration.MESSAGE_TYPE, message.getMessageType());
    mc.setEnvelope(message.getEnvelope());
    Attachments attachments = message.getAttachments();
    if (attachments != null) {
        mc.setAttachmentMap(attachments);
        mc.setDoingSwA(true);
        mc.setProperty(Constants.Configuration.ENABLE_SWA, true);
    }
    for (AxisTestClientConfigurator configurator : configurators) {
        configurator.setupRequestMessageContext(mc);
    }
    mc.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING, options.getCharset());
    mc.setServiceContext(serviceClient.getServiceContext());
    if (metrics != null) {
        mc.setProperty(BaseConstants.METRICS_COLLECTOR, metrics);
    }
    mepClient.addMessageContext(mc);
    mepClient.execute(block);
    // mepClient.complete(mc);
    return resultMessageLabel == null ? null : mepClient.getMessageContext(resultMessageLabel);
}
Also used : OperationClient(org.apache.axis2.client.OperationClient) MessageContext(org.apache.axis2.context.MessageContext) Attachments(org.apache.axiom.attachments.Attachments)

Example 2 with AxisTestClientConfigurator

use of org.apache.axis2.transport.testkit.axis2.client.AxisTestClientConfigurator in project wso2-axis2-transports by wso2.

the class AxisTestClient method setUp.

@Setup
@SuppressWarnings("unused")
private void setUp(AxisTestClientContext context, Channel channel, AxisTestClientConfigurator[] configurators) throws Exception {
    this.configurators = configurators;
    sender = context.getSender();
    serviceClient = new ServiceClient(context.getConfigurationContext(), null);
    axisOptions = new Options();
    axisOptions.setTo(channel.getEndpointReference());
    serviceClient.setOptions(axisOptions);
}
Also used : Options(org.apache.axis2.client.Options) ClientOptions(org.apache.axis2.transport.testkit.client.ClientOptions) ServiceClient(org.apache.axis2.client.ServiceClient) Setup(org.apache.axis2.transport.testkit.tests.Setup)

Example 3 with AxisTestClientConfigurator

use of org.apache.axis2.transport.testkit.axis2.client.AxisTestClientConfigurator in project wso2-axis2-transports by wso2.

the class JMSTransportTest method suite.

public static TestSuite suite() throws Exception {
    ManagedTestSuite suite = new ManagedTestSuite(JMSTransportTest.class);
    // SwA doesn't make sense with text messages
    suite.addExclude("(&(test=AsyncSwA)(client=jms)(jmsType=text))");
    // Don't execute all possible test combinations:
    // * Use a single setup to execute tests with all message types.
    // * Only use a small set of message types for the other setups.
    suite.addExclude("(!(|(&(broker=qpid)(singleCF=false)(cfOnSender=false)(!(|(destType=topic)(replyDestType=topic))))" + "(&(test=AsyncXML)(messageType=SOAP11)(data=ASCII))" + "(&(test=EchoXML)(messageType=POX)(data=ASCII))" + "(test=MinConcurrency)))");
    // SYNAPSE-436:
    suite.addExclude("(&(test=EchoXML)(replyDestType=topic)(endpoint=axis))");
    // Example to run a few use cases.. please leave these commented out - asankha
    // suite.addExclude("(|(test=AsyncXML)(test=MinConcurrency)(destType=topic)(broker=qpid)(destType=topic)(replyDestType=topic)(client=jms)(endpoint=mock)(cfOnSender=true))");
    // suite.addExclude("(|(test=EchoXML)(destType=queue)(broker=qpid)(cfOnSender=true)(singleCF=false)(destType=queue)(client=jms)(endpoint=mock))");
    // suite.addExclude("(|(test=EchoXML)(test=AsyncXML)(test=AsyncSwA)(test=AsyncTextPlain)(test=AsyncBinary)(test=AsyncSOAPLarge)(broker=qpid))");
    TransportTestSuiteBuilder builder = new TransportTestSuiteBuilder(suite);
    JMSTestEnvironment[] environments = new JMSTestEnvironment[] { new QpidTestEnvironment(), new ActiveMQTestEnvironment() };
    for (boolean singleCF : new boolean[] { false, true }) {
        for (boolean cfOnSender : new boolean[] { false, true }) {
            for (JMSTestEnvironment env : environments) {
                builder.addEnvironment(env, new JMSTransportDescriptionFactory(singleCF, cfOnSender, 1));
            }
        }
    }
    builder.addAsyncChannel(new JMSAsyncChannel(JMSConstants.DESTINATION_TYPE_QUEUE, ContentTypeMode.TRANSPORT));
    builder.addAsyncChannel(new JMSAsyncChannel(JMSConstants.DESTINATION_TYPE_TOPIC, ContentTypeMode.TRANSPORT));
    builder.addAxisAsyncTestClient(new AxisAsyncTestClient());
    builder.addAxisAsyncTestClient(new AxisAsyncTestClient(), new JMSAxisTestClientConfigurator(JMSConstants.JMS_BYTE_MESSAGE));
    builder.addAxisAsyncTestClient(new AxisAsyncTestClient(), new JMSAxisTestClientConfigurator(JMSConstants.JMS_TEXT_MESSAGE));
    builder.addByteArrayAsyncTestClient(new JMSAsyncClient<byte[]>(JMSBytesMessageFactory.INSTANCE));
    builder.addStringAsyncTestClient(new JMSAsyncClient<String>(JMSTextMessageFactory.INSTANCE));
    builder.addAxisAsyncEndpoint(new AxisAsyncEndpoint());
    builder.addRequestResponseChannel(new JMSRequestResponseChannel(JMSConstants.DESTINATION_TYPE_QUEUE, JMSConstants.DESTINATION_TYPE_QUEUE, ContentTypeMode.TRANSPORT));
    AxisTestClientConfigurator timeoutConfigurator = new AxisTestClientConfigurator() {

        public void setupRequestMessageContext(MessageContext msgContext) throws AxisFault {
            msgContext.setProperty(JMSConstants.JMS_WAIT_REPLY, "5000");
        }
    };
    builder.addAxisRequestResponseTestClient(new AxisRequestResponseTestClient(), timeoutConfigurator);
    builder.addStringRequestResponseTestClient(new JMSRequestResponseClient<String>(JMSTextMessageFactory.INSTANCE));
    builder.addEchoEndpoint(new MockEchoEndpoint());
    builder.addEchoEndpoint(new AxisEchoEndpoint());
    for (JMSTestEnvironment env : new JMSTestEnvironment[] { new QpidTestEnvironment(), new ActiveMQTestEnvironment() }) {
        suite.addTest(new MinConcurrencyTest(new AsyncChannel[] { new JMSAsyncChannel("endpoint1", JMSConstants.DESTINATION_TYPE_QUEUE, ContentTypeMode.TRANSPORT), new JMSAsyncChannel("endpoint2", JMSConstants.DESTINATION_TYPE_QUEUE, ContentTypeMode.TRANSPORT) }, 2, false, env, new JMSTransportDescriptionFactory(false, false, 2)));
    }
    builder.build();
    return suite;
}
Also used : AxisRequestResponseTestClient(org.apache.axis2.transport.testkit.axis2.client.AxisRequestResponseTestClient) AxisAsyncEndpoint(org.apache.axis2.transport.testkit.axis2.endpoint.AxisAsyncEndpoint) AxisTestClientConfigurator(org.apache.axis2.transport.testkit.axis2.client.AxisTestClientConfigurator) AsyncChannel(org.apache.axis2.transport.testkit.channel.AsyncChannel) ManagedTestSuite(org.apache.axis2.transport.testkit.ManagedTestSuite) AxisAsyncTestClient(org.apache.axis2.transport.testkit.axis2.client.AxisAsyncTestClient) AxisEchoEndpoint(org.apache.axis2.transport.testkit.axis2.endpoint.AxisEchoEndpoint) MinConcurrencyTest(org.apache.axis2.transport.testkit.tests.misc.MinConcurrencyTest) MessageContext(org.apache.axis2.context.MessageContext) TransportTestSuiteBuilder(org.apache.axis2.transport.testkit.TransportTestSuiteBuilder)

Example 4 with AxisTestClientConfigurator

use of org.apache.axis2.transport.testkit.axis2.client.AxisTestClientConfigurator in project wso2-axis2-transports by wso2.

the class HttpTransportTestSuiteBuilder method build.

public void build() {
    TransportTestSuiteBuilder builder = new TransportTestSuiteBuilder(suite);
    builder.addEnvironment(tdf);
    HttpChannel channel = new HttpChannel();
    builder.addAsyncChannel(channel);
    builder.addByteArrayAsyncTestClient(new JavaNetClient());
    if (axisTestClientConfigurators.isEmpty()) {
        builder.addAxisAsyncTestClient(new AxisAsyncTestClient());
    } else {
        for (AxisTestClientConfigurator configurator : axisTestClientConfigurators) {
            builder.addAxisAsyncTestClient(new AxisAsyncTestClient(), configurator);
        }
    }
    builder.addRESTAsyncTestClient(new JavaNetRESTClient());
    builder.addAxisAsyncEndpoint(new AxisAsyncEndpoint());
    builder.addByteArrayAsyncEndpoint(new JettyByteArrayAsyncEndpoint());
    builder.addRESTAsyncEndpoint(new JettyRESTAsyncEndpoint());
    builder.addRequestResponseChannel(channel);
    builder.addAxisRequestResponseTestClient(new AxisRequestResponseTestClient());
    builder.addEchoEndpoint(new AxisEchoEndpoint());
    builder.addEchoEndpoint(new JettyEchoEndpoint());
    builder.build();
    suite.addTest(new MinConcurrencyTest(new AsyncChannel[] { new HttpChannel(), new HttpChannel() }, 2, false, tdf));
}
Also used : AxisRequestResponseTestClient(org.apache.axis2.transport.testkit.axis2.client.AxisRequestResponseTestClient) AxisAsyncEndpoint(org.apache.axis2.transport.testkit.axis2.endpoint.AxisAsyncEndpoint) AxisTestClientConfigurator(org.apache.axis2.transport.testkit.axis2.client.AxisTestClientConfigurator) AsyncChannel(org.apache.axis2.transport.testkit.channel.AsyncChannel) AxisAsyncTestClient(org.apache.axis2.transport.testkit.axis2.client.AxisAsyncTestClient) AxisEchoEndpoint(org.apache.axis2.transport.testkit.axis2.endpoint.AxisEchoEndpoint) MinConcurrencyTest(org.apache.axis2.transport.testkit.tests.misc.MinConcurrencyTest) TransportTestSuiteBuilder(org.apache.axis2.transport.testkit.TransportTestSuiteBuilder)

Aggregations

MessageContext (org.apache.axis2.context.MessageContext)2 TransportTestSuiteBuilder (org.apache.axis2.transport.testkit.TransportTestSuiteBuilder)2 AxisAsyncTestClient (org.apache.axis2.transport.testkit.axis2.client.AxisAsyncTestClient)2 AxisRequestResponseTestClient (org.apache.axis2.transport.testkit.axis2.client.AxisRequestResponseTestClient)2 AxisTestClientConfigurator (org.apache.axis2.transport.testkit.axis2.client.AxisTestClientConfigurator)2 AxisAsyncEndpoint (org.apache.axis2.transport.testkit.axis2.endpoint.AxisAsyncEndpoint)2 AxisEchoEndpoint (org.apache.axis2.transport.testkit.axis2.endpoint.AxisEchoEndpoint)2 AsyncChannel (org.apache.axis2.transport.testkit.channel.AsyncChannel)2 MinConcurrencyTest (org.apache.axis2.transport.testkit.tests.misc.MinConcurrencyTest)2 Attachments (org.apache.axiom.attachments.Attachments)1 OperationClient (org.apache.axis2.client.OperationClient)1 Options (org.apache.axis2.client.Options)1 ServiceClient (org.apache.axis2.client.ServiceClient)1 ManagedTestSuite (org.apache.axis2.transport.testkit.ManagedTestSuite)1 ClientOptions (org.apache.axis2.transport.testkit.client.ClientOptions)1 Setup (org.apache.axis2.transport.testkit.tests.Setup)1