Package org.jclouds.xml.internal

Examples of org.jclouds.xml.internal.JAXBParser


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

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


      binder.bindToRequest(request, null);
   }

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

   }

   public void testBindUnmanagedNetworkIpRef() throws IOException {
      VLANNetworkDto network = NetworkResources.unmanagedNetworkPut();
      RESTLink ipsLink = network.searchLink("ips");
      BindUnmanagedIpRefToPayload binder = new BindUnmanagedIpRefToPayload(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=\"" + ipsLink.getHref()
            + "\" rel=\"unmanagedip\"/></links>"), LinksDto.class);
   }
View Full Code Here

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

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

      binder.bindToRequest(request, null);
   }

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

      HttpRequest request = HttpRequest.builder().method("GET").endpoint(URI.create("http://localhost")).build();
      binder.bindToRequest(request, new Object());
   }

   public void testBindEmptyArray() throws IOException {
      BindHardDiskRefsToPayload binder = new BindHardDiskRefsToPayload(new JAXBParser("false"));
      HttpRequest request = HttpRequest.builder().method("GET").endpoint(URI.create("http://localhost")).build();
      request = binder.bindToRequest(request, new DiskManagementDto[] {});
      assertPayloadEquals(request.getPayload(), withHeader("<links/>"), LinksDto.class);
   }
View Full Code Here

      assertPayloadEquals(request.getPayload(), withHeader("<links/>"), LinksDto.class);
   }

   public void testBindSingleHardDisk() throws IOException {
      DiskManagementDto hardDisk = CloudResources.hardDiskPut();
      BindHardDiskRefsToPayload binder = new BindHardDiskRefsToPayload(new JAXBParser("false"));
      HttpRequest request = HttpRequest.builder().method("GET").endpoint(URI.create("http://localhost")).build();
      request = binder.bindToRequest(request, new DiskManagementDto[] { hardDisk });
      assertPayloadEquals(request.getPayload(), withHeader("<links><link href=\"" + hardDisk.getEditLink().getHref()
            + "\" rel=\"" + binder.getRelToUse(hardDisk) + "\"/></links>"), LinksDto.class);
   }
View Full Code Here

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

   public void testBindMultipleHardDisks() throws IOException {
      DiskManagementDto hardDisk = CloudResources.hardDiskPut();
      BindHardDiskRefsToPayload binder = new BindHardDiskRefsToPayload(new JAXBParser("false"));
      HttpRequest request = HttpRequest.builder().method("GET").endpoint(URI.create("http://localhost")).build();
      request = binder.bindToRequest(request, new DiskManagementDto[] { hardDisk, hardDisk });
      assertPayloadEquals(request.getPayload(), withHeader("<links><link href=\"" + hardDisk.getEditLink().getHref()
            + "\" rel=\"" + binder.getRelToUse(hardDisk) + "\"/></links>"), LinksDto.class);
   }
View Full Code Here

   /**
    * Marshals a JAXB annotated object into XML. The XML is output using
    * {@link org.jclouds.logging.Logger#debug(String)}
    */
   protected void debug(final Object object) {
      JAXBParser parser = new JAXBParser("true");
      try {
         String xml = parser.toXML(object);
         logger.debug(Strings.padStart(Strings.padEnd(" " + object.getClass().toString() + " ", 70, '-'), 80, '-'));
         logger.debug(xml);
         logger.debug(Strings.repeat("-", 80));
      } catch (IOException ioe) {
         Throwables.propagate(ioe);
View Full Code Here

*/
@Test(groups = "unit", testName = "BindNetworkConfigurationRefToPayloadTest")
public class BindNetworkConfigurationRefToPayloadTest {
   @Test(expectedExceptions = NullPointerException.class)
   public void testInvalidNullRequest() throws SecurityException, NoSuchMethodException {
      BindNetworkConfigurationRefToPayload binder = new BindNetworkConfigurationRefToPayload(new JAXBParser("false"));
      binder.bindToRequest(null, new Object());
   }
View Full Code Here

TOP

Related Classes of org.jclouds.xml.internal.JAXBParser

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.