Package org.jclouds.http.functions.ParseSax

Examples of org.jclouds.http.functions.ParseSax.Factory


public class CatalogItemHandlerTest {

   public void testApplyInputStream() {
      InputStream is = getClass().getResourceAsStream("/catalogItem-hosting.xml");
      Injector injector = Guice.createInjector(new SaxParserModule());
      Factory factory = injector.getInstance(ParseSax.Factory.class);
      CatalogItem result = factory.create(injector.getInstance(CatalogItemHandler.class)).parse(is);

      assertEquals(result, new CatalogItemImpl("Windows 2008 Datacenter 64 Bit", URI
               .create("https://vcloud.safesecureweb.com/api/v0.8/catalogItem/2"), "Windows 2008 Datacenter 64 Bit",
               new ReferenceTypeImpl("Windows 2008 Datacenter 64 Bit",
                        "application/vnd.vmware.vcloud.vAppTemplate+xml", URI
View Full Code Here


   }
  
   public void testApplyInputStreamWithNamespaceUsingVcloud() {
      InputStream is = getClass().getResourceAsStream("/catalogItem-carrenza-with-vcloud-namespace.xml");
      Injector injector = Guice.createInjector(new SaxParserModule());
      Factory factory = injector.getInstance(ParseSax.Factory.class);
      CatalogItem result = factory.create(injector.getInstance(CatalogItemHandler.class)).parse(is);

      assertEquals(result, new CatalogItemImpl("ubuntu10.10x64",
               URI.create("https://myvdc.carrenza.net/api/v1.0/catalogItem/ecd4d3a0-0d12-4195-a6d2-14cdf9f925a3"),
               null, new ReferenceTypeImpl("ubuntu10.10x64", "application/vnd.vmware.vcloud.vAppTemplate+xml",
                        URI.create("https://myvdc.carrenza.net/api/v1.0/vAppTemplate/vappTemplate-123766ea-2b55-482c-8adf-735ab1952834")),
View Full Code Here

   }
  
   public void testApplyInputStreamWithNamespaceUsingDefault() {
      InputStream is = getClass().getResourceAsStream("/catalogItem-carrenza-with-default-namespace.xml");
      Injector injector = Guice.createInjector(new SaxParserModule());
      Factory factory = injector.getInstance(ParseSax.Factory.class);
      CatalogItem result = factory.create(injector.getInstance(CatalogItemHandler.class)).parse(is);

      assertEquals(result, new CatalogItemImpl("ubuntu10.10x64",
               URI.create("https://myvdc.carrenza.net/api/v1.0/catalogItem/ecd4d3a0-0d12-4195-a6d2-14cdf9f925a3"),
               null, new ReferenceTypeImpl("ubuntu10.10x64", "application/vnd.vmware.vcloud.vAppTemplate+xml",
                        URI.create("https://myvdc.carrenza.net/api/v1.0/vAppTemplate/vappTemplate-123766ea-2b55-482c-8adf-735ab1952834")),
View Full Code Here

@Test(groups = "unit")
public class OrgNetworkHandlerTest {
   public void testIsolated() {
      InputStream is = getClass().getResourceAsStream("/orgnetwork-isolated.xml");
      Injector injector = Guice.createInjector(new SaxParserModule());
      Factory factory = injector.getInstance(ParseSax.Factory.class);
      OrgNetwork result = factory.create(injector.getInstance(OrgNetworkHandler.class)).parse(is);
      assertEquals(result.getName(), "isolation01");
      assertEquals(result.getHref(), URI.create("https://vcenterprise.bluelock.com/api/v1.0/network/990419644"));
      assertEquals(result.getType(), "application/vnd.vmware.vcloud.network+xml");
      assertEquals(result.getOrg(), new ReferenceTypeImpl(null, VCloudMediaType.ORG_XML, URI
               .create("https://vcenterprise.bluelock.com/api/v1.0/org/9566014")));
View Full Code Here

   }

   public void testBridged() {
      InputStream is = getClass().getResourceAsStream("/orgnetwork-bridged.xml");
      Injector injector = Guice.createInjector(new SaxParserModule());
      Factory factory = injector.getInstance(ParseSax.Factory.class);
      OrgNetwork result = factory.create(injector.getInstance(OrgNetworkHandler.class)).parse(is);
      assertEquals(result.getName(), "internet01");
      assertEquals(result.getHref(), URI.create("https://vcenterprise.bluelock.com/api/v1.0/network/758634723"));
      assertEquals(result.getType(), "application/vnd.vmware.vcloud.network+xml");
      assertEquals(result.getOrg(), new ReferenceTypeImpl(null, VCloudMediaType.ORG_XML, URI
               .create("https://vcenterprise.bluelock.com/api/v1.0/org/9566014")));
View Full Code Here

         protected void configure() {
            super.configure();
            bind(ResourceAllocationSettingDataHandler.class).to(VCloudResourceAllocationSettingDataHandler.class);
         }
      });
      Factory factory = injector.getInstance(ParseSax.Factory.class);
      Vm result = factory.create(injector.getInstance(VmHandler.class)).parse(is);
      checkVm(result);
   }
View Full Code Here

@Test(groups = "unit")
public class OperatingSystemSectionHandlerTest {
   public void test() {
      InputStream is = getClass().getResourceAsStream("/operatingsystemsection.xml");
      Injector injector = Guice.createInjector(new SaxParserModule());
      Factory factory = injector.getInstance(ParseSax.Factory.class);
      OperatingSystemSection result = factory.create(injector.getInstance(OperatingSystemSectionHandler.class)).parse(
               is);
      assertEquals(result.toString(), OperatingSystemSection.builder().info("Specifies the operating system installed")
               .description("Microsoft Windows Server 2008").id(76).build().toString()

      );
View Full Code Here

@Test(groups = "unit")
public class DiskSectionHandlerTest {
   public void test() {
      InputStream is = getClass().getResourceAsStream("/disksection.xml");
      Injector injector = Guice.createInjector(new SaxParserModule());
      Factory factory = injector.getInstance(ParseSax.Factory.class);
      DiskSection result = factory.create(injector.getInstance(DiskSectionHandler.class)).parse(is);
      assertEquals(result.toString(), DiskSection.builder().info("Describes the set of virtual disks").disk(
               Disk.builder().id("vmdisk1")

               .fileRef("file1").capacity(8589934592l).populatedSize(3549324972l).format(
                        URI.create("http://www.vmware.com/interfaces/specifications/vmdk.html#sparse")).build()).disk(
View Full Code Here

   }

   public void testVCloud1_0() {
      InputStream is = getClass().getResourceAsStream("/virtualsystem.xml");
      Injector injector = Guice.createInjector(new SaxParserModule());
      Factory factory = injector.getInstance(ParseSax.Factory.class);
      VirtualSystem result = factory.create(injector.getInstance(VirtualSystemHandler.class)).parse(is);
      checkVirtualSystem(result);
   }
View Full Code Here

@Test(groups = "unit")
public class NetworkSectionHandlerTest {
   public void test() {
      InputStream is = getClass().getResourceAsStream("/networksection.xml");
      Injector injector = Guice.createInjector(new SaxParserModule());
      Factory factory = injector.getInstance(ParseSax.Factory.class);
      NetworkSection result = factory.create(injector.getInstance(NetworkSectionHandler.class)).parse(is);
      assertEquals(result.toString(), NetworkSection.builder().info("List of logical networks used in the package")
               .network(
                        Network.builder().name("red").description("The network the Red service is available on")
                                 .build()).network(
                        Network.builder().name("blue").description("The network the Blue service is available on")
View Full Code Here

TOP

Related Classes of org.jclouds.http.functions.ParseSax.Factory

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.