Examples of async()


Examples of net.jcores.jre.cores.CoreString.async()

                $.sys.sleep(100);
                return x + x;
            }
        };
       
        CoreObject<String> result = c.async(f).await();
        Assert.assertEquals("aabbccddee", result.string().join());
       
        CoreObject<String> result2 = c.async(f, KillSwitch.TIMED(150)).await();
        Assert.assertTrue(result2.contains("aa"));
        Assert.assertFalse(result2.contains("cc"));
View Full Code Here

Examples of org.apache.cxf.jaxrs.client.WebClient.async()

   
    @Test
    public void testGetBookAsyncNoCallback() throws Exception {
        String address = "http://localhost:" + PORT + "/bookstore/bookheaders/simple";
        WebClient wc = createWebClient(address);
        Future<Book> future = wc.async().get(Book.class);
        Book book = future.get();
        assertEquals(124L, book.getId());
        validateResponse(wc);
    }
   
View Full Code Here

Examples of org.apache.cxf.jaxrs.client.WebClient.async()

        GenericEntity<List<Book>> collectionEntity = createGenericEntity();
       
        final Holder<Book> holder = new Holder<Book>();
        InvocationCallback<Book> callback = createCallback(holder);       
           
        Future<Book> future = wc.async().post(Entity.entity(collectionEntity, "application/xml"),
                                              callback);
        Book book = future.get();
        assertEquals(200, wc.getResponse().getStatus());
        assertSame(book, holder.value);
        assertNotSame(collectionEntity.getEntity().get(0), book);
View Full Code Here

Examples of org.apache.cxf.jaxrs.client.WebClient.async()

        wc.accept("application/xml").type("application/xml");
        GenericEntity<List<Book>> collectionEntity = createGenericEntity();
        final Holder<List<Book>> holder = new Holder<List<Book>>();
        InvocationCallback<List<Book>> callback = new CustomInvocationCallback(holder);
           
        Future<List<Book>> future = wc.async().post(Entity.entity(collectionEntity, "application/xml"),
                                                    callback);   
           
        List<Book> books2 = future.get();
        assertNotNull(books2);
       
View Full Code Here

Examples of org.apache.cxf.jaxrs.client.WebClient.async()

        wc.accept("application/xml").type("application/xml");
        GenericEntity<List<Book>> collectionEntity = createGenericEntity();
        GenericType<List<Book>> genericResponseType = new GenericType<List<Book>>() {       
        };
           
        Future<List<Book>> future = wc.async().post(Entity.entity(collectionEntity, "application/xml"),
                                                    genericResponseType);   
           
        List<Book> books2 = future.get();
        assertNotNull(books2);
       
View Full Code Here

Examples of org.apache.cxf.jaxrs.client.WebClient.async()

        WebClient wc = createWebClient(address);
       
        final Holder<Book> holder = new Holder<Book>();
        InvocationCallback<Book> callback = createCallback(holder);
       
        Future<Book> future = asyncInvoker ? wc.async().get(callback) : wc.get(callback);
        Book book = future.get();
        assertSame(book, holder.value);
        assertEquals(124L, book.getId());
        validateResponse(wc);  
    }
View Full Code Here

Examples of org.apache.cxf.jaxrs.client.WebClient.async()

            }
            public void failed(ClientException error) {
            }
        };
       
        Future<Response> future = asyncInvoker ? wc.async().get(callback) : wc.get(callback);
        Book book = future.get().readEntity(Book.class);
        assertEquals(124L, book.getId());
        validateResponse(wc);  
    }
   
View Full Code Here

Examples of org.apache.cxf.jaxrs.client.WebClient.async()

   
    @Test
    public void testPostBookAsync() throws Exception {
        String address = "http://localhost:" + PORT + "/bookstore/bookheaders/simple";
        WebClient wc = createWebClientPost(address);
        Future<Book> future = wc.async().post(Entity.xml(new Book("Book", 126L)), Book.class);
        assertEquals(124L, future.get().getId());
        validatePostResponse(wc);
    }
   
    @Test
View Full Code Here

Examples of org.apache.cxf.jaxrs.client.WebClient.async()

    @Test
    public void testRetrieveBookCustomMethodAsync() throws Exception {
        String address = "http://localhost:" + PORT + "/bookstore/retrieve";
        WebClient wc = WebClient.create(address);
        wc.accept("application/xml");
        Future<Book> book = wc.async().method("RETRIEVE", Entity.xml(new Book("Retrieve", 123L)),
                                              Book.class);
        assertEquals("Retrieve", book.get().getName());
    }
   
    @Test
View Full Code Here

Examples of org.apache.cxf.jaxrs.client.WebClient.async()

   
    @Test
    public void testGetBookAsyncResponse404() throws Exception {
        String address = "http://localhost:" + PORT + "/bookstore/bookheaders/404";
        WebClient wc = createWebClient(address);
        Future<Response> future = wc.async().get(Response.class);
        assertEquals(404, future.get().getStatus());
    }
   
    @Test
    public void testGetBookAsync404() throws Exception {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.