|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjunit.framework.Assert
junit.framework.TestCase
com.xenonsoft.bridgetown.test.TestRecursiveConstruction
A unit test to check validity of recursive constructor injection.
One of the test demonstrates that recursive constructor injection with cyclic dependencies is impossible with Java SDK circa 2004 / 2005!!!
The other test demonstrates how to unravel the former cyclic dependency in Bridgetown. Use property injection for one of the beans instead of constructor injection. In other words this is a work around!
| Field Summary | |
static java.lang.String |
CONFIG_FILE1
Configuration file |
static java.lang.String |
CONFIG_FILE2
Configuration file |
| Constructor Summary | |
TestRecursiveConstruction(java.lang.String name)
Constructor for TestCalcService. |
|
| Method Summary | |
static void |
main(java.lang.String[] args)
|
protected void |
setUp()
|
static junit.framework.Test |
suite()
|
protected void |
tearDown()
|
void |
testRecursive1()
Test construction injection where we have two beans that both reference each other. |
void |
testRecursive2()
Test construction injection where we have two beans that both reference each other. |
| Methods inherited from class junit.framework.TestCase |
countTestCases, createResult, getName, run, run, runBare, runTest, setName, toString |
| Methods inherited from class junit.framework.Assert |
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final java.lang.String CONFIG_FILE1
public static final java.lang.String CONFIG_FILE2
| Constructor Detail |
public TestRecursiveConstruction(java.lang.String name)
name - | Method Detail |
public static void main(java.lang.String[] args)
public static junit.framework.Test suite()
protected void setUp()
throws java.lang.Exception
java.lang.Exception
protected void tearDown()
throws java.lang.Exception
java.lang.Exceptionpublic void testRecursive1()
NB: For the current default implementation
AbstractServiceAssembler cannot be successfully
resolve this case. Therefore the method checks for a thrown
RecursiveDependencyException and then exits
normally.
public void testRecursive2()
In this case we uses a work around either method injection or setter injection after construction.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||