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();
}
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();
}
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();
}
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();
}
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();
}
Aggregations