Package org.apache.abdera.protocol.client

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


    try {
      assertEquals(200, response.getStatus());
      Document<Feed> feed_doc = response.getDocument();
      assertEquals(1, feed_doc.getRoot().getEntries().size());
    } finally {
      response.release();
    }

    // get the entry to see if we can get it
    response = client.get(self_uri, options);
View Full Code Here


      // change the entry
      Document<Entry> doc = response.getDocument();
      entry = (Entry) doc.getRoot().clone();
      entry.setTitle("New title");
    } finally
      response.release();
    }

    // submit the changed entry back to the server
    response = client.put(edit_uri, entry, options);
View Full Code Here

    response = client.put(edit_uri, entry, options);

    try {
      assertEquals(204, response.getStatus());
    } finally {
      response.release();
    }

    // check to see if the entry was modified properly
    response = client.get(self_uri, options);
View Full Code Here

            // RFC 4287 requires non-null id, title, updated elements
            Assert.assertTrue( -1 != body.indexOf( "</id>" ));
            Assert.assertTrue( -1 != body.indexOf( "</title>" ));
            Assert.assertTrue( -1 != body.indexOf( "</updated>" ));
        } finally {
            res.release();
        }
    }   

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

            String title = collection.getTitle();
            Assert.assertEquals("customers", title);
            String href = collection.getHref().toString();
            Assert.assertTrue( href.contains( "customer") );
        } finally {
            res.release();
        }
    }

    public static void printFeed( String title, String indent, Feed feed ) {
        if ( feed == null ) {
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

            eTag = res.getHeader("ETag");
            Assert.assertNotNull( eTag );
            lastModified = res.getLastModified();
            Assert.assertNotNull( lastModified );
        } finally {
            res.release();
        }
    }

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

            Assert.assertEquals(ResponseType.SUCCESS, res.getType());
            // AtomTestCaseUtils.printResponseHeaders( "Feed response headers:", "   ", res );
            // System.out.println("Feed response content:");
            // AtomTestCaseUtils.prettyPrint(abdera, res.getDocument());
        } finally {
            res.release();
        }
    }

    @Test
    public void testUnmodifiedGetIfNoneMatch() 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.