Package org.jclouds.digitalocean.domain

Examples of org.jclouds.digitalocean.domain.Droplet


      DigitalOceanApi api = api(server.getUrl("/"));
      DropletApi dropletApi = api.getDropletApi();

      try {
         Droplet droplet = dropletApi.get(100823);

         assertRequestHasCommonFields(server.takeRequest(), "/droplets/100823");
         assertNotNull(droplet);
         assertNotNull(droplet.getBackups());
         assertNotNull(droplet.getSnapshots());
         assertEquals(droplet.getName(), "test222");
         assertEquals(droplet.getStatus(), Status.ACTIVE);
      } finally {
         api.close();
         server.shutdown();
      }
   }
View Full Code Here


      DigitalOceanApi api = api(server.getUrl("/"));
      DropletApi dropletApi = api.getDropletApi();

      try {
         Droplet droplet = dropletApi.get(100823);

         assertRequestHasCommonFields(server.takeRequest(), "/droplets/100823");
         assertNull(droplet);
      } finally {
         api.close();
View Full Code Here

      function = createNodeParser(hardwares, images, locations, ImmutableMap.of("node#1", (Credentials) credentials));
   }

   @Test
   public void testConvertDroplet() throws ParseException {
      Droplet droplet = new Droplet(1, "mock-droplet", 1, 1, 1, false, ImmutableList.of(), ImmutableList.of(),
            "84.45.69.3", "192.168.2.5", false, ACTIVE, new Date());

      NodeMetadata expected = new NodeMetadataBuilder().ids("1").hardware(getOnlyElement(hardwares))
            .imageId("ubuntu-1404-x86").status(RUNNING).location(getOnlyElement(locations)).name("mock-droplet")
            .hostname("mock-droplet").group("mock").credentials(credentials)
View Full Code Here

   }

   @Test
   public void testConvertDropletOldImage() throws ParseException {
      // Use an image id that is not in the list of images
      Droplet droplet = new Droplet(1, "mock-droplet", 9999, 1, 1, false, ImmutableList.of(), ImmutableList.of(),
            "84.45.69.3", "192.168.2.5", false, ACTIVE, new Date());

      NodeMetadata expected = new NodeMetadataBuilder().ids("1").hardware(getOnlyElement(hardwares)).imageId(null)
            .status(RUNNING).location(getOnlyElement(locations)).name("mock-droplet").hostname("mock-droplet")
            .group("mock").credentials(credentials).publicAddresses(ImmutableSet.of("84.45.69.3"))
View Full Code Here

      this.imageTransformer = checkNotNull(imageTransformer, "imageTransformer cannot be null");
   }

   @Override
   public ImageTemplate buildImageTemplateFromNode(String name, String id) {
      Droplet droplet = api.getDropletApi().get(Integer.valueOf(id));

      if (droplet == null) {
         throw new NoSuchElementException("Cannot find droplet with id: " + id);
      }
View Full Code Here

            Integer.parseInt(template.getHardware().getProviderId()), regionId, options.build());

      // We have to actively wait until the droplet has been provisioned until
      // we can build the entire Droplet object we want to return
      nodeRunningPredicate.apply(dropletCreation.getEventId());
      Droplet droplet = api.getDropletApi().get(dropletCreation.getId());

      LoginCredentials defaultCredentials = LoginCredentials.builder().user("root")
            .privateKey(defaultKeys.get("private")).build();

      return new NodeAndInitialCredentials<Droplet>(droplet, String.valueOf(droplet.getId()), defaultCredentials);
   }
View Full Code Here

      return api.getDropletApi().get(Integer.valueOf(id));
   }

   @Override
   public void destroyNode(String id) {
      Droplet droplet = api.getDropletApi().get(Integer.valueOf(id));
      final String nodeName = droplet.getName();

      // We have to wait here, as the api does not properly populate the state
      // but fails if there is a pending event
      int event = api.getDropletApi().destroy(Integer.valueOf(id), true);
      nodeTerminatedPredicate.apply(event);
View Full Code Here

      DigitalOceanApi api = api(server.getUrl("/"));
      DropletApi dropletApi = api.getDropletApi();

      try {
         Droplet droplet = dropletApi.get(100823);

         assertRequestHasCommonFields(server.takeRequest(), "/droplets/100823");
         assertNotNull(droplet);
         assertNotNull(droplet.getBackups());
         assertNotNull(droplet.getSnapshots());
         assertEquals(droplet.getName(), "test222");
         assertEquals(droplet.getStatus(), Status.ACTIVE);
      } finally {
         api.close();
         server.shutdown();
      }
   }
View Full Code Here

      DigitalOceanApi api = api(server.getUrl("/"));
      DropletApi dropletApi = api.getDropletApi();

      try {
         Droplet droplet = dropletApi.get(100823);

         assertRequestHasCommonFields(server.takeRequest(), "/droplets/100823");
         assertNull(droplet);
      } finally {
         api.close();
View Full Code Here

TOP

Related Classes of org.jclouds.digitalocean.domain.Droplet

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.