use of org.apache.cxf.transport.jms.JMSMessageHeadersType in project cxf by apache.
the class SOAPJMSTestSuiteTest method test1101.
@Test
public void test1101() throws Exception {
// same to test0002
TestCaseType testcase = JMSTestUtil.getTestCase("test1101");
final JMSSimplePortType simplePort = getPort("JMSSimpleService1101", "SimplePort", JMSSimpleService1101.class, JMSSimplePortType.class);
JMSMessageHeadersType requestHeader = new JMSMessageHeadersType();
requestHeader.setSOAPJMSBindingVersion("0.3");
try {
twoWayTestWithRequestHeader(testcase, simplePort, requestHeader);
} catch (Exception e) {
assertTrue(e.getMessage().contains("Unrecognized BindingVersion"));
}
}
use of org.apache.cxf.transport.jms.JMSMessageHeadersType in project cxf by apache.
the class SOAPJMSTestSuiteTest method test0009.
@Test
public void test0009() throws Exception {
TestCaseType testcase = JMSTestUtil.getTestCase("test0009");
final JMSSimplePortType simplePort = getPort("JMSSimpleService0009", "SimplePort", JMSSimpleService0009.class, JMSSimplePortType.class);
JMSMessageHeadersType requestHeader = new JMSMessageHeadersType();
requestHeader.setJMSDeliveryMode(DeliveryMode.NON_PERSISTENT);
requestHeader.setTimeToLive(10800000);
requestHeader.setJMSPriority(3);
requestHeader.setJMSReplyTo("dynamicQueues/replyqueue00093");
twoWayTestWithRequestHeader(testcase, simplePort, requestHeader);
}
use of org.apache.cxf.transport.jms.JMSMessageHeadersType in project cxf by apache.
the class SOAPJMSTestSuiteTest method test0008.
@Test
public void test0008() throws Exception {
TestCaseType testcase = JMSTestUtil.getTestCase("test0008");
final JMSSimplePortType simplePort = getPort("JMSSimpleService0008", "SimplePort", JMSSimpleService0008.class, JMSSimplePortType.class);
JMSMessageHeadersType requestHeader = new JMSMessageHeadersType();
requestHeader.setJMSDeliveryMode(DeliveryMode.NON_PERSISTENT);
requestHeader.setTimeToLive(14400000);
requestHeader.setJMSPriority(8);
requestHeader.setJMSReplyTo("dynamicQueues/replyqueue0008");
twoWayTestWithRequestHeader(testcase, simplePort, requestHeader);
}
use of org.apache.cxf.transport.jms.JMSMessageHeadersType in project cxf by apache.
the class URIConfiguredConduitTest method sendAndReceive.
public void sendAndReceive(SyncType syncType, String address) throws Exception {
// Register bean locator for cf lookup
TestReceiver receiver = new TestReceiver(cf, SERVICE_QUEUE, false);
receiver.runAsync();
EndpointInfo ei = new EndpointInfo();
ei.setAddress(address);
Bus bus = BusFactory.getDefaultBus();
JMSConfiguration jmsConfig = JMSConfigFactory.createFromEndpointInfo(bus, ei, null);
jmsConfig.setConnectionFactory(cf);
JMSConduit conduit = new JMSConduit(new EndpointReferenceType(), jmsConfig, bus);
Exchange exchange = new ExchangeImpl();
exchange.setSynchronous(syncType == SyncType.sync);
Message message = new MessageImpl();
exchange.setOutMessage(message);
conduit.sendExchange(exchange, "Request");
waitForAsyncReply(exchange);
receiver.close();
if (exchange.getInMessage() == null) {
throw new RuntimeException("No reply received within 2 seconds");
}
JMSMessageHeadersType inHeaders = (JMSMessageHeadersType) exchange.getInMessage().get(JMSConstants.JMS_CLIENT_RESPONSE_HEADERS);
Assert.assertEquals(receiver.getRequestMessageId(), inHeaders.getJMSCorrelationID());
conduit.close();
}
use of org.apache.cxf.transport.jms.JMSMessageHeadersType in project cxf by apache.
the class JMSClientServerTest method testContextPropagation.
@Test
public void testContextPropagation() throws Exception {
final String testReturnPropertyName = "Test_Prop";
final String testIgnoredPropertyName = "Test_Prop_No_Return";
QName serviceName = new QName("http://cxf.apache.org/hello_world_jms", "HelloWorldService");
QName portName = new QName("http://cxf.apache.org/hello_world_jms", "HelloWorldPort");
URL wsdl = getWSDLURL("/wsdl/jms_test.wsdl");
HelloWorldService service = new HelloWorldService(wsdl, serviceName);
HelloWorldPortType greeter = service.getPort(portName, HelloWorldPortType.class);
Map<String, Object> requestContext = ((BindingProvider) greeter).getRequestContext();
JMSMessageHeadersType requestHeader = new JMSMessageHeadersType();
requestHeader.setJMSCorrelationID("JMS_SAMPLE_CORRELATION_ID");
requestHeader.setJMSExpiration(3600000L);
requestHeader.putProperty(testReturnPropertyName, "mustReturn");
requestHeader.putProperty(testIgnoredPropertyName, "mustNotReturn");
requestContext.put(JMSConstants.JMS_CLIENT_REQUEST_HEADERS, requestHeader);
String greeting = greeter.greetMe("Milestone-");
assertNotNull("no response received from service", greeting);
assertEquals("Hello Milestone-", greeting);
Map<String, Object> responseContext = ((BindingProvider) greeter).getResponseContext();
JMSMessageHeadersType responseHdr = (JMSMessageHeadersType) responseContext.get(JMSConstants.JMS_CLIENT_RESPONSE_HEADERS);
if (responseHdr == null) {
fail("response Header should not be null");
}
assertTrue("CORRELATION ID should match :", "JMS_SAMPLE_CORRELATION_ID".equals(responseHdr.getJMSCorrelationID()));
assertTrue("response Headers must conain the app property set in request context.", responseHdr.getPropertyKeys().size() > 0);
boolean found = responseHdr.getPropertyKeys().contains(testReturnPropertyName);
assertTrue("response Headers must match the app property set in request context.", found);
((Closeable) greeter).close();
}
Aggregations