Package org.jclouds.http.functions

Examples of org.jclouds.http.functions.ReturnStringIf2xx


   public void test() {

      HttpResponse response = HttpResponse.builder().statusCode(200).payload(
               Payloads.newInputStreamPayload(getClass().getResourceAsStream("/complete-multipart-upload.xml")))
               .build();
      ETagFromHttpResponseViaRegex parser = new ETagFromHttpResponseViaRegex(new ReturnStringIf2xx());

      assertEquals(parser.apply(response), "\"3858f62230ac3c915f300c664312c11f-9\"");
   }
View Full Code Here


   public void test() {

      HttpResponse response = HttpResponse.builder().statusCode(200).payload(
               Payloads.newInputStreamPayload(getClass().getResourceAsStream("/initiate-multipart-upload.xml")))
               .build();
      UploadIdFromHttpResponseViaRegex parser = new UploadIdFromHttpResponseViaRegex(new ReturnStringIf2xx());

      assertEquals(parser.apply(response), "VXBsb2FkIElEIGZvciA2aWWpbmcncyBteS1tb3ZpZS5tMnRzIHVwbG9hZA");
   }
View Full Code Here

   @Test
   public void testApplyInputStreamDetails() throws UnknownHostException {
      InputStream is = Strings2
            .toInputStream("{\"error\":[\"invalid tarball: tarball root must contain java-bytearray\"]}");

      ParseErrorFromJsonOrReturnBody parser = new ParseErrorFromJsonOrReturnBody(new ReturnStringIf2xx());
      String response = parser.apply(HttpResponse.builder().statusCode(200).message("ok").payload(is).build());
      assertEquals(response, "invalid tarball: tarball root must contain java-bytearray");
   }
View Full Code Here

   public void test() {
      InputStream is = getClass().getResourceAsStream("/create_queue.xml");

      URI expected = expected();

      RegexQueueHandler handler = new RegexQueueHandler(new ReturnStringIf2xx());
      URI result = handler.apply(HttpResponse.builder().statusCode(200).payload(is).build());

      assertEquals(result.toString(), expected.toString());

   }
View Full Code Here

   public void test() {
      InputStream is = getClass().getResourceAsStream("/send_message.xml");

      MessageIdAndMD5 expected = expected();

      RegexMessageIdAndMD5Handler handler = new RegexMessageIdAndMD5Handler(new ReturnStringIf2xx());
      MessageIdAndMD5 result = handler.apply(HttpResponse.builder().statusCode(200).payload(is).build());

      assertEquals(result.toString(), expected.toString());

   }
View Full Code Here

TOP

Related Classes of org.jclouds.http.functions.ReturnStringIf2xx

Copyright © 2018 www.massapicom. 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.