Search in sources :

Example 1 with BookNotFoundFault

use of org.apache.camel.example.cxf.jaxrs.resources.BookNotFoundFault in project camel by apache.

the class JAXRSClientServerTest method testJAXWSClient.

@Test
public void testJAXWSClient() throws BookNotFoundFault {
    JAXWSClient jaxwsClient = new JAXWSClient();
    BookStore bookStore = jaxwsClient.getBookStore();
    bookStore.addBook(new Book("Camel User Guide", 123L));
    Book book = bookStore.getBook(123L);
    assertNotNull("We should find the book here", book);
    try {
        book = bookStore.getBook(124L);
        fail("We should not have this book");
    } catch (Exception exception) {
        assertTrue("The exception should be BookNotFoundFault", exception instanceof BookNotFoundFault);
    }
}
Also used : BookStore(org.apache.camel.example.cxf.jaxrs.resources.BookStore) BookNotFoundFault(org.apache.camel.example.cxf.jaxrs.resources.BookNotFoundFault) Book(org.apache.camel.example.cxf.jaxrs.resources.Book) Test(org.junit.Test)

Example 2 with BookNotFoundFault

use of org.apache.camel.example.cxf.jaxrs.resources.BookNotFoundFault in project camel by apache.

the class JAXRSClientServerTest method testJAXRSClient.

@Test
public void testJAXRSClient() throws BookNotFoundFault {
    // JAXRSClient invocation
    JAXRSClient jaxrsClient = new JAXRSClient();
    BookStore bookStore = jaxrsClient.getBookStore();
    bookStore.addBook(new Book("Camel User Guide", 124L));
    Book book = bookStore.getBook(124L);
    assertNotNull("We should find the book here", book);
    try {
        book = bookStore.getBook(126L);
        fail("We should not have this book");
    } catch (Exception exception) {
        assertTrue("The exception should be BookNotFoundFault", exception instanceof BookNotFoundFault);
    }
}
Also used : BookStore(org.apache.camel.example.cxf.jaxrs.resources.BookStore) BookNotFoundFault(org.apache.camel.example.cxf.jaxrs.resources.BookNotFoundFault) Book(org.apache.camel.example.cxf.jaxrs.resources.Book) Test(org.junit.Test)

Aggregations

Book (org.apache.camel.example.cxf.jaxrs.resources.Book)2 BookNotFoundFault (org.apache.camel.example.cxf.jaxrs.resources.BookNotFoundFault)2 BookStore (org.apache.camel.example.cxf.jaxrs.resources.BookStore)2 Test (org.junit.Test)2