SOLR-9025: Add SolrCoreTest.testImplicitPlugins test.

This commit is contained in:
Christine Poerschke 2016-04-22 18:21:41 +01:00
parent 776f9ec7c8
commit 666472b74f
1 changed files with 40 additions and 0 deletions

View File

@ -29,6 +29,7 @@ import org.apache.solr.util.plugin.SolrCoreAware;
import org.junit.Test;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Callable;
@ -68,6 +69,45 @@ public class SolrCoreTest extends SolrTestCaseJ4 {
assertEquals( core.getRequestHandlers().get( path ), handler2 );
}
@Test
public void testImplicitPlugins() {
final SolrCore core = h.getCore();
final List<PluginInfo> implicitHandlers = core.getImplicitHandlers();
final Map<String,String> pathToClassMap = new HashMap<>(implicitHandlers.size());
for (PluginInfo implicitHandler : implicitHandlers) {
assertEquals("wrong type for "+implicitHandler.toString(),
SolrRequestHandler.TYPE, implicitHandler.type);
pathToClassMap.put(implicitHandler.name, implicitHandler.className);
}
int ihCount = 0;
{
++ihCount; assertEquals(pathToClassMap.get("/admin/file"), "solr.ShowFileRequestHandler");
++ihCount; assertEquals(pathToClassMap.get("/admin/logging"), "solr.LoggingHandler");
++ihCount; assertEquals(pathToClassMap.get("/admin/luke"), "solr.LukeRequestHandler");
++ihCount; assertEquals(pathToClassMap.get("/admin/mbeans"), "solr.SolrInfoMBeanHandler");
++ihCount; assertEquals(pathToClassMap.get("/admin/ping"), "solr.PingRequestHandler");
++ihCount; assertEquals(pathToClassMap.get("/admin/plugins"), "solr.PluginInfoHandler");
++ihCount; assertEquals(pathToClassMap.get("/admin/properties"), "solr.PropertiesRequestHandler");
++ihCount; assertEquals(pathToClassMap.get("/admin/segments"), "solr.SegmentsInfoRequestHandler");
++ihCount; assertEquals(pathToClassMap.get("/admin/system"), "solr.SystemInfoHandler");
++ihCount; assertEquals(pathToClassMap.get("/admin/threads"), "solr.ThreadDumpHandler");
++ihCount; assertEquals(pathToClassMap.get("/config"), "solr.SolrConfigHandler");
++ihCount; assertEquals(pathToClassMap.get("/export"), "solr.SearchHandler");
++ihCount; assertEquals(pathToClassMap.get("/get"), "solr.RealTimeGetHandler");
++ihCount; assertEquals(pathToClassMap.get("/replication"), "solr.ReplicationHandler");
++ihCount; assertEquals(pathToClassMap.get("/schema"), "solr.SchemaHandler");
++ihCount; assertEquals(pathToClassMap.get("/sql"), "solr.SQLHandler");
++ihCount; assertEquals(pathToClassMap.get("/stream"), "solr.StreamHandler");
++ihCount; assertEquals(pathToClassMap.get("/update"), "solr.UpdateRequestHandler");
++ihCount; assertEquals(pathToClassMap.get("/update/csv"), "solr.UpdateRequestHandler");
++ihCount; assertEquals(pathToClassMap.get("/update/json"), "solr.UpdateRequestHandler");
++ihCount; assertEquals(pathToClassMap.get("/update/json/docs"), "solr.UpdateRequestHandler");
}
assertEquals("wrong number of implicit handlers", ihCount, implicitHandlers.size());
}
@Test
public void testClose() throws Exception {
final CoreContainer cores = h.getCoreContainer();