Package org.apache.abdera.protocol.client

Examples of org.apache.abdera.protocol.client.ClientResponse.release()


        Assert.assertNotNull(res);
        try {
            // Should return 304 - Feed not provided since feed is modified since.     
            Assert.assertEquals(304, res.getStatus());
        } finally {
            res.release();
        }
    }   

    @Test
    public void testModifiedGetIfModified() throws Exception {   
View Full Code Here


            String thisETag = res.getHeader("ETag");
            Assert.assertNotNull( thisETag );
            Date thisLastModified = res.getLastModified();
            Assert.assertNotNull( thisLastModified );                       
        } finally {
            res.release();
        }
    }   


    public static void printFeed( String title, String indent, Feed feed ) {
View Full Code Here

        IRI colUri = new IRI(providerURI).resolve("customer");
        ClientResponse res = client.get(colUri.toString() + "/" + lastId, opts);
        Assert.assertEquals(200, res.getStatus());
        String returnedContentType = res.getContentType().toString().trim();
        // Assert.assertEquals(contentType, returnedContentType );
        res.release();     
    }

    @Test
    public void testJSONEntryGet() throws Exception {
        //System.out.println(">>>ContentNegotiationTest.testJSONEntryGet");
View Full Code Here

            Assert.assertTrue( -1 < responseBody.indexOf( "\"title\"" ));
            Assert.assertTrue( -1 < responseBody.indexOf( "\"updated\"" ));
            // AtomTestCaseUtils.printResponseHeaders( "JSON Entry response headers:", "   ", res );
            // System.out.println( "ContentNegotiationTest.testJSONEntryGet JSON entry body=" + responseBody );
        } finally {
            res.release();           
        }
    }

    @Test
    public void testXMLFeedGet() throws Exception {   
View Full Code Here

            Assert.assertNotNull( feed.getId() );
            Assert.assertNotNull( feed.getTitle() );
            Assert.assertNotNull( feed.getUpdated() );
            // AtomTestCaseUtils.printFeed( "Feed values", "   ", feed );
        } finally {
            res.release();
        }
    }   

    @Test
    public void testJSONFeedGet() throws Exception {   
View Full Code Here

            Assert.assertTrue( -1 < responseBody.indexOf( "\"updated\"" ));
            Assert.assertTrue( -1 < responseBody.indexOf( "\"entries\"" ));
            // AtomTestCaseUtils.printResponseHeaders( "JSON Entry response headers:", "   ", res );
            // System.out.println( "ContentNegotiationTest.testJSONEntryGet JSON entry body=" + responseBody );
        } finally {
            res.release();
        }
    }

    protected String readResponse( Reader responseReader ) {
        if ( responseReader == null ) return "";
View Full Code Here

        // If-Match Assert response status code is 412. Precondition failed.
        // If-None-Match Assert response status code is 200. OK
        Assert.assertEquals(200, res.getStatus());
        // Put provides null body and no etags.
        res.release();
    }

    @Test
    public void testETagMissGet() throws Exception {
        // 4) Conditional GET example (get with etag. etag not in cache)
View Full Code Here

        // Assert.assertNotNull( res.getLocation().toString() );
        // Assert.assertEquals( "", res.getContentLocation().toString() );
        Assert.assertNotNull( res.getHeader( "ETag" ) );      
        lastModified = res.getLastModified();
        Assert.assertNotNull(lastModified);
        res.release();
    }

    @Test
    public void testETagHitGet() throws Exception {
        // 3) Conditional GET example (get with etag. etag match)
View Full Code Here

        // Assert response status code is 304 Not Modified.
        // Assert header ETag: "e180ee84f0671b1"
        // Assert header Last-Modified: Fri, 25 Jul 2008 14:36:44 -0500
        // Assert.assertEquals(304, res.getStatus());
        res.release();     
    }


    @Test
    public void testUpToDateGet() throws Exception {
View Full Code Here

        // >      HTTP/1.1 304 Not Modified
        //       Date: Sat, 24 Feb 2007 13:17:11 GMT

        // Assert response status code is 304 Not Modified.
        Assert.assertEquals(304, res.getStatus());
        res.release();     
    }

    @Test
    public void testOutOfDateGet() throws Exception {
        // 4) Conditional GET example (get with If-Mod. entry is not to date)
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.