Search in sources :

Example 36 with MapService

use of com.hazelcast.map.impl.MapService in project hazelcast by hazelcast.

the class MapStoreTest method testReadingConfiguration.

@Test(timeout = 120000)
public void testReadingConfiguration() throws Exception {
    String mapName = "mapstore-test";
    InputStream is = getClass().getResourceAsStream("/com/hazelcast/config/hazelcast-mapstore-config.xml");
    XmlConfigBuilder builder = new XmlConfigBuilder(is);
    Config config = builder.build();
    HazelcastInstance hz = createHazelcastInstance(config);
    MapProxyImpl map = (MapProxyImpl) hz.getMap(mapName);
    MapService mapService = (MapService) map.getService();
    MapContainer mapContainer = mapService.getMapServiceContext().getMapContainer(mapName);
    MapStoreWrapper mapStoreWrapper = mapContainer.getMapStoreContext().getMapStoreWrapper();
    Iterator keys = mapStoreWrapper.loadAllKeys().iterator();
    final Set<String> loadedKeySet = loadedKeySet(keys);
    final Set<String> expectedKeySet = expectedKeySet();
    assertEquals(expectedKeySet, loadedKeySet);
    assertEquals("true", mapStoreWrapper.load("my-prop-1"));
    assertEquals("foo", mapStoreWrapper.load("my-prop-2"));
}
Also used : MapStoreWrapper(com.hazelcast.map.impl.MapStoreWrapper) XmlConfigBuilder(com.hazelcast.config.XmlConfigBuilder) HazelcastInstance(com.hazelcast.core.HazelcastInstance) InputStream(java.io.InputStream) MapConfig(com.hazelcast.config.MapConfig) MapStoreConfig(com.hazelcast.config.MapStoreConfig) Config(com.hazelcast.config.Config) GroupConfig(com.hazelcast.config.GroupConfig) MapProxyImpl(com.hazelcast.map.impl.proxy.MapProxyImpl) Iterator(java.util.Iterator) MapService(com.hazelcast.map.impl.MapService) MapContainer(com.hazelcast.map.impl.MapContainer) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 37 with MapService

use of com.hazelcast.map.impl.MapService in project hazelcast by hazelcast.

the class QueryCacheUtilTest method setUp.

@Before
public void setUp() {
    HazelcastInstance instance = createHazelcastInstance();
    MapService mapService = getNodeEngineImpl(instance).getService(MapService.SERVICE_NAME);
    context = new NodeQueryCacheContext(mapService.getMapServiceContext());
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) MapService(com.hazelcast.map.impl.MapService) NodeQueryCacheContext(com.hazelcast.map.impl.querycache.NodeQueryCacheContext) Before(org.junit.Before)

Example 38 with MapService

use of com.hazelcast.map.impl.MapService in project hazelcast by hazelcast.

the class AbstractMapAllPartitionsMessageTask method getOperationProvider.

protected final MapOperationProvider getOperationProvider(String mapName) {
    MapService mapService = getService(SERVICE_NAME);
    MapServiceContext mapServiceContext = mapService.getMapServiceContext();
    return mapServiceContext.getMapOperationProvider(mapName);
}
Also used : MapService(com.hazelcast.map.impl.MapService) MapServiceContext(com.hazelcast.map.impl.MapServiceContext)

Example 39 with MapService

use of com.hazelcast.map.impl.MapService in project hazelcast by hazelcast.

the class AbstractMapPutMessageTask method beforeResponse.

@Override
protected void beforeResponse() {
    final long latency = System.currentTimeMillis() - startTime;
    final MapService mapService = getService(MapService.SERVICE_NAME);
    MapContainer mapContainer = mapService.getMapServiceContext().getMapContainer(getDistributedObjectName());
    if (mapContainer.getMapConfig().isStatisticsEnabled()) {
        mapService.getMapServiceContext().getLocalMapStatsProvider().getLocalMapStatsImpl(getDistributedObjectName()).incrementPuts(latency);
    }
}
Also used : MapService(com.hazelcast.map.impl.MapService) MapContainer(com.hazelcast.map.impl.MapContainer)

Example 40 with MapService

use of com.hazelcast.map.impl.MapService in project hazelcast by hazelcast.

the class MapAddInterceptorMessageTask method createOperationSupplier.

@Override
protected Supplier<Operation> createOperationSupplier() {
    final MapService mapService = getService(MapService.SERVICE_NAME);
    final MapServiceContext mapServiceContext = mapService.getMapServiceContext();
    final MapInterceptor mapInterceptor = serializationService.toObject(parameters.interceptor);
    id = mapServiceContext.generateInterceptorId(parameters.name, mapInterceptor);
    return new AddInterceptorOperationSupplier(id, parameters.name, mapInterceptor);
}
Also used : AddInterceptorOperationSupplier(com.hazelcast.client.impl.AddInterceptorOperationSupplier) MapInterceptor(com.hazelcast.map.MapInterceptor) MapService(com.hazelcast.map.impl.MapService) MapServiceContext(com.hazelcast.map.impl.MapServiceContext)

Aggregations

MapService (com.hazelcast.map.impl.MapService)80 MapServiceContext (com.hazelcast.map.impl.MapServiceContext)44 NodeEngineImpl (com.hazelcast.spi.impl.NodeEngineImpl)20 HazelcastInstance (com.hazelcast.core.HazelcastInstance)13 MapNearCacheManager (com.hazelcast.map.impl.nearcache.MapNearCacheManager)13 MetaDataGenerator (com.hazelcast.internal.nearcache.impl.invalidation.MetaDataGenerator)12 Invalidator (com.hazelcast.internal.nearcache.impl.invalidation.Invalidator)11 MapContainer (com.hazelcast.map.impl.MapContainer)10 MapProxyImpl (com.hazelcast.map.impl.proxy.MapProxyImpl)10 ParallelTest (com.hazelcast.test.annotation.ParallelTest)9 QuickTest (com.hazelcast.test.annotation.QuickTest)9 Test (org.junit.Test)9 RecordStore (com.hazelcast.map.impl.recordstore.RecordStore)8 Config (com.hazelcast.config.Config)7 Before (org.junit.Before)7 Data (com.hazelcast.nio.serialization.Data)6 Map (java.util.Map)6 Address (com.hazelcast.nio.Address)5 IPartitionLostEvent (com.hazelcast.spi.partition.IPartitionLostEvent)5 PartitionContainer (com.hazelcast.map.impl.PartitionContainer)4