Package org.jclouds.cloudstack.domain

Examples of org.jclouds.cloudstack.domain.AsyncCreateResponse


   }

   @Test(enabled = true, dependsOnMethods = "testRegisterTemplate")
   public void testExtractTemplate() throws Exception {
      // Initiate the extraction and wait for it to complete
      AsyncCreateResponse response = client.getTemplateClient().extractTemplate(registeredTemplate.getId(), ExtractMode.HTTP_DOWNLOAD, registeredTemplate.getZoneId());
      assertTrue(jobComplete.apply(response.getJobId()), registeredTemplate.toString());

      // Get the result
      AsyncJob<TemplateExtraction> asyncJob = client.getAsyncJobClient().getAsyncJob(response.getJobId());
      TemplateExtraction extract = asyncJob.getResult();
      assertNotNull(extract);

      // Check that the URL can be retrieved
      String extractUrl = extract.getUrl();
View Full Code Here


         assertTrue(jobComplete.apply(client.getVirtualMachineClient().stopVirtualMachine(vmForRegistration.getId())), vmForRegistration.toString());
         assertTrue(jobComplete.apply(client.getVirtualMachineClient().destroyVirtualMachine(vmForRegistration.getId())), vmForRegistration.toString());
         assert virtualMachineDestroyed.apply(vmForRegistration);
      }
      if (createdTemplate != null) {
         AsyncCreateResponse deleteJob = client.getTemplateClient().deleteTemplate(createdTemplate.getId());
         assertTrue(jobComplete.apply(deleteJob.getJobId()));
      }
      if (registeredTemplate != null) {
         AsyncCreateResponse deleteJob = client.getTemplateClient().deleteTemplate(registeredTemplate.getId());
         assertTrue(jobComplete.apply(deleteJob.getJobId()));
      }
      super.tearDownContext();
   }
View Full Code Here

   }

   public void testCreateSnapshotFromVolume() {
      final Volume volume = getPreferredVolume()//fail fast if none
      logger.info("creating snapshot from volume %s", volume);
      AsyncCreateResponse job = client.getSnapshotClient().createSnapshot(volume.getId());
      assertTrue(jobComplete.apply(job.getJobId()));
      Snapshot snapshot = findSnapshotWithId(job.getId());
      logger.info("created snapshot %s from volume %s", snapshot, volume);
      checkSnapshot(snapshot);
      client.getSnapshotClient().deleteSnapshot(snapshot.getId());
   }
View Full Code Here

            and(associatedWithNetwork(networkId), available()));
   }

   public static PublicIPAddress associateIPAddressInNetwork(Network network, CloudStackClient client,
         BlockUntilJobCompletesAndReturnResult blockUntilJobCompletesAndReturnResult) {
      AsyncCreateResponse job = client.getAddressClient().associateIPAddressInZone(network.getZoneId(),
            networkId(network.getId()));
      PublicIPAddress ip = blockUntilJobCompletesAndReturnResult.<PublicIPAddress> apply(job);
      assert ip.getZoneId().equals(network.getZoneId());
      return ip;
   }
View Full Code Here

            "ip %s should be static NATed to a virtual machine before applying rules", ip);
      if (Iterables.size(ports) == 0)
         return ImmutableSet.<FirewallRule> of();
      Builder<AsyncCreateResponse> responses = ImmutableSet.builder();
      for (int port : ports) {
          AsyncCreateResponse response = client.getFirewallClient().createFirewallRuleForIpAndProtocol(ip.getId(), FirewallRule.Protocol.fromValue(protocol),
                                                                                                       CreateFirewallRuleOptions.Builder.startPort(port).endPort(port));
         logger.debug(">> creating firewall rule IPAddress(%s) for protocol(%s), port(%s); response(%s)",
               ip.getId(), protocol, port, response);
         responses.add(response);
      }
View Full Code Here

         HttpResponse.builder()
            .statusCode(200)
            .payload(payloadFromResource("/createfirewallrulesresponse.json"))
            .build());

      AsyncCreateResponse response = client.createFirewallRuleForIpAndProtocol("2", FirewallRule.Protocol.TCP);
      assertEquals(response.getJobId(), "2036");
      assertEquals(response.getId(), "2017");
   }
View Full Code Here

         HttpResponse.builder()
            .statusCode(200)
            .payload(payloadFromResource("/createportforwardingrulesresponse.json"))
            .build());

      AsyncCreateResponse response = client.createPortForwardingRuleForVirtualMachine(
         "2", PortForwardingRule.Protocol.TCP, 22, "1234", 22);
      assertEquals(response.getJobId(), "2035");
      assertEquals(response.getId(), "2015");
   }
View Full Code Here

      Account testAccount = null;
      try {
         testAccount = createTestAccount(globalAdminClient, prefix);

         AsyncCreateResponse response = domainAdminClient.getAccountClient()
            .disableAccount(testAccount.getName(), testAccount.getDomainId(), false);
         assertNotNull(response);
         assertTrue(jobComplete.apply(response.getJobId()));

         AsyncJob<Account> job = domainAdminClient.getAsyncJobClient().getAsyncJob(response.getJobId());
         assertEquals(job.getResult().getState(), Account.State.DISABLED);

         Account updated = domainAdminClient.getAccountClient()
            .enableAccount(testAccount.getName(), testAccount.getDomainId());
         assertNotNull(updated);
View Full Code Here

      if (networksDisabled)
         return;
      while (portForwardingRule == null) {
         ip = reuseOrAssociate.apply(network);
         try {
            AsyncCreateResponse job = client.getFirewallClient()
               .createPortForwardingRuleForVirtualMachine(ip.getId(), PortForwardingRule.Protocol.TCP, 22, vm.getId(), 22);
            assertTrue(jobComplete.apply(job.getJobId()));
            portForwardingRule = client.getFirewallClient().getPortForwardingRule(job.getId());

         } catch (IllegalStateException e) {
            Logger.CONSOLE.error("Failed while trying to allocate ip: " + e);
            // very likely an ip conflict, so retry;
         }
View Full Code Here

   @Test(dependsOnMethods = "testCreatePortForwardingRule")
   public void testCreateFirewallRule() {
      if (networksDisabled)
         return;

      AsyncCreateResponse job = client.getFirewallClient().createFirewallRuleForIpAndProtocol(
         ip.getId(), FirewallRule.Protocol.TCP, CreateFirewallRuleOptions.Builder.startPort(30).endPort(35));
      assertTrue(jobComplete.apply(job.getJobId()));
      firewallRule = client.getFirewallClient().getFirewallRule(job.getId());

      assertEquals(firewallRule.getStartPort(), 30);
      assertEquals(firewallRule.getEndPort(), 35);
      assertEquals(firewallRule.getProtocol(), FirewallRule.Protocol.TCP);
View Full Code Here

TOP

Related Classes of org.jclouds.cloudstack.domain.AsyncCreateResponse

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.