mirror of https://github.com/apache/lucene.git
SOLR-2160: tests - use classloader from core's resource loader
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1026841 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f3a9836468
commit
af9e49cf88
|
@ -24,6 +24,7 @@ import org.apache.solr.handler.component.SearchComponent;
|
||||||
import org.apache.solr.handler.component.SearchHandler;
|
import org.apache.solr.handler.component.SearchHandler;
|
||||||
import org.apache.solr.highlight.DefaultSolrHighlighter;
|
import org.apache.solr.highlight.DefaultSolrHighlighter;
|
||||||
import org.apache.solr.search.LRUCache;
|
import org.apache.solr.search.LRUCache;
|
||||||
|
import org.junit.BeforeClass;
|
||||||
import org.junit.Ignore;
|
import org.junit.Ignore;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -35,8 +36,13 @@ import java.util.List;
|
||||||
/**
|
/**
|
||||||
* A simple test used to increase code coverage for some standard things...
|
* A simple test used to increase code coverage for some standard things...
|
||||||
*/
|
*/
|
||||||
public class SolrInfoMBeanTest extends LuceneTestCase
|
public class SolrInfoMBeanTest extends SolrTestCaseJ4
|
||||||
{
|
{
|
||||||
|
@BeforeClass
|
||||||
|
public static void beforeClass() throws Exception {
|
||||||
|
initCore("solrconfig.xml","schema.xml");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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...
|
||||||
|
@ -88,7 +94,7 @@ public class SolrInfoMBeanTest extends LuceneTestCase
|
||||||
|
|
||||||
private static List<Class> getClassesForPackage(String pckgname) throws Exception {
|
private static List<Class> getClassesForPackage(String pckgname) throws Exception {
|
||||||
ArrayList<File> directories = new ArrayList<File>();
|
ArrayList<File> directories = new ArrayList<File>();
|
||||||
ClassLoader cld = Thread.currentThread().getContextClassLoader();
|
ClassLoader cld = h.getCore().getResourceLoader().getClassLoader();
|
||||||
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()) {
|
||||||
|
|
Loading…
Reference in New Issue