use of org.apache.solr.handler.component.FacetComponent in project lucene-solr by apache.
the class ResourceLoaderTest method testAwareCompatibility.
public void testAwareCompatibility() throws Exception {
Class<?> clazz = ResourceLoaderAware.class;
// Check ResourceLoaderAware valid objects
assertAwareCompatibility(clazz, new NGramFilterFactory(new HashMap<>()));
assertAwareCompatibility(clazz, new KeywordTokenizerFactory(new HashMap<>()));
// Make sure it throws an error for invalid objects
Object[] invalid = new Object[] { // new NGramTokenFilter( null ),
"hello", new Float(12.3f), new LukeRequestHandler(), new JSONResponseWriter() };
for (Object obj : invalid) {
try {
assertAwareCompatibility(clazz, obj);
Assert.fail("Should be invalid class: " + obj + " FOR " + clazz);
}// OK
catch (SolrException ex) {
}
}
clazz = SolrCoreAware.class;
// Check ResourceLoaderAware valid objects
assertAwareCompatibility(clazz, new LukeRequestHandler());
assertAwareCompatibility(clazz, new FacetComponent());
assertAwareCompatibility(clazz, new JSONResponseWriter());
// Make sure it throws an error for invalid objects
invalid = new Object[] { new NGramFilterFactory(new HashMap<>()), "hello", new Float(12.3f), new KeywordTokenizerFactory(new HashMap<>()) };
for (Object obj : invalid) {
try {
assertAwareCompatibility(clazz, obj);
Assert.fail("Should be invalid class: " + obj + " FOR " + clazz);
}// OK
catch (SolrException ex) {
}
}
}
Aggregations