Ecosystem:Terracotta BigMemory Max
Test procedure
BigMemory Max itself does not interact with databases, so here we test it as a second-level cache of Hibernate ORM, with PostgreSQL as a backing database. Hibernate supports Ehcache as a second-level cache, and BigMemory Max provides the Ehcache interface. Thus, Hibernate can use BigMemory Max as a second-level cache.
Hibernate has a regression test suite to test integration with Ehcache. It resides in the directory hibernate-ehcache. You can run it exactly like other Hibernate test suites. See here for the procedure.
Before running the regression test, you need to perform some preliminary steps to make the test suite use BigMemory Max. First, install the BigMemory Max and start the Terracotta server array by following the Installation Guide. Hereafter, ${HibernateSrcDir} refers to the top directory of Hibernate source distribution.
Copy the BigMemory Max license file (terracotta-license.key) to ${HibernateSrcDir}/project/hibernate-ehcache/src/test/resources/.
To add your BigMemory Max libraries as the dependencies of the regression test, edit ${HibernateSrcDir}/project/hibernate-ehcache/hibernate-ehcache.gradle as follows. Comment out the existing dependency on libraries.ehcache, and add a files dependency line.
dependencies {
...
// compile( libraries.ehcache )
compile files('${BigMemoryInstDir}/apis/ehcache/lib/ehcache-ee-2.10.2.1.7.jar', '/tuna/bigmem/apis/ehcache/lib/slf4j-api-1.7.7.jar', '${BigMemoryInstDir}/apis/toolkit/lib/terracotta-toolkit-runtime-ee-4.3.2.1.7.jar')
...
Modify the Ehcache configuration file ${HibernateSrcDir}/project/hibernate-ehcache/src/test/resources/ehcache.xml to use BigMemory Max and Terracotta Server Array. Specifically, set the overflowToDisk attribute of defaultCache and cache elements to false, add the terracotta element under the defaultCache element, and add the terracottaConfig element under the ehcache element. For example:
<defaultCache
...
overflowToDisk="false">
<terracotta
orphanEviction="false"
orphanEvictionPeriod="-1"/>
</defaultCache>
<cache name="sampleCache1"
...
overflowToDisk="false"/>
<cache name="sampleCache2"
...
overflowToDisk="false"/>
...
<terracottaConfig url="localhost:9510"/>
</ehcache>