1 package org.apache.jcs;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import junit.extensions.ActiveTestSuite;
23 import junit.framework.Test;
24 import junit.framework.TestCase;
25
26 /***
27 * Test which exercises the hierarchical removal when the cache is active.
28 */
29 public class ConcurrentRemovalLoadTest
30 extends TestCase
31 {
32 /***
33 * Constructor for the TestDiskCache object.
34 *
35 * @param testName
36 */
37 public ConcurrentRemovalLoadTest( String testName )
38 {
39 super( testName );
40 }
41
42 /***
43 * Main method passes this test to the text test runner.
44 *
45 * @param args
46 */
47 public static void main( String args[] )
48 {
49 String[] testCaseName = { RemovalTestUtil.class.getName() };
50 junit.textui.TestRunner.main( testCaseName );
51 }
52
53 /***
54 * A unit test suite for JUnit. This verfies that we can remove
55 * hierarchically while the region is active.
56 *
57 * @return The test suite
58 */
59 public static Test suite()
60 {
61 ActiveTestSuite suite = new ActiveTestSuite();
62
63 suite.addTest( new RemovalTestUtil( "testRemoveCache1" )
64 {
65 public void runTest()
66 throws Exception
67 {
68 runTestPutThenRemoveCategorical( 0, 200 );
69 }
70 } );
71
72 suite.addTest( new RemovalTestUtil( "testPutCache1" )
73 {
74 public void runTest()
75 throws Exception
76 {
77 runPutInRange( 300, 400 );
78 }
79 } );
80
81 suite.addTest( new RemovalTestUtil( "testPutCache2" )
82 {
83 public void runTest()
84 throws Exception
85 {
86 runPutInRange( 401, 600 );
87 }
88 } );
89
90
91 suite.addTest( new RemovalTestUtil( "testPutCache3" )
92 {
93 public void runTest()
94 throws Exception
95 {
96 runPutInRange( 401, 600 );
97 }
98 } );
99
100 suite.addTest( new RemovalTestUtil( "testRemoveCache1" )
101 {
102 public void runTest()
103 throws Exception
104 {
105 runTestPutThenRemoveCategorical( 601, 700 );
106 }
107 } );
108
109 suite.addTest( new RemovalTestUtil( "testRemoveCache1" )
110 {
111 public void runTest()
112 throws Exception
113 {
114 runTestPutThenRemoveCategorical( 701, 800 );
115 }
116 } );
117
118 suite.addTest( new RemovalTestUtil( "testPutCache2" )
119 {
120
121 public void runTest()
122 throws Exception
123 {
124 runGetInRange( 0, 1000, false );
125 }
126 } );
127 return suite;
128
129 }
130
131 /***
132 * Test setup
133 */
134 public void setUp()
135 throws Exception
136 {
137 JCS.setConfigFilename( "/TestRemoval.ccf" );
138 JCS.getInstance( "testCache1" );
139 }
140
141 }