Package org.jclouds.cloudstack.domain

Examples of org.jclouds.cloudstack.domain.AsyncCreateResponse


         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


      }
      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

         checkVolume(volume);

         VirtualMachine virtualMachine = getPreferredVirtualMachine();

         logger.info("attaching volume %s to vm %s", volume, virtualMachine);
         AsyncCreateResponse job = client.getVolumeClient().attachVolume(volume.getId(), virtualMachine.getId());
         assertTrue(jobComplete.apply(job.getJobId()));
         Volume attachedVolume = findVolumeWithId(volume.getId());

         checkVolume(attachedVolume);
         assertEquals(virtualMachine.getId(), attachedVolume.getVirtualMachineId());
         assertNotNull(attachedVolume.getAttached());

         logger.info("detaching volume %s from vm %s", volume, virtualMachine);
         job = client.getVolumeClient().detachVolume(volume.getId());
         assertTrue(jobComplete.apply(job.getJobId()));
         Volume detachedVolume = findVolumeWithId(volume.getId());

         checkVolume(detachedVolume);
         assertNull(detachedVolume.getAttached());
View Full Code Here

   public void testCreateVolumeFromSnapshotInZoneAndDeleteVolume() {
      logger.info("testCreateVolumeFromSnapshotInZoneAndDeleteVolume (takes ~3m)");
      assertNotNull(getPreferredSnapshot());

      AsyncCreateResponse job = client.getVolumeClient().createVolumeFromSnapshotInZone(prefix + "-jclouds-volume",
            getPreferredSnapshot().getId(), zoneId);
      assertTrue(jobComplete.apply(job.getJobId()));
      Volume volume = findVolumeWithId(job.getId());

      checkVolume(volume);
      client.getVolumeClient().deleteVolume(volume.getId());
   }
View Full Code Here

              HttpResponse.builder()
                      .statusCode(200)
                      .payload(payloadFromResource("/queryasyncjobresultresponse-createvolume.json"))
                      .build());
     
      AsyncCreateResponse response = client.createVolumeFromCustomDiskOfferingInZone("VolumeClientExpectTest-jclouds-volume", "0473f5dd-bca5-4af4-a9b6-db9e8a88a2f6", "6f9a2921-b22a-4149-8b71-6ffc275a2177", 1);
      assertNotNull(response);
   }
View Full Code Here

      User testUser = null;
      try {
         testAccount = createTestAccount(globalAdminClient, prefix);
         testUser = createTestUser(globalAdminClient, testAccount, prefix);

         AsyncCreateResponse response = domainAdminClient.getUserClient().disableUser(testUser.getId());
         assertNotNull(response);
         assertTrue(jobComplete.apply(response.getJobId()));

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

         User updated = domainAdminClient.getUserClient().enableUser(testUser.getId());
         assertNotNull(updated);
View Full Code Here

   public void testDeployVirtualMachineIs2xxVersion3x() {
      HttpResponse deployVirtualMachineInZoneResponse = HttpResponse.builder().statusCode(200)
            .payload(payloadFromResource("/deployvirtualmachineresponse.json")).build();
      VirtualMachineClient client = requestSendsResponse(deployVirtualMachineInZone, deployVirtualMachineInZoneResponse);

      AsyncCreateResponse async = client.deployVirtualMachineInZone("zone1", "serviceOffering1", "template1");

      assertEquals(async, AsyncCreateResponse.builder().id("1234").jobId("50006").build());
   }
View Full Code Here

   public void testDeployVirtualMachineIs2xxVersion4x() {
      HttpResponse deployVirtualMachineInZoneResponse = HttpResponse.builder().statusCode(200)
            .payload(payloadFromResource("/deployvirtualmachineresponse4x.json")).build();
      VirtualMachineClient client = requestSendsResponse(deployVirtualMachineInZone, deployVirtualMachineInZoneResponse);

      AsyncCreateResponse async = client.deployVirtualMachineInZone("zone1", "serviceOffering1", "template1");

      assertEquals(
            async,
            AsyncCreateResponse.builder().id("1cce6cb7-2268-47ff-9696-d9e610f6619a")
                  .jobId("13330fc9-8b3e-4582-aa3e-90883c041ff0").build());
View Full Code Here

   private PublicIPAddress ip = null;

   public void testAssociateDisassociatePublicIPAddress() throws Exception {
      if (!networksEnabled)
         return;
      AsyncCreateResponse job = client.getAddressClient().associateIPAddressInZone(
            Iterables.get(client.getNetworkClient().listNetworks(), 0).getZoneId());
      checkState(jobComplete.apply(job.getJobId()), "job %s failed to complete", job.getJobId());
      ip = client.getAsyncJobClient().<PublicIPAddress> getAsyncJob(job.getJobId()).getResult();
      checkIP(ip);
   }
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.