Source:
public void testClusteredStateRepositoryReplicationWithSerializableKV() throws Exception { ClusteringServiceConfiguration configuration = ClusteringServiceConfigurationBuilder.cluster(URI.create(STRIPE_URI)) .autoCreate() .build(); ClusteringService service = new ClusteringServiceFactory().create(configuration); service.start(null); BaseCacheConfiguration<Long, String> config = new BaseCacheConfiguration<>(Long.class, String.class, noAdvice(), null, noExpiration(), newResourcePoolsBuilder().with(clusteredDedicated("test", 2, org.ehcache.config.units.MemoryUnit.MB)).build()); ClusteringService.ClusteredCacheIdentifier spaceIdentifier = (ClusteringService.ClusteredCacheIdentifier) service.getPersistenceSpaceIdentifier("test", config); ServerStoreProxy serverStoreProxy = service.getServerStoreProxy(spaceIdentifier, new StoreConfigurationImpl<>(config, 1, null, null), Consistency.STRONG, null); SimpleClusterTierClientEntity clientEntity = getEntity(serverStoreProxy); ClusterStateRepository stateRepository = new ClusterStateRepository(new ClusteringService.ClusteredCacheIdentifier() { @Override public String getId() { return "testStateRepo"; } @Override public Class<ClusteringService> getServiceType() { return ClusteringService.class; } }, "test", clientEntity); StateHolder<TestVal, TestVal> testMap = stateRepository.getPersistentStateHolder("testMap", TestVal.class, TestVal.class); testMap.putIfAbsent(new TestVal("One"), new TestVal("One")); testMap.putIfAbsent(new TestVal("Two"), new TestVal("Two")); clusterControl.terminateActive(); clusterControl.waitForActive(); assertThat(testMap.get(new TestVal("One")), is(new TestVal("One"))); assertThat(testMap.get(new TestVal("Two")), is(new TestVal("Two"))); assertThat(testMap.entrySet(), hasSize(2)); service.stop(); }

Target:
public void testClusteredStateRepositoryReplicationWithSerializableKV() throws Exception { ClusteringServiceConfiguration configuration = ClusteringServiceConfigurationBuilder.cluster(URI.create(STRIPE_URI)) .autoCreate() .build(); ClusteringService service = new ClusteringServiceFactory().create(configuration); service.start(null); BaseCacheConfiguration<Long, String> config = new BaseCacheConfiguration<>(Long.class, String.class, noAdvice(), null, noExpiration(), newResourcePoolsBuilder().with(clusteredDedicated("test", 2, org.ehcache.config.units.MemoryUnit.MB)).build()); ClusteringService.ClusteredCacheIdentifier spaceIdentifier = (ClusteringService.ClusteredCacheIdentifier) service.getPersistenceSpaceIdentifier("test", config); ServerStoreProxy serverStoreProxy = service.getServerStoreProxy(spaceIdentifier, new StoreConfigurationImpl<>(config, 1, null, null), Consistency.STRONG, mock(ServerCallback.class)); SimpleClusterTierClientEntity clientEntity = getEntity(serverStoreProxy); ClusterStateRepository stateRepository = new ClusterStateRepository(new ClusteringService.ClusteredCacheIdentifier() { @Override public String getId() { return "testStateRepo"; } @Override public Class<ClusteringService> getServiceType() { return ClusteringService.class; } }, "test", clientEntity); StateHolder<TestVal, TestVal> testMap = stateRepository.getPersistentStateHolder("testMap", TestVal.class, TestVal.class); testMap.putIfAbsent(new TestVal("One"), new TestVal("One")); testMap.putIfAbsent(new TestVal("Two"), new TestVal("Two")); clusterControl.terminateActive(); clusterControl.waitForActive(); assertThat(testMap.get(new TestVal("One")), is(new TestVal("One"))); assertThat(testMap.get(new TestVal("Two")), is(new TestVal("Two"))); assertThat(testMap.entrySet(), hasSize(2)); service.stop(); }