Search in sources :

Example 6 with MapIndexConfig

use of com.hazelcast.config.MapIndexConfig in project hazelcast by hazelcast.

the class RecordStoreTest method testRecordStoreReset.

private IMap<Object, Object> testRecordStoreReset() {
    String mapName = randomName();
    Config config = new Config();
    MapConfig mapConfig = config.getMapConfig(mapName);
    MapIndexConfig indexConfig = new MapIndexConfig("name", false);
    mapConfig.addMapIndexConfig(indexConfig);
    HazelcastInstance hazelcastInstance = createHazelcastInstance(config);
    IMap<Object, Object> map = hazelcastInstance.getMap(mapName);
    int key = 1;
    map.put(key, new SampleObjects.Employee("tom", 24, true, 10));
    DefaultRecordStore defaultRecordStore = getRecordStore(map, key);
    defaultRecordStore.reset();
    assertNull(map.get(key));
    return map;
}
Also used : MapIndexConfig(com.hazelcast.config.MapIndexConfig) HazelcastInstance(com.hazelcast.core.HazelcastInstance) SampleObjects(com.hazelcast.query.SampleObjects) Config(com.hazelcast.config.Config) MapIndexConfig(com.hazelcast.config.MapIndexConfig) MapConfig(com.hazelcast.config.MapConfig) MapConfig(com.hazelcast.config.MapConfig) DefaultRecordStore(com.hazelcast.map.impl.recordstore.DefaultRecordStore)

Example 7 with MapIndexConfig

use of com.hazelcast.config.MapIndexConfig in project hazelcast by hazelcast.

the class QueryIndexMigrationTest method newConfigWithIndex.

private Config newConfigWithIndex(String mapName, String attribute) {
    Config config = new Config();
    config.setProperty(GroupProperty.WAIT_SECONDS_BEFORE_JOIN.getName(), "0");
    config.getMapConfig(mapName).addMapIndexConfig(new MapIndexConfig(attribute, false));
    return config;
}
Also used : MapIndexConfig(com.hazelcast.config.MapIndexConfig) Config(com.hazelcast.config.Config) MapIndexConfig(com.hazelcast.config.MapIndexConfig)

Example 8 with MapIndexConfig

use of com.hazelcast.config.MapIndexConfig in project hazelcast by hazelcast.

the class QueryBasicTest method testQueryPortableObjectWithIndex.

@Test
public void testQueryPortableObjectWithIndex() {
    String name = randomMapName();
    Config config = getConfig();
    config.addMapConfig(new MapConfig(name).addMapIndexConfig(new MapIndexConfig("timestamp", true)));
    testQueryUsingPortableObject(config, name);
}
Also used : MapIndexConfig(com.hazelcast.config.MapIndexConfig) MapConfig(com.hazelcast.config.MapConfig) Config(com.hazelcast.config.Config) MapIndexConfig(com.hazelcast.config.MapIndexConfig) MapConfig(com.hazelcast.config.MapConfig) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 9 with MapIndexConfig

use of com.hazelcast.config.MapIndexConfig in project hazelcast by hazelcast.

the class QueryBasicTest method testQueryPortableObjectWithIndexAndAlwaysCacheValues.

@Test
public void testQueryPortableObjectWithIndexAndAlwaysCacheValues() {
    String name = randomMapName();
    Config config = getConfig();
    config.addMapConfig(new MapConfig(name).setCacheDeserializedValues(CacheDeserializedValues.ALWAYS).addMapIndexConfig(new MapIndexConfig("timestamp", true)));
    testQueryUsingPortableObject(config, name);
}
Also used : MapIndexConfig(com.hazelcast.config.MapIndexConfig) MapConfig(com.hazelcast.config.MapConfig) Config(com.hazelcast.config.Config) MapIndexConfig(com.hazelcast.config.MapIndexConfig) MapConfig(com.hazelcast.config.MapConfig) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 10 with MapIndexConfig

use of com.hazelcast.config.MapIndexConfig in project hazelcast by hazelcast.

the class EntryProcessorTest method testIndexAware_Issue_1719.

@Test
public void testIndexAware_Issue_1719() {
    Config cfg = getConfig();
    cfg.getMapConfig(MAP_NAME).addMapIndexConfig(new MapIndexConfig("attr1", false));
    HazelcastInstance instance = createHazelcastInstance(cfg);
    IMap<String, TestData> map = instance.getMap(MAP_NAME);
    map.put("a", new TestData("foo", "bar"));
    map.put("b", new TestData("abc", "123"));
    TestPredicate predicate = new TestPredicate("foo");
    Map<String, Object> entries = map.executeOnEntries(new TestLoggingEntryProcessor(), predicate);
    assertEquals("The predicate should only relate to one entry!", 1, entries.size());
    assertEquals("The predicate's apply method should only be invoked once!", 1, predicate.getApplied());
    assertTrue("The predicate should only be used via index service!", predicate.isFilteredAndAppliedOnlyOnce());
}
Also used : MapIndexConfig(com.hazelcast.config.MapIndexConfig) HazelcastInstance(com.hazelcast.core.HazelcastInstance) MapConfig(com.hazelcast.config.MapConfig) MapStoreConfig(com.hazelcast.config.MapStoreConfig) Config(com.hazelcast.config.Config) MapIndexConfig(com.hazelcast.config.MapIndexConfig) EntryObject(com.hazelcast.query.EntryObject) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Aggregations

MapIndexConfig (com.hazelcast.config.MapIndexConfig)22 Config (com.hazelcast.config.Config)17 MapConfig (com.hazelcast.config.MapConfig)14 QuickTest (com.hazelcast.test.annotation.QuickTest)12 Test (org.junit.Test)12 ParallelTest (com.hazelcast.test.annotation.ParallelTest)10 MapStoreConfig (com.hazelcast.config.MapStoreConfig)9 HazelcastInstance (com.hazelcast.core.HazelcastInstance)9 EntryObject (com.hazelcast.query.EntryObject)3 EntryListenerConfig (com.hazelcast.config.EntryListenerConfig)2 SampleObjects (com.hazelcast.query.SampleObjects)2 SqlPredicate (com.hazelcast.query.SqlPredicate)2 TestHazelcastInstanceFactory (com.hazelcast.test.TestHazelcastInstanceFactory)2 Collection (java.util.Collection)2 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)2 ClientConfig (com.hazelcast.client.config.ClientConfig)1 StaticLB (com.hazelcast.client.util.StaticLB)1 ListenerConfig (com.hazelcast.config.ListenerConfig)1 MapAttributeConfig (com.hazelcast.config.MapAttributeConfig)1 MapPartitionLostListenerConfig (com.hazelcast.config.MapPartitionLostListenerConfig)1