Package org.jclouds.http.functions.ParseSax

Examples of org.jclouds.http.functions.ParseSax.Factory.create()


   public static Envelope parseEnvelope() {
      InputStream is = EnvelopeHandlerTest.class.getResourceAsStream("/ovf.xml");
      Injector injector = Guice.createInjector(new SaxParserModule());
      Factory factory = injector.getInstance(ParseSax.Factory.class);
      Envelope result = factory.create(injector.getInstance(EnvelopeHandler.class)).parse(is);
      return result;
   }

   //TODO: create a parser that can!
   @Test(expectedExceptions = IllegalArgumentException.class)
View Full Code Here


   @Test(expectedExceptions = IllegalArgumentException.class)
   public void testThrowIllegalArgumentAsWeDontYetSupportVirtualSystemCollections() {
      InputStream is = getClass().getResourceAsStream("/ovf-vcd1.5.xml");
      Injector injector = Guice.createInjector(new SaxParserModule());
      Factory factory = injector.getInstance(ParseSax.Factory.class);
      factory.create(injector.getInstance(EnvelopeHandler.class)).parse(is).getVirtualSystem();
   }
 
   static void checkOvfEnvelope(Envelope result) {
      VirtualSystemSettingDataHandlerTest.checkVirtualSystem(result.getVirtualSystem());
   }
View Full Code Here

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

public class NetworkConnectionSectionHandlerTest {
   public void testVCloud1_0() {
      InputStream is = getClass().getResourceAsStream("/networkconnectionsection.xml");
      Injector injector = Guice.createInjector(new SaxParserModule());
      Factory factory = injector.getInstance(ParseSax.Factory.class);
      NetworkConnectionSection result = factory.create(injector.getInstance(NetworkConnectionSectionHandler.class))
               .parse(is);
      checkNetworkConnectionSection(result);
   }

   @Test(enabled = false)
View Full Code Here

public class VDCHandlerTest {
   public void testVCloud1_0() {
      InputStream is = getClass().getResourceAsStream("/vdc-1.0.xml");
      Injector injector = Guice.createInjector(new SaxParserModule());
      Factory factory = injector.getInstance(ParseSax.Factory.class);
      VDC result = factory.create(injector.getInstance(VDCHandler.class)).parse(is);
      assertEquals(result.getName(), "Jclouds-Commit-compG1xstorA01");
      assertEquals(result.getHref(), URI.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1014839439"));
      assertEquals(result.getType(), "application/vnd.vmware.vcloud.vdc+xml");
      assertEquals(result.getStatus(), VDCStatus.READY);
      assertEquals(result.getOrg(), new ReferenceTypeImpl(null, VCloudMediaType.ORG_XML, URI
View Full Code Here

   public void testTerremark() {
      InputStream is = getClass().getResourceAsStream("/vdc.xml");
      Injector injector = Guice.createInjector(new SaxParserModule());
      Factory factory = injector.getInstance(ParseSax.Factory.class);
      VDC result = factory.create(injector.getInstance(VDCHandler.class)).parse(is);
      assertEquals(result.getName(), "Miami Environment 1");
      assertEquals(result.getHref(), URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32"));
      assertEquals(result.getDescription(), null);
      assertEquals(result.getStorageCapacity(), new Capacity("bytes * 10^9", 100, 0, 8, 0));
      assertEquals(result.getCpuCapacity(), new Capacity("hz * 10^6", 5000, 0, 0, 0));
View Full Code Here

   public void testHostingDotCom() {
      InputStream is = getClass().getResourceAsStream("/vdc-hosting.xml");
      Injector injector = Guice.createInjector(new SaxParserModule());
      Factory factory = injector.getInstance(ParseSax.Factory.class);
      VDC result = factory.create(injector.getInstance(VDCHandler.class)).parse(is);
      assertEquals(result.getName(), "vDC Name");
      assertEquals(result.getHref(), URI.create("https://vcloud.safesecureweb.com/api/v0.8/vdc/188849"));
      assertEquals(result.getDescription(), "vDC Name");
      assertEquals(result.getStorageCapacity(), new Capacity("bytes * 10^9", 0, 0, 40960, 0));
      assertEquals(result.getCpuCapacity(), new Capacity("hz * 10^6", 0, 0, 2400, 0));
View Full Code Here

   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

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.