Package org.nanocontainer

Examples of org.nanocontainer.NanoPicoContainer


                "      System.out.println('Invalid scope')\n " +
                "  } \n "+
                "}\n");

        Reader script = new StringReader(scriptValue);
        NanoPicoContainer parent = new DefaultNanoPicoContainer(
            buildContainer(script, null, new ParentAssemblyScope()));

        assertNotNull(parent.getComponentAdapterOfType(A.class));

        script = new StringReader(scriptValue);
        PicoContainer pico = buildContainer(script, parent,  new SomeAssemblyScope());
        assertNotNull(pico.getComponentInstance(B.class));
    }
View Full Code Here


                        "    component(B)\n" +
                        "  } else { \n" +
                        "    System.out.println('Invalid scope')\n " +
                        "  } \n "+
                        "}\n";
        NanoPicoContainer parent = new DefaultNanoPicoContainer(buildContainer(
                new StringReader(script), null, new ParentAssemblyScope()));
//        NanoPicoContainer parent = new DefaultNanoPicoContainer();
//        parent.registerComponentImplementation(A.class);
        assertNotNull(parent.getComponentInstanceOfType(A.class));
        PicoContainer pico = buildContainer(new StringReader(script), parent,  new SomeAssemblyScope());
        assertNotNull(pico.getComponentInstanceOfType(B.class));
    }
View Full Code Here

    }

    // TODO - go to a Nano TCK?
    public void testNamedChildContainerIsAccessible() {
        StringBuffer sb = new StringBuffer();
        final NanoPicoContainer parent = (NanoPicoContainer) createPicoContainer(null);
        parent.registerComponentInstance(sb);
        final NanoPicoContainer child = (NanoPicoContainer) parent.makeChildContainer("foo");
        child.registerComponentImplementation(LifeCycleMonitoring.class,LifeCycleMonitoring.class);
        LifeCycleMonitoring o = (LifeCycleMonitoring) parent.getComponentInstance("foo/*" + LifeCycleMonitoring.class.getName());
        assertNotNull(o);
    }
View Full Code Here

    }

    // TODO - go to a Nano TCK?
    public void testNamedChildContainerIsAccessibleForStringKeys() {
        StringBuffer sb = new StringBuffer();
        final NanoPicoContainer parent = (NanoPicoContainer) createPicoContainer(null);
        parent.registerComponentInstance(sb);
        final MutablePicoContainer child = parent.makeChildContainer("foo");
        child.registerComponentImplementation("lcm",LifeCycleMonitoring.class);
        Object o = parent.getComponentInstance("foo/lcm");
        assertNotNull(o);
        assertTrue(sb.toString().indexOf("-instantiated") != -1);
    }
View Full Code Here

    }

    // TODO - go to a Nano TCK?
    public void testNamedChildContainerIsAccessibleForClassKeys() {
        StringBuffer sb = new StringBuffer();
        final NanoPicoContainer parent = (NanoPicoContainer) createPicoContainer(null);
        parent.registerComponentInstance(sb);
        final MutablePicoContainer child = parent.makeChildContainer("foo");
        child.registerComponentImplementation(LifeCycleMonitoring.class,LifeCycleMonitoring.class);
        Object o = parent.getComponentInstance("foo/*" + LifeCycleMonitoring.class.getName());
        assertNotNull(o);
        assertTrue(sb.toString().indexOf("-instantiated") != -1);
    }
View Full Code Here

TOP

Related Classes of org.nanocontainer.NanoPicoContainer

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.