Examples of JAXBParser


Examples of org.jclouds.xml.internal.JAXBParser

            + "\" rel=\"" + binder.getRelToUse(volume) + "\"/></links>"), LinksDto.class);
   }

   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);
   }
View Full Code Here

Examples of org.jclouds.xml.internal.JAXBParser

    *            If there is an error during serialization.
    */
   public static void assertPayloadEquals(final Payload payload, final String expected,
         final Class<? extends SingleResourceTransportDto> entityClass) throws IOException {
      // Serialize and deserialize to avoid formatting issues
      XMLParser xml = new JAXBParser("false");
      SingleResourceTransportDto entity = xml.fromXML(expected, entityClass);
      String toMatch = xml.toXML(entity, entityClass);

      assertEquals(payload.getRawContent(), toMatch);
   }
View Full Code Here

Examples of org.jclouds.xml.internal.JAXBParser

@Test(groups = "unit", testName = "BindVirtualDatacenterRefToPayloadTest")
public class BindVirtualDatacenterRefToPayloadTest {

   @Test(expectedExceptions = NullPointerException.class)
   public void testInvalidNullInput() {
      BindVirtualDatacenterRefToPayload binder = new BindVirtualDatacenterRefToPayload(new JAXBParser("false"));
      HttpRequest request = HttpRequest.builder().method("GET").endpoint(URI.create("http://localhost")).build();
      binder.bindToRequest(request, null);
   }
View Full Code Here

Examples of org.jclouds.xml.internal.JAXBParser

      binder.bindToRequest(request, null);
   }

   @Test(expectedExceptions = IllegalArgumentException.class)
   public void testInvalidTypeInput() {
      BindVirtualDatacenterRefToPayload binder = new BindVirtualDatacenterRefToPayload(new JAXBParser("false"));
      HttpRequest request = HttpRequest.builder().method("GET").endpoint(URI.create("http://localhost")).build();
      binder.bindToRequest(request, new Object());
   }
View Full Code Here

Examples of org.jclouds.xml.internal.JAXBParser

      binder.bindToRequest(request, new Object());
   }

   public void testBindSingleVolume() throws IOException {
      VirtualDatacenterDto vdc = CloudResources.virtualDatacenterPut();
      BindVirtualDatacenterRefToPayload binder = new BindVirtualDatacenterRefToPayload(new JAXBParser("false"));
      HttpRequest request = HttpRequest.builder().method("GET").endpoint(URI.create("http://localhost")).build();
      request = binder.bindToRequest(request, vdc);
      assertPayloadEquals(request.getPayload(), withHeader("<links><link href=\"" + vdc.getEditLink().getHref()
            + "\" rel=\"virtualdatacenter\"/></links>"), LinksDto.class);
   }
View Full Code Here

Examples of org.jclouds.xml.internal.JAXBParser

@Test(groups = "unit", testName = "BindNetworkRefToPayloadTest")
public class BindNetworkRefToPayloadTest {

   @Test(expectedExceptions = NullPointerException.class)
   public void testInvalidNullInput() {
      BindNetworkRefToPayload binder = new BindNetworkRefToPayload(new JAXBParser("false"));
      HttpRequest request = HttpRequest.builder().method("GET").endpoint(URI.create("http://localhost")).build();
      binder.bindToRequest(request, null);
   }
View Full Code Here

Examples of org.jclouds.xml.internal.JAXBParser

      binder.bindToRequest(request, null);
   }

   @Test(expectedExceptions = IllegalArgumentException.class)
   public void testInvalidTypeInput() {
      BindNetworkRefToPayload binder = new BindNetworkRefToPayload(new JAXBParser("false"));
      HttpRequest request = HttpRequest.builder().method("GET").endpoint(URI.create("http://localhost")).build();
      binder.bindToRequest(request, new Object());
   }
View Full Code Here

Examples of org.jclouds.xml.internal.JAXBParser

      binder.bindToRequest(request, new Object());
   }

   public void testBindNetworkRef() throws IOException {
      VLANNetworkDto network = NetworkResources.privateNetworkPut();
      BindNetworkRefToPayload binder = new BindNetworkRefToPayload(new JAXBParser("false"));
      HttpRequest request = HttpRequest.builder().method("GET").endpoint(URI.create("http://localhost")).build();
      request = binder.bindToRequest(request, network);
      assertPayloadEquals(request.getPayload(), withHeader("<links><link href=\"" + network.getEditLink().getHref()
            + "\" rel=\"internalnetwork\"/></links>"), LinksDto.class);
   }
View Full Code Here

Examples of org.jclouds.xml.internal.JAXBParser

@Test(groups = "unit", testName = "BindIpRefToPayloadTest")
public class BindIpRefToPayloadTest {

   @Test(expectedExceptions = NullPointerException.class)
   public void testInvalidNullInput() {
      BindIpRefToPayload binder = new BindIpRefToPayload(new JAXBParser("false"));
      HttpRequest request = HttpRequest.builder().method("GET").endpoint(URI.create("http://localhost")).build();
      binder.bindToRequest(request, null);
   }
View Full Code Here

Examples of org.jclouds.xml.internal.JAXBParser

      binder.bindToRequest(request, null);
   }

   @Test(expectedExceptions = IllegalArgumentException.class)
   public void testInvalidTypeInput() {
      BindIpRefToPayload binder = new BindIpRefToPayload(new JAXBParser("false"));
      HttpRequest request = HttpRequest.builder().method("GET").endpoint(URI.create("http://localhost")).build();
      binder.bindToRequest(request, new Object());
   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.