Search in sources :

Example 81 with SolrQueryResponse

use of org.apache.solr.response.SolrQueryResponse in project lucene-solr by apache.

the class TestLazyCores method checkStatus.

// If ok==true, we shouldn't be seeing any failure cases.
// if ok==false, the core being examined should have a failure in the list.
private void checkStatus(CoreContainer cc, Boolean ok, String core) throws Exception {
    SolrQueryResponse resp = new SolrQueryResponse();
    final CoreAdminHandler admin = new CoreAdminHandler(cc);
    admin.handleRequestBody(req(CoreAdminParams.ACTION, CoreAdminParams.CoreAdminAction.STATUS.toString(), CoreAdminParams.CORE, core), resp);
    Map<String, Exception> failures = (Map<String, Exception>) resp.getValues().get("initFailures");
    if (ok) {
        if (failures.size() != 0) {
            fail("Should have cleared the error, but there are failues " + failures.toString());
        }
    } else {
        if (failures.size() == 0) {
            fail("Should have had errors here but the status return has no failures!");
        }
    }
}
Also used : SolrQueryResponse(org.apache.solr.response.SolrQueryResponse) CoreAdminHandler(org.apache.solr.handler.admin.CoreAdminHandler) HashMap(java.util.HashMap) Map(java.util.Map) SolrException(org.apache.solr.common.SolrException) IOException(java.io.IOException)

Example 82 with SolrQueryResponse

use of org.apache.solr.response.SolrQueryResponse in project lucene-solr by apache.

the class TestInitParams method testElevateExample.

public void testElevateExample() {
    SolrRequestHandler handler = h.getCore().getRequestHandler("/elevate");
    SolrQueryResponse rsp = new SolrQueryResponse();
    handler.handleRequest(req("initArgs", "true"), rsp);
    NamedList nl = (NamedList) rsp.getValues().get("initArgs");
    NamedList def = (NamedList) nl.get(PluginInfo.DEFAULTS);
    assertEquals("text", def.get("df"));
}
Also used : SolrQueryResponse(org.apache.solr.response.SolrQueryResponse) NamedList(org.apache.solr.common.util.NamedList) SolrRequestHandler(org.apache.solr.request.SolrRequestHandler)

Example 83 with SolrQueryResponse

use of org.apache.solr.response.SolrQueryResponse 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);
}
Also used : SolrQueryResponse(org.apache.solr.response.SolrQueryResponse) CoreAdminHandler(org.apache.solr.handler.admin.CoreAdminHandler)

Example 84 with SolrQueryResponse

use of org.apache.solr.response.SolrQueryResponse 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);
}
Also used : SolrQueryResponse(org.apache.solr.response.SolrQueryResponse) CoreAdminHandler(org.apache.solr.handler.admin.CoreAdminHandler)

Example 85 with SolrQueryResponse

use of org.apache.solr.response.SolrQueryResponse in project lucene-solr by apache.

the class TestInitParams method testArbitraryAttributes.

public void testArbitraryAttributes() {
    SolrRequestHandler handler = h.getCore().getRequestHandler("/dump7");
    SolrQueryResponse rsp = new SolrQueryResponse();
    handler.handleRequest(req("initArgs", "true"), rsp);
    NamedList nl = (NamedList) rsp.getValues().get("initArgs");
    assertEquals("server-enabled.txt", nl.get("healthcheckFile"));
}
Also used : SolrQueryResponse(org.apache.solr.response.SolrQueryResponse) NamedList(org.apache.solr.common.util.NamedList) SolrRequestHandler(org.apache.solr.request.SolrRequestHandler)

Aggregations

SolrQueryResponse (org.apache.solr.response.SolrQueryResponse)258 SolrQueryRequest (org.apache.solr.request.SolrQueryRequest)128 Test (org.junit.Test)100 LocalSolrQueryRequest (org.apache.solr.request.LocalSolrQueryRequest)80 NamedList (org.apache.solr.common.util.NamedList)68 ModifiableSolrParams (org.apache.solr.common.params.ModifiableSolrParams)58 SolrCore (org.apache.solr.core.SolrCore)52 AddUpdateCommand (org.apache.solr.update.AddUpdateCommand)41 SolrInputDocument (org.apache.solr.common.SolrInputDocument)40 SolrException (org.apache.solr.common.SolrException)32 ContentStreamBase (org.apache.solr.common.util.ContentStreamBase)29 ArrayList (java.util.ArrayList)26 BufferingRequestProcessor (org.apache.solr.update.processor.BufferingRequestProcessor)24 SolrRequestHandler (org.apache.solr.request.SolrRequestHandler)22 SolrRequestInfo (org.apache.solr.request.SolrRequestInfo)21 SimpleOrderedMap (org.apache.solr.common.util.SimpleOrderedMap)20 UpdateRequestProcessor (org.apache.solr.update.processor.UpdateRequestProcessor)20 JsonLoader (org.apache.solr.handler.loader.JsonLoader)17 IOException (java.io.IOException)16 HashMap (java.util.HashMap)16