Search in sources :

Example 1 with XMLMessage

use of org.apache.axis2.transport.testkit.message.XMLMessage in project wso2-axis2-transports by wso2.

the class TransportTestSuiteBuilder method build.

private void build(Object[] env) {
    for (ResourceRelation<AsyncChannel> channel : asyncChannels) {
        for (ResourceRelation<AsyncTestClient<XMLMessage>> client : xmlAsyncClients) {
            for (ResourceRelation<AsyncEndpoint<XMLMessage>> endpoint : xmlAsyncEndpoints) {
                Object[] resources = merge(env, channel, client, endpoint);
                for (MessageTestData data : messageTestData) {
                    for (XMLMessage.Type type : XMLMessage.Type.values()) {
                        if (type != XMLMessage.Type.SWA) {
                            suite.addTest(new XMLAsyncMessageTestCase(channel.getPrimaryResource(), client.getPrimaryResource(), endpoint.getPrimaryResource(), type, data, resources));
                        }
                    }
                }
                suite.addTest(new SwATestCase(channel.getPrimaryResource(), client.getPrimaryResource(), endpoint.getPrimaryResource(), resources));
                // Regression test for SYNAPSE-423:
                suite.addTest(new LargeSOAPAsyncMessageTestCase(channel.getPrimaryResource(), client.getPrimaryResource(), endpoint.getPrimaryResource(), resources));
            }
        }
        for (ResourceRelation<AsyncTestClient<String>> client : stringAsyncClients) {
            for (ResourceRelation<AsyncEndpoint<String>> endpoint : stringAsyncEndpoints) {
                Object[] resources = merge(env, channel, client, endpoint);
                for (MessageTestData data : messageTestData) {
                    suite.addTest(new TextPlainTestCase(channel.getPrimaryResource(), client.getPrimaryResource(), endpoint.getPrimaryResource(), data, resources));
                }
            }
        }
        for (ResourceRelation<AsyncTestClient<byte[]>> client : byteAsyncClients) {
            for (ResourceRelation<AsyncEndpoint<byte[]>> endpoint : byteAsyncEndpoints) {
                Object[] resources = merge(env, channel, client, endpoint);
                suite.addTest(new BinaryTestCase(channel.getPrimaryResource(), client.getPrimaryResource(), endpoint.getPrimaryResource(), resources));
            }
        }
        for (ResourceRelation<AsyncTestClient<RESTMessage>> client : restAsyncClients) {
            for (ResourceRelation<AsyncEndpoint<RESTMessage>> endpoint : restAsyncEndpoints) {
                Object[] resources = merge(env, channel, client, endpoint);
                suite.addTest(new RESTTestCase(channel.getPrimaryResource(), client.getPrimaryResource(), endpoint.getPrimaryResource(), restTestMessage1, resources));
            // TODO: regression test for SYNAPSE-431
            // addTest(new RESTTestCase(env, channel, client, endpoint, restTestMessage2));
            }
        }
    }
    for (ResourceRelation<RequestResponseChannel> channel : requestResponseChannels) {
        for (ResourceRelation<RequestResponseTestClient<XMLMessage, XMLMessage>> client : xmlRequestResponseClients) {
            for (ResourceRelation<InOutEndpoint> endpoint : echoEndpoints) {
                Object[] resources = merge(env, channel, client, endpoint);
                for (MessageTestData data : messageTestData) {
                    for (XMLMessage.Type type : XMLMessage.Type.values()) {
                        if (type != XMLMessage.Type.SWA) {
                            suite.addTest(new XMLRequestResponseMessageTestCase(channel.getPrimaryResource(), client.getPrimaryResource(), endpoint.getPrimaryResource(), type, data, resources));
                        }
                    }
                }
            }
        }
    }
}
Also used : AsyncEndpoint(org.apache.axis2.transport.testkit.endpoint.AsyncEndpoint) XMLMessage(org.apache.axis2.transport.testkit.message.XMLMessage) InOutEndpoint(org.apache.axis2.transport.testkit.endpoint.InOutEndpoint) AsyncChannel(org.apache.axis2.transport.testkit.channel.AsyncChannel) RequestResponseTestClient(org.apache.axis2.transport.testkit.client.RequestResponseTestClient) BinaryTestCase(org.apache.axis2.transport.testkit.tests.async.BinaryTestCase) RESTTestCase(org.apache.axis2.transport.testkit.tests.async.RESTTestCase) TextPlainTestCase(org.apache.axis2.transport.testkit.tests.async.TextPlainTestCase) LargeSOAPAsyncMessageTestCase(org.apache.axis2.transport.testkit.tests.async.LargeSOAPAsyncMessageTestCase) SwATestCase(org.apache.axis2.transport.testkit.tests.async.SwATestCase) XMLRequestResponseMessageTestCase(org.apache.axis2.transport.testkit.tests.echo.XMLRequestResponseMessageTestCase) AsyncTestClient(org.apache.axis2.transport.testkit.client.AsyncTestClient) RequestResponseChannel(org.apache.axis2.transport.testkit.channel.RequestResponseChannel) XMLAsyncMessageTestCase(org.apache.axis2.transport.testkit.tests.async.XMLAsyncMessageTestCase)

Example 2 with XMLMessage

use of org.apache.axis2.transport.testkit.message.XMLMessage in project wso2-axis2-transports by wso2.

