@Test public void testSenderAndBackupTerminates_AfterInitialLoad() throws InterruptedException { String name = randomString(); Config config = new Config(); MapConfig mapConfig = config.getMapConfig(name); MapStoreConfig mapStoreConfig = new MapStoreConfig(); mapStoreConfig.setEnabled(true); mapStoreConfig.setImplementation(new DummyMapLoader()); mapStoreConfig.setInitialLoadMode(MapStoreConfig.InitialLoadMode.EAGER); mapConfig.setMapStoreConfig(mapStoreConfig); TestHazelcastInstanceFactory instanceFactory = createHazelcastInstanceFactory(5); HazelcastInstance[] instances = instanceFactory.newInstances(config); IMap<Object, Object> map = instances[0].getMap(name); map.clear(); HazelcastInstance[] ownerAndReplicas = findOwnerAndReplicas(instances, name); ownerAndReplicas[0].getLifecycleService().terminate(); ownerAndReplicas[1].getLifecycleService().terminate(); map = ownerAndReplicas[3].getMap(name); map.loadAll(false); assertEquals(DummyMapLoader.SIZE, map.size()); }
@Test(timeout = MINUTE) @Ignore // https://github.com/hazelcast/hazelcast/issues/5453 public void testMapCanBeLoaded_whenLoadAllKeysThrowsExceptionFirstTime() throws InterruptedException { Config config = getConfig(); MapLoader failingMapLoader = new FailingMapLoader(); MapStoreConfig mapStoreConfig = new MapStoreConfig().setImplementation(failingMapLoader); MapConfig mapConfig = config.getMapConfig(getClass().getName()).setMapStoreConfig(mapStoreConfig); HazelcastInstance[] hz = createHazelcastInstanceFactory(2).newInstances(config, 2); IMap map = hz[0].getMap(mapConfig.getName()); Throwable exception = null; try { map.get(generateKeyNotOwnedBy(hz[0])); } catch (Throwable e) { exception = e; } assertNotNull("Exception wasn't propagated", exception); map.loadAll(true); assertEquals(1, map.size()); }