Skip to content

Commit 6dcd543

Browse files
author
James Taylor
committed
Changes to get tests working again, everything builds and tests under maven-b5
now, except that the tests hang after completion. git-svn-id: https://svn.apache.org/repos/asf/jakarta/jcs/trunk@224007 13f79535-47bb-0310-9956-ffa450edef68
1 parent 983cfcb commit 6dcd543

File tree

9 files changed

+196
-23
lines changed

9 files changed

+196
-23
lines changed

maven.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<project default="java:jar">
2+
3+
<preGoal name="test:test">
4+
5+
<!-- Work area for unit tests -->
6+
7+
<mkdir dir="target/test-sandbox/logs"/>
8+
9+
</preGoal>
10+
11+
</project>

project-b5.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,11 @@
110110
<version>1.3-dev</version>
111111
</dependency>
112112

113+
<dependency>
114+
<id>junit</id>
115+
<version>3.7</version>
116+
</dependency>
117+
113118
<!-- Required for the server in JCS -->
114119

115120
<dependency>
@@ -130,6 +135,12 @@
130135
<include>**/TestDiskCacheConcurrent.java</include>
131136
<include>**/TestTCPLateralCache.java</include>
132137
</includes>
138+
<resources>
139+
<includes>
140+
<include>**/*.properties</include>
141+
<include>**/*.ccf</include>
142+
</includes>
143+
</resources>
133144
</unitTest>
134145

135146
<jars></jars>

src/test/TestDiskCache.ccf

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Cache configuration for the 'TestDiskCache' test. The memory cache has a
2+
# a maximum of 100 objects, so objects should get pushed into the disk cache
3+
4+
jcs.default=indexedDiskCache
5+
jcs.default.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
6+
jcs.default.cacheattributes.MaxObjects=100
7+
jcs.default.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
8+
9+
# SYSTEM GROUP ID CACHE
10+
jcs.system.groupIdCache=indexedDiskCache
11+
jcs.system.groupIdCache.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
12+
jcs.system.groupIdCache.cacheattributes.MaxObjects=10000
13+
jcs.system.groupIdCache.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
14+
15+
16+
##### CACHE REGIONS FOR TEST
17+
18+
jcs.region.indexedRegion1=indexedDiskCache
19+
jcs.region.indexedRegion1.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
20+
jcs.region.indexedRegion1.cacheattributes.MaxObjects=100
21+
jcs.region.indexedRegion1.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
22+
23+
jcs.region.indexedRegion2=indexedDiskCache
24+
jcs.region.indexedRegion2.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
25+
jcs.region.indexedRegion2.cacheattributes.MaxObjects=100
26+
jcs.region.indexedRegion2.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
27+
28+
jcs.region.indexedRegion3=indexedDiskCache
29+
jcs.region.indexedRegion3.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
30+
jcs.region.indexedRegion3.cacheattributes.MaxObjects=100
31+
jcs.region.indexedRegion3.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
32+
33+
jcs.region.indexedRegion4=indexedDiskCache2
34+
jcs.region.indexedRegion4.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
35+
jcs.region.indexedRegion4.cacheattributes.MaxObjects=100
36+
jcs.region.indexedRegion4.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
37+
38+
39+
##### AUXILIARY CACHES
40+
41+
# Indexed Disk Cache
42+
jcs.auxiliary.indexedDiskCache=org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheFactory
43+
jcs.auxiliary.indexedDiskCache.attributes=org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheAttributes
44+
jcs.auxiliary.indexedDiskCache.attributes.DiskPath=target/test-sandbox/indexed-disk-cache
45+
46+
# Indexed Disk Cache
47+
jcs.auxiliary.indexedDiskCache2=org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheFactory
48+
jcs.auxiliary.indexedDiskCache2.attributes=org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheAttributes
49+
jcs.auxiliary.indexedDiskCache2.attributes.DiskPath=target/test-sandbox/indexed-disk-cache2

