use of org.apache.solr.search.LRUCache in project lucene-solr by apache.
the class SolrInfoBeanTest method testCallMBeanInfo.
/**
* Gets a list of everything we can find in the classpath and makes sure it has
* a name, description, etc...
*/
public void testCallMBeanInfo() throws Exception {
List<Class> classes = new ArrayList<>();
classes.addAll(getClassesForPackage(StandardRequestHandler.class.getPackage().getName()));
classes.addAll(getClassesForPackage(SearchComponent.class.getPackage().getName()));
classes.addAll(getClassesForPackage(LukeRequestHandler.class.getPackage().getName()));
classes.addAll(getClassesForPackage(DefaultSolrHighlighter.class.getPackage().getName()));
classes.addAll(getClassesForPackage(LRUCache.class.getPackage().getName()));
// System.out.println(classes);
int checked = 0;
SolrMetricManager metricManager = h.getCoreContainer().getMetricManager();
String registry = h.getCore().getCoreMetricManager().getRegistryName();
String scope = TestUtil.randomSimpleString(random(), 2, 10);
for (Class clazz : classes) {
if (SolrInfoBean.class.isAssignableFrom(clazz)) {
try {
SolrInfoBean info = (SolrInfoBean) clazz.newInstance();
if (info instanceof SolrMetricProducer) {
((SolrMetricProducer) info).initializeMetrics(metricManager, registry, scope);
}
//System.out.println( info.getClass() );
assertNotNull(info.getName());
assertNotNull(info.getDescription());
assertNotNull(info.getCategory());
if (info instanceof LRUCache) {
continue;
}
assertNotNull(info.toString());
checked++;
} catch (InstantiationException ex) {
// expected...
//System.out.println( "unable to initialize: "+clazz );
}
}
}
assertTrue("there are at least 10 SolrInfoBean that should be found in the classpath, found " + checked, checked > 10);
}
Aggregations