Package org.jclouds.trmk.vcloud_0_8.domain

Examples of org.jclouds.trmk.vcloud_0_8.domain.Task


      return getNode.getNode(in);
   }

   @Override
   public NodeMetadata resumeNode(String in) {
      Task task = client.powerOnVApp(URI.create(checkNotNull(in, "node.id")));
      return returnWhenTaskCompletes(in, task);
   }
View Full Code Here


      return returnWhenTaskCompletes(in, task);
   }

   @Override
   public NodeMetadata suspendNode(String in) {
      Task task = client.powerOffVApp(URI.create(checkNotNull(in, "node.id")));
      return returnWhenTaskCompletes(in, task);
   }
View Full Code Here

      assertEquals(vApp.getStatus(), Status.RESOLVED);

      // in terremark, this should be a no-op, as it should simply return the
      // above task, which is
      // already deploying
      Task deployTask = api.deployVApp(vApp.getHref());

      // check to see the result of calling deploy twice
      deployTask = api.deployVApp(vApp.getHref());
      assertEquals(deployTask.getHref(), deployTask.getHref());

      vApp = api.getVApp(vApp.getHref());

      assertEquals(vApp.getStatus(), Status.RESOLVED);

      try {// per docs, this is not supported
         api.cancelTask(deployTask.getHref());
      } catch (UnsupportedOperationException e) {
      }

      assert successTester.apply(deployTask.getHref());
      System.out.printf("%d: done deploying vApp%n", System.currentTimeMillis());

      vApp = api.getVApp(vApp.getHref());

      ReferenceType vAppResource = api.findVDCInOrgNamed(null, null).getResourceEntities().get(serverName);
View Full Code Here

      String newName = name.toString();

      CloneVAppOptions options = deploy().powerOn().withDescription("The description of " + newName);

      System.out.printf("%d: cloning vApp%n", System.currentTimeMillis());
      Task task = api.cloneVAppInVDC(vdc.getHref(), vApp.getHref(), newName, options);

      // wait for the task to complete
      assert successTester.apply(task.getHref());
      System.out.printf("%d: done cloning vApp%n", System.currentTimeMillis());

      assert successTester.apply(api.powerOnVApp(vApp.getHref()).getHref());
      System.out.printf("%d: done powering on vApp%n", System.currentTimeMillis());

      // refresh task to get the new vApp location
      task = api.getTask(task.getHref());

      clone = api.getVApp(task.getOwner().getHref());
      assertEquals(clone.getStatus(), Status.ON);

      assertEquals(clone.getName(), newName);
      assertEquals(clone.getNetworkToAddresses().values().size(), 1);
   }
View Full Code Here

   @Test(enabled = true, dependsOnMethods = "testLifeCycle")
   public void testConfigure() throws InterruptedException, ExecutionException, TimeoutException, IOException {

      vApp = api.getVApp(vApp.getHref());

      Task task = api.configureVApp(vApp, changeNameTo("eduardo").changeMemoryTo(1536).changeProcessorCountTo(1)
            .addDisk(25 * 1048576).addDisk(25 * 1048576));

      assert successTester.apply(task.getHref());

      vApp = api.getVApp(vApp.getHref());
      assertEquals(vApp.getName(), "eduardo");
      assertEquals(find(vApp.getResourceAllocations(), CIMPredicates.resourceTypeIn(ResourceType.PROCESSOR))
            .getVirtualQuantity().longValue(), 1);
      assertEquals(find(vApp.getResourceAllocations(), CIMPredicates.resourceTypeIn(ResourceType.MEMORY))
            .getVirtualQuantity().longValue(), 1536);
      assertEquals(size(filter(vApp.getResourceAllocations(), CIMPredicates.resourceTypeIn(ResourceType.DISK_DRIVE))),
            3);

      assert successTester.apply(api.powerOnVApp(vApp.getHref()).getHref());

      loopAndCheckPass();

      assert successTester.apply(api.powerOffVApp(vApp.getHref()).getHref());

      // extract the disks on the vApp sorted by addressOnParent
      List<ResourceAllocationSettingData> disks = Lists.newArrayList(filter(vApp.getResourceAllocations(),
            CIMPredicates.resourceTypeIn(ResourceType.DISK_DRIVE)));

      // delete the second disk
      task = api.configureVApp(vApp,
            deleteDiskWithAddressOnParent(Integer.parseInt(disks.get(1).getAddressOnParent())));

      assert successTester.apply(task.getHref());

      assert successTester.apply(api.powerOnVApp(vApp.getHref()).getHref());
      loopAndCheckPass();
   }
View Full Code Here

                  tasksList.getName());
            assertNotNull(response);
            assertNotNull(response.getLocation());
            assertNotNull(response.getTasks());
            if (response.getTasks().size() > 0) {
               Task task = response.getTasks().last();
               assertEquals(api.getTask(task.getHref()).getHref(), task.getHref());
            }
         }
      }
   }
