Package org.jclouds.softlayer.domain

Examples of org.jclouds.softlayer.domain.VirtualGuest


              .payload(payloadFromResourceWithContentType("/virtual_guest_create.json", MediaType.APPLICATION_JSON))
              .build();

      HttpResponse createVirtualGuestResponse = HttpResponse.builder().statusCode(404).build();
      SoftLayerApi api = requestSendsResponse(createVirtualGuest, createVirtualGuestResponse);
      VirtualGuest virtualGuest = createVirtualGuest();
      assertNull(api.getVirtualGuestApi().createVirtualGuest(virtualGuest));
   }
View Full Code Here


      HttpResponse setTagsOnVirtualGuestResponse = HttpResponse.builder().statusCode(200)
              .payload(payloadFromResource("/virtual_guest_set_tags_response.json")).build();

      SoftLayerApi api = requestSendsResponse(setTagsOnVirtualGuest, setTagsOnVirtualGuestResponse);
      VirtualGuest virtualGuest = createVirtualGuest();
      assertTrue(api.getVirtualGuestApi().setTags(virtualGuest.getId(), ImmutableSet.of("test1", "test2", "test3")));
   }
View Full Code Here

              .payload(payloadFromResourceWithContentType("/virtual_guest_set_tags.json", MediaType.APPLICATION_JSON))
              .build();

      HttpResponse setTagsOnVirtualGuestResponse = HttpResponse.builder().statusCode(404).build();
      SoftLayerApi api = requestSendsResponse(setTagsOnVirtualGuest, setTagsOnVirtualGuestResponse);
      VirtualGuest virtualGuest = createVirtualGuest();
      assertFalse(api.getVirtualGuestApi().setTags(virtualGuest.getId(), ImmutableSet.of("test1", "test2", "test3")));
   }
View Full Code Here

   @Test
   public void testVirtualGuestWithOperatingSystem() {
      HttpRequest request = HttpRequest.builder().method("POST").endpoint("https://api.softlayer.com/rest/v3/SoftLayer_Virtual_Guest").build();
      VirtualGuestToJson binder = new VirtualGuestToJson(json);
      VirtualGuest virtualGuestWithOS = VirtualGuest.builder()
              .hostname("hostname")
              .domain("domain")
              .startCpus(1)
              .maxMemory(1024)
              .datacenter(Datacenter.builder()
View Full Code Here

   @Test
   public void testVirtualGuestWithVirtualGuestBlockDeviceTemplateGroup() {
      HttpRequest request = HttpRequest.builder().method("POST").endpoint("https://api.softlayer.com/rest/v3/SoftLayer_Virtual_Guest").build();
      VirtualGuestToJson binder = new VirtualGuestToJson(json);
      VirtualGuest virtualGuestWithOS = VirtualGuest.builder()
              .hostname("hostname")
              .domain("domain")
              .startCpus(1)
              .maxMemory(1024)
              .datacenter(Datacenter.builder()
View Full Code Here

      @Override
      public boolean apply(VirtualGuest guest) {
         checkNotNull(guest, "virtual guest was null");

         VirtualGuest newGuest = client.getVirtualGuestClient().getVirtualGuest(guest.getId());
         boolean hasBackendIp = newGuest.getPrimaryBackendIpAddress() != null;
         boolean hasPrimaryIp = newGuest.getPrimaryIpAddress() != null;
         boolean hasPasswords = newGuest.getOperatingSystem() != null
               && newGuest.getOperatingSystem().getPasswords().size() > 0;

         return hasBackendIp && hasPrimaryIp && hasPasswords;
      }
View Full Code Here

   public void testCorrect() {

      ProductItemPrice price1 = ProductItemPrice.builder().id(100).build();
      ProductItemPrice price2 = ProductItemPrice.builder().id(101).build();

      VirtualGuest guest = VirtualGuest.builder().hostname("myhost")
                                                 .domain("mydomain")
                                                 .build();

      ProductOrder order = ProductOrder.builder()
                                       .packageId(123)
View Full Code Here

   public void testListVirtualGuests() throws Exception {
      Set<VirtualGuest> response = api().listVirtualGuests();
      assert null != response;
      assertTrue(response.size() >= 0);
      for (VirtualGuest vg : response) {
         VirtualGuest newDetails = api().getVirtualGuest(vg.getId());
         assertEquals(vg.getId(), newDetails.getId());
         checkVirtualGuest(vg);
      }
   }
View Full Code Here

      prices.addAll(defaultPrices);
      prices.add(ramPrice);
      prices.add(cpuPrice);
      prices.add(osPrice);

      VirtualGuest guest = VirtualGuest.builder().domain("jclouds.org").hostname(
               TEST_HOSTNAME_PREFIX + new Random().nextInt()).build();

      ProductOrder order = ProductOrder.builder().packageId(pkgId).quantity(1).useHourlyPricing(true).prices(
               prices.build()).virtualGuests(guest).build();

      ProductOrderReceipt receipt = api().orderVirtualGuest(order);
      ProductOrder order2 = receipt.getOrderDetails();
      VirtualGuest result = Iterables.get(order2.getVirtualGuests(), 0);

      ProductOrder order3 = api().getOrderTemplate(result.getId());

      assertEquals(order.getPrices(), order3.getPrices());
      assertNotNull(receipt);
   }
View Full Code Here

            "options class %s should have been assignable from SoftLayerTemplateOptions", template.getOptions()
                  .getClass());

      String domainName = template.getOptions().as(SoftLayerTemplateOptions.class).getDomainName();

      VirtualGuest newGuest = VirtualGuest.builder().domain(domainName).hostname(name).build();

      ProductOrder order = ProductOrder.builder().packageId(productPackageSupplier.get().getId())
            .location(template.getLocation().getId()).quantity(1).useHourlyPricing(true).prices(getPrices(template))
            .virtualGuests(newGuest).build();

      logger.debug(">> ordering new virtualGuest domain(%s) hostname(%s)", domainName, name);
      ProductOrderReceipt productOrderReceipt = client.getVirtualGuestClient().orderVirtualGuest(order);
      VirtualGuest result = get(productOrderReceipt.getOrderDetails().getVirtualGuests(), 0);
      logger.trace("<< virtualGuest(%s)", result.getId());

      logger.debug(">> awaiting login details for virtualGuest(%s)", result.getId());
      boolean orderInSystem = loginDetailsTester.apply(result);
      logger.trace("<< virtualGuest(%s) complete(%s)", result.getId(), orderInSystem);

      checkState(orderInSystem, "order for guest %s doesn't have login details within %sms", result,
            Long.toString(guestLoginDelay));
      result = client.getVirtualGuestClient().getVirtualGuest(result.getId());

      Password pw = get(result.getOperatingSystem().getPasswords(), 0);
      return new NodeAndInitialCredentials<VirtualGuest>(result, result.getId() + "", LoginCredentials.builder().user(pw.getUsername()).password(
            pw.getPassword()).build());
   }
View Full Code Here

TOP

Related Classes of org.jclouds.softlayer.domain.VirtualGuest

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.