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);
}
};
}
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));
}
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));
}
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));
}
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));
}
Aggregations