Package org.jclouds.http

Examples of org.jclouds.http.HttpRequest$ConcreteBuilder


   public void testRetryOn400PutSandbox() {

      HttpCommand command = createMock(HttpCommand.class);
      BackoffLimitedRetryHandler retry = createMock(BackoffLimitedRetryHandler.class);

      HttpRequest request = HttpRequest.builder().method("PUT")
            .endpoint("https://api.opscode.com/organizations/jclouds/sandboxes/bfd68d4052f44053b2e593a33b5e1cd5")
            .build();
      HttpResponse response = HttpResponse
            .builder()
            .statusCode(400)
View Full Code Here


@Test
public class UrlEncodeAndJoinOnNewlineTest {
   UrlEncodeAndJoinOnNewline binder = new UrlEncodeAndJoinOnNewline();

   public void urlEncodesPaths() {
      HttpRequest request = HttpRequest.builder()
                                       .method("DELETE")
                                       .endpoint("https://storage101.dfw1.clouddrive.com/v1/MossoCloudFS_XXXXXX/")
                                       .addQueryParam("bulk-delete").build();

      request = binder.bindToRequest(request, ImmutableList.<String> builder()
            .add("/v1/12345678912345/mycontainer/home/xx<yy")
            .add("/v1/12345678912345/mycontainer/../image.gif").build());

      assertEquals(request.getPayload().getRawContent(), "" //
            + "/v1/12345678912345/mycontainer/home/xx%3Cyy\n" //
            + "/v1/12345678912345/mycontainer/../image.gif");
   }
View Full Code Here

    */
   public InputStream getBlobInputStream(BlobStore blobStore, String containerName, String blobName, boolean signedRequest)
         throws Exception {
      if (signedRequest) {
         BlobStoreContext context = blobStore.getContext();
         HttpRequest request = context.getSigner().signGetBlob(containerName, blobName);
         HttpClient httpClient = context.utils().http();
         HttpResponse response = httpClient.invoke(request);
         int statusCode = response.getStatusCode();
         if (statusCode != 200) {
            throw new IOException(response.getStatusLine());
View Full Code Here

         }
      }

      if (signedRequest) {
         BlobStoreContext context = blobStore.getContext();
         HttpRequest request = context.getSigner().signPutBlob(bucket, blob);
         HttpClient httpClient = context.utils().http();
         HttpResponse response = httpClient.invoke(request);
         int statusCode = response.getStatusCode();
         if (statusCode != 200 && statusCode != 201) {
            throw new IOException(response.getStatusLine());
View Full Code Here

      assertEquals(api.get("myproject"), new ParseProjectTest().expected());
   }

   public void testGetProjectResponseIs4xx() throws Exception {
      HttpRequest getProjectRequest = HttpRequest
              .builder()
              .method("GET")
              .endpoint(PROJECTS_URL_PREFIX + "/myproject")
              .addHeader("Accept", "application/json")
              .addHeader("Authorization", "Bearer " + TOKEN).build();
View Full Code Here

      assertNull(api.get("myproject"));
   }

   public void testSetCommonInstanceMetadata() {
      HttpRequest setMetadata = HttpRequest
              .builder()
              .method("POST")
              .endpoint(PROJECTS_URL_PREFIX + "/myproject/setCommonInstanceMetadata")
              .addHeader("Accept", "application/json")
              .addHeader("Authorization", "Bearer " + TOKEN)
View Full Code Here

           .statusCode(200)
           .payload(staticPayloadFromResource("/machinetype_list.json"))
           .build();

   public void testGetMachineTypeResponseIs2xx() throws Exception {
      HttpRequest get = HttpRequest
              .builder()
              .method("GET")
              .endpoint("https://www.googleapis" +
                      ".com/compute/v1beta13/projects/myproject/machineTypes/n1-standard-1")
              .addHeader("Accept", "application/json")
View Full Code Here

      assertEquals(machineTypeApi.get("n1-standard-1"),
              new ParseMachineTypeTest().expected());
   }

   public void testGetMachineTypeResponseIs4xx() throws Exception {
      HttpRequest get = HttpRequest
              .builder()
              .method("GET")
              .endpoint("https://www.googleapis" +
                      ".com/compute/v1beta13/projects/myproject/machineTypes/n1-standard-1")
              .addHeader("Accept", "application/json")
View Full Code Here

*/
@Test(groups = "unit")
public class DiskApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {

   public void testGetDiskResponseIs2xx() throws Exception {
      HttpRequest get = HttpRequest
              .builder()
              .method("GET")
              .endpoint("https://www.googleapis.com/compute/v1beta13/projects/myproject/disks/testimage1")
              .addHeader("Accept", "application/json")
              .addHeader("Authorization", "Bearer " + TOKEN).build();
View Full Code Here

      assertEquals(api.get("testimage1"),
              new ParseDiskTest().expected());
   }

   public void testGetDiskResponseIs4xx() throws Exception {
      HttpRequest get = HttpRequest
              .builder()
              .method("GET")
              .endpoint("https://www.googleapis.com/compute/v1beta13/projects/myproject/disks/testimage1")
              .addHeader("Accept", "application/json")
              .addHeader("Authorization", "Bearer " + TOKEN).build();
View Full Code Here

TOP

Related Classes of org.jclouds.http.HttpRequest$ConcreteBuilder

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.