Package com.abiquo.server.core.infrastructure.storage

Examples of com.abiquo.server.core.infrastructure.storage.DiskManagementDto


      DisksManagementDto hardDisks = context.getApi().getCloudApi().listHardDisks(target);
      return wrap(context, HardDisk.class, hardDisks.getCollection());
   }

   public HardDisk getHardDisk(final Integer id) {
      DiskManagementDto hardDisk = context.getApi().getCloudApi().getHardDisk(target, id);
      return wrap(context, HardDisk.class, hardDisk);
   }
View Full Code Here


      request = binder.bindToRequest(request, new DiskManagementDto[] {});
      assertPayloadEquals(request.getPayload(), withHeader("<links/>"), LinksDto.class);
   }

   public void testBindSingleHardDisk() throws IOException {
      DiskManagementDto hardDisk = CloudResources.hardDiskPut();
      BindHardDiskRefsToPayload binder = new BindHardDiskRefsToPayload(new JAXBParser("false"));
      HttpRequest request = HttpRequest.builder().method("GET").endpoint(URI.create("http://localhost")).build();
      request = binder.bindToRequest(request, new DiskManagementDto[] { hardDisk });
      assertPayloadEquals(request.getPayload(), withHeader("<links><link href=\"" + hardDisk.getEditLink().getHref()
            + "\" rel=\"" + binder.getRelToUse(hardDisk) + "\"/></links>"), LinksDto.class);
   }
View Full Code Here

      assertPayloadEquals(request.getPayload(), withHeader("<links><link href=\"" + hardDisk.getEditLink().getHref()
            + "\" rel=\"" + binder.getRelToUse(hardDisk) + "\"/></links>"), LinksDto.class);
   }

   public void testBindMultipleHardDisks() throws IOException {
      DiskManagementDto hardDisk = CloudResources.hardDiskPut();
      BindHardDiskRefsToPayload binder = new BindHardDiskRefsToPayload(new JAXBParser("false"));
      HttpRequest request = HttpRequest.builder().method("GET").endpoint(URI.create("http://localhost")).build();
      request = binder.bindToRequest(request, new DiskManagementDto[] { hardDisk, hardDisk });
      assertPayloadEquals(request.getPayload(), withHeader("<links><link href=\"" + hardDisk.getEditLink().getHref()
            + "\" rel=\"" + binder.getRelToUse(hardDisk) + "\"/></links>"), LinksDto.class);
   }
View Full Code Here

      buffer.append("</virtualmachinetask>");
      return buffer.toString();
   }

   public static DiskManagementDto hardDiskPost() {
      DiskManagementDto disk = new DiskManagementDto();
      disk.setSizeInMb(1024L);
      return disk;
   }
View Full Code Here

      disk.setSizeInMb(1024L);
      return disk;
   }

   public static DiskManagementDto hardDiskPut() {
      DiskManagementDto disk = hardDiskPost();
      disk.addLink(new RESTLink("edit", "http://localhost/api/cloud/virtualdatacenters/1/disks/1"));
      disk.addLink(new RESTLink("virtualdatacenter", "http://localhost/api/cloud/virtualdatacenters/1"));
      return disk;
   }
View Full Code Here

         this.sizeInMb = sizeInMb;
         return this;
      }

      public HardDisk build() {
         DiskManagementDto dto = new DiskManagementDto();
         dto.setSizeInMb(sizeInMb);

         HardDisk hardDisk = new HardDisk(context, dto);
         hardDisk.virtualDatacenter = virtualDatacenter;

         return hardDisk;
View Full Code Here

      checkFilters(request);
   }

   public void testReplaceHardDisks() throws SecurityException, NoSuchMethodException, IOException {
      DiskManagementDto first = CloudResources.hardDiskPut();
      DiskManagementDto second = CloudResources.hardDiskPut();
      second.getEditLink().setHref(second.getEditLink().getHref() + "second");

      Invokable<?, ?> method = method(CloudApi.class, "replaceHardDisks", VirtualMachineDto.class,
            DiskManagementDto[].class);
      GeneratedHttpRequest request = processor.apply(Invocation.create(method,
            ImmutableList.<Object> of(CloudResources.virtualMachinePut(), new DiskManagementDto[] { first, second })));
View Full Code Here

      request = binder.bindToRequest(request, new DiskManagementDto[] {});
      assertPayloadEquals(request.getPayload(), withHeader("<links/>"), LinksDto.class);
   }

   public void testBindSingleHardDisk() throws IOException {
      DiskManagementDto hardDisk = CloudResources.hardDiskPut();
      BindHardDiskRefsToPayload binder = new BindHardDiskRefsToPayload(new JAXBParser("false"));
      HttpRequest request = HttpRequest.builder().method("GET").endpoint(URI.create("http://localhost")).build();
      request = binder.bindToRequest(request, new DiskManagementDto[] { hardDisk });
      assertPayloadEquals(request.getPayload(), withHeader("<links><link href=\"" + hardDisk.getEditLink().getHref()
            + "\" rel=\"" + binder.getRelToUse(hardDisk) + "\"/></links>"), LinksDto.class);
   }
View Full Code Here

      assertPayloadEquals(request.getPayload(), withHeader("<links><link href=\"" + hardDisk.getEditLink().getHref()
            + "\" rel=\"" + binder.getRelToUse(hardDisk) + "\"/></links>"), LinksDto.class);
   }

   public void testBindMultipleHardDisks() throws IOException {
      DiskManagementDto hardDisk = CloudResources.hardDiskPut();
      BindHardDiskRefsToPayload binder = new BindHardDiskRefsToPayload(new JAXBParser("false"));
      HttpRequest request = HttpRequest.builder().method("GET").endpoint(URI.create("http://localhost")).build();
      request = binder.bindToRequest(request, new DiskManagementDto[] { hardDisk, hardDisk });
      assertPayloadEquals(request.getPayload(), withHeader("<links><link href=\"" + hardDisk.getEditLink().getHref()
            + "\" rel=\"" + binder.getRelToUse(hardDisk) + "\"/></links>"), LinksDto.class);
   }
View Full Code Here

      buffer.append("</virtualmachinetask>");
      return buffer.toString();
   }

   public static DiskManagementDto hardDiskPost() {
      DiskManagementDto disk = new DiskManagementDto();
      disk.setSizeInMb(1024L);
      return disk;
   }
View Full Code Here

TOP

Related Classes of com.abiquo.server.core.infrastructure.storage.DiskManagementDto

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.