Package org.jclouds.http.functions.config

Examples of org.jclouds.http.functions.config.SaxParserModule$Factory


      checkOvfEnvelope(result);
   }

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


      install(new LocationModule());
   }

   @Override
   protected void configure() {
      install(new SaxParserModule());
      install(new GsonModule());
      install(new SetCaller.Module());
      install(new FactoryModuleBuilder().build(BindToJsonPayloadWrappedWith.Factory.class));
      bind(new TypeLiteral<Function<HttpRequest, Function<HttpResponse, ?>>>() {
      }).to(TransformerForRequest.class);
View Full Code Here

   private Factory factory;

   public void testTerremark() {
      InputStream is = getClass().getResourceAsStream("/vAppTemplate-trmk.xml");
      injector = Guice.createInjector(new SaxParserModule());
      factory = injector.getInstance(ParseSax.Factory.class);
      VAppTemplate result = factory.create(injector.getInstance(VAppTemplateHandler.class)).parse(is);
      assertEquals(result, new VAppTemplateImpl("CentOS 5.3 (32-bit)", URI
            .create("https://services.vcloudexpress.terremark.com/api/v0.8/vAppTemplate/5"),
            "description of CentOS 5.3 (32-bit)", null));
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 VDCHandlerTest {

   public void testApplyInputStream() {
      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"));
View Full Code Here

   @SuppressWarnings("unchecked")
   protected Function<HttpResponse, T> parser(Injector i) {
      try {
         return (Function<HttpResponse, T>) i
               .createChildInjector(new SaxParserModule())
               .getInstance(TransformerForRequest.class)
               .getTransformerForMethod(Invocation.create(method(getClass(), "expected"), ImmutableList.of()), i);
      } catch (Exception e) {
         throw Throwables.propagate(e);
      }
View Full Code Here

   }

   protected void assertCodeMakes(String method, URI uri, int statusCode, String message, String contentType,
            String content, Class<? extends Exception> expected) {

      HttpErrorHandler function = Guice.createInjector(new SaxParserModule()).getInstance(getHandlerClass());

      HttpCommand command = createMock(HttpCommand.class);
      HttpRequest request = HttpRequest.builder().method(method).endpoint(uri).build();
      HttpResponse response = HttpResponse.builder().statusCode(statusCode).message(message).payload(content).build();
      if (contentType != null)
View Full Code Here

public class SupportedVersionsHandlerTest {

   public void testApplyInputStream() {
      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
View Full Code Here

   private Factory factory;

   public void testTerremark() {
      InputStream is = getClass().getResourceAsStream("/catalog.xml");
      injector = Guice.createInjector(new SaxParserModule());
      factory = injector.getInstance(ParseSax.Factory.class);
      Catalog result = factory.create(injector.getInstance(CatalogHandler.class)).parse(is);
      assertEquals(result.getName(), "Miami Environment 1");
      assert result.getDescription() == null;
View Full Code Here

@Test(groups = "unit", testName = "CatalogItemHandlerTest")
public class CatalogItemHandlerTest extends BaseHandlerTest {
   @Override
   @BeforeTest
   protected void setUpInjector() {
      injector = Guice.createInjector(new SaxParserModule() {
         @Override
         public void configure() {
            super.configure();
            Names.bindProperties(binder(), TerremarkVCloudApiMetadata.defaultProperties());
         }
View Full Code Here

TOP

Related Classes of org.jclouds.http.functions.config.SaxParserModule$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.