Package org.jclouds.vcloud.domain

Examples of org.jclouds.vcloud.domain.ReferenceType


   }

   @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

      super(orgVDCMap, defaultOrg, defaultVDC);
   }

   protected URI getEndpointOfResourceInVDC(Object org, Object vDC, Object resource,
         org.jclouds.vcloud.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.vcloud.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

      super(orgVDCMap, defaultOrg, defaultVDC);
   }

   protected URI getEndpointOfResourceInVDC(Object org, Object vDC, Object resource,
         org.jclouds.vcloud.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.vcloud.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

            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

TOP

Related Classes of org.jclouds.vcloud.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.