Search in sources :

Example 6 with Greeter

use of org.apache.hello_world_doc_lit.Greeter in project cxf by apache.

the class JMSClientServerTest method docBasicJmsDestinationTest.

@Test
public void docBasicJmsDestinationTest() throws Exception {
    QName serviceName = new QName("http://apache.org/hello_world_doc_lit", "SOAPService6");
    QName portName = new QName("http://apache.org/hello_world_doc_lit", "SoapPort6");
    URL wsdl = getWSDLURL("/wsdl/hello_world_doc_lit.wsdl");
    SOAPService2 service = new SOAPService2(wsdl, serviceName);
    Greeter greeter = service.getPort(portName, Greeter.class);
    for (int idx = 0; idx < 5; idx++) {
        greeter.greetMeOneWay("test String");
        String greeting = greeter.greetMe("Milestone-" + idx);
        assertEquals("Hello Milestone-" + idx, greeting);
        String reply = greeter.sayHi();
        assertEquals("Bonjour", reply);
        try {
            greeter.pingMe();
            fail("Should have thrown FaultException");
        } catch (PingMeFault ex) {
            assertNotNull(ex.getFaultInfo());
        }
    }
    ((java.io.Closeable) greeter).close();
}
Also used : PingMeFault(org.apache.hello_world_doc_lit.PingMeFault) QName(javax.xml.namespace.QName) Greeter(org.apache.hello_world_doc_lit.Greeter) Closeable(java.io.Closeable) SOAPService2(org.apache.hello_world_doc_lit.SOAPService2) URL(java.net.URL) Endpoint(javax.xml.ws.Endpoint) Test(org.junit.Test)

Example 7 with Greeter

use of org.apache.hello_world_doc_lit.Greeter in project cxf by apache.

the class JMSClientServerTest method testReplyToConfig.

@Test
public void testReplyToConfig() throws Exception {
    ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory(broker.getBrokerURL());
    TestReceiver receiver = new TestReceiver(cf, "SoapService7.replyto.queue", false);
    receiver.setStaticReplyQueue("SoapService7.reply.queue");
    receiver.runAsync();
    QName serviceName = new QName("http://apache.org/hello_world_doc_lit", "SOAPService7");
    QName portName = new QName("http://apache.org/hello_world_doc_lit", "SoapPort7");
    URL wsdl = getWSDLURL("/wsdl/hello_world_doc_lit.wsdl");
    SOAPService7 service = new SOAPService7(wsdl, serviceName);
    Greeter greeter = service.getPort(portName, Greeter.class);
    String name = "FooBar";
    String reply = greeter.greetMe(name);
    Assert.assertEquals("Hello " + name, reply);
    ((Closeable) greeter).close();
}
Also used : ActiveMQConnectionFactory(org.apache.activemq.ActiveMQConnectionFactory) QName(javax.xml.namespace.QName) Greeter(org.apache.hello_world_doc_lit.Greeter) Closeable(java.io.Closeable) TestReceiver(org.apache.cxf.transport.jms.util.TestReceiver) URL(java.net.URL) SOAPService7(org.apache.hello_world_doc_lit.SOAPService7) Test(org.junit.Test)

Example 8 with Greeter

use of org.apache.hello_world_doc_lit.Greeter in project cxf by apache.

the class JaxWsAPITest method testGreeterUsingJaxWSAPI.

@Test
public void testGreeterUsingJaxWSAPI() throws Exception {
    QName serviceName = new QName("http://apache.org/hello_world_doc_lit", "SOAPService2");
    QName portName = new QName("http://apache.org/hello_world_doc_lit", "SoapPort2");
    URL wsdl = getWSDLURL("/wsdl/hello_world_doc_lit.wsdl");
    SOAPService2 service = new SOAPService2(wsdl, serviceName);
    Greeter greeter = markForClose(service.getPort(portName, Greeter.class, cff));
    Client client = ClientProxy.getClient(greeter);
    client.getEndpoint().getOutInterceptors().add(new TibcoSoapActionInterceptor());
    greeter.greetMeOneWay("test String");
    String greeting = greeter.greetMe("Chris");
    Assert.assertEquals("Hello Chris", greeting);
}
Also used : QName(javax.xml.namespace.QName) Greeter(org.apache.hello_world_doc_lit.Greeter) TibcoSoapActionInterceptor(org.apache.cxf.binding.soap.interceptor.TibcoSoapActionInterceptor) SOAPService2(org.apache.hello_world_doc_lit.SOAPService2) Client(org.apache.cxf.endpoint.Client) URL(java.net.URL) Test(org.junit.Test)

