Registry-aware components
The RegistryAware interface can be implemented in order to let the component know of the registry it is being bound to.
This commit is contained in:
parent
f2cff8995b
commit
36887ae759
4 changed files with 50 additions and 1 deletions
src/test/java/info/ebenoit/ebul/cmp
|
@ -65,6 +65,20 @@ public class TestComponentState
|
|||
|
||||
}
|
||||
|
||||
/** Class used to test registry-aware components */
|
||||
private static class RACmpTest
|
||||
implements RegistryAware
|
||||
{
|
||||
private ComponentRegistry registry;
|
||||
|
||||
@Override
|
||||
public void setComponentRegistry( ComponentRegistry registry )
|
||||
{
|
||||
this.registry = registry;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/** Class used to test methods that affect the component's lifecycle */
|
||||
private static class LCATest
|
||||
{
|
||||
|
@ -187,6 +201,17 @@ public class TestComponentState
|
|||
}
|
||||
|
||||
|
||||
/** Test: initialising a {@link ComponentState} that implements {@link RegistryAware} */
|
||||
@Test
|
||||
public void testInitialiseRegistryAware( )
|
||||
{
|
||||
final RACmpTest object = new RACmpTest( );
|
||||
final NewComponentInfo< Object > ci = new NewComponentInfo< Object >( object );
|
||||
new ComponentState( this.reg , ci );
|
||||
Assert.assertSame( this.reg , object.registry );
|
||||
}
|
||||
|
||||
|
||||
/** Test: {@link ComponentState} copies autostart flag */
|
||||
@Test
|
||||
public void testInitialiseAutostart( )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue