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");
}
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();
}
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);
}
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));
}
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);
}
Aggregations