Package com.google.inject

Examples of com.google.inject.Injector


    assertTrue(fetcher instanceof HttpCache);
    assertEquals(10, fetcher.getDefaultRequestOptions().getMaxRedirects());
  }

  public void testGuiceNoModule() throws Exception {
    Injector injector = Guice.createInjector();
    ConsumerManager m = injector.getInstance(ConsumerManager.class);
    HttpFetcher fetcher = m.getHttpFetcher();

    assertTrue(fetcher instanceof HttpCache);
    assertEquals(0, fetcher.getDefaultRequestOptions().getMaxRedirects());
View Full Code Here


    assertTrue(fetcher instanceof HttpCache);
    assertEquals(10, fetcher.getDefaultRequestOptions().getMaxRedirects());
  }

  public void testGuiceInjectedFetcher() throws Exception {
    Injector injector = Guice.createInjector(new TestModule());
    ConsumerManager m = injector.getInstance(ConsumerManager.class);
    HttpFetcher fetcher = m.getHttpFetcher();

    assertTrue(fetcher instanceof TestFetcher);
    assertEquals(0, fetcher.getDefaultRequestOptions().getMaxRedirects());
View Full Code Here

      this.providerFactory = providerFactory;
   }

   public void process(final Module... modules)
   {
      final Injector injector = Guice.createInjector(modules);
      processInjector(injector);
   }
View Full Code Here

      processInjector(injector);
   }

   public void process(final Stage stage, final Module... modules)
   {
      final Injector injector = Guice.createInjector(stage, modules);
      processInjector(injector);
   }
View Full Code Here

      processInjector(injector);
   }

   public void process(final Iterable<Module> modules)
   {
      final Injector injector = Guice.createInjector(modules);
      processInjector(injector);
   }
View Full Code Here

      processInjector(injector);
   }

   public void process(final Stage stage, final Iterable<Module> modules)
   {
      final Injector injector = Guice.createInjector(stage, modules);
      processInjector(injector);
   }
View Full Code Here

      new ComponentTest()
      {
         @Override
         protected void testComponents() throws Exception
         {
            Injector injector = (Injector) getInstance("guiceExampleInjector");

            Object juiceInstance = injector.getInstance(Juice.class);
            assert juiceInstance instanceof AppleJuice : juiceInstance;

            Object orangeInstance = injector.getInstance(Key.get(Juice.class, Orange.class));
            assert orangeInstance instanceof OrangeJuice : orangeInstance;
         }
      }.run();
   }
View Full Code Here

   */
  public void openJob(final File file, final AnalysisJobBuilder ajb) {
    _userPreferences.setAnalysisJobDirectory(file.getParentFile());
    _userPreferences.addRecentJobFile(file);

    Injector injector = Guice.createInjector(new DCModule(_parentModule, ajb) {
      public String getJobFilename() {
        return file.getName();
      };
    });

    AnalysisJobBuilderWindow window = injector.getInstance(AnalysisJobBuilderWindow.class);
    window.open();

    if (_parentWindow != null && !_parentWindow.isDatastoreSet()) {
      _parentWindow.close();
    }
View Full Code Here

    GWTMockUtilities.disarm();
  }

  @Before
  public void setup() {
    Injector myInjector = Guice.createInjector(new GeomajasTestModule());
    mapPresenter = myInjector.getInstance(MapPresenter.class);
  }
View Full Code Here

  /**
   * Creates polygons with a single hole in them.
   */
  @Before
  public void setUp() {
    Injector myInjector = Guice.createInjector(new GeomajasTestModule());
    gwtFactory = myInjector.getInstance(GeometryFactory.class);
    LinearRing gwtShell = gwtFactory.createLinearRing(new Coordinate[] { new Coordinate(10.0, 10.0),
        new Coordinate(20.0, 10.0), new Coordinate(20.0, 20.0), new Coordinate(10.0, 10.0) });
    LinearRing gwtHole = gwtFactory.createLinearRing(new Coordinate[] { new Coordinate(12.0, 12.0),
        new Coordinate(18.0, 12.0), new Coordinate(18.0, 18.0), new Coordinate(12.0, 12.0) });
    gwt = gwtFactory.createPolygon(gwtShell, new LinearRing[] { gwtHole });
View Full Code Here

TOP

Related Classes of com.google.inject.Injector

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.