@Override protected void afterSitesCreated() { super.afterSitesCreated(); ConfigurationBuilder builder = newConfiguration(); builder.sites().addBackup().site(siteName(2)).strategy(BackupConfiguration.BackupStrategy.SYNC); defineInSite(site(0), CacheType.BACKUP_TO_SITE_2.name(), builder.build()); defineInSite(site(2), CacheType.BACKUP_TO_SITE_2.name(), newConfiguration().build()); builder = newConfiguration(); builder.sites().addBackup().site(siteName(1)).strategy(BackupConfiguration.BackupStrategy.SYNC); builder.sites().addBackup().site(siteName(2)).strategy(BackupConfiguration.BackupStrategy.SYNC); defineInSite(site(0), CacheType.BACKUP_TO_SITE_1_AND_2.name(), builder.build()); defineInSite(site(1), CacheType.BACKUP_TO_SITE_1_AND_2.name(), newConfiguration().build()); defineInSite(site(2), CacheType.BACKUP_TO_SITE_1_AND_2.name(), newConfiguration().build()); defineInSite(site(0), CacheType.NO_BACKUP.name(), newConfiguration().build()); // wait for caches in primary cluster site(0).waitForClusterToForm(null); site(0).waitForClusterToForm(CacheType.BACKUP_TO_SITE_1_AND_2.name()); site(0).waitForClusterToForm(CacheType.BACKUP_TO_SITE_1_AND_2.name()); site(0).waitForClusterToForm(CacheType.BACKUP_TO_SITE_2.name()); // wait for caches in backup site 1 site(1).waitForClusterToForm(null); site(1).waitForClusterToForm(CacheType.BACKUP_TO_SITE_1_AND_2.name()); // wait for caches in backup site 2 site(2).waitForClusterToForm(CacheType.BACKUP_TO_SITE_1_AND_2.name()); site(2).waitForClusterToForm(CacheType.BACKUP_TO_SITE_2.name()); }
private void assertValueInAllCachesInPrimarySite(String key, String value) { assertValueInCache(0, null, key, value); assertValueInCache(0, CacheType.BACKUP_TO_SITE_1_AND_2.name(), key, value); assertValueInCache(0, CacheType.BACKUP_TO_SITE_2.name(), key, value); assertValueInCache(0, CacheType.NO_BACKUP.name(), key, value); }
private void putInAllCache(String key, String value) { cache(0, 0, null).put(key, value); cache(0, 0, CacheType.BACKUP_TO_SITE_1_AND_2.name()).put(key, value); cache(0, 0, CacheType.BACKUP_TO_SITE_2.name()).put(key, value); cache(0, 0, CacheType.NO_BACKUP.name()).put(key, value); }