Package org.jclouds.glesys.domain

Examples of org.jclouds.glesys.domain.ServerDetails$Builder


     
      // use random root password unless one was provided via template options
      String password = templateOptions.hasRootPassword() ? templateOptions.getRootPassword() : getRandomPassword();

      logger.debug(">> creating new Server spec(%s) name(%s) options(%s)", spec, name, createServerOptions);
      ServerDetails result = api.getServerApi().createWithHostnameAndRootPassword(spec, name, password,
            createServerOptions);
      logger.trace("<< server(%s)", result.getId());

      return new NodeAndInitialCredentials<ServerDetails>(result, result.getId() + "", LoginCredentials.builder()
            .password(password).build());
   }
View Full Code Here


                       .addHeader("Authorization", "Basic aWRlbnRpdHk6Y3JlZGVudGlhbA==")
                       .addFormParam("includestate", "true")
                       .addFormParam("serverid", "xm3276891").build(),
            HttpResponse.builder().statusCode(200).payload(payloadFromResource("/server_details.json")).build()).getServerApi();

      ServerDetails actual = api.get("xm3276891");
      assertEquals(actual.toString(), expectedServerDetails().toString());
   }
View Full Code Here

                       .addFormParam("cpucores", "1")
                       .addFormParam("transfer", "50").build(),
            HttpResponse.builder().statusCode(200).payload(payloadFromResource("/server_noip.json")).build()).getServerApi();

      Cost cost = Cost.builder().amount(6.38).currency("EUR").timePeriod("month").build();
      ServerDetails expected = ServerDetails.builder().id("vz1541880").hostname("mammamia").datacenter("Falkenberg").platform("OpenVZ")
            .templateName("Ubuntu 11.04 64-bit").description("description").cpuCores(1).memorySizeMB(128).diskSizeGB(5).transferGB(50).cost(cost).build();

      assertEquals(
            api.createWithHostnameAndRootPassword(
                  ServerSpec.builder().datacenter("Falkenberg").platform("OpenVZ").templateName("Ubuntu 32-bit")
                        .diskSizeGB(5).memorySizeMB(512).cpuCores(1).transferGB(50).build(), "jclouds-test", "password").toString(),
            expected.toString());
   }
View Full Code Here

   }

   protected Predicate<State> createServer(String hostName) {
      final ServerApi serverApi = api.getServerApi();

      ServerDetails testServer = serverApi.createWithHostnameAndRootPassword(
            ServerSpec.builder().datacenter("Falkenberg").platform("OpenVZ").templateName("Ubuntu 10.04 LTS 32-bit")
                  .diskSizeGB(5).memorySizeMB(512).cpuCores(1).transferGB(50).build(), hostName, UUID.randomUUID()
                  .toString().replace("-",""));

      assertNotNull(testServer.getId());
      assertEquals(testServer.getHostname(), hostName);
      assertFalse(testServer.getIps().isEmpty());

      Predicate<State> statusChecker = statusChecker(serverApi, testServer.getId());
      assertTrue(statusChecker.apply(Server.State.RUNNING));
      serverId = testServer.getId();
      return statusChecker;
   }
View Full Code Here

      FluentIterable<Server> response = serverApi.list();
      assertNotNull(response);
      assertTrue(response.size() > 0);

      for (Server server : response) {
         ServerDetails newDetails = serverApi.get(server.getId());
         assertEquals(newDetails.getId(), server.getId());
         assertEquals(newDetails.getHostname(), server.getHostname());
         assertEquals(newDetails.getPlatform(), server.getPlatform());
         assertEquals(newDetails.getDatacenter(), server.getDatacenter());
         checkServer(newDetails);
      }
   }
View Full Code Here

         checkServer(newDetails);
      }
   }

   public void testServerDetails() throws Exception {
      ServerDetails details = serverApi.get(serverId);
      checkServer(details);
      assertEquals("Ubuntu 10.04 LTS 32-bit", details.getTemplateName());
      assertEquals("Falkenberg", details.getDatacenter());
      assertEquals("OpenVZ", details.getPlatform());
      assertEquals(5, details.getDiskSizeGB());
      assertEquals(512, details.getMemorySizeMB());
      assertEquals(1, details.getCpuCores());
      assertEquals(50, details.getTransferGB());
   }
View Full Code Here

      ServerStatus newStatus = serverApi.getStatus(serverId);
      checkStatus(newStatus);
   }

   public void testUpdateServer() throws Exception {
      ServerDetails edited = serverApi.update(serverId, UpdateServerOptions.Builder.description("this is a different description!"));
      assertEquals(edited.getDescription(), "this is a different description!");

      edited = serverApi.update(serverId, UpdateServerOptions.Builder.description("another description!").hostname("host-name1"));
      assertEquals(edited.getDescription(), "another description!");
      assertEquals(edited.getHostname(), "host-name1");

      edited = serverApi.resetPassword(serverId, "anotherpass");
      assertEquals(edited.getHostname(), "host-name1");

      edited = serverApi.update(serverId, UpdateServerOptions.Builder.hostname(hostName));
      assertEquals(edited.getHostname(), hostName);
   }
View Full Code Here

   }

   // takes a few minutes and requires an extra server (used 1 already)
   @Test(enabled=false)
   public void testCloneServer() throws Exception {
      ServerDetails testServer2 = serverApi.clone(serverId, testHostName2, CloneServerOptions.Builder.cpucores(1));

      assertNotNull(testServer2.getId());
      assertEquals(testServer2.getHostname(), "jclouds-test2");
      assertTrue(testServer2.getIps().isEmpty());
     
      testServerId2 = testServer2.getId();

      Predicate<State> cloneChecker = statusChecker(serverApi, testServerId2);
      assertTrue(cloneChecker.apply(Server.State.STOPPED));

      serverApi.start(testServer2.getId());

      // TODO ServerStatus==STOPPED suggests the previous call to start should have worked
      cloneChecker = retry(new Predicate<Server.State>() {
         public boolean apply(Server.State value) {
            ServerStatus status = serverApi.getStatus(testServerId2, ServerStatusOptions.Builder.state());
View Full Code Here

   }

   protected Predicate<State> createServer(String hostName) {
      final ServerApi serverApi = api.getServerApi();

      ServerDetails testServer = serverApi.createWithHostnameAndRootPassword(
            ServerSpec.builder().datacenter("Falkenberg").platform("OpenVZ").templateName("Ubuntu 10.04 LTS 32-bit")
                  .diskSizeGB(5).memorySizeMB(512).cpuCores(1).transferGB(50).build(), hostName, UUID.randomUUID()
                  .toString().replace("-", ""));

      assertNotNull(testServer.getId());
      assertEquals(testServer.getHostname(), hostName);
      assertFalse(testServer.getIps().isEmpty());

      Predicate<State> statusChecker = statusChecker(serverApi, testServer.getId());
      assertTrue(statusChecker.apply(Server.State.RUNNING));
      serverId = testServer.getId();
      return statusChecker;
   }
View Full Code Here

      FluentIterable<Server> response = serverApi.list();
      assertNotNull(response);
      assertTrue(!response.isEmpty());

      for (Server server : response) {
         ServerDetails newDetails = serverApi.get(server.getId());
         assertEquals(newDetails.getId(), server.getId());
         assertEquals(newDetails.getHostname(), server.getHostname());
         assertEquals(newDetails.getPlatform(), server.getPlatform());
         assertEquals(newDetails.getDatacenter(), server.getDatacenter());
         checkServer(newDetails);
      }
   }
View Full Code Here

TOP

Related Classes of org.jclouds.glesys.domain.ServerDetails$Builder

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.