use of com.google.refine.model.recon.StandardReconConfig in project OpenRefine by OpenRefine.
the class ReconJudgeSimilarCellsTests method testMarkNewTopics.
@Test
public void testMarkNewTopics() throws Exception {
Project project = createCSVProject("A,B\n" + "foo,bar\n" + "alpha,beta\n");
Column column = project.columnModel.columns.get(0);
ReconConfig config = new StandardReconConfig("http://my.database/recon_service", "http://my.database/entity/", "http://my.database/schema/", null, null, true, Collections.emptyList());
column.setReconConfig(config);
AbstractOperation op = new ReconJudgeSimilarCellsOperation(ENGINE_CONFIG, "A", "foo", Recon.Judgment.New, null, true);
Process process = op.createProcess(project, new Properties());
process.performImmediate();
Cell cell = project.rows.get(0).cells.get(0);
assertEquals(Recon.Judgment.New, cell.recon.judgment);
assertEquals("http://my.database/entity/", cell.recon.identifierSpace);
assertNull(project.rows.get(1).cells.get(0).recon);
}
use of com.google.refine.model.recon.StandardReconConfig in project OpenRefine by OpenRefine.
the class ReconOperationTests method testFailingRecon.
@Test
public void testFailingRecon() throws Exception {
Project project = createCSVProject("my recon test project", "column\n" + "valueA\n" + "valueB\n" + "valueC");
StandardReconConfig reconConfig = mock(StandardReconConfig.class);
List<Recon> reconList = Arrays.asList((Recon) null, (Recon) null, (Recon) null);
ReconJob reconJob = mock(ReconJob.class);
when(reconConfig.batchRecon(Mockito.any(), Mockito.anyLong())).thenReturn(reconList);
when(reconConfig.getBatchSize()).thenReturn(10);
when(reconConfig.createJob(Mockito.eq(project), Mockito.anyInt(), Mockito.any(), Mockito.any(), Mockito.any())).thenReturn(reconJob);
ReconOperation op = new ReconOperation(EngineConfig.reconstruct("{}"), "column", reconConfig);
Process process = op.createProcess(project, new Properties());
runAndWait(project.getProcessManager(), process, 1000);
Column column = project.columnModel.columns.get(0);
Assert.assertNotNull(column.getReconStats());
Assert.assertEquals(column.getReconStats().matchedTopics, 0);
Assert.assertNull(project.rows.get(0).getCell(0).recon);
Assert.assertNull(project.rows.get(1).getCell(0).recon);
Assert.assertNull(project.rows.get(2).getCell(0).recon);
}
Aggregations