Search in sources :

Example 6 with JMSMessageHeadersType

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"));
    }
}
Also used : TestCaseType(org.apache.cxf.testsuite.testcase.TestCaseType) JMSSimplePortType(org.apache.cxf.jms_simple.JMSSimplePortType) JMSMessageHeadersType(org.apache.cxf.transport.jms.JMSMessageHeadersType) JMSException(javax.jms.JMSException) WebServiceException(javax.xml.ws.WebServiceException) Test(org.junit.Test)

Example 7 with JMSMessageHeadersType

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);
}
Also used : TestCaseType(org.apache.cxf.testsuite.testcase.TestCaseType) JMSSimplePortType(org.apache.cxf.jms_simple.JMSSimplePortType) JMSMessageHeadersType(org.apache.cxf.transport.jms.JMSMessageHeadersType) Test(org.junit.Test)

Example 8 with JMSMessageHeadersType

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);
}
Also used : TestCaseType(org.apache.cxf.testsuite.testcase.TestCaseType) JMSSimplePortType(org.apache.cxf.jms_simple.JMSSimplePortType) JMSMessageHeadersType(org.apache.cxf.transport.jms.JMSMessageHeadersType) Test(org.junit.Test)

Example 9 with JMSMessageHeadersType

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();
}
Also used : Exchange(org.apache.cxf.message.Exchange) EndpointInfo(org.apache.cxf.service.model.EndpointInfo) Bus(org.apache.cxf.Bus) JMSConfiguration(org.apache.cxf.transport.jms.JMSConfiguration) EndpointReferenceType(org.apache.cxf.ws.addressing.EndpointReferenceType) JMSConduit(org.apache.cxf.transport.jms.JMSConduit) Message(org.apache.cxf.message.Message) JMSMessageHeadersType(org.apache.cxf.transport.jms.JMSMessageHeadersType) TestReceiver(org.apache.cxf.transport.jms.util.TestReceiver) MessageImpl(org.apache.cxf.message.MessageImpl) ExchangeImpl(org.apache.cxf.message.ExchangeImpl)

Example 10 with JMSMessageHeadersType

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();
}
Also used : QName(javax.xml.namespace.QName) HelloWorldService(org.apache.cxf.hello_world_jms.HelloWorldService) Closeable(java.io.Closeable) HelloWorldPortType(org.apache.cxf.hello_world_jms.HelloWorldPortType) JMSMessageHeadersType(org.apache.cxf.transport.jms.JMSMessageHeadersType) BindingProvider(javax.xml.ws.BindingProvider) URL(java.net.URL) Test(org.junit.Test)

Aggregations

JMSMessageHeadersType (org.apache.cxf.transport.jms.JMSMessageHeadersType)20 Test (org.junit.Test)13 JMSSimplePortType (org.apache.cxf.jms_simple.JMSSimplePortType)8 TestCaseType (org.apache.cxf.testsuite.testcase.TestCaseType)8 JMSException (javax.jms.JMSException)7 BindingProvider (javax.xml.ws.BindingProvider)7 WebServiceException (javax.xml.ws.WebServiceException)7 URL (java.net.URL)6 QName (javax.xml.namespace.QName)6 Closeable (java.io.Closeable)3 SOAPFaultException (javax.xml.ws.soap.SOAPFaultException)3 HelloWorldOneWayPort (org.apache.cxf.hello_world_jms.HelloWorldOneWayPort)3 HelloWorldQueueDecoupledOneWaysService (org.apache.cxf.hello_world_jms.HelloWorldQueueDecoupledOneWaysService)3 InvocationHandler (java.lang.reflect.InvocationHandler)2 UndeclaredThrowableException (java.lang.reflect.UndeclaredThrowableException)2 ExecutionException (java.util.concurrent.ExecutionException)2 Endpoint (javax.xml.ws.Endpoint)2 MessageContext (javax.xml.ws.handler.MessageContext)2 JMSGreeterPortType (org.apache.cxf.jms_greeter.JMSGreeterPortType)2 JMSGreeterService (org.apache.cxf.jms_greeter.JMSGreeterService)2