Package com.abiquo.server.core.cloud

Examples of com.abiquo.server.core.cloud.VirtualDatacenterDto


                  .payload(
                        payloadFromResourceWithContentType("/payloads/volumes-lastpage.xml",
                              normalize(VolumesManagementDto.MEDIA_TYPE))) //
                  .build());

      VirtualDatacenterDto vdc = new VirtualDatacenterDto();
      vdc.addLink(new RESTLink("volumes", "http://example.com/api/cloud/virtualdatacenters/1/volumes"));

      PagedIterable<VolumeManagementDto> volumes = api.listVolumes(vdc);
      List<VolumeManagementDto> all = volumes.concat().toList();

      assertEquals(all.size(), 2);
View Full Code Here


                  .payload(
                        payloadFromResourceWithContentType("/payloads/volumes-lastpage.xml",
                              normalize(VolumesManagementDto.MEDIA_TYPE))) //
                  .build());

      VirtualDatacenterDto vdc = new VirtualDatacenterDto();
      vdc.addLink(new RESTLink("volumes", "http://example.com/api/cloud/virtualdatacenters/1/volumes"));

      VolumeOptions options = VolumeOptions.builder().startWith(1).build();
      PaginatedCollection<VolumeManagementDto, VolumesManagementDto> templates = api.listVolumes(vdc, options);

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

    *      # VirtualDatacenterResource-Retireveavirtualdatacenter</a>
    * @return The virtual datacenter where this virtual machine is.
    */
   public VirtualDatacenter getVirtualDatacenter() {
      Integer virtualDatacenterId = target.getIdFromLink(ParentLinkName.VIRTUAL_DATACENTER);
      VirtualDatacenterDto dto = context.getApi().getCloudApi().getVirtualDatacenter(virtualDatacenterId);
      return wrap(context, VirtualDatacenter.class, dto);
   }
View Full Code Here

      HttpRequest request = HttpRequest.builder().method("GET").endpoint(URI.create("http://localhost")).build();
      binder.bindToRequest(request, new Object());
   }

   public void testBindSingleVolume() throws IOException {
      VirtualDatacenterDto vdc = CloudResources.virtualDatacenterPut();
      BindVirtualDatacenterRefToPayload binder = new BindVirtualDatacenterRefToPayload(new JAXBParser("false"));
      HttpRequest request = HttpRequest.builder().method("GET").endpoint(URI.create("http://localhost")).build();
      request = binder.bindToRequest(request, vdc);
      assertPayloadEquals(request.getPayload(), withHeader("<links><link href=\"" + vdc.getEditLink().getHref()
            + "\" rel=\"virtualdatacenter\"/></links>"), LinksDto.class);
   }
View Full Code Here

      return listVirtualDatacenters.execute(options);
   }

   @Override
   public VirtualDatacenter getVirtualDatacenter(final Integer virtualDatacenterId) {
      VirtualDatacenterDto virtualDatacenter = context.getApi().getCloudApi().getVirtualDatacenter(virtualDatacenterId);
      return wrap(context, VirtualDatacenter.class, virtualDatacenter);
   }
View Full Code Here

/**
* Cloud domain utilities.
*/
public class CloudResources {
   public static VirtualDatacenterDto virtualDatacenterPost() {
      VirtualDatacenterDto virtualDatacenter = new VirtualDatacenterDto();
      virtualDatacenter.setName("VDC");
      virtualDatacenter.setHypervisorType(HypervisorType.KVM);
      virtualDatacenter.setVlan(NetworkResources.vlanPost());
      return virtualDatacenter;
   }
View Full Code Here

