Details
-
Type: Bug
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 1.1
-
Component/s: None
-
Labels:None
-
Number of attachments :
Description
Just so I don't forget it. The whole pico.verify() thing is a little eager. Add this to a TestCase of your choice to see what I mean:
public static class VerificationCounterAdapter extends DecoratingComponentAdapter {
public int counter = 0;
public VerificationCounterAdapter(ComponentAdapter delegate)
{ super(delegate); }public int getCounter()
{ return counter; }public void verify()
{ super.verify(); counter++; }}
public void testComponentVerificationCount() throws Exception
{ DefaultPicoContainer pico = new DefaultPicoContainer(); VerificationCounterAdapter vca = new VerificationCounterAdapter(new ConstructorInjectionComponentAdapter(Touchable.class, SimpleTouchable.class)); pico.registerComponent(new CachingComponentAdapter(vca)); pico.registerComponentImplementation(DependsOnTouchable.class); pico.registerComponentImplementation(DependsOnTwoComponents.class); pico.registerComponentImplementation("test", DecoratedTouchable.class); pico.verify(); // assertTrue(vca.getCounter() == 1); }You will see that vca.getCounter() == 5, so the poor little SimpleTouchable gets verified 5 times.
I marked that for v2 since its in no way problematic (at least for me yet) it just a thing that could be optimized.
Issue Links
- is superceded by
-
PICO-215 Refactore to allow stateful PicoVisitor
Activity
Status | Open [ 1 ] | Reopened [ 4 ] |
Assignee | Thomas Heller [ maniax ] | Joerg Schaible [ joehni ] |
Fix Version/s | 2.0 [ 10411 ] | |
Fix Version/s | 1.1 [ 10307 ] | |
Status | Reopened [ 4 ] | Closed [ 6 ] |
Resolution | Fixed [ 1 ] |
I would propose change in ACA, so ACA handles basic
verification ( check for cyclic , cache successfull verification )
and delegates concrete verification stuff via abstract nethid further down.