use of org.apache.solr.handler.admin.CoreAdminHandler in project lucene-solr by apache.
the class TestLazyCores method unloadViaAdmin.
private void unloadViaAdmin(CoreContainer cc, String name) throws Exception {
final CoreAdminHandler admin = new CoreAdminHandler(cc);
SolrQueryResponse resp = new SolrQueryResponse();
admin.handleRequestBody(req(CoreAdminParams.ACTION, CoreAdminParams.CoreAdminAction.UNLOAD.toString(), CoreAdminParams.CORE, name), resp);
}
use of org.apache.solr.handler.admin.CoreAdminHandler in project lucene-solr by apache.
the class TestLazyCores method createViaAdmin.
private void createViaAdmin(CoreContainer cc, String name, boolean isTransient, boolean loadOnStartup) throws Exception {
final CoreAdminHandler admin = new CoreAdminHandler(cc);
SolrQueryResponse resp = new SolrQueryResponse();
admin.handleRequestBody(req(CoreAdminParams.ACTION, CoreAdminParams.CoreAdminAction.CREATE.toString(), CoreAdminParams.NAME, name, CoreAdminParams.TRANSIENT, Boolean.toString(isTransient), CoreAdminParams.LOAD_ON_STARTUP, Boolean.toString(loadOnStartup)), resp);
}
use of org.apache.solr.handler.admin.CoreAdminHandler in project lucene-solr by apache.
the class TestLazyCores method testCreateSame.
@Test
public void testCreateSame() throws Exception {
final CoreContainer cc = init();
try {
// First, try all 4 combinations of load on startup and transient
final CoreAdminHandler admin = new CoreAdminHandler(cc);
SolrCore lc2 = cc.getCore("collection2");
SolrCore lc4 = cc.getCore("collection4");
SolrCore lc5 = cc.getCore("collection5");
SolrCore lc6 = cc.getCore("collection6");
copyMinConf(new File(solrHomeDirectory, "t2"));
copyMinConf(new File(solrHomeDirectory, "t4"));
copyMinConf(new File(solrHomeDirectory, "t5"));
copyMinConf(new File(solrHomeDirectory, "t6"));
// Should also fail with the same name
tryCreateFail(admin, "collection2", "t12", "Core with name", "collection2", "already exists");
tryCreateFail(admin, "collection4", "t14", "Core with name", "collection4", "already exists");
tryCreateFail(admin, "collection5", "t15", "Core with name", "collection5", "already exists");
tryCreateFail(admin, "collection6", "t16", "Core with name", "collection6", "already exists");
lc2.close();
lc4.close();
lc5.close();
lc6.close();
} finally {
cc.shutdown();
}
}
use of org.apache.solr.handler.admin.CoreAdminHandler in project lucene-solr by apache.
the class TestManagedSchema method assertSchemaResource.
private void assertSchemaResource(String collection, String expectedSchemaResource) throws Exception {
final CoreContainer cores = h.getCoreContainer();
final CoreAdminHandler admin = new CoreAdminHandler(cores);
SolrQueryRequest request = req(CoreAdminParams.ACTION, CoreAdminParams.CoreAdminAction.STATUS.toString());
SolrQueryResponse response = new SolrQueryResponse();
admin.handleRequestBody(request, response);
assertNull("Exception on create", response.getException());
NamedList responseValues = response.getValues();
NamedList status = (NamedList) responseValues.get("status");
NamedList collectionStatus = (NamedList) status.get(collection);
String collectionSchema = (String) collectionStatus.get(CoreAdminParams.SCHEMA);
assertEquals("Schema resource name differs from expected name", expectedSchemaResource, collectionSchema);
}
use of org.apache.solr.handler.admin.CoreAdminHandler in project lucene-solr by apache.
the class TestManagedSchema method testDefaultSchemaFactory.
public void testDefaultSchemaFactory() throws Exception {
deleteCore();
initCore("solrconfig-managed-schema-test.xml", "schema-minimal.xml", tmpSolrHome.getPath());
final CoreContainer cores = h.getCoreContainer();
final CoreAdminHandler admin = new CoreAdminHandler(cores);
SolrQueryRequest request = req(CoreAdminParams.ACTION, CoreAdminParams.CoreAdminAction.STATUS.toString());
SolrQueryResponse response = new SolrQueryResponse();
admin.handleRequestBody(request, response);
assertNull("Exception on create", response.getException());
assertSchemaResource(collection, "managed-schema");
}
Aggregations