Package org.apache.commons.httpclient.methods

Examples of org.apache.commons.httpclient.methods.PutMethod.releaseConnection()


            System.out.println("Response headers:");
            List<Header> headers = Arrays.asList(putHttpMethod.getResponseHeaders());
            System.out.println(headers);
            assertEquals(200, result);
        } finally {
            putHttpMethod.releaseConnection();
        }
    }
}
View Full Code Here


            assertEquals(getStringFromInputStream(expected),
                         getStringFromInputStream(put.getResponseBodyAsStream()));
        } finally {
            // Release current connection to the connection pool once you are
            // done
            put.releaseConnection();
        }
    } 
   
    @Test
    public void testUpdateBookWithDom() throws Exception {
View Full Code Here

            //System.out.println(s);           
            assertTrue(resp.indexOf(s) >= 0);
        } finally {
            // Release current connection to the connection pool once you are
            // done
            put.releaseConnection();
        }
    }
   
    @Test
    public void testUpdateBookWithJSON() throws Exception {
View Full Code Here

            assertEquals(getStringFromInputStream(expected),
                         getStringFromInputStream(put.getResponseBodyAsStream()));
        } finally {
            // Release current connection to the connection pool once you are
            // done
            put.releaseConnection();
        }
    }
   
    @Test
    public void testUpdateBookFailed() throws Exception {
View Full Code Here

        try {
            int result = httpclient.executeMethod(post);
            assertEquals(304, result);
        } finally {
            // Release current connection to the connection pool once you are done
            post.releaseConnection();
        }              
    }
       
    @Test
    public void testGetCDs() throws Exception {
View Full Code Here

   public void testPutReplication() throws Exception {
      PutMethod put = new PutMethod(PATH1 + "a");
      put.setRequestEntity(new StringRequestEntity("data", "application/text", null));
      call(put);
      assertEquals(put.getStatusCode(), HttpServletResponse.SC_OK);
      put.releaseConnection();
      GetMethod get = new GetMethod(PATH1 + "a");
      call(get);
      assertEquals(get.getStatusCode(), HttpServletResponse.SC_OK);
      get.releaseConnection();
      get = new GetMethod(PATH2 + "a");
View Full Code Here

   public void testReplace() throws Exception {
      PutMethod put = new PutMethod(PATH1 + "testReplace");
      put.setRequestEntity(new StringRequestEntity("data", "application/text", null));
      call(put);
      assertEquals(put.getStatusCode(), HttpServletResponse.SC_OK);
      put.releaseConnection();
      put = new PutMethod(PATH1 + "testReplace");
      put.setRequestEntity(new StringRequestEntity("data2", "application/text", null));
      call(put);
      assertEquals(put.getStatusCode(), HttpServletResponse.SC_OK);
      put.releaseConnection();
View Full Code Here

      put.releaseConnection();
      put = new PutMethod(PATH1 + "testReplace");
      put.setRequestEntity(new StringRequestEntity("data2", "application/text", null));
      call(put);
      assertEquals(put.getStatusCode(), HttpServletResponse.SC_OK);
      put.releaseConnection();
      GetMethod get = new GetMethod(PATH2 + "testReplace");
      call(get);
      assertEquals(get.getStatusCode(), HttpServletResponse.SC_OK);
      assertEquals("data2", get.getResponseBodyAsString());
      get.releaseConnection();
View Full Code Here

   public void testExtendedHeaders() throws Exception {
      PutMethod put = new PutMethod(PATH1 + "testExtendedHeaders");
      put.setRequestEntity(new StringRequestEntity("data", "application/text", null));
      call(put);
      assertEquals(put.getStatusCode(), HttpServletResponse.SC_OK);
      put.releaseConnection();
      GetMethod get = new GetMethod(PATH2 + "testExtendedHeaders?extended");
      call(get);
      assertEquals(get.getStatusCode(), HttpServletResponse.SC_OK);
      Header po = get.getResponseHeader("Cluster-Primary-Owner");
      assertNotNull(po);
View Full Code Here

            assertEquals(getStringFromInputStream(expected),
                         getStringFromInputStream(put.getResponseBodyAsStream()));
        } finally {
            // Release current connection to the connection pool once you are
            // done
            put.releaseConnection();
        }
    } 
   
    @Test
    public void testUpdateBookWithDom() 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.