Package org.jclouds.trmk.vcloud_0_8.domain

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


            Predicates.<ReferenceType> alwaysTrue()).apply(ImmutableSet.<ReferenceType> of());
   }

   @Test
   public void testReturnsOnlyResource() {
      ReferenceType reference = createMock(ReferenceType.class);

      assertEquals(new OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefault(valueOfConfigurationKeyOrNull,
            "foo", Predicates.<ReferenceType> alwaysTrue()).apply(ImmutableSet.<ReferenceType> of(reference)),
            reference);
View Full Code Here


   }

   @Test
   public void testReturnsFirstResourceWhenConfigurationUnspecified() {
      ReferenceType reference1 = createMock(ReferenceType.class);
      ReferenceType reference2 = createMock(ReferenceType.class);

      assertEquals(new OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefault(valueOfConfigurationKeyOrNull,
            "foo", Predicates.<ReferenceType> alwaysTrue()).apply(ImmutableList.<ReferenceType> of(reference1,
            reference2)), reference1);
View Full Code Here

   }

   @Test
   public void testReturnsResourceMatchingDefaultPredicateWhenConfigurationUnspecified() {
      ReferenceType reference1 = createMock(ReferenceType.class);
      ReferenceType reference2 = createMock(ReferenceType.class);

      assertEquals(new OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefault(valueOfConfigurationKeyOrNull,
            "foo", Predicates.equalTo(reference2)).apply(ImmutableList.<ReferenceType> of(reference1, reference2)),
            reference2);
View Full Code Here

   }

   @Test
   public void testReturnsResourceWithNameMatchingConfigurationKey() {
      ReferenceType reference1 = new ReferenceTypeImpl("travis tritt", null, null);
      ReferenceType reference2 = new ReferenceTypeImpl("hail mary", null, null);

      assertEquals(
            new OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefault(Guice.createInjector(
                  new AbstractModule() {
                     protected void configure() {
View Full Code Here

   }

   @Test(expectedExceptions = NoSuchElementException.class)
   public void testThrowsNoSuchElementWhenNoneMatchConfigurationKey() {
      ReferenceType reference1 = new ReferenceTypeImpl("travis tritt", null, null);
      ReferenceType reference2 = new ReferenceTypeImpl("hail mary", null, null);

      new OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefault(Guice.createInjector(new AbstractModule() {
         protected void configure() {
            bindConstant().annotatedWith(Names.named("foo")).to(".*happy.*");
         }
View Full Code Here

      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);
      assertEquals(vAppResource.getHref(), vApp.getHref());

      int processorCount = 1;
      long memory = 512;
      verifyConfigurationOfVApp(vApp, serverName, expectedOs, processorCount, memory, hardDisk);
      assertEquals(vApp.getStatus(), Status.OFF);
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

      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 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.ReferenceType

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.