public void testClusterCacheTest() { waitForClusterToForm(); manager(0).administration().withFlags(CacheContainerAdmin.AdminFlag.PERMANENT).createCache("a", configuration); waitForClusterToForm("a"); checkConsistencyAcrossCluster("a", configuration); manager(1).administration().createCache("b", configuration); createStatefulCacheManager("A", false); checkConsistencyAcrossCluster("a", configuration); createStatefulCacheManager("B", true); checkConsistencyAcrossCluster("a", configuration); checkCacheExistenceAcrossCluster("b", false); manager(0).administration().withFlags(CacheContainerAdmin.AdminFlag.PERMANENT).createCache("c", configuration); checkConsistencyAcrossCluster("c", configuration); createStatefulCacheManager("C", false); checkConsistencyAcrossCluster("a", configuration);
protected void createStatefulCacheManager(String id, boolean clear) { String stateDirectory = TestingUtil.tmpDirectory(this.getClass().getSimpleName() + File.separator + id); if (clear) Util.recursiveFileRemove(stateDirectory); GlobalConfigurationBuilder global = GlobalConfigurationBuilder.defaultClusteredBuilder(); global.globalState().enable().persistentLocation(stateDirectory). configurationStorage(ConfigurationStorage.OVERLAY); if (isShared()) { String sharedDirectory = TestingUtil.tmpDirectory(this.getClass().getSimpleName() + File.separator + "COMMON"); global.globalState().sharedPersistentLocation(sharedDirectory); } else { global.globalState().sharedPersistentLocation(stateDirectory); } ConfigurationBuilder builder = new ConfigurationBuilder(); builder.clustering().cacheMode(CacheMode.DIST_SYNC); addClusterEnabledCacheManager(global, builder); }
@Override protected void createCacheManagers() throws Throwable { Util.recursiveFileRemove(TestingUtil.tmpDirectory(this.getClass().getSimpleName())); createStatefulCacheManager("A", false); createStatefulCacheManager("B", false); }