use of org.dkpro.lab.task.impl.ExecutableTaskBase in project dkpro-lab by dkpro.
the class MultiThreadBatchTaskTest method importTest.
@Test(expected = UnresolvedImportException.class)
public void importTest() throws Exception {
Task producer = new ExecutableTaskBase() {
@Override
public void execute(TaskContext aContext) throws Exception {
System.out.println("Running producer");
Properties data = new Properties();
data.setProperty("key", "value");
aContext.storeBinary("DATA", new PropertiesAdapter(data));
}
};
Task consumer = new ExecutableTaskBase() {
@Override
public void execute(TaskContext aContext) throws Exception {
System.out.println("Running consumer");
Properties data = new Properties();
aContext.retrieveBinary("DATA", new PropertiesAdapter(data));
Assert.assertEquals(data.getProperty("key"), "value");
}
};
consumer.addImport(producer, "DATA1", "DATA");
DefaultBatchTask batch = new DefaultBatchTask();
// BatchTask batch = new BatchTask();
batch.addTask(producer);
batch.addTask(consumer);
Lab.getInstance().run(batch);
}
Aggregations