      virtualMachine.setHdInBytes(20l);
      return virtualMachine;
   }

   public static VirtualDatacenterDto virtualDatacenterPut() {
      VirtualDatacenterDto virtualDatacenter = virtualDatacenterPost();
      virtualDatacenter.setId(1);
      virtualDatacenter.addLink(new RESTLink("datacenter", "http://localhost/api/admin/datacenters/1"));
      virtualDatacenter.addLink(new RESTLink("disks", "http://localhost/api/cloud/virtualdatacenters/1/disks"));
      virtualDatacenter.addLink(new RESTLink("enterprise", "http://localhost/api/admin/enterprises/1"));
      virtualDatacenter.addLink(new RESTLink("edit", "http://localhost/api/cloud/virtualdatacenters/1"));
      virtualDatacenter.addLink(new RESTLink("tiers", "http://localhost/api/cloud/virtualdatacenters/1/tiers"));
      virtualDatacenter.addLink(new RESTLink("virtualappliances",
            "http://localhost/api/cloud/virtualdatacenters/1/virtualappliances"));
      virtualDatacenter.addLink(new RESTLink("volumes", "http://localhost/api/cloud/virtualdatacenters/1/volumes"));
      virtualDatacenter.addLink(new RESTLink("privatenetworks",
            "http://localhost/api/cloud/virtualdatacenters/1/privatenetworks"));
      virtualDatacenter.addLink(new RESTLink("defaultnetwork",
            "http://localhost/api/cloud/virtualdatacenters/1/privatenetworks/1"));
      virtualDatacenter.addLink(new RESTLink("defaultvlan",
            "http://localhost/api/cloud/virtualdatacenters/1/action/defaultvlan"));
      virtualDatacenter.addLink(new RESTLink("topurchase",
            "http://localhost/api/cloud/virtualdatacenters/1/publicips/topurchase"));
      virtualDatacenter.addLink(new RESTLink("purchased",
            "http://localhost/api/cloud/virtualdatacenters/1/publicips/purchased"));
      virtualDatacenter.addLink(new RESTLink("templates",
            "http://localhost/api/cloud/virtualdatacenters/1/action/templates"));
      return virtualDatacenter;

   }
View Full Code Here

      dto.setCpuRequired(5);
      dto.setRamRequired(2048);
      dto.addLink(new RESTLink("edit", "http://foo/bar"));
      VirtualMachineTemplate template = wrap(context, VirtualMachineTemplate.class, dto);

      VirtualDatacenterDto vdcDto = new VirtualDatacenterDto();
      vdcDto.setId(6);
      vdcDto.setHypervisorType(HypervisorType.VMX_04);
      VirtualDatacenter vdc = wrap(context, VirtualDatacenter.class, vdcDto);

      Hardware hardware = function.apply(new VirtualMachineTemplateInVirtualDatacenter(template, vdc));

      verify(vdcToLocation);
View Full Code Here

      dto.setHdRequired(50L * 1024 * 1024 * 1024); // 50 GB
      dto.setCpuRequired(5);
      dto.setRamRequired(2048);
      VirtualMachineTemplate template = wrap(context, VirtualMachineTemplate.class, dto);

      VirtualDatacenterDto vdcDto = new VirtualDatacenterDto();
      vdcDto.setId(6);
      vdcDto.setHypervisorType(HypervisorType.VMX_04);
      VirtualDatacenter vdc = wrap(context, VirtualDatacenter.class, vdcDto);

      Hardware hardware = function.apply(new VirtualMachineTemplateInVirtualDatacenter(template, vdc));

      verify(vdcToLocation);
View Full Code Here

      Function<VirtualDatacenter, Location> vdcToLocation = mockVirtualDatacenterToLocation();
      VirtualMachineTemplateInVirtualDatacenterToHardware function = new VirtualMachineTemplateInVirtualDatacenterToHardware(
            vdcToLocation);

      VirtualMachineTemplate template = wrap(context, VirtualMachineTemplate.class, new VirtualMachineTemplateDto());
      VirtualDatacenter vdc = wrap(context, VirtualDatacenter.class, new VirtualDatacenterDto());

      function.apply(new VirtualMachineTemplateInVirtualDatacenter(template, vdc));
   }
View Full Code Here

TOP

Related Classes of com.abiquo.server.core.cloud.VirtualDatacenterDto

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.