Package org.jclouds.abiquo.functions

Examples of org.jclouds.abiquo.functions.AppendApiVersionToAbiquoMimeType


      payload.getContentMetadata().setContentType("application/xml");

      HttpRequest request = HttpRequest.builder().method("GET").endpoint(URI.create("http://foo")).payload(payload)
            .build();

      AppendApiVersionToMediaType filter = new AppendApiVersionToMediaType(new AppendApiVersionToAbiquoMimeType(
            AbiquoApi.API_VERSION));

      HttpRequest filtered = filter.appendVersionToPayloadHeaders(request);

      assertEquals(filtered.getPayload().getContentMetadata().getContentType(), "application/xml");
View Full Code Here


      Payload payload = Payloads.newByteArrayPayload(new byte[] {});

      HttpRequest request = HttpRequest.builder().method("GET").endpoint(URI.create("http://foo")).payload(payload)
            .build();

      AppendApiVersionToMediaType filter = new AppendApiVersionToMediaType(new AppendApiVersionToAbiquoMimeType(
            AbiquoApi.API_VERSION));

      HttpRequest filtered = filter.appendVersionToPayloadHeaders(request);

      assertEquals(filtered.getPayload().getContentMetadata().getContentType(), "application/unknown");
View Full Code Here

      payload.getContentMetadata().setContentType("application/vnd.abiquo.racks+xml;version=1.8.5");

      HttpRequest request = HttpRequest.builder().method("GET").endpoint(URI.create("http://foo")).payload(payload)
            .build();

      AppendApiVersionToMediaType filter = new AppendApiVersionToMediaType(new AppendApiVersionToAbiquoMimeType(
            AbiquoApi.API_VERSION));

      HttpRequest filtered = filter.appendVersionToPayloadHeaders(request);

      assertEquals(filtered.getPayload().getContentMetadata().getContentType(),
View Full Code Here

      payload.getContentMetadata().setContentType("application/vnd.abiquo.racks+xml");

      HttpRequest request = HttpRequest.builder().method("GET").endpoint(URI.create("http://foo")).payload(payload)
            .build();

      AppendApiVersionToMediaType filter = new AppendApiVersionToMediaType(new AppendApiVersionToAbiquoMimeType(
            AbiquoApi.API_VERSION));

      HttpRequest filtered = filter.appendVersionToPayloadHeaders(request);

      assertEquals(filtered.getPayload().getContentMetadata().getContentType(),
View Full Code Here

      headers.put(HttpHeaders.ACCEPT, "application/vnd.abiquo.racks+xml;version=2.1-SNAPSHOT");

      HttpRequest request = HttpRequest.builder().method("GET").endpoint(URI.create("http://foo")).headers(headers)
            .payload(payload).build();

      AppendApiVersionToMediaType filter = new AppendApiVersionToMediaType(new AppendApiVersionToAbiquoMimeType(
            AbiquoApi.API_VERSION));

      HttpRequest filtered = filter.filter(request);

      Collection<String> accept = filtered.getHeaders().get(HttpHeaders.ACCEPT);
View Full Code Here

      headers.put(HttpHeaders.ACCEPT, "application/vnd.abiquo.racks+xml");

      HttpRequest request = HttpRequest.builder().method("GET").endpoint(URI.create("http://foo")).headers(headers)
            .payload(payload).build();

      AppendApiVersionToMediaType filter = new AppendApiVersionToMediaType(new AppendApiVersionToAbiquoMimeType(
            AbiquoApi.API_VERSION));

      HttpRequest filtered = filter.filter(request);

      Collection<String> accept = filtered.getHeaders().get(HttpHeaders.ACCEPT);
View Full Code Here

      headers.put(HttpHeaders.ACCEPT, "application/vnd.abiquo.racks+xml;version=1.8.5");

      HttpRequest request = HttpRequest.builder().method("GET").endpoint(URI.create("http://foo")).headers(headers)
            .payload(payload).build();

      AppendApiVersionToMediaType filter = new AppendApiVersionToMediaType(new AppendApiVersionToAbiquoMimeType(
            AbiquoApi.API_VERSION));

      HttpRequest filtered = filter.filter(request);

      Collection<String> accept = filtered.getHeaders().get(HttpHeaders.ACCEPT);
View Full Code Here

      headers.put(HttpHeaders.ACCEPT, "application/vnd.abiquo.racks+xml");

      HttpRequest request = HttpRequest.builder().method("GET").endpoint(URI.create("http://foo")).headers(headers)
            .payload(payload).build();

      AppendApiVersionToMediaType filter = new AppendApiVersionToMediaType(new AppendApiVersionToAbiquoMimeType(
            AbiquoApi.API_VERSION));

      HttpRequest filtered = filter.filter(request);

      Collection<String> accept = filtered.getHeaders().get(HttpHeaders.ACCEPT);
View Full Code Here

*/
@Test(groups = "unit", testName = "AppendApiVersionToAbiquoMimeTypeTest")
public class AppendApiVersionToAbiquoMimeTypeTest {
   @Test(expectedExceptions = NullPointerException.class)
   public void testApplyWithNullInput() {
      Function<String, String> function = new AppendApiVersionToAbiquoMimeType(AbiquoApi.API_VERSION);
      function.apply(null);
   }
View Full Code Here

      function.apply(null);
   }

   @Test(expectedExceptions = IllegalArgumentException.class)
   public void testApplyWithInvalidMediaType() {
      Function<String, String> function = new AppendApiVersionToAbiquoMimeType(AbiquoApi.API_VERSION);
      function.apply("foo");
   }
View Full Code Here

TOP

Related Classes of org.jclouds.abiquo.functions.AppendApiVersionToAbiquoMimeType

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.