Package org.jclouds.trmk.vcloud_0_8.compute.strategy

Examples of org.jclouds.trmk.vcloud_0_8.compute.strategy.TerremarkVCloudListNodesStrategy


   public void endElement(String uri, String name, String qName) {
      depth--;
      if (equalsOrSuffix(qName, "PublicIpAddress")) {
         inPublicIpAddress = false;
         publicIpAddress = new PublicIpAddress(address, addressLocation);
         address = null;
         addressLocation = null;
      } else {
         String value = currentOrNull(currentText);
         if (value != null && !value.equals("")) {
View Full Code Here


      super(orgVDCMap, defaultOrg, defaultVDC);
   }

   protected URI getEndpointOfResourceInVDC(Object org, Object vDC, Object resource,
         org.jclouds.trmk.vcloud_0_8.domain.VDC vDCObject) {
      ReferenceType resourceEntity = vDCObject.getResourceEntities().get(resource);
      if (resourceEntity == null)
         throw new NoSuchElementException("entity " + resource + " in vdc " + vDC + ", org " + org + " not found in "
               + vDCObject.getResourceEntities().keySet());
      return resourceEntity.getHref();
   }
View Full Code Here

      super(orgVDCMap, defaultOrg, defaultVDC);
   }

   protected URI getEndpointOfResourceInVDC(Object org, Object vDC, Object resource,
         org.jclouds.trmk.vcloud_0_8.domain.VDC vDCObject) {
      ReferenceType resourceEntity = vDCObject.getAvailableNetworks().get(resource);
      if (resourceEntity == null)
         throw new NoSuchElementException("network " + resource + " in vdc " + vDC + ", org " + org + " not found in "
               + vDCObject.getAvailableNetworks().keySet());
      return resourceEntity.getHref();
   }
View Full Code Here

   }

   public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
      Map<String, String> attributes = SaxUtils.cleanseAttributes(attrs);
      if (qName.equals("VApp")) {
         ReferenceType resource = newReferenceType(attributes);
         name = resource.getName();
         location = resource.getHref();
         String statusString = attributes.get("status");
         status = Status.fromValue(statusString);
         if (attributes.containsKey("size"))
            size = Long.valueOf(attributes.get("size"));
      } else if (qName.equals("Link")) { // type should never be missing
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

   }

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

      Task result = factory.create(injector.getInstance(TaskHandler.class)).parse(is);

      Task expects = new TaskImpl(URI.create("https://vcloud.safesecureweb.com/api/v0.8/task/d188849-78"), null,
            TaskStatus.QUEUED, null, null, null, null, null);
      assertEquals(result, expects);

   }
View Full Code Here

   }

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

      Task result = factory.create(injector.getInstance(TaskHandler.class)).parse(is);

      Task expects = new TaskImpl(URI.create("http://10.150.4.49/api/v0.8/task/23"), null, TaskStatus.ERROR,
            dateService.iso8601SecondsDateParse("2009-12-07T19:05:02Z"),
            dateService.iso8601SecondsDateParse("2009-12-10T14:40:32Z"), null, new ReferenceTypeImpl("testapp1",
                  TerremarkVCloudMediaType.VAPP_XML, URI.create("http://10.150.4.49/api/v0.8/vapp/1")), new ErrorImpl(
                  "Error processing job", 500, MinorCode.UNRECOGNIZED,
                  " Error in runDailySummaries date used:2009-12-09 19:40:30.577326+00:00", null));
View Full Code Here

   }

   public boolean apply(URI taskId) {
      logger.trace("looking for status on task %s", taskId);

      Task task = client.getTask(taskId);
      // perhaps task isn't available, yet
      if (task == null)
         return false;
      logger.trace("%s: looking for status %s: currently: %s", task, TaskStatus.SUCCESS, task.getStatus());
      if (task.getStatus() == TaskStatus.ERROR)
         throw new RuntimeException("error on task: " + task.getHref() + " error: " + task.getError());
      return task.getStatus() == TaskStatus.SUCCESS;
   }