View Full Code Here

      InputStream is = getClass().getResourceAsStream("/taskslist.xml");

      TasksList result = factory.create(injector.getInstance(TasksListHandler.class)).parse(is);
      assertEquals(result.getLocation(), URI
               .create("https://services.vcloudexpress.terremark.com/api/v0.8/tasksList/1"));
      Task task1 = new TaskImpl(URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/task/3300"),
               null, TaskStatus.SUCCESS, dateService.iso8601DateParse("2009-08-24T21:30:19.587Z"), dateService
                        .iso8601DateParse("2009-08-24T21:30:32.63Z"), null, new ReferenceTypeImpl("Server1",
                              TerremarkVCloudMediaType.VAPP_XML, URI
                                 .create("https://services.vcloudexpress.terremark.com/api/v0.8/vapp/4012")), null);
      Task task2 = new TaskImpl(URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/task/3299"),
               null, TaskStatus.SUCCESS, dateService.iso8601DateParse("2009-08-24T21:29:32.983Z"), dateService
                        .iso8601DateParse("2009-08-24T21:29:44.65Z"), null, new ReferenceTypeImpl("Server1",
                              TerremarkVCloudMediaType.VAPP_XML, URI
                                 .create("https://services.vcloudexpress.terremark.com/api/v0.8/vapp/4012")), null);
      assertEquals(result.getTasks(), ImmutableSortedSet.of(task1, task2));
View Full Code Here

      InternetServiceAndPublicIpAddressSupplier supplier = createMock(InternetServiceAndPublicIpAddressSupplier.class);
      expect(client.getVAppTemplate(templateURI)).andReturn(template);
      expect(
            client.instantiateVAppTemplateInVDC(vdcURI, templateURI, "name",
                  new InstantiateVAppTemplateOptions().productProperty("password", "password"))).andReturn(vApp);
      Task task = createMock(Task.class);
      URI vappLocation = URI.create("vapp");
      URI taskLocation = URI.create("task");

      expect(vApp.getHref()).andReturn(vappLocation).atLeastOnce();
      expect(vApp.getName()).andReturn("name").atLeastOnce();
      expect(client.deployVApp(vappLocation)).andReturn(task);
      expect(task.getHref()).andReturn(taskLocation).atLeastOnce();
      Predicate<URI> successTester = createMock(Predicate.class);
      expect(successTester.apply(taskLocation)).andReturn(true).atLeastOnce();
      expect(client.powerOnVApp(vappLocation)).andReturn(task);

      Predicate<VApp> notFoundTester = createMock(Predicate.class);
View Full Code Here

      InputStream is = getClass().getResourceAsStream("/taskslist.xml");

      TasksList result = factory.create(injector.getInstance(TasksListHandler.class)).parse(is);
      assertEquals(result.getLocation(), URI
               .create("https://services.vcloudexpress.terremark.com/api/v0.8/tasksList/1"));
      Task task1 = new TaskImpl(URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/task/3300"),
               null, TaskStatus.SUCCESS, dateService.iso8601DateParse("2009-08-24T21:30:19.587Z"), dateService
                        .iso8601DateParse("2009-08-24T21:30:32.63Z"), null, new ReferenceTypeImpl("Server1",
                              TerremarkVCloudMediaType.VAPP_XML, URI
                                 .create("https://services.vcloudexpress.terremark.com/api/v0.8/vapp/4012")), null);
      Task task2 = new TaskImpl(URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/task/3299"),
               null, TaskStatus.SUCCESS, dateService.iso8601DateParse("2009-08-24T21:29:32.983Z"), dateService
                        .iso8601DateParse("2009-08-24T21:29:44.65Z"), null, new ReferenceTypeImpl("Server1",
                              TerremarkVCloudMediaType.VAPP_XML, URI
                                 .create("https://services.vcloudexpress.terremark.com/api/v0.8/vapp/4012")), null);
      assertEquals(result.getTasks(), ImmutableSortedSet.of(task1, task2));
View Full Code Here

   }

   public void testTerremark() {
      InputStream is = getClass().getResourceAsStream("/task.xml");

      Task result = factory.create(injector.getInstance(TaskHandler.class)).parse(is);
      Task expects = new TaskImpl(URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/task/3299"), null,
            TaskStatus.SUCCESS, dateService.iso8601DateParse("2009-08-24T21:29:32.983Z"),
            dateService.iso8601DateParse("2009-08-24T21:29:44.65Z"), null, new ReferenceTypeImpl("Server1",
                  TerremarkVCloudMediaType.VAPP_XML,
                  URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/vapp/4012")), null
View Full Code Here

TOP

Related Classes of org.jclouds.trmk.vcloud_0_8.domain.Task

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.