Package org.jclouds.abiquo.functions

Examples of org.jclouds.abiquo.functions.AppendApiVersionToAbiquoMimeType


      Function<String, String> function = new AppendApiVersionToAbiquoMimeType(AbiquoApi.API_VERSION);
      function.apply("foo");
   }

   public void testApplyToStandardMediaType() {
      Function<String, String> function = new AppendApiVersionToAbiquoMimeType(AbiquoApi.API_VERSION);
      assertEquals(function.apply("application/xml"), "application/xml");
   }
View Full Code Here


      Function<String, String> function = new AppendApiVersionToAbiquoMimeType(AbiquoApi.API_VERSION);
      assertEquals(function.apply("application/xml"), "application/xml");
   }

   public void testApplyToAbiquoMediaTypeWithVersion() {
      Function<String, String> function = new AppendApiVersionToAbiquoMimeType(AbiquoApi.API_VERSION);
      assertEquals(function.apply("application/vnd.abiquo.datacenters+xml;version=1.8.5"),
            "application/vnd.abiquo.datacenters+xml;version=1.8.5");
   }
View Full Code Here

      assertEquals(function.apply("application/vnd.abiquo.datacenters+xml;version=1.8.5"),
            "application/vnd.abiquo.datacenters+xml;version=1.8.5");
   }

   public void testApplyToAbiquoMediaTypeWithoutVersion() {
      Function<String, String> function = new AppendApiVersionToAbiquoMimeType(AbiquoApi.API_VERSION);
      assertEquals(function.apply("application/vnd.abiquo.datacenters+xml"),
            "application/vnd.abiquo.datacenters+xml;version=" + AbiquoApi.API_VERSION);
   }
View Full Code Here

public class AppendApiVersionToMediaTypeTest {

   public void testAppendVersionToNonPayloadHeadersWithoutHeaders() {
      HttpRequest request = HttpRequest.builder().method("GET").endpoint(URI.create("http://foo")).build();

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

      HttpRequest filtered = filter.appendVersionToNonPayloadHeaders(request);

      assertTrue(filtered.getHeaders().get(HttpHeaders.ACCEPT).isEmpty());
View Full Code Here

      headers.put(HttpHeaders.ACCEPT, "application/xml");

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

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

      HttpRequest filtered = filter.appendVersionToNonPayloadHeaders(request);

      Collection<String> contentType = filtered.getHeaders().get(HttpHeaders.ACCEPT);
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)
            .build();

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

      HttpRequest filtered = filter.appendVersionToNonPayloadHeaders(request);

      Collection<String> contentType = 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)
            .build();

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

      HttpRequest filtered = filter.appendVersionToNonPayloadHeaders(request);

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

   }

   public void testAppendVersionToPayloadHeadersWithoutPayload() {
      HttpRequest request = HttpRequest.builder().method("GET").endpoint(URI.create("http://foo")).build();

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

      HttpRequest filtered = filter.appendVersionToPayloadHeaders(request);

      assertNull(filtered.getPayload());
View Full Code Here

      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.newByteSourcePayload(ByteSource.wrap(new byte[0]));

      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

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.