use of org.apache.axis2.builder.Builder 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;
}
use of org.apache.axis2.builder.Builder in project wso2-axis2-transports by wso2.
the class UDPTransportTest method suite.
public static TestSuite suite() throws Exception {
ManagedTestSuite suite = new ManagedTestSuite(UDPTransportTest.class);
// For the moment, we can only do SOAP 1.1 (see TODO item on UDPChannel)
suite.addExclude("(|(messageType=SOAP12)(messageType=POX)(test=AsyncTextPlain)(test=AsyncBinary))");
// Who would want to do SwA over UDP?
suite.addExclude("(test=AsyncSwA)");
// Obviously, UDP will not support large SOAP messages
suite.addExclude("(test=AsyncSOAPLarge)");
TransportTestSuiteBuilder builder = new TransportTestSuiteBuilder(suite);
builder.addAsyncChannel(new UDPChannel());
builder.addRequestResponseChannel(new UDPChannel());
builder.addEnvironment(new SimpleTransportDescriptionFactory("udp", UDPListener.class, UDPSender.class));
builder.addAxisAsyncTestClient(new AxisAsyncTestClient());
builder.addAxisAsyncEndpoint(new AxisAsyncEndpoint());
builder.addAxisRequestResponseTestClient(new AxisRequestResponseTestClient());
builder.addEchoEndpoint(new AxisEchoEndpoint());
builder.build();
return suite;
}
use of org.apache.axis2.builder.Builder in project wso2-axis2-transports by wso2.
the class RabbitMQUtils method setSoapEnvelop.
private static void setSoapEnvelop(MessageContext msgContext, byte[] body, String contentType) throws AxisFault {
Builder builder = getBuilder(msgContext, contentType);
OMElement documentElement = builder.processDocument(new ByteArrayInputStream(body), contentType, msgContext);
msgContext.setEnvelope(TransportUtils.createSOAPEnvelope(documentElement));
}
use of org.apache.axis2.builder.Builder in project wso2-synapse by wso2.
the class JsonStreamingBuilderTest method testProcessDocumentNoJsonPayload.
public void testProcessDocumentNoJsonPayload() throws AxisFault {
String defaultEnvelope = "<?xml version='1.0' encoding='utf-8'?>" + "<soapenv:Envelope xmlns:soapenv=\"http://www.w3.org/2003/05/soap-envelope\">" + "<soapenv:Body />" + "</soapenv:Envelope>";
MessageContext messageContext = Util.newMessageContext();
messageContext.setTo(new EndpointReference("http://localhost:8000"));
Builder jsonBuilder = Util.newJsonStreamBuilder();
OMElement element = jsonBuilder.processDocument(null, "application/json", messageContext);
assertEquals("Default envelope expected", defaultEnvelope, element.toString());
}
use of org.apache.axis2.builder.Builder in project wso2-synapse by wso2.
the class JsonStreamingBuilderTest method testInvalidJson.
/**
* Test for the RuntimeException thrown when the json payload is invalid.
*/
public void testInvalidJson() {
String invalidJson = "{\n" + "\"account_number\":\"1234567890\",\n" + "\"routing_number\":\"09100001\n" + "\"image_type\":\"COMMERCIAL_DEPOSIT\"\n" + "}";
try {
MessageContext message = Util.newMessageContext();
InputStream inputStream = Util.newInputStream(invalidJson.getBytes());
Builder jsonBuilder = Util.newJsonStreamBuilder();
OMElement element = jsonBuilder.processDocument(inputStream, "application/json", message);
message.getEnvelope().getBody().addChild(element);
} catch (Exception e) {
assertTrue("Not a RuntimeException instance", e instanceof RuntimeException);
}
}
Aggregations