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

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


  }
 
  public void testCycleAfterProvider() throws Exception {
    eagerCycleFinder.reportError(
        TestUtils.dependencyList(
            new Dependency(Dependency.GINJECTOR, foo(), SOURCE),
            new Dependency(foo(), bar(), false, true, SOURCE)),
        TestUtils.dependencyList(
            new Dependency(bar(), baz(), SOURCE),
            new Dependency(baz(), bar(), SOURCE)));
    expect(origin.getDependencies()).andStubReturn(
        TestUtils.dependencyList(new Dependency(Dependency.GINJECTOR, foo(), SOURCE)));
    control.replay();
    DependencyGraph graph = new DependencyGraph.Builder(origin)
        .addEdge(new Dependency(Dependency.GINJECTOR, foo(), SOURCE))
        .addEdge(new Dependency(foo(), bar(), false, true, SOURCE))
        .addEdge(new Dependency(bar(), baz(), SOURCE))
        .addEdge(new Dependency(baz(), bar(), SOURCE)).build();
    assertTrue(eagerCycleFinder.findAndReportCycles(graph));
    control.verify();
  }
View Full Code Here


      if (guiceUtil.isMemberInject(method)) {
        memberInjectRequests.add(key.getTypeLiteral());
        addDependencies(guiceUtil.getMemberInjectionDependencies(
            Dependency.GINJECTOR, key.getTypeLiteral()));
      } else {
        addDependency(new Dependency(Dependency.GINJECTOR, key, method.toString()));
      }
    }
  }
View Full Code Here

            MethodLiteral.get((Method) member, TypeLiteral.get(member.getDeclaringClass()))));
      } else if (member instanceof Field) {
        FieldLiteral<?> field =
            FieldLiteral.get((Field) member, TypeLiteral.get(member.getDeclaringClass()));
        Key<?> key = guiceUtil.getKey(field);
        addDependency(new Dependency(
            Dependency.GINJECTOR, key, guiceUtil.isOptional(field), false,
            source.toString()));
      }
    }
  }
View Full Code Here

    origin = control.createMock(GinjectorBindings.class);
  }
 
  public void testChainOfSingleDeps() throws Exception {
    EasyMock.expect(origin.getDependencies()).andStubReturn(TestUtils.dependencyList(
        new Dependency(Dependency.GINJECTOR, foo(), SOURCE)));
    control.replay();
    DependencyGraph graph = new DependencyGraph.Builder(origin)
        .addEdge(new Dependency(Dependency.GINJECTOR, foo(), SOURCE))
        .addEdge(new Dependency(foo(), bar(), SOURCE))
        .addEdge(new Dependency(bar(), baz(), SOURCE)).build();
    RequiredKeySet requiredKeys = new RequiredKeySet(graph);
    assertTrue(requiredKeys.isRequired(foo()));
    assertTrue(requiredKeys.isRequired(bar()));
    assertTrue(requiredKeys.isRequired(baz()));
    control.verify();
View Full Code Here

    control.verify();
  }
 
  public void testWithMultipleDeps() throws Exception {
    EasyMock.expect(origin.getDependencies()).andStubReturn(TestUtils.dependencyList(
        new Dependency(Dependency.GINJECTOR, foo(), SOURCE)));
    control.replay();
    DependencyGraph graph = new DependencyGraph.Builder(origin)
        .addEdge(new Dependency(Dependency.GINJECTOR, foo(), SOURCE))
        .addEdge(new Dependency(foo(), bar(), SOURCE))
        .addEdge(new Dependency(foo(), baz(), SOURCE)).build();
    RequiredKeySet requiredKeys = new RequiredKeySet(graph);
    assertTrue(requiredKeys.isRequired(foo()));
    assertTrue(requiredKeys.isRequired(bar()));
    assertTrue(requiredKeys.isRequired(baz()));
    control.verify();
View Full Code Here

    control.verify();
  }
 
  public void testRequiredSkipsOptional() throws Exception {
    EasyMock.expect(origin.getDependencies()).andStubReturn(TestUtils.dependencyList(
        new Dependency(Dependency.GINJECTOR, foo(), SOURCE)));
    control.replay();
    DependencyGraph graph = new DependencyGraph.Builder(origin)
        .addEdge(new Dependency(Dependency.GINJECTOR, foo(), SOURCE))
        .addEdge(new Dependency(foo(), bar(), true, false, SOURCE))
        .addEdge(new Dependency(foo(), baz(), SOURCE)).build();
    RequiredKeySet requiredKeys = new RequiredKeySet(graph);
    assertTrue(requiredKeys.isRequired(foo()));
    assertFalse(requiredKeys.isRequired(bar()));
    assertTrue(requiredKeys.isRequired(baz()));
    control.verify();
View Full Code Here

    control.verify();
  }
 
  public void testRequiredNotHiddenByOptional() throws Exception {
    EasyMock.expect(origin.getDependencies()).andStubReturn(TestUtils.dependencyList(
        new Dependency(Dependency.GINJECTOR, foo(), SOURCE)));
    control.replay();
    DependencyGraph graph = new DependencyGraph.Builder(origin)
        .addEdge(new Dependency(Dependency.GINJECTOR, foo(), SOURCE))
        .addEdge(new Dependency(foo(), bar(), true, false, SOURCE))
        .addEdge(new Dependency(baz(), bar(), SOURCE))
        .addEdge(new Dependency(foo(), baz(), SOURCE)).build();
    RequiredKeySet requiredKeys = new RequiredKeySet(graph);
    assertTrue(requiredKeys.isRequired(foo()));
    assertTrue(requiredKeys.isRequired(bar()));
    assertTrue(requiredKeys.isRequired(baz()));
    control.verify();
View Full Code Here

    expect(graph.getDependenciesOf(foo())).andReturn(TestUtils.dependencyList());
    implicitBindingMap.put(foo(), fooBinding);
   
    expect(output.getImplicitBindings()).andReturn(implicitBindingMap.entrySet());
    expect(child.getDependencies()).andReturn(TestUtils.dependencyList(
        new Dependency(Dependency.GINJECTOR, foo(), SOURCE),
        new Dependency(Dependency.GINJECTOR, bar(), SOURCE)));
   
    child.addBinding(bar(), barBinding);
    child.addBinding(foo(), fooBinding);
    control.replay();
    installer.installBindings(output);
View Full Code Here

    implicitBindingMap.put(baz(), bazBinding);
   
    // Implicit binding for Foo
    Binding fooBinding = control.createMock("fooBinding", Binding.class);
    expect(graph.getDependenciesOf(foo())).andReturn(TestUtils.dependencyList(
        new Dependency(foo(), bar(), SOURCE),
        new Dependency(foo(), baz(), SOURCE)));
    implicitBindingMap.put(foo(), fooBinding);
   
    expect(output.getImplicitBindings()).andReturn(implicitBindingMap.entrySet());
    expect(child.getDependencies()).andReturn(TestUtils.dependencyList(
        new Dependency(Dependency.GINJECTOR, foo(), SOURCE)));
   
    child.addBinding(baz(), bazBinding);
    child.addBinding(bar(), barBinding);
    child.addBinding(foo(), fooBinding);
    control.replay();
View Full Code Here

    List<Dependency> cycle = new ArrayList<Dependency>();
    cycle.add(cycleEdge);
   
    Key<?> curr = cycleEdge.getSource();
    while (!curr.equals(cycleEdge.getTarget())) {
      Dependency edge = visitedEdge.get(curr);
      cycle.add(edge);
      curr = edge.getSource();
    }
    Collections.reverse(cycle);
    return cycle;
  }
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.