Package org.jclouds.http

Examples of org.jclouds.http.HttpRequest$ConcreteBuilder


   }

   @Test
   public void testNetworksAndFirewallDeletedWhenAllGroupNodesAreTerminated() throws IOException {

      HttpRequest deleteNodeRequest = HttpRequest.builder()
              .method("DELETE")
              .endpoint("https://www.googleapis" +
                      ".com/compute/v1beta13/projects/myproject/instances/test-delete-networks")
              .addHeader("Accept", "application/json")
              .addHeader("Authorization", "Bearer " + TOKEN).build();

      HttpRequest deleteFirewallRequest = HttpRequest.builder()
              .method("DELETE")
              .endpoint("https://www.googleapis" +
                      ".com/compute/v1beta13/projects/myproject/firewalls/jclouds-test-delete")
              .addHeader("Accept", "application/json")
              .addHeader("Authorization", "Bearer " + TOKEN).build();

      HttpRequest deleteNetworkReqquest = HttpRequest.builder()
              .method("DELETE")
              .endpoint("https://www.googleapis" +
                      ".com/compute/v1beta13/projects/myproject/networks/jclouds-test-delete")
              .addHeader("Accept", "application/json")
              .addHeader("Authorization", "Bearer " + TOKEN).build();
View Full Code Here


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

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

      assertEquals(kernelApi.get("12941177846308850718"),
              new ParseKernelTest().expected());
   }

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

      assertNull(kernelApi.get("12941177846308850718"));
   }

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

      assertEquals(kernelApi.listFirstPage().toString(),
              new ParseKernelListTest().expected().toString());
   }

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

                                String content, Class<? extends Exception> expected) {

      GoogleComputeEngineErrorHandler function = new GoogleComputeEngineErrorHandler();

      HttpCommand command = createMock(HttpCommand.class);
      HttpRequest request = HttpRequest.builder().method(method).endpoint(uri).build();
      HttpResponse response = HttpResponse.builder().statusCode(statusCode).message(message).payload(content).build();
      response.getPayload().getContentMetadata().setContentType(contentType);

      expect(command.getCurrentRequest()).andReturn(request).atLeastOnce();
      command.setException(classEq(expected));
View Full Code Here

      assertEquals(api.get("jclouds-test"),
              new ParseNetworkTest().expected());
   }

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

      assertNull(api.get("jclouds-test"));
   }

   public void testInsertNetworkResponseIs2xx() {
      HttpRequest insert = HttpRequest
              .builder()
              .method("POST")
              .endpoint("https://www.googleapis.com/compute/v1beta13/projects/myproject/networks")
              .addHeader("Accept", "application/json")
              .addHeader("Authorization", "Bearer " + TOKEN)
View Full Code Here

      assertEquals(api.createInIPv4Range("test-network", "10.0.0.0/8"), new ParseOperationTest().expected());
   }

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

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

   public void testDeleteNetworkResponseIs4xx() {
      HttpRequest delete = HttpRequest
              .builder()
              .method("DELETE")
              .endpoint("https://www.googleapis" +
                      ".com/compute/v1beta13/projects/myproject/networks/jclouds-test")
              .addHeader("Accept", "application/json")
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.