[nanocontainer-scm] [jira] Updated: (NANO-137) Groovy Builder for Nano does not propate parent container types or component adapters.
"Mauro Talevi (JIRA)" <jira-yCVjj/[email protected]> Sat, 11 Jun 2005 19:54:42 -0500 (CDT)
| Newsgroups | gmane.comp.java.nanocontainer.cvs |
|---|---|
| Message-ID | <10538774.1118537682837.JavaMail.haus-jira@codehaus01.managed.contegix.com> |
[ http://jira.codehaus.org/browse/NANO-137?page=all ]
Mauro Talevi updated NANO-137:
------------------------------
Fix Version: 1.0
Component: (was: core)
groovy
> Groovy Builder for Nano does not propate parent container types or component adapters.
> --------------------------------------------------------------------------------------
>
> Key: NANO-137
> URL: http://jira.codehaus.org/browse/NANO-137
> Project: NanoContainer
> Type: Bug
> Components: groovy
> Versions: 1.0-beta-5
> Reporter: Michael Rimov
> Fix For: 1.0
>
>
> Using the Groovy Builder, it appears currently impossible to implicitly propagate parent container types and adapterfactories to children containers. The following test case will fail. (NOTE: The test case depends on the BasePicoVisitor enhancement submitted in PICO-235, but it is easy enough to backport)
> public void testChildContainerHasParentAdapter() {
> Reader script = new StringReader("" +
> "builder = new org.nanocontainer.script.groovy.NanoContainerBuilder()\n"
> + "pico = builder.container(parent) { \n"
> + " container() {\n"
> + " component(ArrayList)"
> + " }\n"
> + "}"
> );
> //Build the parent
> ObjectReference parent = new SimpleReference();
> parent.set(new DefaultPicoContainer(new BeanPropertyComponentAdapterFactory(new DefaultComponentAdapterFactory())));
> //Build target
> ScriptedContainerBuilder builder = new GroovyContainerBuilder(script, Thread.currentThread().getContextClassLoader());
> builder.buildContainer(new SimpleReference(),parent,null, true);
>
> //Collect a list of all containers.
> final List allContainers = new ArrayList();
> PicoVisitor testingVisitor = new BasePicoVisitor() {
> public void visitContainer(PicoContainer pico) {
> super.visitContainer(pico); //Calls checkTraversal for us.
> allContainers.add(pico);
> }
> };
> testingVisitor.traverse((PicoContainer)parent.get());
> //Verify that default component adapter factory gets propagated
> //down the hierarchy much in the way that pico.makeChildContainer() works.
> for (Iterator i = allContainers.iterator(); i.hasNext();) {
> PicoContainer oneContainer = (PicoContainer)i.next(); assertNotNull(oneContainer.getComponentAdapterOfType(BeanPropertyComponentAdapterFactory.class));
> }
> }
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira