Package org.apache.cxf.systest.jaxrs

Examples of org.apache.cxf.systest.jaxrs.Book


        @FormParam("name") String name, @FormParam("id") long id) {
        if (name == null || id == 0 || map.getFirst("name") == null
            || Integer.valueOf(map.getFirst("id")) == 0) {
            throw new RuntimeException("FormParams are not set");
        }
        return new Book(name, id);
    }
View Full Code Here


        String name = params.get("name")[0];
        Long id = Long.valueOf(params.get("id")[0]);
        if (name == null || id == 0) {
            throw new RuntimeException("FormParams are not set");
        }
        return new Book(name, id);
    }
View Full Code Here

        for (int i = 0; i < 20; i++) {
            BookStore bookStore = getBookStore(initialAddress, feature);
            verifyStrategy(bookStore, SequentialStrategy.class);
            String bookId = "123";
           
            Book book = bookStore.getBook(bookId);
            assertNotNull("expected non-null response", book);
            assertEquals("unexpected id", 123L, book.getId());
           
            String address = getCurrentEndpointAddress(bookStore);
            if (Server.ADDRESS2.equals(address)) {
                address2Count++;
            } else if (Server.ADDRESS3.equals(address)) {
View Full Code Here

                              ? RandomStrategy.class
                              : SequentialStrategy.class);
            String bookId = expectServerException ? "9999" : "123";
            Exception ex = null;
            try {
                Book book = bookStore.getBook(bookId);
                assertNotNull("expected non-null response", book);
                assertEquals("unexpected id", 123L, book.getId());
            } catch (Exception error) {
                if (!expectServerException) {
                    //String currEndpoint = getCurrentEndpointAddress(bookStore);
                    //assertTrue(currEndpoint.equals(inactiveReplica));
                    throw error;
View Full Code Here

                              : SequentialStrategy.class);
            String bookId = expectServerException ? "9999" : "123";
            bookStore.path("bookstore/books").path(bookId);
            Exception ex = null;
            try {
                Book book = bookStore.get(Book.class);
                assertNotNull("expected non-null response", book);
                assertEquals("unexpected id", 123L, book.getId());
            } catch (Exception error) {
                if (!expectServerException) {
                    throw error;
                }
                ex = error;
View Full Code Here

   
    private void doGetBookProxyClient(String address, String username, String password, int expectedStatus)
        throws BookNotFoundFault {
        SecureBookInterface books = JAXRSClientFactory.create(address, SecureBookInterface.class,
                                                       username, password, null);
        Book b = books.getThatBook();
        assertEquals(123, b.getId());
        Response r = WebClient.client(books).getResponse();
        assertEquals(expectedStatus, r.getStatus());
           
    }
View Full Code Here

        builder.keyStore(keyStore, "password");
       
        Client client = builder.build();
       
        WebTarget target = client.target("https://localhost:" + PORT + "/bookstore/securebooks/123");
        Book b = target.request().accept(MediaType.APPLICATION_XML_TYPE).get(Book.class);
        assertEquals(123, b.getId());
    }
View Full Code Here

       
       
        Client client = builder.build();
       
        WebTarget target = client.target("https://localhost:" + PORT + "/bookstore/securebooks/123");
        Book b = target.request().accept(MediaType.APPLICATION_XML_TYPE).get(Book.class);
        assertEquals(123, b.getId());
    }
View Full Code Here

        AuthorizationPolicy pol = new AuthorizationPolicy();
        pol.setUserName("bob");
        pol.setPassword("bobspassword");
        WebClient.getConfig(wc).getHttpConduit().setAuthorization(pol);
        wc.accept("application/xml");
        Book book = wc.get(Book.class);
        assertEquals(123L, book.getId());
    }
View Full Code Here

        String endpointAddress =
            "http://localhost:" + PORT + "/service/jaas2/bookstorestorage/thosebooks/123";
        WebClient wc = WebClient.create(endpointAddress, "bob", "bobspassword", null);
        //WebClient.getConfig(wc).getOutInterceptors().add(new LoggingOutInterceptor());
        wc.accept("application/xml");
        Book book = wc.get(Book.class);
        assertEquals(123L, book.getId());
    }
View Full Code Here

TOP

Related Classes of org.apache.cxf.systest.jaxrs.Book

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.