1 package org.apache.fulcrum.yaafi;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 import org.apache.fulcrum.yaafi.testcontainer.BaseUnitTest;
24
25 /**
26 * Test suite for the project
27 *
28 * @author <a href="mailto:siegfried.goeschl@it20one.at">Siegfried Goeschl</a>
29 */
30
31 public class TestComponentTest extends BaseUnitTest
32 {
33 /**
34 * Constructor
35 * @param name the name of the test case
36 */
37 public TestComponentTest( String name )
38 {
39 super(name);
40 }
41
42 public void testTestComponent() throws Exception
43 {
44 TestComponent testComponent = (TestComponent) this.lookup(
45 TestComponent.ROLE
46 );
47
48 testComponent.test();
49 testComponent.doSomething(100, new Object[10]);
50
51 assertEquals( testComponent.getBar(), "BAR" );
52 assertEquals( testComponent.getFoo(), "FOO" );
53
54 assertNotNull( testComponent.getUrnAvalonClassLoader() );
55 assertNotNull( testComponent.getUrnAvaloneHome() );
56 assertNotNull( testComponent.getUrnAvaloneTemp() );
57 assertNotNull( testComponent.getUrnAvalonName() );
58 assertNotNull( testComponent.getUrnAvalonPartition() );
59
60 Object [] temp = new Object[10];
61 System.out.println(temp.toString());
62
63 try
64 {
65 testComponent.createException("enforce exception", this);
66 }
67 catch( Exception e )
68 {
69
70 }
71 }
72
73 /**
74 * Verify bug fix for not calling dispose method of components
75 * @throws Exception
76 */
77 public void testTestComponentDecomissioned() throws Exception
78 {
79
80 TestComponent testComponent = (TestComponent) this.lookup(
81 TestComponent.ROLE
82 );
83
84 assertFalse( testComponent.isDecomissioned() );
85
86
87 this.decommision( TestComponent.ROLE );
88 assertTrue( testComponent.isDecomissioned() );
89
90
91
92 testComponent = (TestComponent) this.lookup(
93 TestComponent.ROLE
94 );
95
96 assertFalse( testComponent.isDecomissioned() );
97 }
98 }