Search in sources :

Example 1 with AMapStore

use of com.hazelcast.client.map.helpers.AMapStore in project hazelcast by hazelcast.

the class ClientMapStoreTest method testIssue3023_testWithSubStringMapNames.

@Test
public void testIssue3023_testWithSubStringMapNames() {
    String mapNameWithStore = "MapStore*";
    String mapNameWithStoreAndSize = "MapStoreMaxSize*";
    String xml = "<hazelcast xsi:schemaLocation=\"http://www.hazelcast.com/schema/config\n" + "                             http://www.hazelcast.com/schema/config/hazelcast-config-3.11.xsd\"\n" + "                             xmlns=\"http://www.hazelcast.com/schema/config\"\n" + "                             xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n" + "\n" + "    <map name=\"" + mapNameWithStore + "\">\n" + "        <map-store enabled=\"true\">\n" + "            <class-name>com.will.cause.problem.if.used</class-name>\n" + "            <write-delay-seconds>5</write-delay-seconds>\n" + "        </map-store>\n" + "    </map>\n" + "\n" + "    <map name=\"" + mapNameWithStoreAndSize + "\">\n" + "        <in-memory-format>BINARY</in-memory-format>\n" + "        <backup-count>1</backup-count>\n" + "        <async-backup-count>0</async-backup-count>\n" + "        <max-idle-seconds>0</max-idle-seconds>\n" + "        <eviction size=\"10\" max-size-policy=\"PER_NODE\" eviction-policy=\"LRU\" />\n" + "        <merge-policy>PassThroughMergePolicy</merge-policy>\n" + "        <map-store enabled=\"true\">\n" + "            <class-name>com.hazelcast.client.map.helpers.AMapStore</class-name>\n" + "            <write-delay-seconds>5</write-delay-seconds>\n" + "        </map-store>\n" + "    </map>\n" + "\n" + "</hazelcast>";
    Config config = buildConfig(xml);
    HazelcastInstance hz = hazelcastFactory.newHazelcastInstance(config);
    HazelcastInstance client = hazelcastFactory.newHazelcastClient();
    IMap<Integer, Integer> map = client.getMap(mapNameWithStoreAndSize + "1");
    map.put(1, 1);
    final AMapStore store = getMapStoreInstance(hz, mapNameWithStoreAndSize + "1");
    assertTrueEventually(new AssertTask() {

        @Override
        public void run() {
            assertEquals(1, store.store.get(1));
        }
    });
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) MapConfig(com.hazelcast.config.MapConfig) Config(com.hazelcast.config.Config) MapStoreConfig(com.hazelcast.config.MapStoreConfig) AssertTask(com.hazelcast.test.AssertTask) AMapStore(com.hazelcast.client.map.helpers.AMapStore) MapStoreTest(com.hazelcast.map.impl.mapstore.MapStoreTest) Test(org.junit.Test) SlowTest(com.hazelcast.test.annotation.SlowTest)

Aggregations

AMapStore (com.hazelcast.client.map.helpers.AMapStore)1 Config (com.hazelcast.config.Config)1 MapConfig (com.hazelcast.config.MapConfig)1 MapStoreConfig (com.hazelcast.config.MapStoreConfig)1 HazelcastInstance (com.hazelcast.core.HazelcastInstance)1 MapStoreTest (com.hazelcast.map.impl.mapstore.MapStoreTest)1 AssertTask (com.hazelcast.test.AssertTask)1 SlowTest (com.hazelcast.test.annotation.SlowTest)1 Test (org.junit.Test)1