Search in sources :

Example 1 with Lab

use of org.dkpro.lab.Lab in project dkpro-lab by dkpro.

the class MultiThreadBatchTaskTest method setup.

@Before
public void setup() {
    File path = new File("target/repository/" + getClass().getSimpleName() + "/" + name.getMethodName());
    System.setProperty("DKPRO_HOME", path.getAbsolutePath());
    FileUtils.deleteQuietly(path);
    // Configure Lab to use MultiThreadBatchTaskEngine
    // Use newInstance here to avoid leaking the reconfiguration into other unit tests
    Lab lab = Lab.newInstance(Lab.DEFAULT_CONTEXT);
    oldEngine = ((DefaultTaskExecutionService) lab.getTaskExecutionService()).getEngine(BatchTask.class);
    ((DefaultTaskExecutionService) lab.getTaskExecutionService()).registerEngine(BatchTask.class, MultiThreadBatchTaskEngine.class);
    lab.setProperty(MultiThreadBatchTaskEngine.PROP_THREADS, "10");
}
Also used : DefaultBatchTask(org.dkpro.lab.task.impl.DefaultBatchTask) DefaultTaskExecutionService(org.dkpro.lab.engine.impl.DefaultTaskExecutionService) Lab(org.dkpro.lab.Lab) File(java.io.File) Before(org.junit.Before)

Example 2 with Lab

use of org.dkpro.lab.Lab in project dkpro-lab by dkpro.

the class UimaDescriptorsReport method main.

public static void main(String[] args) throws Exception {
    String uuid = args[0];
    Lab framework = Lab.getInstance();
    UimaDescriptorsReport report = new UimaDescriptorsReport();
    report.setContext(framework.getTaskContextFactory().getContext(uuid));
    report.execute();
}
Also used : Lab(org.dkpro.lab.Lab)

Example 3 with Lab

use of org.dkpro.lab.Lab in project dkpro-lab by dkpro.

the class MultiThreadBatchTaskTest method teardown.

@After
public void teardown() {
    // Restore Lab to using default BatchTask engine
    Lab lab = Lab.getInstance();
    oldEngine = ((DefaultTaskExecutionService) lab.getTaskExecutionService()).getEngine(BatchTask.class);
    ((DefaultTaskExecutionService) lab.getTaskExecutionService()).registerEngine(BatchTask.class, oldEngine);
}
Also used : DefaultBatchTask(org.dkpro.lab.task.impl.DefaultBatchTask) DefaultTaskExecutionService(org.dkpro.lab.engine.impl.DefaultTaskExecutionService) Lab(org.dkpro.lab.Lab) After(org.junit.After)

Example 4 with Lab

use of org.dkpro.lab.Lab in project dkpro-lab by dkpro.

the class ConversionServiceTest method testConversionService.

@Test
public void testConversionService() {
    Lab instance = Lab.newInstance(Lab.DEFAULT_CONTEXT);
    ConversionService conversionService = instance.getConversionService();
    assertNotNull(conversionService);
    String key = "hello";
    conversionService.registerDiscriminable(key, "a Text");
    assertTrue(conversionService.isRegistered(key));
    assertEquals("a Text", conversionService.getDiscriminableValue(key));
}
Also used : Lab(org.dkpro.lab.Lab) Test(org.junit.Test)

Example 5 with Lab

use of org.dkpro.lab.Lab in project dkpro-lab by dkpro.

the class ConversionServiceTest method testDiscriminationWithoutConversionServiceOverride.

@Test
public void testDiscriminationWithoutConversionServiceOverride() throws Exception {
    Integer integer = new Integer(3);
    ParameterSpace ps = new ParameterSpace(Dimension.create(KEY, integer));
    DefaultBatchTask batch = new DefaultBatchTask();
    batch.setParameterSpace(ps);
    batch.addTask(consumer);
    Lab instance = Lab.newInstance(Lab.DEFAULT_CONTEXT);
    instance.run(batch);
    assertEquals("3", discriminatorText);
}
Also used : ParameterSpace(org.dkpro.lab.task.ParameterSpace) Lab(org.dkpro.lab.Lab) DefaultBatchTask(org.dkpro.lab.task.impl.DefaultBatchTask) Test(org.junit.Test)

Aggregations

Lab (org.dkpro.lab.Lab)6 DefaultBatchTask (org.dkpro.lab.task.impl.DefaultBatchTask)4 Test (org.junit.Test)3 DefaultTaskExecutionService (org.dkpro.lab.engine.impl.DefaultTaskExecutionService)2 ParameterSpace (org.dkpro.lab.task.ParameterSpace)2 File (java.io.File)1 After (org.junit.After)1 Before (org.junit.Before)1