public static EmbeddedCacheManager createCacheContainer(boolean local, String passivationDir, boolean totalReplication, boolean purgeCacheLoader) throws Exception {
CacheMode mode = local ? CacheMode.LOCAL : (totalReplication ? CacheMode.REPL_SYNC : CacheMode.DIST_SYNC);
GlobalConfigurationBuilder globalBuilder = new GlobalConfigurationBuilder();
String name = "container" + containerIndex++;
globalBuilder.transport()
.transport(local ? null : new JGroupsTransport())
.addProperty(JGroupsTransport.CHANNEL_LOOKUP, ChannelLookup.class.getName())
.distributedSyncTimeout(60000)
.clusterName("test")
.globalJmxStatistics().enable().cacheManagerName(name).allowDuplicateDomains(true)