Search in sources :

Example 16 with JMSMessageHeadersType

use of org.apache.cxf.transport.jms.JMSMessageHeadersType in project cxf by apache.

the class SOAPJMSTestSuiteTest method test1105.

@Test
public void test1105() throws Exception {
    TestCaseType testcase = JMSTestUtil.getTestCase("test1105");
    final JMSSimplePortType simplePort = getPort("JMSSimpleService1105", "SimplePort", JMSSimpleService1105.class, JMSSimplePortType.class);
    JMSMessageHeadersType requestHeader = new JMSMessageHeadersType();
    requestHeader.setSOAPJMSSOAPAction("mismatch");
    try {
        twoWayTestWithRequestHeader(testcase, simplePort, requestHeader);
    } catch (Exception e) {
        assertTrue(e.getMessage().contains("Mismatched SoapAction"));
    }
}
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 17 with JMSMessageHeadersType

use of org.apache.cxf.transport.jms.JMSMessageHeadersType in project cxf by apache.

the class SOAPJMSTestSuiteTest method test1109.

@Test
public void test1109() throws Exception {
    TestCaseType testcase = JMSTestUtil.getTestCase("test1109");
    final JMSSimplePortType simplePort = getPort("JMSSimpleService1109", "SimplePort", JMSSimpleService1109.class, JMSSimplePortType.class);
    JMSMessageHeadersType requestHeader = new JMSMessageHeadersType();
    try {
        twoWayTestWithRequestHeader(testcase, simplePort, requestHeader);
    } catch (Exception e) {
        assertTrue(e.getMessage().contains("Unknow JMS Variant"));
    }
}
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 18 with JMSMessageHeadersType

use of org.apache.cxf.transport.jms.JMSMessageHeadersType in project cxf by apache.

the class SOAPJMSTestSuiteTest method twoWayTest.

private void twoWayTest(TestCaseType testcase, final JMSSimplePortType port) throws Exception {
    JMSMessageHeadersType requestHeader = new JMSMessageHeadersType();
    twoWayTestWithRequestHeader(testcase, port, requestHeader);
}
Also used : JMSMessageHeadersType(org.apache.cxf.transport.jms.JMSMessageHeadersType)

Example 19 with JMSMessageHeadersType

use of org.apache.cxf.transport.jms.JMSMessageHeadersType in project cxf by apache.

the class SoapJmsSpecTest method testWsdlExtensionSpecJMS.

@Test
public void testWsdlExtensionSpecJMS() throws Exception {
    QName serviceName = new QName(SERVICE_NS, "JMSGreeterService");
    QName portName = new QName(SERVICE_NS, "GreeterPort");
    URL wsdl = getWSDLURL(WSDL);
    JMSGreeterService service = new JMSGreeterService(wsdl, serviceName);
    JMSGreeterPortType greeter = markForClose(service.getPort(portName, JMSGreeterPortType.class, cff));
    Map<String, Object> requestContext = ((BindingProvider) greeter).getRequestContext();
    JMSMessageHeadersType requestHeader = new JMSMessageHeadersType();
    requestContext.put(JMSConstants.JMS_CLIENT_REQUEST_HEADERS, requestHeader);
    String reply = greeter.sayHi();
    Assert.assertEquals("Bonjour", reply);
    requestContext = ((BindingProvider) greeter).getRequestContext();
    requestHeader = (JMSMessageHeadersType) requestContext.get(JMSConstants.JMS_CLIENT_REQUEST_HEADERS);
    Assert.assertEquals("1.0", requestHeader.getSOAPJMSBindingVersion());
    Assert.assertEquals("\"test\"", requestHeader.getSOAPJMSSOAPAction());
    Assert.assertEquals(3000, requestHeader.getTimeToLive());
    Assert.assertEquals(DeliveryMode.PERSISTENT, requestHeader.getJMSDeliveryMode());
    Assert.assertEquals(7, requestHeader.getJMSPriority());
    Map<String, Object> responseContext = ((BindingProvider) greeter).getResponseContext();
    JMSMessageHeadersType responseHeader = (JMSMessageHeadersType) responseContext.get(JMSConstants.JMS_CLIENT_RESPONSE_HEADERS);
    Assert.assertEquals("1.0", responseHeader.getSOAPJMSBindingVersion());
    Assert.assertEquals("\"test\"", responseHeader.getSOAPJMSSOAPAction());
    Assert.assertEquals(DeliveryMode.PERSISTENT, responseHeader.getJMSDeliveryMode());
    Assert.assertEquals(7, responseHeader.getJMSPriority());
}
Also used : QName(javax.xml.namespace.QName) JMSMessageHeadersType(org.apache.cxf.transport.jms.JMSMessageHeadersType) BindingProvider(javax.xml.ws.BindingProvider) JMSGreeterService(org.apache.cxf.jms_greeter.JMSGreeterService) JMSGreeterPortType(org.apache.cxf.jms_greeter.JMSGreeterPortType) URL(java.net.URL) Test(org.junit.Test) AbstractVmJMSTest(org.apache.cxf.systest.jms.AbstractVmJMSTest)

Example 20 with JMSMessageHeadersType

use of org.apache.cxf.transport.jms.JMSMessageHeadersType in project cxf by apache.

the class SoapJmsSpecTest method testBindingVersionError.

@Test
public void testBindingVersionError() throws Exception {
    QName serviceName = new QName(SERVICE_NS, "JMSGreeterService");
    QName portName = new QName(SERVICE_NS, "GreeterPort");
    URL wsdl = getWSDLURL(WSDL);
    JMSGreeterService service = new JMSGreeterService(wsdl, serviceName);
    JMSGreeterPortType greeter = markForClose(service.getPort(portName, JMSGreeterPortType.class, cff));
    BindingProvider bp = (BindingProvider) greeter;
    Map<String, Object> requestContext = bp.getRequestContext();
    JMSMessageHeadersType requestHeader = new JMSMessageHeadersType();
    requestHeader.setSOAPJMSBindingVersion("0.3");
    requestContext.put(JMSConstants.JMS_CLIENT_REQUEST_HEADERS, requestHeader);
    try {
        greeter.greetMe("Milestone-");
        Assert.fail("Should have thrown a fault");
    } catch (SOAPFaultException ex) {
        Assert.assertTrue(ex.getMessage().contains("0.3"));
        Map<String, Object> responseContext = bp.getResponseContext();
        JMSMessageHeadersType responseHdr = (JMSMessageHeadersType) responseContext.get(JMSConstants.JMS_CLIENT_RESPONSE_HEADERS);
        if (responseHdr == null) {
            Assert.fail("response Header should not be null");
        }
        Assert.assertTrue(responseHdr.isSOAPJMSIsFault());
    }
}
Also used : QName(javax.xml.namespace.QName) JMSMessageHeadersType(org.apache.cxf.transport.jms.JMSMessageHeadersType) SOAPFaultException(javax.xml.ws.soap.SOAPFaultException) BindingProvider(javax.xml.ws.BindingProvider) JMSGreeterService(org.apache.cxf.jms_greeter.JMSGreeterService) JMSGreeterPortType(org.apache.cxf.jms_greeter.JMSGreeterPortType) Map(java.util.Map) URL(java.net.URL) Test(org.junit.Test) AbstractVmJMSTest(org.apache.cxf.systest.jms.AbstractVmJMSTest)

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