the class SwATestCase method prepareMessage.

@Override
protected XMLMessage prepareMessage() throws Exception {
    OMFactory factory = OMAbstractFactory.getOMFactory();
    OMElement payload = factory.createOMElement(new QName("root"));
    Attachments attachments = new Attachments();
    attachments.addDataHandler(contentID, new DataHandler(new ByteArrayDataSource(attachmentContent, "application/octet-stream")));
    return new XMLMessage(payload, XMLMessage.Type.SWA, attachments);
}
Also used : OMFactory(org.apache.axiom.om.OMFactory) XMLMessage(org.apache.axis2.transport.testkit.message.XMLMessage) QName(javax.xml.namespace.QName) OMElement(org.apache.axiom.om.OMElement) DataHandler(javax.activation.DataHandler) Attachments(org.apache.axiom.attachments.Attachments) ByteArrayDataSource(org.apache.axiom.attachments.ByteArrayDataSource)

Example 3 with XMLMessage

use of org.apache.axis2.transport.testkit.message.XMLMessage in project wso2-axis2-transports by wso2.

the class LargeSOAPAsyncMessageTestCase method prepareMessage.

@Override
protected XMLMessage prepareMessage() throws Exception {
    OMFactory factory = OMAbstractFactory.getOMFactory();
    OMElement root = factory.createOMElement(new QName("root"));
    for (int i = 0; i < 1000; i++) {
        OMElement child = factory.createOMElement(new QName("child"));
        child.setText("text");
        root.addChild(child);
    }
    return new XMLMessage(root, XMLMessage.Type.SOAP11);
}
Also used : OMFactory(org.apache.axiom.om.OMFactory) XMLMessage(org.apache.axis2.transport.testkit.message.XMLMessage) QName(javax.xml.namespace.QName) OMElement(org.apache.axiom.om.OMElement) AsyncEndpoint(org.apache.axis2.transport.testkit.endpoint.AsyncEndpoint)

Example 4 with XMLMessage

use of org.apache.axis2.transport.testkit.message.XMLMessage in project wso2-axis2-transports by wso2.

the class XMLAsyncMessageTestCase method prepareMessage.

@Override
protected XMLMessage prepareMessage() throws Exception {
    OMFactory factory = OMAbstractFactory.getOMFactory();
    OMElement orgElement = factory.createOMElement(new QName("root"));
    orgElement.setText(data.getText());
    return new XMLMessage(orgElement, xmlMessageType);
}
Also used : OMFactory(org.apache.axiom.om.OMFactory) XMLMessage(org.apache.axis2.transport.testkit.message.XMLMessage) QName(javax.xml.namespace.QName) OMElement(org.apache.axiom.om.OMElement)

Example 5 with XMLMessage

use of org.apache.axis2.transport.testkit.message.XMLMessage in project wso2-axis2-transports by wso2.

the class XMLRequestResponseMessageTestCase method prepareRequest.

@Override
protected XMLMessage prepareRequest() throws Exception {
    OMFactory factory = OMAbstractFactory.getOMFactory();
    OMElement orgElement = factory.createOMElement(new QName("root"));
    orgElement.setText(data.getText());
    return new XMLMessage(orgElement, xmlMessageType);
}
Also used : OMFactory(org.apache.axiom.om.OMFactory) XMLMessage(org.apache.axis2.transport.testkit.message.XMLMessage) QName(javax.xml.namespace.QName) OMElement(org.apache.axiom.om.OMElement)

Aggregations

XMLMessage (org.apache.axis2.transport.testkit.message.XMLMessage)5 QName (javax.xml.namespace.QName)4 OMElement (org.apache.axiom.om.OMElement)4 OMFactory (org.apache.axiom.om.OMFactory)4 AsyncEndpoint (org.apache.axis2.transport.testkit.endpoint.AsyncEndpoint)2 DataHandler (javax.activation.DataHandler)1 Attachments (org.apache.axiom.attachments.Attachments)1 ByteArrayDataSource (org.apache.axiom.attachments.ByteArrayDataSource)1 AsyncChannel (org.apache.axis2.transport.testkit.channel.AsyncChannel)1 RequestResponseChannel (org.apache.axis2.transport.testkit.channel.RequestResponseChannel)1 AsyncTestClient (org.apache.axis2.transport.testkit.client.AsyncTestClient)1 RequestResponseTestClient (org.apache.axis2.transport.testkit.client.RequestResponseTestClient)1 InOutEndpoint (org.apache.axis2.transport.testkit.endpoint.InOutEndpoint)1 BinaryTestCase (org.apache.axis2.transport.testkit.tests.async.BinaryTestCase)1 LargeSOAPAsyncMessageTestCase (org.apache.axis2.transport.testkit.tests.async.LargeSOAPAsyncMessageTestCase)1 RESTTestCase (org.apache.axis2.transport.testkit.tests.async.RESTTestCase)1 SwATestCase (org.apache.axis2.transport.testkit.tests.async.SwATestCase)1 TextPlainTestCase (org.apache.axis2.transport.testkit.tests.async.TextPlainTestCase)1 XMLAsyncMessageTestCase (org.apache.axis2.transport.testkit.tests.async.XMLAsyncMessageTestCase)1 XMLRequestResponseMessageTestCase (org.apache.axis2.transport.testkit.tests.echo.XMLRequestResponseMessageTestCase)1