Package org.jclouds.openstack.nova.v2_0

Examples of org.jclouds.openstack.nova.v2_0.NovaApi


            .statusCode(200)
            .headers(
                  ImmutableMultimap.<String, String> builder()
                  .put("Location", "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/images/" + imageId).build()).build();

      NovaApi apiWhenServerExists = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
               responseWithKeystoneAccess, createImage, createImageResponse);

      assertEquals(apiWhenServerExists.getServerApiForZone("az-1.region-a.geo-1").createImageFromServer(imageName, serverId),
            imageId);
   }
View Full Code Here


            .payload(payloadFromStringWithContentType(
                  "{\"createImage\":{\"name\":\"" + imageName + "\", \"metadata\": {}}}", "application/json"))
               .build();

      HttpResponse createImageResponse = HttpResponse.builder().statusCode(404).build();
      NovaApi apiWhenServerDoesNotExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
               responseWithKeystoneAccess, createImage, createImageResponse);

      try {
         apiWhenServerDoesNotExist.getServerApiForZone("az-1.region-a.geo-1").createImageFromServer(imageName, serverId);
         fail("Expected an exception.");
      } catch (Exception e) {
         // expected
      }
   }
View Full Code Here

                  "{\"os-stop\":null}", "application/json"))
               .build();

      HttpResponse stopServerResponse = HttpResponse.builder().statusCode(202).build();

      NovaApi apiWhenServerExists = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
               responseWithKeystoneAccess, stopServer, stopServerResponse);

      apiWhenServerExists.getServerApiForZone("az-1.region-a.geo-1").stop(serverId);
   }
View Full Code Here

                  "{\"os-stop\":null}", "application/json"))
               .build();

      HttpResponse stopServerResponse = HttpResponse.builder().statusCode(404).build();

      NovaApi apiWhenServerExists = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
               responseWithKeystoneAccess, stopServer, stopServerResponse);

      try {
         apiWhenServerExists.getServerApiForZone("az-1.region-a.geo-1").stop(serverId);
         fail("Expected an exception.");
      } catch (Exception e) {
         // expected
      }
   }
View Full Code Here

                  "{\"os-start\":null}", "application/json"))
               .build();

      HttpResponse startServerResponse = HttpResponse.builder().statusCode(202).build();

      NovaApi apiWhenServerExists = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
               responseWithKeystoneAccess, startServer, startServerResponse);

      apiWhenServerExists.getServerApiForZone("az-1.region-a.geo-1").start(serverId);
   }
View Full Code Here

                  "{\"os-startp\":null}", "application/json"))
               .build();

      HttpResponse startServerResponse = HttpResponse.builder().statusCode(404).build();

      NovaApi apiWhenServerExists = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
               responseWithKeystoneAccess, startServer, startServerResponse);

      try {
         apiWhenServerExists.getServerApiForZone("az-1.region-a.geo-1").start(serverId);
         fail("Expected an exception.");
      } catch (Exception e) {
         // expected
      }
   }
View Full Code Here

       
      HttpResponse getMetadataResponse = HttpResponse.builder().statusCode(200)
              .payload(payloadFromResource("/metadata_list.json")).build();
     
     
      NovaApi apiWhenServerExists = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
               responseWithKeystoneAccess, getMetadata, getMetadataResponse);

      assertEquals(apiWhenServerExists.getServerApiForZone("az-1.region-a.geo-1").getMetadata(serverId).toString()
             new ParseMetadataListTest().expected().toString());
   }
View Full Code Here

            .addHeader("X-Auth-Token", authToken)
            .build();

      HttpResponse getMetadataResponse = HttpResponse.builder().statusCode(404).build();

      NovaApi apiWhenServerExists = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
               responseWithKeystoneAccess, getMetadata, getMetadataResponse);

      try {
       apiWhenServerExists.getServerApiForZone("az-1.region-a.geo-1").getMetadata(serverId);
         fail("Expected an exception.");
      } catch (Exception e) {
         // expected
      }
   }
View Full Code Here

            .build();

      HttpResponse setMetadataResponse = HttpResponse.builder().statusCode(200)
              .payload(payloadFromResource("/metadata_list.json")).build();
     
      NovaApi apiWhenServerExists = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
               responseWithKeystoneAccess, setMetadata, setMetadataResponse);

      assertEquals(apiWhenServerExists.getServerApiForZone("az-1.region-a.geo-1").setMetadata(serverId, metadata).toString()
             new ParseMetadataListTest().expected().toString());
   }
View Full Code Here

            .payload(payloadFromStringWithContentType("{\"metadata\":{\"Server Label\":\"Web Head 1\",\"Image Version\":\"2.1\"}}","application/json"))
            .build();

      HttpResponse setMetadataResponse = HttpResponse.builder().statusCode(404).build();

      NovaApi apiWhenServerExists = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
               responseWithKeystoneAccess, setMetadata, setMetadataResponse);

      try {
       apiWhenServerExists.getServerApiForZone("az-1.region-a.geo-1").setMetadata(serverId, metadata);
         fail("Expected an exception.");
      } catch (Exception e) {
         // expected
      }
   }
View Full Code Here

TOP

Related Classes of org.jclouds.openstack.nova.v2_0.NovaApi

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.