Package org.jclouds.http.functions.ParseSax

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


  
   public void testOrgWithoutVDC() {
        InputStream is = getClass().getResourceAsStream("/org_no_vdc.xml");
        Injector injector = Guice.createInjector(new SaxParserModule());
        Factory factory = injector.getInstance(ParseSax.Factory.class);
        Org result = factory.create(injector.getInstance(OrgHandler.class)).parse(is);
        assertEquals(
              result.toString(),
              Org.builder()
                    .name("100000.0")
                    .description("SAVVISStation Integration Testing").build().toString());
View Full Code Here


      Location location = new LocationBuilder().id("https://1.1.1.1/api/v1.0/vdc/1").description("description")
            .scope(LocationScope.PROVIDER).build();
      Injector injector = createInjectorWithLocation(location);
      InputStream is = getClass().getResourceAsStream("/vapp-pool.xml");
      Factory factory = injector.getInstance(ParseSax.Factory.class);
      VApp result = factory.create(injector.getInstance(VAppHandler.class)).parse(is);
      VAppToNodeMetadata converter = injector.getInstance(VAppToNodeMetadata.class);
      NodeMetadata node = converter.apply(result);
      assertNotNull(node);
      assertEquals(node.getUserMetadata(), ImmutableMap.<String, String>of());
      assertEquals(node.getTags(), ImmutableSet.<String>of());
View Full Code Here

      Location location = new LocationBuilder().id("https://1.1.1.1/api/v1.0/vdc/1").description("description")
         .scope(LocationScope.PROVIDER).build();
      Injector injector = createInjectorWithLocation(location);
      InputStream is = getClass().getResourceAsStream("/vapp-pool.xml");
      Factory factory = injector.getInstance(ParseSax.Factory.class);
      VApp result = factory.create(injector.getInstance(VAppHandler.class)).parse(is);
      VAppToNodeMetadata converter = injector.getInstance(VAppToNodeMetadata.class);
      ImmutableMap<String, String> metadata = ImmutableMap.<String, String>of();
      ImmutableSet<String> tags = ImmutableSet.<String>of();

      String description = " user=user_ssoid_1\nuid=3b7bb605-bb30-4e62-a3de-9076b052dee7 label='foo-DEVELOPMENT' date=2013-01-22 17:39:28.252";
View Full Code Here

      InputStream is = getClass().getResourceAsStream("/org-1.0.xml");

      Injector injector = Guice.createInjector(new SaxParserModule());
      Factory factory = injector.getInstance(ParseSax.Factory.class);

      Org result = factory.create(injector.getInstance(OrgHandler.class)).parse(is);
      assertEquals(result.getName(), "ExampleOrg");
      assertEquals(result.getFullName(), "ExampleOrg");
      assertEquals(result.getDescription(), "Example Corp's Primary Organization.");
      assertEquals(result.getHref(), URI.create("http://vcloud.example.com/api/v1.0/org/5"));
      assertEquals(result.getCatalogs(), ImmutableMap.of("Main Catalog", new ReferenceTypeImpl("Main Catalog",
View Full Code Here

      InputStream is = getClass().getResourceAsStream("/org.xml");

      Injector injector = Guice.createInjector(new SaxParserModule());
      Factory factory = injector.getInstance(ParseSax.Factory.class);

      Org result = factory.create(injector.getInstance(OrgHandler.class)).parse(is);
      assertEquals(result.getName(), "adrian@jclouds.org");
      assertEquals(result.getFullName(), "adrian@jclouds.org");
      assertEquals(result.getHref(), URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/org/48"));
      assertEquals(result.getCatalogs(), ImmutableMap.of("Miami Environment 1 Catalog", new ReferenceTypeImpl(
               "Miami Environment 1 Catalog", CATALOG_XML, URI
View Full Code Here

   public void testHosting() {
      InputStream is = getClass().getResourceAsStream("/org-hosting.xml");
      Injector injector = Guice.createInjector(new SaxParserModule());
      Factory factory = injector.getInstance(ParseSax.Factory.class);
      Org result = factory.create(injector.getInstance(OrgHandler.class)).parse(is);
      assertEquals(result.getName(), "Customer 188849");
      assertEquals(result.getFullName(), "Customer 188849");
      assertEquals(result.getHref(), URI.create("https://vcloud.safesecureweb.com/api/v0.8/org/188849"));
      assertEquals(result.getCatalogs(), ImmutableMap.of("HMS Shared Catalog", new ReferenceTypeImpl(
               "HMS Shared Catalog", CATALOG_XML, URI.create("https://vcloud.safesecureweb.com/api/v0.8/catalog/1"))));
View Full Code Here

   public void testSavvis() {
      InputStream is = getClass().getResourceAsStream("/org-savvis.xml");
      Injector injector = Guice.createInjector(new SaxParserModule());
      Factory factory = injector.getInstance(ParseSax.Factory.class);
      Org result = factory.create(injector.getInstance(OrgHandler.class)).parse(is);
      assertEquals(result, new OrgImpl("607968.0", null, null, "607968.0", "Gravitant Inc", ImmutableMap
               .<String, ReferenceType> of(), ImmutableMap.<String, ReferenceType> of("GravDataCenter1(Saved)",
               new ReferenceTypeImpl("GravDataCenter1(Saved)", "application/vnd.vmware.vcloud.vdc+xml", URI
                        .create("https://api.symphonyVPDC.savvis.net/rest/api/v0.8/org/607968.0/vdc/2826"))),
               ImmutableMap.<String, ReferenceType> of(), null, ImmutableSet.<Task> of()));
View Full Code Here

            super.configure();
            bind(ResourceAllocationSettingDataHandler.class).to(VCloudResourceAllocationSettingDataHandler.class);
         }
      });
      Factory factory = injector.getInstance(ParseSax.Factory.class);
      VApp result = factory.create(injector.getInstance(VAppHandler.class)).parse(is);
      assertEquals(result.getName(), "vApp_acole_2");
      assertEquals(result.getDescription(), "foo");
      assertEquals(result.getHref(), URI.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320"));
      assertEquals(result.getType(), "application/vnd.vmware.vcloud.vApp+xml");
      assertEquals(result.getStatus(), Status.OFF);
View Full Code Here

      InputStream is = getClass().getResourceAsStream("/versions.xml");

      Injector injector = Guice.createInjector(new SaxParserModule());
      Factory factory = injector.getInstance(ParseSax.Factory.class);

      SortedMap<String, URI> result = factory.create(
               injector.getInstance(SupportedVersionsHandler.class)).parse(is);
      assertEquals(result, ImmutableSortedMap.of("0.8", URI
               .create("https://services.vcloudexpress.terremark.com/api/v0.8/login")));
   }
}
View Full Code Here

      Location location = new LocationBuilder().id("https://1.1.1.1/api/v1.0/vdc/1").description("description")
         .scope(LocationScope.PROVIDER).build();
      Injector injector = createInjectorWithLocation(location);
      InputStream is = getClass().getResourceAsStream("/vapp-pool.xml");
      Factory factory = injector.getInstance(ParseSax.Factory.class);
      VApp result = factory.create(injector.getInstance(VAppHandler.class)).parse(is);
      VAppToNodeMetadata converter = injector.getInstance(VAppToNodeMetadata.class);
      ImmutableMap<String, String> metadata = ImmutableMap.<String, String>of();
      ImmutableSet<String> tags = ImmutableSet.<String>of();

      String description = " user=user_ssoid_1 uid=3b7bb605-bb30-4e62-a3de-9076b052dee7 label='foo-DEVELOPMENT' date=2013-01-22 17:39:28.252";
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.