use of com.hazelcast.config.MapConfig in project hazelcast by hazelcast.
the class MapStoreTest method testIssue1070.
// bug: store is called twice on loadAll
@Test(timeout = 120000)
public void testIssue1070() {
final String mapName = randomMapName();
final Config config = getConfig();
final MapConfig mapConfig = config.getMapConfig(mapName);
final MapStoreConfig mapStoreConfig = new MapStoreConfig();
final NoDuplicateMapStore myMapStore = new NoDuplicateMapStore();
final MapStoreConfig implementation = mapStoreConfig.setImplementation(myMapStore);
mapConfig.setMapStoreConfig(implementation);
myMapStore.store.put(1, 2);
TestHazelcastInstanceFactory nodeFactory = createHazelcastInstanceFactory(2);
HazelcastInstance instance = nodeFactory.newHazelcastInstance(config);
nodeFactory.newHazelcastInstance(config);
IMap<Object, Object> map = instance.getMap(mapName);
for (int i = 0; i < 271; i++) {
map.get(i);
}
assertFalse(myMapStore.failed);
}
use of com.hazelcast.config.MapConfig in project hazelcast by hazelcast.
the class MapStoreTest method createChunkedMapLoaderConfig.
private Config createChunkedMapLoaderConfig(String mapName, int chunkSize, ChunkedLoader chunkedLoader) {
Config cfg = getConfig();
cfg.setProperty(GroupProperty.PARTITION_COUNT.getName(), "1");
cfg.setProperty(GroupProperty.MAP_LOAD_CHUNK_SIZE.getName(), String.valueOf(chunkSize));
MapStoreConfig mapStoreConfig = new MapStoreConfig();
mapStoreConfig.setEnabled(true);
mapStoreConfig.setImplementation(chunkedLoader);
MapConfig mapConfig = cfg.getMapConfig(mapName);
mapConfig.setMapStoreConfig(mapStoreConfig);
return cfg;
}
use of com.hazelcast.config.MapConfig in project hazelcast by hazelcast.
the class LazyEntryViewFromRecordTest method createDefaultEntryView.
/**
* Returns an entry-view instance populated with default values of fields.
*/
private EntryView createDefaultEntryView() {
PartitioningStrategy mockPartitioningStrategy = mock(PartitioningStrategy.class);
MapConfig mapConfig = new MapConfig();
serializationService = new DefaultSerializationServiceBuilder().build();
DataRecordFactory dataRecordFactory = new DataRecordFactory(mapConfig, serializationService, mockPartitioningStrategy);
recordInstance = dataRecordFactory.newRecord(value);
((AbstractRecord) recordInstance).setKey(serializationService.toData(key));
return new LazyEntryViewFromRecord(recordInstance, serializationService);
}
use of com.hazelcast.config.MapConfig in project hazelcast by hazelcast.
the class MapProjectionTest method getMapWithNodeCount.
public <K, V> IMap<K, V> getMapWithNodeCount(int nodeCount) {
if (nodeCount < 1) {
throw new IllegalArgumentException("node count < 1");
}
TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(nodeCount);
Config config = new Config();
config.setProperty("hazelcast.partition.count", "3");
MapConfig mapConfig = new MapConfig();
mapConfig.setName("aggr");
mapConfig.setInMemoryFormat(InMemoryFormat.OBJECT);
config.addMapConfig(mapConfig);
doWithConfig(config);
HazelcastInstance instance = factory.newInstances(config)[0];
return instance.getMap("aggr");
}
use of com.hazelcast.config.MapConfig in project hazelcast by hazelcast.
the class MultiAttributeProjectionTest method getMapWithNodeCount.
private <K, V> IMap<K, V> getMapWithNodeCount() {
TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(1);
MapConfig mapConfig = new MapConfig().setName("aggr").setInMemoryFormat(InMemoryFormat.OBJECT);
Config config = new Config().setProperty(PARTITION_COUNT.getName(), "3").addMapConfig(mapConfig);
HazelcastInstance instance = factory.newInstances(config)[0];
return instance.getMap("aggr");
}
Aggregations