MCPcopy Create free account
hub / github.com/apache/solr / SolrCoreTest

Class SolrCoreTest

solr/core/src/test/org/apache/solr/core/SolrCoreTest.java:49–425  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47import org.junit.Test;
48
49public class SolrCoreTest extends SolrTestCaseJ4 {
50
51 @Override
52 public void setUp() throws Exception {
53 super.setUp();
54 initCore("solrconfig.xml", "schema.xml");
55 }
56
57 @Override
58 public void tearDown() throws Exception {
59 deleteCore();
60 super.tearDown();
61 }
62
63 @Test
64 public void testRequestHandlerRegistry() {
65 SolrCore core = h.getCore();
66
67 EmptyRequestHandler handler1 = new EmptyRequestHandler();
68 EmptyRequestHandler handler2 = new EmptyRequestHandler();
69
70 String path = "/this/is A path /that won't be registered!";
71 SolrRequestHandler old = core.registerRequestHandler(path, handler1);
72 assertNull(old); // should not be anything...
73 assertEquals(core.getRequestHandlers().get(path), handler1);
74 old = core.registerRequestHandler(path, handler2);
75 assertEquals(old, handler1); // should pop out the old one
76 assertEquals(core.getRequestHandlers().get(path), handler2);
77 }
78
79 @Test
80 public void testImplicitPlugins() {
81 final SolrCore core = h.getCore();
82 final List<PluginInfo> implicitHandlers = core.getImplicitHandlers();
83
84 final Map<String, String> pathToClassMap = new HashMap<>(implicitHandlers.size());
85 for (PluginInfo implicitHandler : implicitHandlers) {
86 assertEquals(
87 "wrong type for " + implicitHandler.toString(),
88 SolrRequestHandler.TYPE,
89 implicitHandler.type);
90 pathToClassMap.put(implicitHandler.name, implicitHandler.className);
91 }
92
93 int ihCount = 0;
94 {
95 ++ihCount;
96 assertEquals(pathToClassMap.get("/admin/file"), "solr.ShowFileRequestHandler");
97 ++ihCount;
98 assertEquals(pathToClassMap.get("/admin/luke"), "solr.LukeRequestHandler");
99 ++ihCount;
100 assertEquals(pathToClassMap.get("/admin/ping"), "solr.PingRequestHandler");
101 ++ihCount;
102 assertEquals(pathToClassMap.get("/admin/segments"), "solr.SegmentsInfoRequestHandler");
103 ++ihCount;
104 assertEquals(pathToClassMap.get("/admin/info"), "solr.CoreInfoHandler");
105 ++ihCount;
106 assertEquals(pathToClassMap.get("/config"), "solr.SolrConfigHandler");

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…