use of com.hazelcast.config.MapStoreConfig in project hazelcast by hazelcast.
the class MapStoreContextFactory method createMapStoreContext.
public static MapStoreContext createMapStoreContext(MapContainer mapContainer) {
final MapConfig mapConfig = mapContainer.getMapConfig();
final MapStoreConfig mapStoreConfig = mapConfig.getMapStoreConfig();
if (mapStoreConfig == null || !mapStoreConfig.isEnabled()) {
return EMPTY_MAP_STORE_CONTEXT;
}
return BasicMapStoreContext.create(mapContainer);
}
use of com.hazelcast.config.MapStoreConfig in project hazelcast by hazelcast.
the class BasicMapStoreContext method setStoreImplToWritableMapStoreConfig.
private static void setStoreImplToWritableMapStoreConfig(NodeEngine nodeEngine, String mapName, Object store) {
final Config config = nodeEngine.getConfig();
// get writable config (not read-only one) from node engine.
final MapConfig mapConfig = config.getMapConfig(mapName);
final MapStoreConfig mapStoreConfig = mapConfig.getMapStoreConfig();
mapStoreConfig.setImplementation(store);
}
use of com.hazelcast.config.MapStoreConfig in project hazelcast by hazelcast.
the class MapIndexBackupTest method createNode.
private HazelcastInstance createNode(TestHazelcastInstanceFactory instanceFactory) {
Config config = getConfig();
MapConfig mapConfig = config.getMapConfig("book");
mapConfig.addMapIndexConfig(new MapIndexConfig("author", false));
mapConfig.addMapIndexConfig(new MapIndexConfig("year", true));
mapConfig.setMapStoreConfig(new MapStoreConfig().setImplementation(new BookMapLoader()));
mapConfig.setBackupCount(1);
return instanceFactory.newHazelcastInstance(config);
}
use of com.hazelcast.config.MapStoreConfig in project hazelcast by hazelcast.
the class NearCacheTestSupport method createNearCachedMapConfigWithMapStoreConfig.
protected Config createNearCachedMapConfigWithMapStoreConfig(String mapName) {
SimpleMapStore store = new SimpleMapStore();
MapStoreConfig mapStoreConfig = new MapStoreConfig();
mapStoreConfig.setEnabled(true);
mapStoreConfig.setImplementation(store);
Config config = createNearCachedMapConfig(mapName);
config.getMapConfig(mapName).setMapStoreConfig(mapStoreConfig);
return config;
}
use of com.hazelcast.config.MapStoreConfig in project hazelcast by hazelcast.
the class QueryAdvancedTest method testQueryAfterInitialLoad.
// issue 1404 "to be fixed by issue 1404"
@Test
public void testQueryAfterInitialLoad() {
final int size = 100;
String name = "default";
Config config = getConfig();
MapStoreConfig mapStoreConfig = new MapStoreConfig();
mapStoreConfig.setEnabled(true);
mapStoreConfig.setImplementation(new MapStoreAdapter<Integer, Employee>() {
@Override
public Map<Integer, Employee> loadAll(Collection<Integer> keys) {
Map<Integer, Employee> map = new HashMap<Integer, Employee>();
for (Integer key : keys) {
Employee emp = new Employee();
emp.setActive(true);
map.put(key, emp);
}
return map;
}
@Override
public Set<Integer> loadAllKeys() {
Set<Integer> set = new HashSet<Integer>();
for (int i = 0; i < size; i++) {
set.add(i);
}
return set;
}
});
config.getMapConfig(name).setMapStoreConfig(mapStoreConfig);
HazelcastInstance instance = createHazelcastInstance(config);
final IMap map = instance.getMap(name);
assertTrueEventually(new AssertTask() {
@Override
public void run() throws Exception {
Collection values = map.values(new SqlPredicate("active = true"));
assertEquals(size, values.size());
}
});
}
Aggregations