Package org.jclouds.gogrid.domain

Examples of org.jclouds.gogrid.domain.ServerImage


         }
      };

      assert Iterables.all(images, isDatabaseServer) : "All of the images should've been of database type";

      ServerImage image = Iterables.getLast(images);
      ServerImage imageFromServer = Iterables
               .getOnlyElement(api.getImageServices().getImagesByName(image.getName()));
      assertEquals(image, imageFromServer);

      try {
         api.getImageServices().editImageDescription(image.getName(), "newDescription");
View Full Code Here


      Location location = new LocationBuilder().scope(LocationScope.ZONE).id("1").description("US-West-1").build();
      Set< ? extends Location> locations = ImmutableSet.< Location> of( location);
     
      expect(server.getIp()).andReturn(Ip.builder().ip("127.0.0.1").build());

      ServerImage image = createMock(ServerImage.class);
      expect(server.getImage()).andReturn(image).atLeastOnce();
      expect(server.getRam()).andReturn(ram).atLeastOnce();
      expect(server.getDatacenter()).andReturn(dc).atLeastOnce();
      expect(image.getId()).andReturn(2000l).atLeastOnce();
      expect(jcImage.getProviderId()).andReturn("2000").atLeastOnce();
      expect(jcImage.getLocation()).andReturn(location).atLeastOnce();
      expect(jcImage.getOperatingSystem()).andReturn(createMock(OperatingSystem.class)).atLeastOnce();

      replay(serverStateToNodeStatus);
View Full Code Here

         }
      };

      assert Iterables.all(images, isDatabaseServer) : "All of the images should've been of database type";

      ServerImage image = Iterables.getLast(images);
      ServerImage imageFromServer = Iterables
               .getOnlyElement(api.getImageServices().getImagesByName(image.getName()));
      assertEquals(image, imageFromServer);

      try {
         api.getImageServices().editImageDescription(image.getName(), "newDescription");
View Full Code Here

      assert null != response;
      for (ServerImage image : response) {
         assert image.getId() >= 0 : image;
         checkImage(image);

         ServerImage query = Iterables.getOnlyElement(api.getImageServices()
               .getImagesById(image.getId()));
         assertEquals(query.getId(), image.getId());

         checkImage(query);
      }
   }
View Full Code Here

   public void testSaveServerToImage() throws IOException {
      Predicate<Server> serverLatestJobCompleted = retry(new ServerLatestJobCompleted(api
            .getJobServices()), 800, 20, SECONDS);

      final String nameOfServer = "Server" + String.valueOf(new Date().getTime()).substring(6);
      ServerImage image = null;
      try {
         Set<Ip> availableIps = api.getIpServices().getUnassignedPublicIpList();
         Ip availableIp = Iterables.getLast(availableIps);

         Server createdServer = api.getServerServices()
               .addServer(nameOfServer, "5489", "1", availableIp.getIp());
         assertNotNull(createdServer);
         assert serverLatestJobCompleted.apply(createdServer);
         image = api
               .getImageServices()
               .saveImageFromServer("friendlyName", createdServer.getName(),
                     SaveImageOptions.Builder.withDescription("description"));
        
         assertEquals(image.getFriendlyName(), "friendlyName");
         assertEquals(image.getDescription(), "description");
         assertFalse(image.isPublic());

         assertEventuallyImageStateEquals(image, ServerImageState.AVAILABLE);
        
         api.getImageServices().deleteById(image.getId());

         assertEventuallyImageStateEquals(image, ServerImageState.TRASH);
        
         image = null;
      } finally {
         if (image != null)
            try {
               api.getImageServices().deleteById(image.getId());
            } catch (Exception e) {
               // not failing so that we can ensure server below deletes
               e.printStackTrace();
            }
         // delete the server
View Full Code Here

TOP

Related Classes of org.jclouds.gogrid.domain.ServerImage

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.