Search in sources :

Example 1 with ReconJob

use of com.google.refine.model.recon.ReconJob 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);
}
Also used : Project(com.google.refine.model.Project) StandardReconConfig(com.google.refine.model.recon.StandardReconConfig) Column(com.google.refine.model.Column) ReconJob(com.google.refine.model.recon.ReconJob) Process(com.google.refine.process.Process) Properties(java.util.Properties) Recon(com.google.refine.model.Recon) RefineTest(com.google.refine.RefineTest) Test(org.testng.annotations.Test) BeforeTest(org.testng.annotations.BeforeTest)

Aggregations

RefineTest (com.google.refine.RefineTest)1 Column (com.google.refine.model.Column)1 Project (com.google.refine.model.Project)1 Recon (com.google.refine.model.Recon)1 ReconJob (com.google.refine.model.recon.ReconJob)1 StandardReconConfig (com.google.refine.model.recon.StandardReconConfig)1 Process (com.google.refine.process.Process)1 Properties (java.util.Properties)1 BeforeTest (org.testng.annotations.BeforeTest)1 Test (org.testng.annotations.Test)1