use of com.graphaware.nlp.dsl.result.WorkflowInstanceItemInfo in project neo4j-nlp by graphaware.
the class DynamicConfiguration method loadPipelineInstanceItems.
public List<WorkflowInstanceItemInfo> loadPipelineInstanceItems(String prefix) {
List<WorkflowInstanceItemInfo> list = new ArrayList<>();
Map<String, Object> config = getAllConfigValuesFromStore();
config.keySet().forEach(k -> {
if (k.startsWith(prefix)) {
try {
WorkflowInstanceItemInfo pipelineSpecification = mapper.readValue(config.get(k).toString(), WorkflowInstanceItemInfo.class);
list.add(pipelineSpecification);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
});
return list;
}
use of com.graphaware.nlp.dsl.result.WorkflowInstanceItemInfo in project neo4j-nlp by graphaware.
the class DynamicConfigurationTest method testLoadingInstances.
@Test
public void testLoadingInstances() throws Exception {
resetSingleton();
ObjectMapper mapper = new ObjectMapper();
mapper.configure(SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS, false);
keyValueStore = new GraphKeyValueStore(getDatabase());
WorkflowTask workflowInput = new WorkflowTask("test", getDatabase());
DynamicConfiguration configuration = new DynamicConfiguration(getDatabase());
HashMap<String, Object> properties = new HashMap<>();
properties.put(WorkflowTaskConfiguration.WORFKLOW_INPUT_NAME, "");
properties.put(WorkflowTaskConfiguration.WORFKLOW_OUTPUT_NAME, "");
properties.put(WorkflowTaskConfiguration.WORFKLOW_PROCESSOR_NAME, "");
workflowInput.setConfiguration(new WorkflowTaskConfiguration(properties));
try (Transaction tx = getDatabase().beginTx()) {
configuration.storeWorkflowInstanceItem(workflowInput);
tx.success();
}
List<WorkflowInstanceItemInfo> pipelineInstanceItems = configuration.loadPipelineInstanceItems(WorkflowTask.WORFKLOW_TASK_KEY_PREFIX);
assertTrue(pipelineInstanceItems.size() == 1);
WorkflowInstanceItemInfo info = pipelineInstanceItems.get(0);
assertTrue(info instanceof WorkflowTaskInstanceItemInfo);
assertEquals("test", info.getName());
assertEquals("com.graphaware.nlp.workflow.task.WorkflowTask", info.getClassName());
}
Aggregations