Examples of DatacenterDto


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

   /*********************** Enterprise Limits ********************** */

   public void testCreateLimits() throws SecurityException, NoSuchMethodException, IOException {
      EnterpriseDto enterprise = EnterpriseResources.enterprisePut();
      DatacenterDto datacenter = InfrastructureResources.datacenterPut();
      DatacenterLimitsDto limits = EnterpriseResources.datacenterLimitsPost();

      Invokable<?, ?> method = method(EnterpriseApi.class, "createLimits", EnterpriseDto.class, DatacenterDto.class,
            DatacenterLimitsDto.class);
      GeneratedHttpRequest request = processor.apply(Invocation.create(method,
            ImmutableList.<Object> of(enterprise, datacenter, limits)));

      String limitsUri = enterprise.searchLink("limits").getHref();
      String requestURI = String.format("POST %s?datacenter=%d HTTP/1.1", limitsUri, datacenter.getId());

      assertRequestLineEquals(request, requestURI);
      assertNonPayloadHeadersEqual(request, "Accept: " + DatacenterLimitsDto.BASE_MEDIA_TYPE + "\n");
      assertPayloadEquals(request, withHeader(EnterpriseResources.datacenterLimitsPostPayload()),
            DatacenterLimitsDto.class, DatacenterLimitsDto.BASE_MEDIA_TYPE, false);
View Full Code Here

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

      checkFilters(request);
   }

   public void testGetLimits() throws SecurityException, NoSuchMethodException, IOException {
      EnterpriseDto enterprise = EnterpriseResources.enterprisePut();
      DatacenterDto datacenter = InfrastructureResources.datacenterPut();

      Invokable<?, ?> method = method(EnterpriseApi.class, "getLimits", EnterpriseDto.class, DatacenterDto.class);
      GeneratedHttpRequest request = processor.apply(Invocation.create(method,
            ImmutableList.<Object> of(enterprise, datacenter)));

      String limitsUri = enterprise.searchLink("limits").getHref();
      String requestURI = String.format("GET %s?datacenter=%d HTTP/1.1", limitsUri, datacenter.getId());

      assertRequestLineEquals(request, requestURI);
      assertNonPayloadHeadersEqual(request, "Accept: " + DatacentersLimitsDto.BASE_MEDIA_TYPE + "\n");
      assertPayloadEquals(request, null, null, false);
View Full Code Here

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

                  .payload(
                        payloadFromResourceWithContentType("/payloads/enterprises-page.xml",
                              normalize(EnterprisesDto.MEDIA_TYPE))) //
                  .build());

      DatacenterDto datacenter = new DatacenterDto();
      datacenter.addLink(new RESTLink("enterprises", "http://localhost/api/admin/datacenters/1/action/enterprises"));

      EnterpriseOptions options = EnterpriseOptions.builder().limit(1).has("text").build();
      PaginatedCollection<EnterpriseDto, EnterprisesDto> result = api.listEnterprises(datacenter, options);

      assertEquals(result.size(), 1);
View Full Code Here

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

/**
* Infrastructure domain utilities.
*/
public class InfrastructureResources {
   public static DatacenterDto datacenterPost() {
      DatacenterDto datacenter = new DatacenterDto();
      datacenter.setName("DC");
      datacenter.setLocation("Honolulu");
      return datacenter;
   }
View Full Code Here

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

      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

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

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

   }

   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

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

      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

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

      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

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

      return wrap(context, Datacenter.class, result.getCollection());
   }

   @Override
   public Datacenter getDatacenter(final Integer datacenterId) {
      DatacenterDto datacenter = context.getApi().getInfrastructureApi().getDatacenter(datacenterId);
      return wrap(context, Datacenter.class, datacenter);
   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.