Package org.jclouds.http

Examples of org.jclouds.http.HttpRequest$ConcreteBuilder


      assertEquals(api.delete("test-1"),
              new ParseOperationTest().expected());
   }

   public void testDeleteInstanceResponseIs4xx() {
      HttpRequest delete = HttpRequest
              .builder()
              .method("DELETE")
              .endpoint("https://www.googleapis" +
                      ".com/compute/v1beta13/projects/myproject/instances/test-1")
              .addHeader("Accept", "application/json")
View Full Code Here


      assertEquals(api.listFirstPage().toString(),
              new ParseInstanceListTest().expected().toString());
   }

   public void testListInstancesResponseIs4xx() {
      HttpRequest list = HttpRequest
              .builder()
              .method("GET")
              .endpoint("https://www.googleapis" +
                      ".com/compute/v1beta13/projects/myproject/instances")
              .addHeader("Accept", "application/json")
View Full Code Here

public class ProjectApiExpectTest extends BaseGoogleComputeEngineApiExpectTest {

   public static final String PROJECTS_URL_PREFIX = "https://www.googleapis.com/compute/v1beta13/projects";

   public void testGetProjectResponseIs2xx() 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

*/
@Test(groups = "unit", testName = "ImageApiExpectTest")
public class ImageApiExpectTest extends BaseGlanceApiExpectTest {

   public void testListWhenResponseIs2xx() throws Exception {
      HttpRequest list = HttpRequest.builder().method("GET")
            .endpoint("https://glance.jclouds.org:9292/v1.0/images")
            .addHeader("Accept", "application/json")
            .addHeader("X-Auth-Token", authToken).build();


View Full Code Here

      assertEquals(apiWhenExist.getImageApiForZone("az-1.region-a.geo-1").list().concat().toString(),
            new ParseImagesTest().expected().toString());
   }

   public void testListWhenReponseIs404IsEmpty() throws Exception {
      HttpRequest list = HttpRequest.builder().method("GET")
            .endpoint("https://glance.jclouds.org:9292/v1.0/images")
            .addHeader("Accept", "application/json")
            .addHeader("X-Auth-Token", authToken).build();

      HttpResponse listResponse = HttpResponse.builder().statusCode(404).build();
View Full Code Here

      assertTrue(apiWhenNoExist.getImageApiForZone("az-1.region-a.geo-1").list().concat().isEmpty());
   }

   public void testListInDetailWhenResponseIs2xx() throws Exception {
      HttpRequest listInDetail = HttpRequest.builder().method("GET")
            .endpoint("https://glance.jclouds.org:9292/v1.0/images/detail")
            .addHeader("Accept", "application/json")
            .addHeader("X-Auth-Token", authToken).build();

View Full Code Here

      assertEquals(apiWhenExistInDetail.getImageApiForZone("az-1.region-a.geo-1").listInDetail().concat().toString(),
            new ParseImagesInDetailTest().expected().toString());
   }

   public void testListInDetailWhenReponseIs404IsEmpty() throws Exception {
      HttpRequest listInDetail = HttpRequest.builder().method("GET")
            .endpoint("https://glance.jclouds.org:9292/v1.0/images/detail")
            .addHeader("Accept", "application/json")
            .addHeader("X-Auth-Token", authToken).build();

View Full Code Here

      assertTrue(apiWhenNoExistInDetail.getImageApiForZone("az-1.region-a.geo-1").listInDetail().concat().isEmpty());
   }

   public void testShowWhenResponseIs2xx() throws Exception {
      HttpRequest show = HttpRequest
            .builder()
            .method("HEAD")
            .endpoint("https://glance.jclouds.org:9292/v1.0/images/fcc451d0-f6e4-4824-ad8f-70ec12326d07")
            .addHeader("X-Auth-Token", authToken).build();
View Full Code Here

      assertEquals(apiWhenExist.getImageApiForZone("az-1.region-a.geo-1").get("fcc451d0-f6e4-4824-ad8f-70ec12326d07").toString(),
            new ParseImageDetailsFromHeadersTest().expected().toString());
   }

   public void testShowWhenReponseIs404IsNull() throws Exception {
      HttpRequest show = HttpRequest.builder().method("HEAD")
            .endpoint("https://glance.jclouds.org:9292/v1.0/images/fcc451d0-f6e4-4824-ad8f-70ec12326d07")
            .addHeader("X-Auth-Token", authToken).build();


      HttpResponse showResponse = HttpResponse.builder().statusCode(404).build();
View Full Code Here

      assertNull(apiWhenNoExist.getImageApiForZone("az-1.region-a.geo-1").get("fcc451d0-f6e4-4824-ad8f-70ec12326d07"));
   }
  

   public void testGetAsStreamWhenResponseIs2xx() throws Exception {
      HttpRequest get = HttpRequest.builder().method("GET")
            .endpoint("https://glance.jclouds.org:9292/v1.0/images/fcc451d0-f6e4-4824-ad8f-70ec12326d07")
            .addHeader("X-Auth-Token", authToken).build();


      HttpResponse getResponse = HttpResponse.builder().statusCode(200).payload(Payloads.newStringPayload("foo")).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.