Package org.apache.felix.resolver

Examples of org.apache.felix.resolver.ResolverImpl$Blame


        // Begin resolve
        ResolveProcess resolve = new ResolveProcess();
        ResolverLogger logger = new ResolverLogger();
        try {
            ResolverImpl felixResolver = new ResolverImpl(logger);

            ReporterLogService log = new ReporterLogService(Central.getWorkspace());
            Map<Resource,List<Wire>> wirings = resolve.resolveRequired(model, Central.getWorkspace(), felixResolver, callbacks, log);
            result = new ResolutionResult(Outcome.Resolved, wirings, null, status, logger.getLog());
            if (coordination != null)
View Full Code Here


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);
    }
View Full Code Here

public class ResolverTest
{
    @Test
    public void testScenario1() throws Exception
    {
        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 = populateScenario1(wirings, candMap);
        ResolveContextImpl rci = new ResolveContextImpl(wirings, candMap, mandatory, Collections.<Resource> emptyList());

        Map<Resource, List<Wire>> wireMap = resolver.resolve(rci);
        assertEquals(2, wireMap.size());

        Resource aRes = findResource("A", wireMap.keySet());
        List<Wire> aWires = wireMap.get(aRes);
        assertEquals(0, aWires.size());
View Full Code Here

    }

    @Test
    public void testScenario2() throws Exception
    {
        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 = populateScenario2(wirings, candMap);
        ResolveContextImpl rci = new ResolveContextImpl(wirings, candMap, mandatory, Collections.<Resource> emptyList());

        Map<Resource, List<Wire>> wireMap = resolver.resolve(rci);
        assertEquals(2, wireMap.size());

        Resource bRes = findResource("B", wireMap.keySet());
        List<Wire> bWires = wireMap.get(bRes);
        assertEquals(0, bWires.size());
View Full Code Here

    }

    @Test
    public void testScenario3() throws Exception
    {
        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 = populateScenario3(wirings, candMap);
        ResolveContextImpl rci = new ResolveContextImpl(wirings, candMap, mandatory, Collections.<Resource> emptyList());

        Map<Resource, List<Wire>> wireMap = resolver.resolve(rci);
        assertEquals(3, wireMap.size());

        Resource cRes = findResource("C", wireMap.keySet());
        List<Wire> cWires = wireMap.get(cRes);
        assertEquals(0, cWires.size());
View Full Code Here

    }

    @Test
    public void testScenario4() throws Exception
    {
        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 = populateScenario4(wirings, candMap);
        ResolveContextImpl rci = new ResolveContextImpl(wirings, candMap, mandatory, Collections.<Resource> emptyList());

        try
        {
            resolver.resolve(rci);
            fail("Should have thrown a resolution exception as bundle A in scenario 4 cannot be resolved due to constraint violations.");
        }
        catch (ResolutionException re)
        {
            // good
View Full Code Here

    }

    @Test
    public void testScenario5() throws Exception
    {
        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 = populateScenario5(wirings, candMap);
        ResolveContextImpl rci = new ResolveContextImpl(wirings, candMap, mandatory, Collections.<Resource> emptyList());

        try
        {
            resolver.resolve(rci);
            fail("Should have thrown a resolution exception as bundle A in scenario 5 cannot be resolved due to constraint violations.");
        }
        catch (ResolutionException re)
        {
            // good
View Full Code Here

    }

    @Test
    public void testScenario6() throws Exception
    {
        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 = populateScenario6(wirings, candMap);
        ResolveContextImpl rci = new ResolveContextImpl(wirings, candMap, mandatory, Collections.<Resource> emptyList());

        Map<Resource, List<Wire>> wireMap = resolver.resolve(rci);

        int aResources = 0;
        for (Resource r : wireMap.keySet())
        {
            if ("A".equals(getResourceName(r)))
View Full Code Here

    }

    @Test
    public void testScenario7() throws Exception
    {
        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 = populateScenario7(wirings, candMap);
        ResolveContextImpl rci = new ResolveContextImpl(wirings, candMap, mandatory, Collections.<Resource> emptyList());

        Map<Resource, List<Wire>> wireMap = resolver.resolve(rci);
        assertEquals(4, wireMap.size());

        Resource aRes = findResource("A", wireMap.keySet());
        List<Wire> aWires = wireMap.get(aRes);
        assertEquals(0, aWires.size());
View Full Code Here

        List<org.osgi.service.repository.Repository> repos = new ArrayList<org.osgi.service.repository.Repository>();
        repos.add(new StaticRepository(resources.values()));
        repos.addAll(resourceRepos);

        ResolverImpl resolver = new ResolverImpl(new Slf4jResolverLog(LOGGER));
        ResolveContext context = new ResolveContextImpl(
                Collections.<Resource>singleton(requirements),
                Collections.<Resource>emptySet(),
                new AggregateRepository(repos),
                resolveOptionalImports);

        try {
            wiring = resolver.resolve(context);
        } catch (ResolutionException e) {
            // if its missing feature(s) then build a better error response the end user better understands
            // as today its a bit confusing with dummy/0.0.0 etc
            List<String> missing = new ArrayList<>();
View Full Code Here

TOP

Related Classes of org.apache.felix.resolver.ResolverImpl$Blame

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.