Search in sources :

Example 1 with MapAttributeConfig

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

the class SingleValueAllPredicatesExtractorTest method getInstanceConfigurator.

@Override
protected AbstractExtractionTest.Configurator getInstanceConfigurator() {
    return new AbstractExtractionTest.Configurator() {

        @Override
        public void doWithConfig(Config config, Multivalue mv) {
            MapConfig mapConfig = config.getMapConfig("map");
            MapAttributeConfig iqConfig = new AbstractExtractionTest.TestMapAttributeIndexConfig();
            iqConfig.setName("brain.iq");
            iqConfig.setExtractor("com.hazelcast.query.impl.extractor.predicates.SingleValueAllPredicatesExtractorTest$IqExtractor");
            mapConfig.addMapAttributeConfig(iqConfig);
            MapAttributeConfig nameConfig = new AbstractExtractionTest.TestMapAttributeIndexConfig();
            nameConfig.setName("brain.name");
            nameConfig.setExtractor("com.hazelcast.query.impl.extractor.predicates.SingleValueAllPredicatesExtractorTest$NameExtractor");
            mapConfig.addMapAttributeConfig(nameConfig);
        }
    };
}
Also used : MapAttributeConfig(com.hazelcast.config.MapAttributeConfig) MapConfig(com.hazelcast.config.MapConfig) Config(com.hazelcast.config.Config) MapAttributeConfig(com.hazelcast.config.MapAttributeConfig) MapConfig(com.hazelcast.config.MapConfig)

Example 2 with MapAttributeConfig

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

the class ExtractorHelperTest method instantiate_extractors_wrongType.

@Test
public void instantiate_extractors_wrongType() {
    // GIVEN
    MapAttributeConfig string = new MapAttributeConfig("iq", "java.lang.String");
    // EXPECT
    expected.expect(IllegalArgumentException.class);
    // WHEN
    instantiateExtractors(asList(string));
}
Also used : MapAttributeConfig(com.hazelcast.config.MapAttributeConfig) Test(org.junit.Test)

Example 3 with MapAttributeConfig

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

the class ExtractorHelperTest method instantiate_extractors_withCustomClassLoader.

@Test
public void instantiate_extractors_withCustomClassLoader() {
    // GIVEN
    MapAttributeConfig iqExtractor = new MapAttributeConfig("iq", "com.hazelcast.query.impl.getters.ExtractorHelperTest$IqExtractor");
    MapAttributeConfig nameExtractor = new MapAttributeConfig("name", "com.hazelcast.query.impl.getters.ExtractorHelperTest$NameExtractor");
    Config config = new Config();
    // For other custom class loaders (from OSGi bundles, for example)
    ClassLoader customClassLoader = getClass().getClassLoader();
    config.setClassLoader(customClassLoader);
    // WHEN
    Map<String, ValueExtractor> extractors = instantiateExtractors(asList(iqExtractor, nameExtractor));
    // THEN
    assertThat(extractors.get("iq"), instanceOf(IqExtractor.class));
    assertThat(extractors.get("name"), instanceOf(NameExtractor.class));
}
Also used : MapAttributeConfig(com.hazelcast.config.MapAttributeConfig) Config(com.hazelcast.config.Config) MapAttributeConfig(com.hazelcast.config.MapAttributeConfig) ValueExtractor(com.hazelcast.query.extractor.ValueExtractor) Test(org.junit.Test)

Example 4 with MapAttributeConfig

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

the class ExtractorHelperTest method instantiate_extractors_oneClassNotExisting.

@Test
public void instantiate_extractors_oneClassNotExisting() {
    // GIVEN
    MapAttributeConfig iqExtractor = new MapAttributeConfig("iq", "com.hazelcast.query.impl.getters.ExtractorHelperTest$IqExtractor");
    MapAttributeConfig nameExtractor = new MapAttributeConfig("name", "not.existing.class");
    // EXPECT
    expected.expect(IllegalArgumentException.class);
    expected.expectCause(isA(ClassNotFoundException.class));
    // WHEN
    instantiateExtractors(asList(iqExtractor, nameExtractor));
}
Also used : MapAttributeConfig(com.hazelcast.config.MapAttributeConfig) Test(org.junit.Test)

Example 5 with MapAttributeConfig

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

the class ExtractorHelperTest method instantiate_extractors_initException.

@Test
public void instantiate_extractors_initException() {
    // GIVEN
    MapAttributeConfig string = new MapAttributeConfig("iq", "com.hazelcast.query.impl.getters.ExtractorHelperTest$InitExceptionExtractor");
    // EXPECT
    expected.expect(IllegalArgumentException.class);
    // WHEN
    instantiateExtractors(asList(string));
}
Also used : MapAttributeConfig(com.hazelcast.config.MapAttributeConfig) Test(org.junit.Test)

Aggregations

MapAttributeConfig (com.hazelcast.config.MapAttributeConfig)17 Test (org.junit.Test)12 Config (com.hazelcast.config.Config)5 MapConfig (com.hazelcast.config.MapConfig)5 ValueExtractor (com.hazelcast.query.extractor.ValueExtractor)3 EntryListenerConfig (com.hazelcast.config.EntryListenerConfig)1 MapIndexConfig (com.hazelcast.config.MapIndexConfig)1 MapPartitionLostListenerConfig (com.hazelcast.config.MapPartitionLostListenerConfig)1 MapStoreConfig (com.hazelcast.config.MapStoreConfig)1 MultiMapConfig (com.hazelcast.config.MultiMapConfig)1 NearCacheConfig (com.hazelcast.config.NearCacheConfig)1 ReplicatedMapConfig (com.hazelcast.config.ReplicatedMapConfig)1 WanReplicationRef (com.hazelcast.config.WanReplicationRef)1 DefaultPortableReaderQuickTest (com.hazelcast.nio.serialization.impl.DefaultPortableReaderQuickTest)1 ComplexDataStructure (com.hazelcast.query.impl.extractor.specification.ComplexDataStructure)1 QuickTest (com.hazelcast.test.annotation.QuickTest)1 Setup (org.openjdk.jmh.annotations.Setup)1