src/test/TestDiskCacheCon.ccf

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Cache configuration for the 'TestDiskCache' test. The memory cache has a
2+
# a maximum of 100 objects, so objects should get pushed into the disk cache
3+
4+
jcs.default=indexedDiskCache
5+
jcs.default.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
6+
jcs.default.cacheattributes.MaxObjects=100
7+
jcs.default.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
8+
9+
# SYSTEM GROUP ID CACHE
10+
jcs.system.groupIdCache=indexedDiskCache
11+
jcs.system.groupIdCache.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
12+
jcs.system.groupIdCache.cacheattributes.MaxObjects=10000
13+
jcs.system.groupIdCache.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
14+
15+
16+
##### CACHE REGIONS FOR TEST
17+
18+
jcs.region.indexedRegion1=indexedDiskCache
19+
jcs.region.indexedRegion1.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
20+
jcs.region.indexedRegion1.cacheattributes.MaxObjects=100
21+
jcs.region.indexedRegion1.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
22+
23+
jcs.region.indexedRegion2=indexedDiskCache
24+
jcs.region.indexedRegion2.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
25+
jcs.region.indexedRegion2.cacheattributes.MaxObjects=100
26+
jcs.region.indexedRegion2.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
27+
28+
jcs.region.indexedRegion3=indexedDiskCache
29+
jcs.region.indexedRegion3.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
30+
jcs.region.indexedRegion3.cacheattributes.MaxObjects=100
31+
jcs.region.indexedRegion3.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
32+
33+
jcs.region.indexedRegion4=indexedDiskCache
34+
jcs.region.indexedRegion4.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
35+
jcs.region.indexedRegion4.cacheattributes.MaxObjects=100
36+
jcs.region.indexedRegion4.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
37+
38+
39+
##### AUXILIARY CACHES
40+
41+
# Indexed Disk Cache
42+
jcs.auxiliary.indexedDiskCache=org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheFactory
43+
jcs.auxiliary.indexedDiskCache.attributes=org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheAttributes
44+
jcs.auxiliary.indexedDiskCache.attributes.DiskPath=target/test-sandbox/indexed-disk-cache-conc
45+

src/test/TestTCPLateralCache.ccf

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Cache configuration for the 'TestDiskCache' test. The memory cache has a
2+
# a maximum of 100 objects, so objects should get pushed into the disk cache
3+
4+
jcs.default=
5+
jcs.default.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
6+
jcs.default.cacheattributes.MaxObjects=10000
7+
jcs.default.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
8+
9+
# SYSTEM GROUP ID CACHE
10+
jcs.system.groupIdCache=
11+
jcs.system.groupIdCache.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
12+
jcs.system.groupIdCache.cacheattributes.MaxObjects=10000
13+
jcs.system.groupIdCache.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
14+
15+
16+
##### CACHE REGIONS FOR TEST
17+
18+
jcs.region.testTcpRegion1=LTCP
19+
jcs.region.testTcpRegion1.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
20+
jcs.region.testTcpRegion1.cacheattributes.MaxObjects=10000
21+
jcs.region.testTcpRegion1.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
22+
23+
24+
##### AUXILIARY CACHES
25+
26+
# simple Lateral TCP auxiliary
27+
jcs.auxiliary.LTCP=org.apache.jcs.auxiliary.lateral.LateralCacheFactory
28+
jcs.auxiliary.LTCP.attributes=org.apache.jcs.auxiliary.lateral.LateralCacheAttributes
29+
jcs.auxiliary.LTCP.attributes.TransmissionTypeName=TCP
30+
jcs.auxiliary.LTCP.attributes.TcpServers=localhost:1111
31+
jcs.auxiliary.LTCP.attributes.TcpListenerPort=1110
32+
jcs.auxiliary.LTCP.attributes.PutOnlyMode=true

src/test/cache.ccf

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# JCS Config for unit testing, just a simple memory only cache
2+
3+
jcs.default=
4+
jcs.default.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
5+
jcs.default.cacheattributes.MaxObjects=1000
6+
jcs.default.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
7+
8+
jcs.system.groupIdCache=
9+
jcs.system.groupIdCache.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
10+
jcs.system.groupIdCache.cacheattributes.MaxObjects=10000
11+
jcs.system.groupIdCache.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
12+
13+
jcs.region.testCache1=
14+
jcs.region.testCache1.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
15+
jcs.region.testCache1.cacheattributes.MaxObjects=1000
16+
jcs.region.testCache1.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
17+

