Search in sources :

Example 36 with Dependency

use of com.google.gwt.inject.rebind.binding.Dependency in project google-gin by gwtplus.

the class EagerCycleFinderTest method testEagerCycleSecondInUnresolved.

public void testEagerCycleSecondInUnresolved() throws Exception {
    eagerCycleFinder.reportError(TestUtils.dependencyList(new Dependency(Dependency.GINJECTOR, foo(), SOURCE)), TestUtils.dependencyList(new Dependency(foo(), baz(), SOURCE), new Dependency(baz(), foo(), SOURCE)));
    expect(origin.getDependencies()).andStubReturn(TestUtils.dependencyList(new Dependency(Dependency.GINJECTOR, foo(), SOURCE), new Dependency(foo(), bar(), SOURCE), new Dependency(foo(), baz(), 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)).addEdge(new Dependency(baz(), foo(), SOURCE)).build();
    assertTrue(eagerCycleFinder.findAndReportCycles(graph));
    control.verify();
}
Also used : Dependency(com.google.gwt.inject.rebind.binding.Dependency)

Example 37 with Dependency

use of com.google.gwt.inject.rebind.binding.Dependency in project google-gin by gwtplus.

the class PathFinderTest method testRequiredPath_OptionalInPath.

public void testRequiredPath_OptionalInPath() throws Exception {
    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)).addEdge(// avoid optional short-cut
    new Dependency(foo(), baz(), true, false, SOURCE)).build();
    control.replay();
    assertEquals(TestUtils.dependencyList(new Dependency(Dependency.GINJECTOR, foo(), SOURCE), new Dependency(foo(), bar(), SOURCE), new Dependency(bar(), baz(), SOURCE)), new PathFinder().onGraph(graph).addRoots(Dependency.GINJECTOR).addDestinations(baz()).withOnlyRequiredEdges(true).findShortestPath());
    control.verify();
}
Also used : Dependency(com.google.gwt.inject.rebind.binding.Dependency)

Example 38 with Dependency

use of com.google.gwt.inject.rebind.binding.Dependency in project google-gin by gwtplus.

the class PathFinderTest method testPathInUnresolved.

public void testPathInUnresolved() throws Exception {
    DependencyGraph graph = new DependencyGraph.Builder(origin).addEdge(new Dependency(Dependency.GINJECTOR, foo(), SOURCE)).addEdge(new Dependency(Dependency.GINJECTOR, baz(), SOURCE)).addEdge(new Dependency(foo(), bar(), SOURCE)).addEdge(new Dependency(bar(), baz(), SOURCE)).addEdge(new Dependency(foo(), baz(), SOURCE)).build();
    control.replay();
    assertEquals(TestUtils.dependencyList(new Dependency(Dependency.GINJECTOR, baz(), SOURCE)), new PathFinder().onGraph(graph).addRoots(Dependency.GINJECTOR).addDestinations(baz()).findShortestPath());
    control.verify();
}
Also used : Dependency(com.google.gwt.inject.rebind.binding.Dependency)

Example 39 with Dependency

use of com.google.gwt.inject.rebind.binding.Dependency in project google-gin by gwtplus.

the class PathFinderTest method testFindShortestPath.

public void testFindShortestPath() throws Exception {
    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)).addEdge(// we should use the "shortcut" to baz
    new Dependency(foo(), baz(), SOURCE)).build();
    control.replay();
    assertEquals(TestUtils.dependencyList(new Dependency(Dependency.GINJECTOR, foo(), SOURCE), new Dependency(foo(), baz(), SOURCE)), new PathFinder().onGraph(graph).addRoots(Dependency.GINJECTOR).addDestinations(baz()).findShortestPath());
    control.verify();
}
Also used : Dependency(com.google.gwt.inject.rebind.binding.Dependency)

Example 40 with Dependency

use of com.google.gwt.inject.rebind.binding.Dependency in project google-gin by gwtplus.

the class PathFinderTest method testFindAnyPath.

public void testFindAnyPath() throws Exception {
    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();
    control.replay();
    assertEquals(TestUtils.dependencyList(new Dependency(Dependency.GINJECTOR, foo(), SOURCE), new Dependency(foo(), bar(), SOURCE), new Dependency(bar(), baz(), SOURCE)), new PathFinder().onGraph(graph).addRoots(Dependency.GINJECTOR).addDestinations(baz()).findShortestPath());
    control.verify();
}
Also used : Dependency(com.google.gwt.inject.rebind.binding.Dependency)

Aggregations

Dependency (com.google.gwt.inject.rebind.binding.Dependency)50 DependencyExplorerOutput (com.google.gwt.inject.rebind.resolution.DependencyExplorer.DependencyExplorerOutput)10 GinjectorBindings (com.google.gwt.inject.rebind.GinjectorBindings)8 Key (com.google.inject.Key)6 Binding (com.google.gwt.inject.rebind.binding.Binding)5 ParentBinding (com.google.gwt.inject.rebind.binding.ParentBinding)4 Method (java.lang.reflect.Method)4 LinkedHashSet (java.util.LinkedHashSet)4 ExposedChildBinding (com.google.gwt.inject.rebind.binding.ExposedChildBinding)3 HashMap (java.util.HashMap)3 Context (com.google.gwt.inject.rebind.binding.Context)2 BindingCreationException (com.google.gwt.inject.rebind.resolution.ImplicitBindingCreator.BindingCreationException)2 ArrayList (java.util.ArrayList)2 FieldLiteral (com.google.gwt.inject.rebind.reflect.FieldLiteral)1 InjectionPoint (com.google.inject.spi.InjectionPoint)1 Field (java.lang.reflect.Field)1 Member (java.lang.reflect.Member)1 HashSet (java.util.HashSet)1 Set (java.util.Set)1