Search in sources :

Example 21 with MapProxyImpl

use of com.hazelcast.map.impl.proxy.MapProxyImpl in project hazelcast by hazelcast.

the class WanReplicationTest method getOperationProvider.

private MapOperationProvider getOperationProvider(Map map) {
    MapProxyImpl mapProxy = (MapProxyImpl) map;
    MapServiceContext mapServiceContext = ((MapService) mapProxy.getService()).getMapServiceContext();
    return mapServiceContext.getMapOperationProvider(mapProxy.getName());
}
Also used : MapProxyImpl(com.hazelcast.map.impl.proxy.MapProxyImpl) MapService(com.hazelcast.map.impl.MapService) MapServiceContext(com.hazelcast.map.impl.MapServiceContext)

Example 22 with MapProxyImpl

use of com.hazelcast.map.impl.proxy.MapProxyImpl in project hazelcast by hazelcast.

the class MapPartitionAwareService method onPartitionLost.

@Override
public void onPartitionLost(IPartitionLostEvent partitionLostEvent) {
    final Address thisAddress = nodeEngine.getThisAddress();
    final int partitionId = partitionLostEvent.getPartitionId();
    Collection<DistributedObject> result = proxyService.getDistributedObjects(MapService.SERVICE_NAME);
    for (DistributedObject object : result) {
        final MapProxyImpl mapProxy = (MapProxyImpl) object;
        final String mapName = mapProxy.getName();
        if (mapProxy.getTotalBackupCount() <= partitionLostEvent.getLostReplicaIndex()) {
            mapServiceContext.getMapEventPublisher().publishMapPartitionLostEvent(thisAddress, mapName, partitionId);
        }
    }
}
Also used : DistributedObject(com.hazelcast.core.DistributedObject) Address(com.hazelcast.nio.Address) MapProxyImpl(com.hazelcast.map.impl.proxy.MapProxyImpl)

Example 23 with MapProxyImpl

use of com.hazelcast.map.impl.proxy.MapProxyImpl 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 24 with MapProxyImpl

use of com.hazelcast.map.impl.proxy.MapProxyImpl in project hazelcast by hazelcast.

the class PartitioningStrategyFactoryTest method setup.

@Before
public void setup() {
    mapName = testName.getMethodName();
    HazelcastInstance hazelcastInstance = createHazelcastInstance();
    map = hazelcastInstance.getMap(mapName);
    MapProxyImpl mapProxy = (MapProxyImpl) map;
    MapService mapService = (MapService) mapProxy.getService();
    MapServiceContextImpl mapServiceContext = (MapServiceContextImpl) mapService.getMapServiceContext();
    partitioningStrategyFactory = mapServiceContext.partitioningStrategyFactory;
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) MapProxyImpl(com.hazelcast.map.impl.proxy.MapProxyImpl) Before(org.junit.Before)

Aggregations

MapProxyImpl (com.hazelcast.map.impl.proxy.MapProxyImpl)24 HazelcastInstance (com.hazelcast.core.HazelcastInstance)13 ParallelTest (com.hazelcast.test.annotation.ParallelTest)12 QuickTest (com.hazelcast.test.annotation.QuickTest)12 Test (org.junit.Test)12 MapService (com.hazelcast.map.impl.MapService)10 MapServiceContext (com.hazelcast.map.impl.MapServiceContext)7 Config (com.hazelcast.config.Config)3 DistributedObject (com.hazelcast.core.DistributedObject)3 MapContainer (com.hazelcast.map.impl.MapContainer)3 Map (java.util.Map)3 MapConfig (com.hazelcast.config.MapConfig)2 PartitionContainer (com.hazelcast.map.impl.PartitionContainer)2 RecordStore (com.hazelcast.map.impl.recordstore.RecordStore)2 Address (com.hazelcast.nio.Address)2 NodeEngine (com.hazelcast.spi.NodeEngine)2 IPartitionService (com.hazelcast.spi.partition.IPartitionService)2 TestHazelcastInstanceFactory (com.hazelcast.test.TestHazelcastInstanceFactory)2 HashSet (java.util.HashSet)2 Ignore (org.junit.Ignore)2