}
private static Configuration getConfiguration(boolean local, String passivationDir,
boolean totalReplication, boolean marshalling, boolean purgeCacheLoader)
{
Configuration config = new Configuration();
config.setClusterName("Tomcat-TestCluster");
config.setTransactionManagerLookupClass(BatchModeTransactionManagerLookup.class.getName());
config.setNodeLockingScheme(NodeLockingScheme.PESSIMISTIC);
config.setIsolationLevel(IsolationLevel.REPEATABLE_READ);
config.setSyncReplTimeout(20000);
config.setLockAcquisitionTimeout(15000);
config.setCacheMode(local ? CacheMode.LOCAL : CacheMode.REPL_SYNC);
config.setUseRegionBasedMarshalling(marshalling);
config.setInactiveOnStartup(marshalling);
// No async marshalling or notifications
config.setSerializationExecutorPoolSize(0);
config.setListenerAsyncPoolSize(0);
// Block for commits -- no races between test driver and replication
config.setSyncCommitPhase(true);
config.setSyncRollbackPhase(true);
if (passivationDir != null)
{
CacheLoaderConfig clc = new CacheLoaderConfig();
clc.setPassivation(true);
clc.setShared(false);
FileCacheLoaderConfig fclc = new FileCacheLoaderConfig();
fclc.setLocation(passivationDir);
fclc.setFetchPersistentState(true);
fclc.setPurgeOnStartup(purgeCacheLoader);
fclc.setAsync(false);
fclc.setIgnoreModifications(false);
ArrayList<IndividualCacheLoaderConfig> iclcs = new ArrayList<IndividualCacheLoaderConfig>();
iclcs.add(fclc);
clc.setIndividualCacheLoaderConfigs(iclcs);
config.setCacheLoaderConfig(clc);
}
if (!local && !totalReplication)
{
BuddyReplicationConfig brc = new BuddyReplicationConfig();
brc.setEnabled(true);
NextMemberBuddyLocatorConfig blc = new NextMemberBuddyLocatorConfig();
blc.setNumBuddies(1);
blc.setIgnoreColocatedBuddies(true);
brc.setBuddyLocatorConfig(blc);
brc.setBuddyPoolName("default");
brc.setBuddyCommunicationTimeout(20000);
brc.setAutoDataGravitation(false);
brc.setDataGravitationRemoveOnFind(true);
brc.setDataGravitationSearchBackupTrees(true);
config.setBuddyReplicationConfig(brc);
}
return config;
}