1 package org.apache.jcs.auxiliary.disk.indexed;
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 import org.apache.jcs.JCS;
27 import org.apache.jcs.engine.control.CompositeCacheManager;
28
29 /***
30 * Test which exercises the indexed disk cache. Runs three threads against the
31 * same region.
32 *
33 * @version $Id: TestDiskCacheConcurrentForDeadLock.java,v 1.2 2005/02/01
34 * 00:01:59 asmuts Exp $
35 */
36 public class IndexedDiskCacheConcurrentNoDeadLockUnitTest
37 extends TestCase
38 {
39 /***
40 * Constructor for the TestDiskCache object.
41 *
42 * @param testName
43 */
44 public IndexedDiskCacheConcurrentNoDeadLockUnitTest( String testName )
45 {
46 super( testName );
47 }
48
49 /***
50 * Main method passes this test to the text test runner.
51 *
52 * @param args
53 */
54 public static void main( String args[] )
55 {
56 String[] testCaseName = { IndexedDiskCacheConcurrentNoDeadLockUnitTest.class.getName() };
57 junit.textui.TestRunner.main( testCaseName );
58 }
59
60 /***
61 * A unit test suite for JUnit
62 *
63 * @return The test suite
64 */
65 public static Test suite()
66 {
67 ActiveTestSuite suite = new ActiveTestSuite();
68
69 suite.addTest( new IndexedDiskCacheRandomConcurrentTestUtil( "testIndexedDiskCache1" )
70 {
71 public void runTest()
72 throws Exception
73 {
74 this.runTestForRegion( "indexedRegion4", 0, 200, 1 );
75 }
76 } );
77
78 suite.addTest( new IndexedDiskCacheRandomConcurrentTestUtil( "testIndexedDiskCache2" )
79 {
80 public void runTest()
81 throws Exception
82 {
83 this.runTestForRegion( "indexedRegion4", 10000, 50000, 2 );
84 }
85 } );
86
87 suite.addTest( new IndexedDiskCacheRandomConcurrentTestUtil( "testIndexedDiskCache3" )
88 {
89 public void runTest()
90 throws Exception
91 {
92 this.runTestForRegion( "indexedRegion4", 10000, 50000, 3 );
93 }
94 } );
95
96 suite.addTest( new IndexedDiskCacheRandomConcurrentTestUtil( "testIndexedDiskCache4" )
97 {
98 public void runTest()
99 throws Exception
100 {
101 this.runTestForRegion( "indexedRegion4", 10000, 50000, 4 );
102 }
103 } );
104
105 suite.addTest( new IndexedDiskCacheRandomConcurrentTestUtil( "testIndexedDiskCache5" )
106 {
107 public void runTest()
108 throws Exception
109 {
110 this.runTestForRegion( "indexedRegion4", 10000, 50000, 5 );
111 }
112 } );
113
114 return suite;
115 }
116
117 /***
118 * Test setup
119 */
120 public void setUp()
121 {
122 JCS.setConfigFilename( "/TestDiskCacheCon.ccf" );
123 }
124
125 /***
126 * Test tearDown. Dispose of the cache.
127 */
128 public void tearDown()
129 {
130 try
131 {
132 CompositeCacheManager cacheMgr = CompositeCacheManager.getInstance();
133 cacheMgr.shutDown();
134 }
135 catch ( Exception e )
136 {
137
138 }
139 }
140
141 }