src/test/log4j.properties

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# For unit testing, all output goes to bin/test/logs/jcs.log
2+
3+
log4j.category.org.apache.jcs = DEBUG, jcs
4+
log4j.appender.jcs = org.apache.log4j.FileAppender
5+
log4j.appender.jcs.file = target/test-sandbox/logs/jcs.log
6+
log4j.appender.jcs.layout = org.apache.log4j.PatternLayout
7+
log4j.appender.jcs.layout.conversionPattern = %d [%t] %-5p %c - %m%n
8+
log4j.appender.jcs.append = false

src/test/org/apache/jcs/access/TestCacheAccess.java

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,18 @@
6060

6161
import java.util.Enumeration;
6262
import java.util.StringTokenizer;
63+
import java.util.Iterator;
6364

6465
import org.apache.jcs.access.exception.CacheException;
6566

6667
import org.apache.jcs.engine.behavior.IElementAttributes;
6768
import org.apache.jcs.engine.ElementAttributes;
68-
import org.apache.jcs.engine.control.group.GroupCacheHub;
6969

7070
import org.apache.commons.logging.Log;
7171
import org.apache.commons.logging.LogFactory;
7272

7373
import org.apache.jcs.engine.control.event.TestElementEventHandler;
74+
import org.apache.jcs.engine.control.CompositeCacheManager;
7475

7576

7677

@@ -110,27 +111,27 @@ public static void main( String[] args )
110111
//cache_control= GroupCacheAccess.getGroupAccess( "testGroupCache" );
111112

112113
// start the local cache witht he appropriate props file
113-
GroupCacheHub.getInstance( args[0] );
114+
CompositeCacheManager.getInstance( args[0] );
114115

115116
cache_control = GroupCacheAccess.getGroupAccess( "testCache1" );
116117

117118
// not necessary if you don't set default element attributes
118-
try
119-
{
120-
cache_control.defineGroup( "gr" );
121-
}
122-
catch ( CacheException ce )
123-
{
124-
p( ce.toString() + " /n" + ce.getMessage() );
125-
}
126-
try
127-
{
128-
cache_control.defineGroup( "gr2" );
129-
}
130-
catch ( CacheException ce )
131-
{
132-
p( ce.toString() + " /n" + ce.getMessage() );
133-
}
119+
// try
120+
// {
121+
// cache_control.defineGroup( "gr" );
122+
// }
123+
// catch ( CacheException ce )
124+
// {
125+
// p( ce.toString() + " /n" + ce.getMessage() );
126+
// }
127+
// try
128+
// {
129+
// cache_control.defineGroup( "gr2" );
130+
// }
131+
// catch ( CacheException ce )
132+
// {
133+
// p( ce.toString() + " /n" + ce.getMessage() );
134+
// }
134135

135136
GroupCacheAccess cache_control2 = GroupCacheAccess.getGroupAccess( "testCache2" );
136137
p( "cache_control = " + cache_control );
@@ -741,11 +742,11 @@ public static void help()
741742
/** Gets the attributeNames attribute of the TestCacheAccess class */
742743
static void getAttributeNames( String groupName )
743744
{
744-
Enumeration enum = cache_control.getAttributeNames( groupName );
745-
p( "enum = " + enum );
746-
while ( enum.hasMoreElements() )
745+
Iterator iter = cache_control.getGroupKeys( groupName ).iterator();
746+
747+
while ( iter.hasNext() )
747748
{
748-
p( "=" + ( String ) enum.nextElement() );
749+
p( "=" + ( String ) iter.next() );
749750
}
750751
}
751752
}

src/test/org/apache/jcs/servlet/ListTestCacheServlet.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import org.apache.jcs.engine.behavior.ICompositeCacheAttributes;
3030

3131
import org.apache.jcs.engine.control.CompositeCacheManager;
32-
import org.apache.jcs.engine.control.group.GroupCacheHub;
3332

3433
import org.apache.commons.logging.Log;
3534
import org.apache.commons.logging.LogFactory;

0 commit comments

Comments
 (0)