Package com.google.gwt.inject.rebind.binding

Examples of com.google.gwt.inject.rebind.binding.Dependency


    assertTrue(String.format("Expected to be empty, but was %s", actual), actual.isEmpty());
  }
 
  public void testAlreadyPositioned() throws Exception {
    expect(origin.getDependencies()).andStubReturn(TestUtils.dependencyList(
        new Dependency(Dependency.GINJECTOR, foo(), SOURCE)));
    expect(origin.isBound(foo())).andReturn(true).anyTimes();
    expect(origin.getParent()).andReturn(null);
    control.replay();
    DependencyExplorerOutput output = dependencyExplorer.explore(origin);
    assertSame(origin, output.getPreExistingLocations().get(foo()));
    assertEquals(1, output.getPreExistingLocations().size());
    assertEmpty(output.getBindingErrors());
    assertEmpty(output.getImplicitlyBoundKeys());
    assertSame(origin, output.getGraph().getOrigin());
    assertEmpty(output.getGraph().getDependenciesOf(foo()));
    assertContentsAnyOrder(output.getGraph().getDependenciesTargeting(foo()),
        new Dependency(Dependency.GINJECTOR, foo(), SOURCE));
    control.verify();
  }
View Full Code Here


  }

  public void testAlreadyBoundInParent() throws Exception {
    GinjectorBindings parent = control.createMock("parent", GinjectorBindings.class);
    expect(origin.getDependencies()).andStubReturn(TestUtils.dependencyList(
        new Dependency(Dependency.GINJECTOR, foo(), SOURCE)));
    expect(origin.isPinned(foo())).andReturn(false).anyTimes();
    expect(origin.isBound(foo())).andReturn(false).anyTimes();
    expect(origin.getParent()).andReturn(parent).anyTimes();
    expect(parent.getParent()).andReturn(null);
    expect(parent.isBound(foo())).andReturn(true);
View Full Code Here

  }

  public void testWillBeBoundBoundInParent() throws Exception {
    GinjectorBindings parent = control.createMock("parent", GinjectorBindings.class);
    expect(origin.getDependencies()).andStubReturn(TestUtils.dependencyList(
        new Dependency(Dependency.GINJECTOR, foo(), SOURCE)));
    expect(origin.isPinned(foo())).andReturn(false).anyTimes();
    expect(origin.isBound(foo())).andReturn(false).anyTimes();
    expect(origin.getParent()).andReturn(parent).anyTimes();
    expect(parent.getParent()).andReturn(null);
    expect(parent.isBound(foo())).andReturn(false);
View Full Code Here

   * we will treat foo as previously positioned.
   */
  public void testSourcePositioned() throws Exception {
    GinjectorBindings parent = control.createMock("parent", GinjectorBindings.class);
    expect(origin.getDependencies()).andStubReturn(TestUtils.dependencyList(
        new Dependency(Dependency.GINJECTOR, foo(), SOURCE),
        new Dependency(foo(), bar(), SOURCE)));
    expect(origin.isBound(foo())).andReturn(true).anyTimes();
    expect(origin.isBound(bar())).andReturn(false).anyTimes();
    expect(origin.isPinned(foo())).andReturn(true).anyTimes();
    expect(origin.isPinned(bar())).andReturn(false).anyTimes();
    expect(origin.getParent()).andReturn(parent).anyTimes();
View Full Code Here

   * we will use the highest foo available.
   */
  public void testSourcePositioned_Exposed() throws Exception {
    GinjectorBindings parent = control.createMock("parent", GinjectorBindings.class);
    expect(origin.getDependencies()).andStubReturn(TestUtils.dependencyList(
        new Dependency(Dependency.GINJECTOR, foo(), SOURCE),
        new Dependency(foo(), bar(), SOURCE)));
    expect(origin.isBound(foo())).andReturn(true).anyTimes();
    expect(origin.isBound(bar())).andReturn(false).anyTimes();
    expect(origin.isPinned(foo())).andReturn(true).anyTimes();
    expect(origin.isPinned(bar())).andReturn(false).anyTimes();
    expect(origin.getParent()).andReturn(parent).anyTimes();
View Full Code Here

   * from the origin.
   */
  public void testSkipsExposedBindingFromOrigin() throws Exception {
    GinjectorBindings parent = control.createMock("parent", GinjectorBindings.class);
    expect(origin.getDependencies()).andStubReturn(TestUtils.dependencyList(
        new Dependency(Dependency.GINJECTOR, foo(), SOURCE)));
    expect(origin.isBound(foo())).andReturn(false).anyTimes();
    expect(origin.isPinned(foo())).andReturn(true).anyTimes();
    expect(origin.getParent()).andReturn(parent).anyTimes();
    expect(bindingCreator.create(foo())).andReturn(binding);
    expect(binding.getDependencies()).andReturn(TestUtils.dependencyList());
View Full Code Here

   */
  public void testUsesExposedBinding() throws Exception {
    GinjectorBindings parent = control.createMock("parent", GinjectorBindings.class);
    GinjectorBindings otherGinjector = control.createMock("other", GinjectorBindings.class);
    expect(origin.getDependencies()).andStubReturn(TestUtils.dependencyList(
        new Dependency(Dependency.GINJECTOR, foo(), SOURCE)));
    expect(origin.isBound(foo())).andReturn(false).anyTimes();
    expect(origin.isPinned(foo())).andReturn(false).anyTimes();
    expect(origin.getParent()).andReturn(parent).anyTimes();
    expect(parent.getParent()).andReturn(null);
    expect(parent.isBound(foo())).andReturn(true);
View Full Code Here

    control.verify();
  }
 
  public void testImplicitBinding() throws Exception {
    expect(origin.getDependencies()).andStubReturn(TestUtils.dependencyList(
            new Dependency(Dependency.GINJECTOR, foo(), SOURCE)));
    expect(origin.getParent()).andStubReturn(null);
    expect(origin.isBound(foo())).andReturn(false).anyTimes();
    expect(origin.isPinned(foo())).andReturn(false).anyTimes();
    expect(bindingCreator.create(foo())).andReturn(binding);
    expect(binding.getDependencies()).andReturn(TestUtils.dependencyList(
        new Dependency(foo(), bar(), SOURCE)));
    expect(origin.isBound(bar())).andReturn(true).anyTimes();
    control.replay();
    DependencyExplorerOutput output = dependencyExplorer.explore(origin);
    assertSame(origin, output.getPreExistingLocations().get(bar()));
    assertEmpty(output.getBindingErrors());
    assertEquals(1, output.getImplicitlyBoundKeys().size());
    assertEquals(foo(), output.getImplicitBindings().iterator().next().getKey());
    assertEquals(binding, output.getImplicitBindings().iterator().next().getValue());
    DependencyGraph graph = output.getGraph();
    assertContentsAnyOrder(graph.getDependenciesTargeting(foo()),
        new Dependency(Dependency.GINJECTOR, foo(), SOURCE));
    assertContentsAnyOrder(graph.getDependenciesTargeting(bar()),
        new Dependency(foo(), bar(), SOURCE));
    control.verify();
  }
View Full Code Here

    control.verify();
  }
 
  public void testImplicitBindingFailed() throws Exception {
    expect(origin.getDependencies()).andStubReturn(TestUtils.dependencyList(
        new Dependency(Dependency.GINJECTOR, foo(), SOURCE)));
    expect(origin.getParent()).andStubReturn(null);
    expect(origin.isBound(foo())).andReturn(false).anyTimes();
    expect(origin.isPinned(foo())).andReturn(false).anyTimes();
    expect(bindingCreator.create(foo())).andThrow(new BindingCreationException("failed"));
    control.replay();
View Full Code Here

    control.verify();
  }
 
  public void testEdgeInUnresolvedAndOptional() throws Exception {
    expect(origin.getDependencies()).andStubReturn(TestUtils.dependencyList(
        new Dependency(foo(), bar(), SOURCE)));
    expect(origin.getParent()).andStubReturn(null);
    expect(origin.isBound(foo())).andReturn(true).anyTimes();
    expect(origin.isBound(bar())).andReturn(false).anyTimes();
    expect(origin.isPinned(bar())).andReturn(false).anyTimes();
    expect(origin.isBound(baz())).andReturn(true).anyTimes();
    expect(bindingCreator.create(bar())).andReturn(binding);
    expect(binding.getDependencies()).andReturn(TestUtils.dependencyList(
        new Dependency(bar(), baz(), true, false, SOURCE)));
    control.replay();
    DependencyExplorerOutput output = dependencyExplorer.explore(origin);
    DependencyGraph graph = output.getGraph();
    assertContentsAnyOrder(graph.getDependenciesOf(foo()), new Dependency(foo(), bar(), SOURCE));
    assertEmpty(graph.getDependenciesTargeting(foo()));
    assertContentsAnyOrder(graph.getDependenciesOf(bar()),
        new Dependency(bar(), baz(), true, false, SOURCE));
    assertContentsAnyOrder(graph.getDependenciesTargeting(bar()),
        new Dependency(foo(), bar(), SOURCE));
    control.verify();
  }
View Full Code Here

TOP

Related Classes of com.google.gwt.inject.rebind.binding.Dependency

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.