Package org.apache.cxf.systest.jaxrs

Examples of org.apache.cxf.systest.jaxrs.BookStore$StreamingOutputImpl


        Book b = wc.get(Book.class);
        assertEquals(123, b.getId());
       
        wc.back(true);
       
        BookStore bs = JAXRSClientFactory.fromClient(wc, BookStore.class);
        Book b2 = bs.getSecureBook("123");
        assertEquals(b2.getId(), 123);
       
    }
View Full Code Here


                                boolean expectServerException,
                                boolean expectRandom,
                                boolean singleProxy) throws Exception {
        boolean randomized = false;
        String prevEndpoint = null;
        BookStore bookStore = null;
       
        if (singleProxy) {
            bookStore = getBookStore(inactiveReplica, feature);
        }
       
        for (int i = 0; i < 20; i++) {
            if (!singleProxy) {
                bookStore = getBookStore(inactiveReplica, feature);
            }
            verifyStrategy(bookStore, expectRandom
                              ? 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);
View Full Code Here

                                boolean expectServerException,
                                boolean expectRandom) throws Exception {
        boolean randomized = false;
        String prevEndpoint = null;
        for (int i = 0; i < 20; i++) {
            BookStore bookStore = getBookStore(inactiveReplica, feature);
            verifyStrategy(bookStore, expectRandom
                              ? 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);
View Full Code Here

        CustomRetryStrategy strategy = new CustomRetryStrategy();
        strategy.setMaxNumberOfRetries(5);
        strategy.setAlternateAddresses(alternateAddresses);
        feature.setStrategy(strategy);
           
        BookStore store = getBookStore(address, feature);
        try {
            store.getBook("1");
            fail("Exception expected");
        } catch (ClientException ex) {
            assertEquals(10, strategy.getTotalCount());
            assertEquals(5, strategy.getAddressCount(address));
            assertEquals(5, strategy.getAddressCount(address2));
View Full Code Here

                                boolean expectServerException,
                                boolean expectRandom,
                                boolean singleProxy) throws Exception {
        boolean randomized = false;
        String prevEndpoint = null;
        BookStore bookStore = null;
       
        if (singleProxy) {
            bookStore = getBookStore(inactiveReplica, feature);
        }
       
        for (int i = 0; i < 20; i++) {
            if (!singleProxy) {
                feature.getTargetSelector().close();
                bookStore = getBookStore(inactiveReplica, feature);
            }
            verifyStrategy(bookStore, expectRandom
                              ? 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);
View Full Code Here

    }
       
    private void createEndpoint(String address) {
        JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
        sf.setResourceClasses(BookStore.class);
        sf.setResourceProvider(BookStore.class, new SingletonResourceProvider(new BookStore(), false));
        sf.setAddress(address);
        servers.add(sf.create());
    }
View Full Code Here

        alternateAddresses.add(Server.ADDRESS2);
        SequentialStrategy strategy = new SequentialStrategy();
        strategy.setAlternateAddresses(alternateAddresses);
        feature.setStrategy(strategy);
       
        BookStore bookStore = getBookStore(Server.ADDRESS1, feature);
        Book book = bookStore.getBook("123");
        assertEquals("unexpected id", 123L, book.getId());
       
        book = bookStore.getBook("123");
        assertEquals("unexpected id", 123L, book.getId());
    }
View Full Code Here

                                FailoverFeature feature) throws Exception {
        assertEquals(Server.ADDRESS1, initialAddress);
        int address2Count = 0;
        int address3Count = 0;
        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)) {
View Full Code Here

        CustomRetryStrategy strategy = new CustomRetryStrategy();
        strategy.setMaxNumberOfRetries(5);
        strategy.setAlternateAddresses(alternateAddresses);
        feature.setStrategy(strategy);
           
        BookStore store = getBookStore(address, feature);
        try {
            store.getBook("1");
            fail("Exception expected");
        } catch (ClientWebApplicationException ex) {
            assertEquals(10, strategy.getTotalCount());
            assertEquals(5, strategy.getAddressCount(address));
            assertEquals(5, strategy.getAddressCount(address2));
View Full Code Here

                                boolean expectServerException,
                                boolean expectRandom,
                                boolean singleProxy) throws Exception {
        boolean randomized = false;
        String prevEndpoint = null;
        BookStore bookStore = null;
       
        if (singleProxy) {
            bookStore = getBookStore(inactiveReplica, feature);
        }
       
        for (int i = 0; i < 20; i++) {
            if (!singleProxy) {
                feature.getTargetSelector().close();
                bookStore = getBookStore(inactiveReplica, feature);
            }
            verifyStrategy(bookStore, expectRandom
                              ? 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);
View Full Code Here

TOP

Related Classes of org.apache.cxf.systest.jaxrs.BookStore$StreamingOutputImpl

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.