Details
Description
Here's the test case that fails:
(Specific test run is: DefaultNanoPicoContainerTestCase)
org.picocontainer.tck.AbstractPicoContainerTestCase:
public void testMakeRemoveChildContainer()
{ final NanoPicoContainer parent = (NanoPicoContainer) createPicoContainer(null); parent.registerComponentInstance("java.lang.String", "This is a test"); MutablePicoContainer pico = parent.makeChildContainer(); //Verify they are indeed wired together. assertNotNull(pico.getComponentInstance("java.lang.String")); boolean result = parent.removeChildContainer(pico); assertTrue(result); }I'm posting the concept here because after wracking my brains out, the BEST solution I could come up with was modify a few methods in AbstractNanoPicoContainer to have if/thens like this:
public boolean removeChildContainer(PicoContainer child) {
boolean result;
if (child instanceof AbstractNanoPicoContainer)
else
{ result = getDelegate().removeChildContainer(child); }
//.....
}
(Full details in the patch).
To me, this fix is u g l y. But I couldn't think of any other way to pull it off without changing the API.
Anybody have any thoughts?
Thanks!
-Mike (R)
Activity
Jörg Schaible
made changes -
Field | Original Value | New Value |
---|---|---|
Attachment | removeChildContainer.patch [ 20949 ] |
Michael Rimov
made changes -
Resolution | Fixed [ 1 ] | |
Fix Version/s | 1.1 [ 12307 ] | |
Status | Open [ 1 ] | Closed [ 6 ] |
Assignee | Michael Rimov [ rimovm ] |
Can you try the following patch? Basic idea is, that the registered child container in the MPC is replaced with the DNPC itself.