use of com.hazelcast.config.AttributeConfig in project hazelcast by hazelcast.
the class DynamicConfigXmlGenerator method attributeConfigXmlGenerator.
private static void attributeConfigXmlGenerator(ConfigXmlGenerator.XmlGenerator gen, MapConfig m) {
if (!m.getAttributeConfigs().isEmpty()) {
gen.open("attributes");
for (AttributeConfig attributeCfg : m.getAttributeConfigs()) {
gen.node("attribute", attributeCfg.getName(), "extractor-class-name", attributeCfg.getExtractorClassName());
}
gen.close();
}
}
use of com.hazelcast.config.AttributeConfig in project hazelcast by hazelcast.
the class MemberDomConfigProcessor method attributesHandle.
protected void attributesHandle(Node n, MapConfig mapConfig) {
for (Node extractorNode : childElements(n)) {
if (matches("attribute", cleanNodeName(extractorNode))) {
String extractor = getTextContent(getNamedItemNode(extractorNode, "extractor-class-name"));
String name = getTextContent(extractorNode);
mapConfig.addAttributeConfig(new AttributeConfig(name, extractor));
}
}
}
use of com.hazelcast.config.AttributeConfig in project hazelcast by hazelcast.
the class ExtractorsTest method getGetter_extractor_cachingWorks.
@Test
public void getGetter_extractor_cachingWorks() {
// GIVEN
AttributeConfig config = new AttributeConfig("gimmePower", "com.hazelcast.query.impl.getters.ExtractorsTest$PowerExtractor");
Extractors extractors = createExtractors(config);
// WHEN
Getter getterFirstInvocation = extractors.getGetter(bond, "gimmePower", true);
Getter getterSecondInvocation = extractors.getGetter(bond, "gimmePower", true);
// THEN
assertThat(getterFirstInvocation, sameInstance(getterSecondInvocation));
assertThat(getterFirstInvocation, instanceOf(ExtractorGetter.class));
}
use of com.hazelcast.config.AttributeConfig in project hazelcast by hazelcast.
the class QueryCacheTest method testQueryCache_with_attribute_inPredicate.
@Test
public void testQueryCache_with_attribute_inPredicate() {
String ATTRIBUTE_NAME = "booleanAttribute";
Config config = new Config();
config.getMapConfig(mapName).addQueryCacheConfig(new QueryCacheConfig(cacheName).setIncludeValue(true).setPredicateConfig(new PredicateConfig(Predicates.equal(ATTRIBUTE_NAME, true)))).addAttributeConfig(new AttributeConfig().setExtractorClassName(EvenNumberEmployeeValueExtractor.class.getName()).setName(ATTRIBUTE_NAME));
IMap<Integer, Employee> map = getIMap(config);
QueryCache<Integer, Employee> queryCache = map.getQueryCache(cacheName);
populateMap(map, 100);
assertQueryCacheSizeEventually(50, queryCache);
}
use of com.hazelcast.config.AttributeConfig 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");
AttributeConfig iqConfig = new TestAttributeIndexConfig();
iqConfig.setName("brain.iq");
iqConfig.setExtractorClassName("com.hazelcast.query.impl.extractor.predicates.SingleValueAllPredicatesExtractorTest$IqExtractor");
mapConfig.addAttributeConfig(iqConfig);
AttributeConfig nameConfig = new TestAttributeIndexConfig();
nameConfig.setName("brain.name");
nameConfig.setExtractorClassName("com.hazelcast.query.impl.extractor.predicates.SingleValueAllPredicatesExtractorTest$NameExtractor");
mapConfig.addAttributeConfig(nameConfig);
}
};
}
Aggregations