Skip to content

Commit 6023423

Browse files
Merge pull request lucee#1988 from MitrahSoft/LDEV-4429
Added a testcase to check EHCache with "distributed":"automatic" for LDEV-4429
2 parents 7af9139 + ea3d382 commit 6023423

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

test/tickets/LDEV4429.cfc

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
component extends="org.lucee.cfml.test.LuceeTestCase" labels="cache,ehCache" {
2+
3+
function beforeAll() {
4+
variables.postgres = server.getDatasource("postgres");
5+
6+
if( structCount(postgres) ) {
7+
// define datasource
8+
application name="LDEV-4429" action="update" datasource=postgres;
9+
}
10+
}
11+
12+
public function testCachePutEHCache() {
13+
createEHCache();
14+
testCachePut();
15+
}
16+
17+
private function testCachePut() localMode="modern" {
18+
var res =queryExecute('SELECT ''{"a" : "aab"}''::jsonb AS result');
19+
var jsonbColl = res.result[1];
20+
cachePut("def",jsonbColl,createTimespan(0,0,0,30),createTimespan(0,0,0,30),"testCache4429")
21+
var cachedval = cacheGet(id ="def", region="testCache4429")
22+
23+
expect(isInstanceOf(cachedval, "java.lang.Object")).toBe("true");
24+
}
25+
26+
private function createEHCache() {
27+
var cacheConn = {
28+
class: 'org.lucee.extension.cache.eh.EHCache'
29+
, bundleName: 'ehcache.extension'
30+
, bundleVersion: '2.10.9.2-SNAPSHOT'
31+
, storage: false
32+
, custom: {
33+
"bootstrapAsynchronously":"true",
34+
"automatic_hostName":"",
35+
"bootstrapType":"on",
36+
"maxelementsinmemory":"10000",
37+
"manual_rmiUrls":"",
38+
"distributed":"automatic",
39+
"automatic_multicastGroupAddress":"230.0.0.1",
40+
"memoryevictionpolicy":"LRU",
41+
"timeToIdleSeconds":"86400",
42+
"maximumChunkSizeBytes":"5000000",
43+
"automatic_multicastGroupPort":"4446",
44+
"listener_socketTimeoutMillis":"120000",
45+
"timeToLiveSeconds":"86400",
46+
"diskpersistent":"true",
47+
"manual_addional":"",
48+
"replicateRemovals":"true",
49+
"automatic_addional":"",
50+
"overflowtodisk":"true",
51+
"replicateAsynchronously":"true",
52+
"maxelementsondisk":"10000000",
53+
"listener_remoteObjectPort":"",
54+
"asynchronousReplicationIntervalMillis":"1000",
55+
"listener_hostName":"",
56+
"replicateUpdates":"true",
57+
"manual_hostName":"",
58+
"automatic_timeToLive":"unrestricted",
59+
"listener_port":""
60+
}
61+
, default: ''
62+
};
63+
application name="LDEV-4429" action="update" caches={"testCache4429":cacheConn};
64+
}
65+
}

0 commit comments

Comments
 (0)