mirror of https://github.com/apache/lucene.git
Reenable the test: The bug was that all classes (even test classes) were handled as SolrInfoMBeans, so the test loaded all classes. Some tests initialized statics at the wrong time. This patch adds a check, that only build/solr classes are loaded by classloader.
If there are still problems, we may have solr core classes, that initialize statics in a wrong way. In this case we have to fix those, these are real bugs! git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1023845 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
abbd3f0e4d
commit
fa603c9f7f
|
@ -41,7 +41,6 @@ public class SolrInfoMBeanTest extends LuceneTestCase
|
||||||
* Gets a list of everything we can find in the classpath and makes sure it has
|
* Gets a list of everything we can find in the classpath and makes sure it has
|
||||||
* a name, description, etc...
|
* a name, description, etc...
|
||||||
*/
|
*/
|
||||||
@Ignore("meddles with unrelated tests")
|
|
||||||
public void testCallMBeanInfo() throws Exception {
|
public void testCallMBeanInfo() throws Exception {
|
||||||
List<Class> classes = new ArrayList<Class>();
|
List<Class> classes = new ArrayList<Class>();
|
||||||
classes.addAll(getClassesForPackage(StandardRequestHandler.class.getPackage().getName()));
|
classes.addAll(getClassesForPackage(StandardRequestHandler.class.getPackage().getName()));
|
||||||
|
@ -91,7 +90,14 @@ public class SolrInfoMBeanTest extends LuceneTestCase
|
||||||
String path = pckgname.replace('.', '/');
|
String path = pckgname.replace('.', '/');
|
||||||
Enumeration<URL> resources = cld.getResources(path);
|
Enumeration<URL> resources = cld.getResources(path);
|
||||||
while (resources.hasMoreElements()) {
|
while (resources.hasMoreElements()) {
|
||||||
directories.add(new File(resources.nextElement().toURI()));
|
final File f = new File(resources.nextElement().toURI());
|
||||||
|
// only iterate classes from the core, not the tests
|
||||||
|
if (!f.toString().contains("build" + File.separator + "solr"))
|
||||||
|
continue;
|
||||||
|
// extra security :-)
|
||||||
|
if (f.toString().contains("tests"))
|
||||||
|
continue;
|
||||||
|
directories.add(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayList<Class> classes = new ArrayList<Class>();
|
ArrayList<Class> classes = new ArrayList<Class>();
|
||||||
|
@ -100,12 +106,6 @@ public class SolrInfoMBeanTest extends LuceneTestCase
|
||||||
String[] files = directory.list();
|
String[] files = directory.list();
|
||||||
for (String file : files) {
|
for (String file : files) {
|
||||||
if (file.endsWith(".class")) {
|
if (file.endsWith(".class")) {
|
||||||
// FIXME: Find the static/sysprop/file leakage here.
|
|
||||||
// If we call Class.forName(ReplicationHandler) here, its test will later fail
|
|
||||||
// when run inside the same JVM (-Dtests.threadspercpu=0), so something is wrong.
|
|
||||||
if (file.contains("ReplicationHandler"))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
classes.add(Class.forName(pckgname + '.' + file.substring(0, file.length() - 6)));
|
classes.add(Class.forName(pckgname + '.' + file.substring(0, file.length() - 6)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue