Search in sources :

Example 21 with AttributeConfig

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

the class ExtractionWithExtractorsSpecTest method doWithConfig.

@Override
public void doWithConfig(Config config) {
    MapConfig mapConfig = config.getMapConfig("map");
    AttributeConfig tattoosCount = new AttributeConfig();
    tattoosCount.setName("tattoosCount");
    tattoosCount.setExtractorClassName("com.hazelcast.internal.serialization.impl.compact.extractor.ExtractionWithExtractorsSpecTest$LimbTattoosCountExtractor");
    mapConfig.addAttributeConfig(tattoosCount);
    config.getSerializationConfig().setCompactSerializationConfig(new CompactSerializationConfig().setEnabled(true));
}
Also used : CompactSerializationConfig(com.hazelcast.config.CompactSerializationConfig) MapConfig(com.hazelcast.config.MapConfig) AttributeConfig(com.hazelcast.config.AttributeConfig)

Example 22 with AttributeConfig

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

the class NestedPredicateWithExtractorTest method extractor.

private static AttributeConfig extractor(String name, String extractor) {
    AttributeConfig extractorConfig = new AttributeConfig();
    extractorConfig.setName(name);
    extractorConfig.setExtractorClassName(extractor);
    return extractorConfig;
}
Also used : AttributeConfig(com.hazelcast.config.AttributeConfig)

Example 23 with AttributeConfig

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

the class CollectionAllPredicatesExtractorTest method getInstanceConfigurator.

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

        @Override
        public void doWithConfig(Config config, Multivalue mv) {
            MapConfig mapConfig = config.getMapConfig("map");
            AttributeConfig reducedNameAttribute = new TestAttributeIndexConfig();
            reducedNameAttribute.setName(AbstractExtractionTest.parametrize("limb_[any].name", mv));
            reducedNameAttribute.setExtractorClassName("com.hazelcast.query.impl.extractor.predicates.CollectionAllPredicatesExtractorTest$ReducedLimbNameExtractor");
            mapConfig.addAttributeConfig(reducedNameAttribute);
            AttributeConfig indexOneNameAttribute = new TestAttributeIndexConfig();
            indexOneNameAttribute.setName(AbstractExtractionTest.parametrize("limb_[1].name", mv));
            indexOneNameAttribute.setExtractorClassName("com.hazelcast.query.impl.extractor.predicates.CollectionAllPredicatesExtractorTest$IndexOneLimbNameExtractor");
            mapConfig.addAttributeConfig(indexOneNameAttribute);
            AttributeConfig reducedPowerAttribute = new TestAttributeIndexConfig();
            reducedPowerAttribute.setName(AbstractExtractionTest.parametrize("limb_[any].power", mv));
            reducedPowerAttribute.setExtractorClassName("com.hazelcast.query.impl.extractor.predicates.CollectionAllPredicatesExtractorTest$ReducedLimbPowerExtractor");
            mapConfig.addAttributeConfig(reducedPowerAttribute);
            AttributeConfig indexOnePowerAttribute = new TestAttributeIndexConfig();
            indexOnePowerAttribute.setName(AbstractExtractionTest.parametrize("limb_[1].power", mv));
            indexOnePowerAttribute.setExtractorClassName("com.hazelcast.query.impl.extractor.predicates.CollectionAllPredicatesExtractorTest$IndexOneLimbPowerExtractor");
            mapConfig.addAttributeConfig(indexOnePowerAttribute);
        }
    };
}
Also used : Config(com.hazelcast.config.Config) AttributeConfig(com.hazelcast.config.AttributeConfig) MapConfig(com.hazelcast.config.MapConfig) MapConfig(com.hazelcast.config.MapConfig) AttributeConfig(com.hazelcast.config.AttributeConfig)

Example 24 with AttributeConfig

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

the class ExtractionWithExtractorsSpecTest method getInstanceConfigurator.

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

        @Override
        public void doWithConfig(Config config, AbstractExtractionTest.Multivalue mv) {
            MapConfig mapConfig = config.getMapConfig("map");
            AttributeConfig tattoosCount = new TestAttributeIndexConfig();
            tattoosCount.setName("tattoosCount");
            tattoosCount.setExtractorClassName("com.hazelcast.query.impl.extractor.specification.ExtractionWithExtractorsSpecTest$LimbTattoosCountExtractor");
            mapConfig.addAttributeConfig(tattoosCount);
            config.getSerializationConfig().addPortableFactory(ComplexTestDataStructure.PersonPortableFactory.ID, new ComplexTestDataStructure.PersonPortableFactory());
        }
    };
}
Also used : AttributeConfig(com.hazelcast.config.AttributeConfig) MapConfig(com.hazelcast.config.MapConfig) Config(com.hazelcast.config.Config) MapConfig(com.hazelcast.config.MapConfig) AttributeConfig(com.hazelcast.config.AttributeConfig)

Example 25 with AttributeConfig

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

the class ExtractorsTest method extract_extractor_correctValue.

@Test
public void extract_extractor_correctValue() {
    // GIVEN
    AttributeConfig config = new AttributeConfig("gimmePower", "com.hazelcast.query.impl.getters.ExtractorsTest$PowerExtractor");
    Extractors extractors = createExtractors(config);
    // WHEN
    Object power = extractors.extract(bond, "gimmePower", null);
    // THEN
    assertThat((Integer) power, equalTo(550));
}
Also used : AttributeConfig(com.hazelcast.config.AttributeConfig) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

AttributeConfig (com.hazelcast.config.AttributeConfig)31 QuickTest (com.hazelcast.test.annotation.QuickTest)17 Test (org.junit.Test)17 MapConfig (com.hazelcast.config.MapConfig)11 Config (com.hazelcast.config.Config)9 IndexConfig (com.hazelcast.config.IndexConfig)9 QueryCacheConfig (com.hazelcast.config.QueryCacheConfig)6 EntryListenerConfig (com.hazelcast.config.EntryListenerConfig)4 EventJournalConfig (com.hazelcast.config.EventJournalConfig)4 EvictionConfig (com.hazelcast.config.EvictionConfig)4 MapPartitionLostListenerConfig (com.hazelcast.config.MapPartitionLostListenerConfig)4 MapStoreConfig (com.hazelcast.config.MapStoreConfig)4 MergePolicyConfig (com.hazelcast.config.MergePolicyConfig)4 MultiMapConfig (com.hazelcast.config.MultiMapConfig)4 NearCacheConfig (com.hazelcast.config.NearCacheConfig)4 AwsConfig (com.hazelcast.config.AwsConfig)3 CacheSimpleConfig (com.hazelcast.config.CacheSimpleConfig)3 CacheSimpleEntryListenerConfig (com.hazelcast.config.CacheSimpleEntryListenerConfig)3 CardinalityEstimatorConfig (com.hazelcast.config.CardinalityEstimatorConfig)3 DiscoveryConfig (com.hazelcast.config.DiscoveryConfig)3