Package org.apache.abdera.protocol.client

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


        // 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 testUpToDateUnModGet() throws Exception {
        // 3) Conditional GET example (get with If-Unmod. entry is not modified (< predicate date).
View Full Code Here


        // Assert header Location: http://example.org/edit/first-post.atom
        // Assert header Content-Location: http://example.org/edit/first-post.atom
        // Assert header ETag: "e180ee84f0671b1"
        // Assert header Last-Modified: Less than If-Unmod     
        Assert.assertEquals(200, res.getStatus());
        res.release();         
    }

    @Test
    public void testOutOfDateUnModGet() throws Exception {
        // 4) Conditional GET example (get with If-Unmod. entry is modified (> predicate date)
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();     
    }
}
View Full Code Here

                    new StringRequestEntity(getRequest(id, pwd, service));
            RequestOptions options = client.getDefaultRequestOptions();
            options.setContentType("application/x-www-form-urlencoded");
            ClientResponse response = client.post(URI, stringreq, options);
            String auth = read(response.getInputStream());
            response.release();
            return auth.split("\n")[2].replaceAll("Auth=", "auth=");
        } catch (CarbonException e) {
            log.error("Error reading content from Google Client Login for \"" + id + "\"", e);
        } catch (UnsupportedEncodingException e) {
            log.error("Error parsing content from Google Client Login for \"" + id + "\"", e);
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

      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

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.