Package org.jclouds.cloudstack.domain

Examples of org.jclouds.cloudstack.domain.AsyncCreateResponse


   }

   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


      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

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

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

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

         Predicate<VirtualMachine> virtualMachineRunning) {
      String serviceOfferingId = DEFAULT_SIZE_ORDERING.min(client.getOfferingClient().listServiceOfferings()).getId();

      System.out.printf("serviceOfferingId %s, templateId %s, zoneId %s, options %s%n", serviceOfferingId, templateId,
            zoneId, options);
      AsyncCreateResponse job = client.getVirtualMachineClient().deployVirtualMachineInZone(zoneId, serviceOfferingId,
            templateId, options);
      assertTrue(jobComplete.apply(job.getJobId()));
      AsyncJob<VirtualMachine> jobWithResult = client.getAsyncJobClient().<VirtualMachine> getAsyncJob(job.getJobId());
      if (jobWithResult.getError() != null)
         Throwables.propagate(new ExecutionException(String.format("job %s failed with exception %s", job.getId(),
               jobWithResult.getError().toString())) {
         });
      VirtualMachine vm = jobWithResult.getResult();
      if (vm.isPasswordEnabled()) {
         assert vm.getPassword() != null : vm;
View Full Code Here

      assertEquals(volumes.size(), 1);
      Volume volume = Iterables.getOnlyElement(volumes);

      // Create a template
      CreateTemplateOptions options = CreateTemplateOptions.Builder.volumeId(volume.getId());
      AsyncCreateResponse response = client.getTemplateClient().createTemplate(TemplateMetadata.builder().name(prefix+"-createTemplate").osTypeId(vmForCreation.getGuestOSId()).displayText("jclouds live testCreateTemplate").build(), options);
      assertTrue(jobComplete.apply(response.getJobId()), vmForCreation.toString());
      createdTemplate = client.getTemplateClient().getTemplateInZone(response.getId(), vmForCreation.getZoneId());

      // Assertions
      assertNotNull(createdTemplate);
   }
View Full Code Here

   }

   @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

      }
      throw new AssertionError("No suitable VirtualMachine found.");
   }

   protected Volume createPreferredVolumeFromDisk() {
      AsyncCreateResponse job = client.getVolumeClient().createVolumeFromDiskOfferingInZone(prefix + "-jclouds-volume",
            getPreferredDiskOffering().getId(), zoneId);
      assertTrue(jobComplete.apply(job.getJobId()));
      logger.info("created volume " + job.getId());
      return findVolumeWithId(job.getId());
   }
View Full Code Here

         }
      }
     
      assertNotNull("No custom disk offering found!", offering);
     
      AsyncCreateResponse job = client.getVolumeClient().createVolumeFromCustomDiskOfferingInZone(
                prefix + "-jclouds-volume", offering.getId(), zoneId, size);
      assertTrue(jobComplete.apply(job.getJobId()));
      logger.info("created volume "+job.getId());
     
      Volume volume = findVolumeWithId(job.getId());
      try {
         checkVolume(volume);
         assertEquals(volume.getSize(), size * 1024 * 1024 * 1024);
      } finally {
         client.getVolumeClient().deleteVolume(volume.getId());
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.