use of cz.mzk.recordmanager.server.solr.SolrServerFacadeImpl in project RecordManager2 by moravianlibrary.
the class AbstractSolrTest method createEmbeddedSolrServer.
@BeforeMethod
protected void createEmbeddedSolrServer() throws Exception {
server.deleteByQuery("*:*");
server.commit();
resetToNice(solrServerFactory);
SolrIndexingExceptionHandler handler = new FaultTolerantIndexingExceptionHandler();
expect(solrServerFactory.create(eq(SOLR_URL), anyObject(Mode.class), anyObject(SolrIndexingExceptionHandler.class))).andReturn(new SolrServerFacadeImpl(server, handler)).anyTimes();
expect(solrServerFactory.create(eq(SOLR_URL))).andReturn(new SolrServerFacadeImpl(server, handler)).anyTimes();
replay(solrServerFactory);
}
use of cz.mzk.recordmanager.server.solr.SolrServerFacadeImpl in project RecordManager2 by moravianlibrary.
the class IndexRecordsToSolrJobTest method execute.
@Test
@SuppressWarnings("unchecked")
public void execute() throws Exception {
resetToNice(solrServerFactory);
reset(mockedSolrServer);
expect(solrServerFactory.create(eq(SOLR_URL), anyObject())).andReturn(new SolrServerFacadeImpl(mockedSolrServer)).anyTimes();
expect(solrServerFactory.create(eq(SOLR_URL), anyObject(), anyObject())).andReturn(new SolrServerFacadeImpl(mockedSolrServer)).anyTimes();
expect(solrServerFactory.create(eq(SOLR_URL))).andReturn(new SolrServerFacadeImpl(mockedSolrServer)).anyTimes();
expect(mockedSolrServer.add(and(capture(EasyMock.newCapture()), anyObject(SolrInputDocument.class)), anyInt())).andReturn(new UpdateResponse()).anyTimes();
expect(mockedSolrServer.add(and(capture(EasyMock.newCapture()), (Collection<SolrInputDocument>) anyObject(Collection.class)), anyInt())).andReturn(new UpdateResponse()).anyTimes();
expect(mockedSolrServer.commit()).andReturn(new UpdateResponse());
expect(mockedSolrServer.commit()).andReturn(new UpdateResponse());
replay(solrServerFactory, mockedSolrServer);
Job job = jobRegistry.getJob("indexAllRecordsToSolrJob");
Map<String, JobParameter> params = new HashMap<String, JobParameter>();
params.put(Constants.JOB_PARAM_FROM_DATE, new JobParameter(dateFormat.parse("1. 1. 2010"), true));
params.put(Constants.JOB_PARAM_UNTIL_DATE, new JobParameter(dateFormat.parse("1. 1. 2016"), true));
params.put(Constants.JOB_PARAM_SOLR_URL, new JobParameter(SOLR_URL, true));
JobParameters jobParams = new JobParameters(params);
JobExecution execution = jobLauncher.run(job, jobParams);
Assert.assertEquals(execution.getExitStatus(), ExitStatus.COMPLETED);
verify(solrServerFactory, mockedSolrServer);
}
Aggregations