Package com.abiquo.server.core.infrastructure

Examples of com.abiquo.server.core.infrastructure.DatacenterDto


   }

   @Test(expectedExceptions = NullPointerException.class)
   public void testInvalidId() {
      Function<Object, String> parser = new ParseDatacenterId();
      parser.apply(new DatacenterDto());
   }
View Full Code Here


   }

   public void testValidId() {
      Function<Object, String> parser = new ParseDatacenterId();

      DatacenterDto datacenter = new DatacenterDto();
      datacenter.setId(5);
      assertEquals(parser.apply(datacenter), "5");
   }
View Full Code Here

   }

   public Datacenter getDatacenter() {
      Integer datacenterId = target.getIdFromLink(ParentLinkName.DATACENTER);
      checkNotNull(datacenterId, ValidationErrors.MISSING_REQUIRED_LINK);
      DatacenterDto dto = context.getApi().getInfrastructureApi().getDatacenter(datacenterId);
      return wrap(context, Datacenter.class, dto);
   }
View Full Code Here

   public void testUpdate() {
      env.datacenter.setLocation("New York");
      env.datacenter.update();

      // Recover the updated datacenter
      DatacenterDto updated = env.infrastructureApi.getDatacenter(env.datacenter.getId());

      assertEquals(updated.getLocation(), "New York");
   }
View Full Code Here

         this.location = location;
         return this;
      }

      public Datacenter build() {
         DatacenterDto dto = new DatacenterDto();
         dto.setName(name);
         dto.setLocation(location);
         Datacenter datacenter = new Datacenter(context, dto);
         datacenter.ip = ip;
         return datacenter;
      }
View Full Code Here

*
* @author Ignasi Barrera
*/
public class InfrastructureResources {
   public static DatacenterDto datacenterPost() {
      DatacenterDto datacenter = new DatacenterDto();
      datacenter.setName("DC");
      datacenter.setLocation("Honolulu");
      return datacenter;
   }
View Full Code Here

      storagePool.setName("Hawaian Storage Pool");
      return storagePool;
   }

   public static DatacenterDto datacenterPut() {
      DatacenterDto datacenter = datacenterPost();
      datacenter.setId(1);
      datacenter.addLink(new RESTLink("checkmachinestate",
            "http://localhost/api/admin/datacenters/1/action/checkmachinestate"));
      datacenter.addLink(new RESTLink("checkmachineipmistate",
            "http://localhost/api/admin/datacenters/1/action/checkmachineipmistate"));
      datacenter.addLink(new RESTLink("checkremoteservice",
            "http://localhost/api/admin/datacenters/1/action/checkremoteservice"));
      datacenter.addLink(new RESTLink("devices", "http://localhost/api/admin/datacenters/1/storage/devices"));
      datacenter.addLink(new RESTLink("discovermultiple",
            "http://localhost/api/admin/datacenters/1/action/discovermultiple"));
      datacenter.addLink(new RESTLink("discoversingle",
            "http://localhost/api/admin/datacenters/1/action/discoversingle"));
      datacenter.addLink(new RESTLink("edit", "http://localhost/api/admin/datacenters/1"));
      datacenter.addLink(new RESTLink("getLimits", "http://localhost/api/admin/datacenters/1/action/getLimits"));
      datacenter.addLink(new RESTLink("racks", "http://localhost/api/admin/datacenters/1/racks"));
      datacenter.addLink(new RESTLink("remoteservices", "http://localhost/api/admin/datacenters/1/remoteservices"));
      datacenter.addLink(new RESTLink("tiers", "http://localhost/api/admin/datacenters/1/storage/tiers"));
      datacenter.addLink(new RESTLink("network", "http://localhost/api/admin/datacenters/1/network"));
      datacenter.addLink(new RESTLink("enterprises", "http://localhost/api/admin/datacenters/1/action/enterprises"));
      datacenter.addLink(new RESTLink("hypervisor", "http://localhost/api/admin/datacenters/1/action/hypervisor"));
      datacenter.addLink(new RESTLink("hypervisors", "http://localhost/api/admin/datacenters/1/hypervisors"));
      return datacenter;
   }
View Full Code Here

      BindSupportedDevicesLinkToPath binder = new BindSupportedDevicesLinkToPath();
      binder.getNewEndpoint(null, new Object());
   }

   public void testGetNewEnpoint() throws Exception {
      DatacenterDto datacenter = new DatacenterDto();
      datacenter.addLink(new RESTLink("devices", "http://foo/bar"));

      BindSupportedDevicesLinkToPath binder = new BindSupportedDevicesLinkToPath();

      Invokable<?, ?> withEndpointLink = method(InfrastructureApi.class, "listSupportedStorageDevices",
            DatacenterDto.class);
View Full Code Here

      assertEquals(binder.getNewEndpoint(request, datacenter), "http://foo/bar/action/supported");
   }

   @Test(expectedExceptions = NullPointerException.class)
   public void testGetNewEnpointWithoutLink() throws Exception {
      DatacenterDto datacenter = new DatacenterDto();

      BindSupportedDevicesLinkToPath binder = new BindSupportedDevicesLinkToPath();

      Invokable<?, ?> withEndpointLink = method(InfrastructureApi.class, "listSupportedStorageDevices",
            DatacenterDto.class);
View Full Code Here

    *      > http://community.abiquo.com/display/ABI20/DatacenterResource#
    *      DatacenterResource- Retrieveadatacenter</a>
    */
   public Datacenter getDatacenter() {
      Integer datacenterId = target.getIdFromLink(ParentLinkName.DATACENTER);
      DatacenterDto dto = context.getApi().getInfrastructureApi().getDatacenter(datacenterId);
      datacenter = wrap(context, Datacenter.class, dto);
      return datacenter;
   }
View Full Code Here

TOP

Related Classes of com.abiquo.server.core.infrastructure.DatacenterDto

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.