use of org.apache.solr.request.LocalSolrQueryRequest in project lucene-solr by apache.
the class SkipExistingDocumentsProcessorFactoryTest method testSkipUpdatesFalseIfInitArgsTrueButFalseBooleanInRequest.
@Test
public void testSkipUpdatesFalseIfInitArgsTrueButFalseBooleanInRequest() {
SkipExistingDocumentsProcessorFactory factory = new SkipExistingDocumentsProcessorFactory();
NamedList<Object> initArgs = new NamedList<>();
initArgs.add("skipUpdateIfMissing", true);
factory.init(initArgs);
NamedList<Object> requestArgs = new NamedList<>();
requestArgs.add("skipUpdateIfMissing", false);
SolrQueryRequest req = new LocalSolrQueryRequest(null, requestArgs);
UpdateRequestProcessor next = Mockito.mock(DistributedUpdateProcessor.class);
SkipExistingDocumentsUpdateProcessor processor = factory.getInstance(req, new SolrQueryResponse(), next);
assertTrue("Expected skipInsertIfExists to be true", processor.isSkipInsertIfExists());
assertFalse("Expected skipUpdateIfMissing to be false", processor.isSkipUpdateIfMissing());
}
use of org.apache.solr.request.LocalSolrQueryRequest in project lucene-solr by apache.
the class SkipExistingDocumentsProcessorFactoryTest method testSkipInsertsFalseIfInitArgsTrueButFalseStringInRequest.
@Test
public void testSkipInsertsFalseIfInitArgsTrueButFalseStringInRequest() {
SkipExistingDocumentsProcessorFactory factory = new SkipExistingDocumentsProcessorFactory();
NamedList<Object> initArgs = new NamedList<>();
initArgs.add("skipInsertIfExists", true);
factory.init(initArgs);
NamedList<String> requestArgs = new NamedList<>();
requestArgs.add("skipInsertIfExists", "false");
SolrQueryRequest req = new LocalSolrQueryRequest(null, requestArgs);
UpdateRequestProcessor next = Mockito.mock(DistributedUpdateProcessor.class);
SkipExistingDocumentsUpdateProcessor processor = factory.getInstance(req, new SolrQueryResponse(), next);
assertFalse("Expected skipInsertIfExists to be false", processor.isSkipInsertIfExists());
assertTrue("Expected skipUpdateIfMissing to be true", processor.isSkipUpdateIfMissing());
}
use of org.apache.solr.request.LocalSolrQueryRequest in project lucene-solr by apache.
the class AbstractDIHJdbcTestCase method totalDatabaseRequests.
public int totalDatabaseRequests(String dihHandlerName) throws Exception {
LocalSolrQueryRequest request = lrf.makeRequest("indent", "true");
String response = h.query(dihHandlerName, request);
Matcher m = totalRequestsPattern.matcher(response);
Assert.assertTrue("The handler " + dihHandlerName + " is not reporting any database requests. ", m.find() && m.groupCount() == 1);
return Integer.parseInt(m.group(1));
}
use of org.apache.solr.request.LocalSolrQueryRequest in project lucene-solr by apache.
the class BlobHandler method forward.
// This does not work for the general case of forwarding requests. It probably currently
// works OK for real-time get (which is all that BlobHandler uses it for).
private static void forward(SolrQueryRequest req, String handler, SolrParams params, SolrQueryResponse rsp) {
LocalSolrQueryRequest r = new LocalSolrQueryRequest(req.getCore(), params);
// Close as late as possible...
SolrRequestInfo.getRequestInfo().addCloseHook(r);
req.getCore().getRequestHandler(handler).handleRequest(r, rsp);
}
use of org.apache.solr.request.LocalSolrQueryRequest in project lucene-solr by apache.
the class TestCrossCoreJoin method testCoresAreDifferent.
@Test
public void testCoresAreDifferent() throws Exception {
assertQEx("schema12.xml" + " has no \"cat\" field", req("cat:*"), ErrorCode.BAD_REQUEST);
final LocalSolrQueryRequest req = new LocalSolrQueryRequest(fromCore, "cat:*", "/select", 0, 100, Collections.emptyMap());
final String resp = query(fromCore, req);
assertTrue(resp, resp.contains("numFound=\"1\""));
assertTrue(resp, resp.contains("<str name=\"id\">10</str>"));
}
Aggregations