예제 #1
0
 public static VolumeManagementDto volumePost() {
   VolumeManagementDto volume = new VolumeManagementDto();
   volume.setName("Volume");
   volume.setSizeInMB(1024);
   volume.addLink(new RESTLink("tier", "http://localhost/api/cloud/virtualdatacenters/1/tiers/1"));
   return volume;
 }
 public void testBindMultipleVolumes() throws IOException {
   VolumeManagementDto volume = CloudResources.volumePut();
   BindVolumeRefsToPayload binder = new BindVolumeRefsToPayload(new JAXBParser("false"));
   HttpRequest request =
       HttpRequest.builder().method("GET").endpoint(URI.create("http://localhost")).build();
   request = binder.bindToRequest(request, new VolumeManagementDto[] {volume, volume});
   assertPayloadEquals(
       request.getPayload(),
       withHeader(
           "<links><link href=\""
               + volume.getEditLink().getHref()
               + "\" rel=\""
               + binder.getRelToUse(volume)
               + "\"/></links>"),
       LinksDto.class);
 }
예제 #3
0
  public static VolumeManagementDto volumePut() {
    VolumeManagementDto volume = volumePost();
    volume.setId(1);
    volume.setState(VolumeState.DETACHED.name());

    volume.getLinks().clear();

    RESTLink mappings =
        new RESTLink(
            "action",
            "http://localhost/api/cloud/virtualdatacenters/1/volumes/1/action/initiatormappings");
    mappings.setTitle("initiator mappings");
    volume.addLink(mappings);
    volume.addLink(
        new RESTLink("edit", "http://localhost/api/cloud/virtualdatacenters/1/volumes/1"));
    volume.addLink(new RESTLink("tier", "http://localhost/api/cloud/virtualdatacenters/1/tiers/1"));
    volume.addLink(
        new RESTLink("virtualdatacenter", "http://localhost/api/cloud/virtualdatacenters/1"));
    return volume;
  }