Example 9 with Greeter

use of org.apache.hello_world_doc_lit.Greeter in project cxf by apache.

the class JMSTransactionTest method testTransactionOneWay.

@Test
public void testTransactionOneWay() throws Exception {
    Connection conn = cf.createConnection();
    conn.start();
    Queue queue = JMSUtil.createQueue(conn, "ActiveMQ.DLQ");
    assertNumMessagesInQueue("DLQ should be empty", conn, queue, 0, 1000);
    Greeter greeter = markForClose(createGreeterProxy());
    // Should be processed normally
    greeter.greetMeOneWay(GreeterImplWithTransaction.GOOD_GUY);
    assertNumMessagesInQueue("DLQ should be empty", conn, queue, 0, 1000);
    // Should cause rollback, redelivery and in the end the message should go to the dead letter queue
    greeter.greetMeOneWay(GreeterImplWithTransaction.BAD_GUY);
    assertNumMessagesInQueue("Request should be put into DLQ", conn, queue, 1, 2000);
    conn.close();
}
Also used : Greeter(org.apache.hello_world_doc_lit.Greeter) Connection(javax.jms.Connection) Queue(javax.jms.Queue) Test(org.junit.Test) AbstractVmJMSTest(org.apache.cxf.systest.jms.AbstractVmJMSTest)

Example 10 with Greeter

use of org.apache.hello_world_doc_lit.Greeter in project cxf by apache.

the class JMSTransactionTest method testNoTransactionRequestReply.

/**
 * Request reply should not cause roll backs
 *
 * @throws Exception
 */
@Test
public void testNoTransactionRequestReply() throws Exception {
    Greeter greeter = markForClose(createGreeterProxy());
    greeter.greetMe("Good guy");
    try {
        greeter.greetMe("Bad guy");
        Assert.fail("Expecting exception here");
    } catch (Exception e) {
    // Fine
    }
}
Also used : Greeter(org.apache.hello_world_doc_lit.Greeter) JMSException(javax.jms.JMSException) XAException(javax.transaction.xa.XAException) Test(org.junit.Test) AbstractVmJMSTest(org.apache.cxf.systest.jms.AbstractVmJMSTest)

Aggregations

Greeter (org.apache.hello_world_doc_lit.Greeter)10 Test (org.junit.Test)9 URL (java.net.URL)7 QName (javax.xml.namespace.QName)7 PingMeFault (org.apache.hello_world_doc_lit.PingMeFault)5 SOAPService2 (org.apache.hello_world_doc_lit.SOAPService2)5 Closeable (java.io.Closeable)3 Endpoint (javax.xml.ws.Endpoint)3 TibcoSoapActionInterceptor (org.apache.cxf.binding.soap.interceptor.TibcoSoapActionInterceptor)2 Client (org.apache.cxf.endpoint.Client)2 AbstractVmJMSTest (org.apache.cxf.systest.jms.AbstractVmJMSTest)2 Connection (javax.jms.Connection)1 JMSException (javax.jms.JMSException)1 Queue (javax.jms.Queue)1 XAException (javax.transaction.xa.XAException)1 AddressingFeature (javax.xml.ws.soap.AddressingFeature)1 ActiveMQConnectionFactory (org.apache.activemq.ActiveMQConnectionFactory)1 LoggingInInterceptor (org.apache.cxf.ext.logging.LoggingInInterceptor)1 LoggingOutInterceptor (org.apache.cxf.ext.logging.LoggingOutInterceptor)1 JaxWsProxyFactoryBean (org.apache.cxf.jaxws.JaxWsProxyFactoryBean)1