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);
 }
Пример #2
0
  public void testListTasksVirtualMachine()
      throws SecurityException, NoSuchMethodException, IOException {
    Invokable<?, ?> method = method(TaskApi.class, "listTasks", SingleResourceTransportDto.class);
    GeneratedHttpRequest request =
        processor.apply(
            Invocation.create(
                method, ImmutableList.<Object>of(CloudResources.virtualMachinePut())));

    assertRequestLineEquals(
        request,
        "GET http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines/1/tasks HTTP/1.1");
    assertNonPayloadHeadersEqual(request, "Accept: " + TasksDto.BASE_MEDIA_TYPE + "\n");
    assertPayloadEquals(request, null, null, false);

    assertResponseParserClassEquals(method, request, ParseXMLWithJAXB.class);
    assertSaxResponseParserClassEquals(method, null);
    assertFallbackClassEquals(method, null);

    checkFilters(request);
  }