use of org.apache.cxf.systest.jaxrs.Book in project cxf by apache.
the class JAXRSJmsTest method testGetBookFromSubresourceProxyClient.
@Test
public void testGetBookFromSubresourceProxyClient() throws Exception {
// setup the the client
String endpointAddressUrlEncoded = "jms:jndi:dynamicQueues/test.jmstransport.text" + "?jndiInitialContextFactory=org.apache.activemq.jndi.ActiveMQInitialContextFactory" + "&replyToName=dynamicQueues/test.jmstransport.response" + "&jndiURL=tcp://localhost:" + JMS_PORT + "&jndiConnectionFactoryName=ConnectionFactory";
JMSBookStore client = JAXRSClientFactory.create(endpointAddressUrlEncoded, JMSBookStore.class);
Book bookProxy = client.getBookSubResource("123");
Book book = bookProxy.retrieveState();
assertEquals("Get a wrong response code.", 200, WebClient.client(bookProxy).getResponse().getStatus());
assertEquals("Get a wrong book id.", 123, book.getId());
}
use of org.apache.cxf.systest.jaxrs.Book in project cxf by apache.
the class JAXRSJmsTest method testGetBookFromWebClientWithTextJMSMessage.
@Test
public void testGetBookFromWebClientWithTextJMSMessage() throws Exception {
// setup the the client
String endpointAddressUrlEncoded = "jms:jndi:dynamicQueues/test.jmstransport.text" + "?replyToName=dynamicQueues/test.jmstransport.response" + "&jndiInitialContextFactory=org.apache.activemq.jndi.ActiveMQInitialContextFactory" + "&jndiURL=tcp://localhost:" + JMS_PORT + "&messageType=text";
WebClient client = WebClient.create(endpointAddressUrlEncoded);
WebClient.getConfig(client).getInInterceptors().add(new LoggingInInterceptor());
WebClient.getConfig(client).getRequestContext().put(org.apache.cxf.message.Message.REQUEST_URI, "/bookstore/books/123");
Book book = client.get(Book.class);
assertEquals("Get a wrong response code.", 200, client.getResponse().getStatus());
assertEquals("Get a wrong book id.", 123, book.getId());
}
use of org.apache.cxf.systest.jaxrs.Book in project cxf by apache.
the class JAXRSJmsTest method testGetBookFromProxyClient.
@Test
public void testGetBookFromProxyClient() throws Exception {
// setup the the client
String endpointAddressUrlEncoded = "jms:jndi:dynamicQueues/test.jmstransport.text" + "?jndiInitialContextFactory=org.apache.activemq.jndi.ActiveMQInitialContextFactory" + "&replyToName=dynamicQueues/test.jmstransport.response" + "&jndiURL=tcp://localhost:" + JMS_PORT + "&jndiConnectionFactoryName=ConnectionFactory";
JMSBookStore client = JAXRSClientFactory.create(endpointAddressUrlEncoded, JMSBookStore.class);
Book book = client.getBook("123");
assertEquals("Get a wrong response code.", 200, WebClient.client(client).getResponse().getStatus());
assertEquals("Get a wrong book id.", 123, book.getId());
}
use of org.apache.cxf.systest.jaxrs.Book in project cxf by apache.
the class JAXRSCompletionStageTest method testGetBookAsyncStageAsyncResponse.
@Test
public void testGetBookAsyncStageAsyncResponse() throws Exception {
String address = "http://localhost:" + PORT + "/completable/booksAsync";
WebClient wc = createWebClient(address);
CompletionStage<Book> stage = wc.path("123").rx().get(Book.class);
Book book = stage.toCompletableFuture().join();
assertEquals(123L, book.getId());
}
use of org.apache.cxf.systest.jaxrs.Book in project cxf by apache.
the class JAXRSCompletionStageTest method testGetBookAsyncStage.
@Test
public void testGetBookAsyncStage() throws Exception {
String address = "http://localhost:" + PORT + "/completable/books";
WebClient wc = createWebClient(address);
CompletionStage<Book> stage = wc.path("123").rx().get(Book.class);
Book book = stage.toCompletableFuture().join();
assertEquals(123L, book.getId());
}
Aggregations