View Full Code Here

   }

   public void testInstantiated() throws UnknownHostException {
      InputStream is = getClass().getResourceAsStream("/instantiatedvapp.xml");

      VApp result = factory.create(injector.getInstance(VAppHandler.class)).parse(is);

      VApp expects = new VAppImpl("centos53", URI
               .create("http://10.150.4.49/api/v0.8/vApp/10"), Status.RESOLVED, 123456789l, new ReferenceTypeImpl(null,
               "application/vnd.vmware.vcloud.vdc+xml", URI.create("http://10.150.4.49/api/v0.8/vdc/4")),
               ImmutableListMultimap.<String, String> of(), null, null, null, ImmutableSet
                        .<ResourceAllocationSettingData> of());
      assertEquals(result, expects);
View Full Code Here

   }

   public void testDefault() throws UnknownHostException {
      InputStream is = getClass().getResourceAsStream("/vapp.xml");

      VApp result = factory.create(injector.getInstance(VAppHandler.class)).parse(is);

      ListMultimap<String, String> networkToAddresses = ImmutableListMultimap.<String, String> of("Public Network",
               "10.150.4.93");

      VirtualSystemSettingData system = VirtualSystemSettingData.builder().instanceID("0").elementName(
               "Virtual Hardware Family").virtualSystemIdentifier("centos53").virtualSystemType("vmx-07").build();

      Set<ResourceAllocationSettingData> resourceAllocations = ImmutableSet.<ResourceAllocationSettingData> of(
               ResourceAllocationSettingData.builder().instanceID("1").elementName("1 virtual CPU(s)").description(
                        "Number of Virtual CPUs").resourceType(ResourceType.PROCESSOR).virtualQuantity(1l)
                        .allocationUnits("hertz * 10^6").virtualQuantityUnits("count").build(),

               ResourceAllocationSettingData.builder().instanceID("2").elementName("16MB of memory").description(
                        "Memory Size").resourceType(ResourceType.MEMORY).virtualQuantity(16l).allocationUnits(
                        "byte * 2^20").virtualQuantityUnits("byte * 2^20").build(),

               ResourceAllocationSettingData.builder().instanceID("3").elementName("SCSI Controller 0").description(
                        "SCSI Controller").resourceType(ResourceType.PARALLEL_SCSI_HBA).resourceSubType("lsilogic")
                        .address("0").build(),

               ResourceAllocationSettingData.builder().instanceID("8").elementName("Network Adapter 1").description(
                        "PCNet32 ethernet adapter on \"Internal\" network").resourceType(ResourceType.ETHERNET_ADAPTER)
                        .resourceSubType("PCNet32").addressOnParent("7").connection("Internal").automaticAllocation(
                                 true).build(),

               ResourceAllocationSettingData.builder().instanceID("9").elementName("Hard Disk 1").resourceType(
                        ResourceType.DISK_DRIVE).hostResource("104857").addressOnParent("0").parent("3")
                        .virtualQuantity(104857l).build());

      VApp expects = new VAppImpl("centos53", URI
               .create("http://10.150.4.49/api/v0.8/vApp/10"), Status.ON, Long.valueOf(104857), new ReferenceTypeImpl(null,
               "application/vnd.vmware.vcloud.vdc+xml", URI.create("http://10.150.4.49/api/v0.8/vdc/4")),
               networkToAddresses, null, "Other Linux (32-bit)", system, resourceAllocations);
      assertEquals(result.getHref(), expects.getHref());
      assertEquals(result.getName(), expects.getName());
      assertEquals(result.getNetworkToAddresses(), expects.getNetworkToAddresses());
      assertEquals(result.getOperatingSystemDescription(), expects.getOperatingSystemDescription());
      assertEquals(result.getResourceAllocations().toString(), expects.getResourceAllocations().toString());
      assertEquals(result.getSize(), expects.getSize());
      assertEquals(result.getStatus(), expects.getStatus());
      assertEquals(result.getSystem().toString(), expects.getSystem().toString());
      assertEquals(result.getType(), expects.getType());
      assertEquals(result.getVDC(), expects.getVDC());
   }
View Full Code Here

TOP

Related Classes of org.jclouds.trmk.vcloud_0_8.compute.strategy.TerremarkVCloudListNodesStrategy

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.