public class Main
{
public static void main(String[] args) throws ResolutionException
{
Resolver resolver = new ResolverImpl(new Logger(Logger.LOG_DEBUG));
Map<Resource, Wiring> wirings = new HashMap<Resource, Wiring>();
Map<Requirement, List<Capability>> candMap = new HashMap<Requirement, List<Capability>>();
List<Resource> mandatory;
ResolveContextImpl rci;
Map<Resource, List<Wire>> wireMap;
System.out.println("\nSCENARIO 1\n");
mandatory = populateScenario1(wirings, candMap);
rci = new ResolveContextImpl(wirings, candMap, mandatory, Collections.EMPTY_LIST);
wireMap = resolver.resolve(rci);
System.out.println("RESULT " + wireMap);
System.out.println("\nSCENARIO 2\n");
mandatory = populateScenario2(wirings, candMap);
rci = new ResolveContextImpl(wirings, candMap, mandatory, Collections.EMPTY_LIST);
wireMap = resolver.resolve(rci);
System.out.println("RESULT " + wireMap);
System.out.println("\nSCENARIO 3\n");
mandatory = populateScenario3(wirings, candMap);
rci = new ResolveContextImpl(wirings, candMap, mandatory, Collections.EMPTY_LIST);
wireMap = resolver.resolve(rci);
System.out.println("RESULT " + wireMap);
System.out.println("\nSCENARIO 4\n");
mandatory = populateScenario4(wirings, candMap);
rci = new ResolveContextImpl(wirings, candMap, mandatory, Collections.EMPTY_LIST);
try
{
wireMap = resolver.resolve(rci);
System.err.println("UNEXPECTED RESULT " + wireMap);
}
catch (ResolutionException e)
{
System.out.println("EXPECTED ResolutionException:");
e.printStackTrace(System.out);
}
System.out.println("\nSCENARIO 5\n");
mandatory = populateScenario5(wirings, candMap);
rci = new ResolveContextImpl(wirings, candMap, mandatory, Collections.EMPTY_LIST);
try
{
wireMap = resolver.resolve(rci);
System.err.println("UNEXPECTED RESULT " + wireMap);
}
catch (ResolutionException e)
{
System.out.println("EXPECTED ResolutionException:");
e.printStackTrace(System.out);
}
System.out.println("\nSCENARIO 6\n");
mandatory = populateScenario6(wirings, candMap);
rci = new ResolveContextImpl(wirings, candMap, mandatory, Collections.EMPTY_LIST);
wireMap = resolver.resolve(rci);
System.out.println("RESULT " + wireMap);
System.out.println("\nSCENARIO 7\n");
mandatory = populateScenario7(wirings, candMap);
rci = new ResolveContextImpl(wirings, candMap, mandatory, Collections.EMPTY_LIST);
wireMap = resolver.resolve(rci);
System.out.println("RESULT " + wireMap);
}