Package org.apache.http.impl.client.cache

Examples of org.apache.http.impl.client.cache.CachingHttpClient.execute()


                EasyMock.same(context))).andReturn(response);
        EasyMock.replay(client);
       
        CachingHttpClient t = new CachingHttpClient(client, resourceFactory, httpCacheStorage, cacheConfig);

        HttpResponse response1 = t.execute(get, context);
        Assert.assertEquals(200, response1.getStatusLine().getStatusCode());
        EntityUtils.consume(response1.getEntity());
       
        EasyMock.verify(client);
       
View Full Code Here


                EasyMock.eq(target),
                EasyMock.isA(HttpRequest.class),
                EasyMock.same(context))).andReturn(response);
        EasyMock.replay(client);
       
        HttpResponse response2 = t.execute(get, context);
        Assert.assertEquals(200, response2.getStatusLine().getStatusCode());
        EntityUtils.consume(response2.getEntity());

        EasyMock.verify(client);
    }
View Full Code Here

                EasyMock.same(context))).andReturn(response);
        EasyMock.replay(client);
       
        CachingHttpClient t = new CachingHttpClient(client, resourceFactory, httpCacheStorage, cacheConfig);

        HttpResponse response1 = t.execute(get, context);
        Assert.assertEquals(200, response1.getStatusLine().getStatusCode());
        EntityUtils.consume(response1.getEntity());
       
        EasyMock.verify(client);
       
View Full Code Here

                EasyMock.eq(target),
                EasyMock.isA(HttpRequest.class),
                EasyMock.same(context))).andReturn(response);
        EasyMock.replay(client);
       
        HttpResponse response2 = t.execute(get, context);
        Assert.assertEquals(200, response2.getStatusLine().getStatusCode());
        EntityUtils.consume(response2.getEntity());

        EasyMock.verify(client);
    }
View Full Code Here

                EasyMock.same(context))).andReturn(response);
        EasyMock.replay(client);
       
        CachingHttpClient t = new CachingHttpClient(client, resourceFactory, httpCacheStorage, cacheConfig);

        HttpResponse response1 = t.execute(get, context);
        Assert.assertEquals(200, response1.getStatusLine().getStatusCode());
        EntityUtils.consume(response1.getEntity());
       
        EasyMock.verify(client);
       
View Full Code Here

                EasyMock.eq(target),
                EasyMock.isA(HttpRequest.class),
                EasyMock.same(context))).andReturn(response);
        EasyMock.replay(client);
       
        HttpResponse response2 = t.execute(get, context);
        Assert.assertEquals(200, response2.getStatusLine().getStatusCode());
        EntityUtils.consume(response2.getEntity());

        EasyMock.verify(client);
    }
View Full Code Here

    public void cacheHit() throws Exception {
        final JarCacheStorage storage = new JarCacheStorage();
        final HttpClient httpClient = new CachingHttpClient(new SystemDefaultHttpClient(), storage,
                storage.getCacheConfig());
        final HttpGet get = new HttpGet("http://nonexisting.example.com/context");
        final HttpResponse resp = httpClient.execute(get);

        assertEquals("application/ld+json", resp.getEntity().getContentType().getValue());
        final String str = IOUtils.toString(resp.getEntity().getContent(), "UTF-8");
        assertTrue(str.contains("ex:datatype"));
    }
View Full Code Here

        final HttpClient httpClient = new CachingHttpClient(new SystemDefaultHttpClient(), storage,
                storage.getCacheConfig());
        final HttpGet get = new HttpGet("http://nonexisting.example.com/notfound");
        // Should throw an IOException as the DNS name
        // nonexisting.example.com does not exist
        final HttpResponse resp = httpClient.execute(get);
    }

    @Test
    public void doubleLoad() throws Exception {
        final JarCacheStorage storage = new JarCacheStorage();
View Full Code Here

    public void doubleLoad() throws Exception {
        final JarCacheStorage storage = new JarCacheStorage();
        final HttpClient httpClient = new CachingHttpClient(new SystemDefaultHttpClient(), storage,
                storage.getCacheConfig());
        final HttpGet get = new HttpGet("http://nonexisting.example.com/context");
        HttpResponse resp = httpClient.execute(get);
        resp = httpClient.execute(get);
        // Ensure second load through the cached jarcache list works
        assertEquals("application/ld+json", resp.getEntity().getContentType().getValue());
    }
View Full Code Here

        final JarCacheStorage storage = new JarCacheStorage();
        final HttpClient httpClient = new CachingHttpClient(new SystemDefaultHttpClient(), storage,
                storage.getCacheConfig());
        final HttpGet get = new HttpGet("http://nonexisting.example.com/context");
        HttpResponse resp = httpClient.execute(get);
        resp = httpClient.execute(get);
        // Ensure second load through the cached jarcache list works
        assertEquals("application/ld+json", resp.getEntity().getContentType().getValue());
    }

    @Test
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.