use of org.knime.core.node.exec.SandboxedNodeCreator in project knime-core by knime.
the class BugAP7010_DataLoadedWithSandboxedNodeCreator method testExecuteAfterSandboxedNodeCreation.
/**
* Creates an SandboxedNode of a node of the workflow and
* executes the workflow afterwards.
* @throws Exception
*/
@Test(timeout = 30000L)
public void testExecuteAfterSandboxedNodeCreation() throws Exception {
WorkflowManager manager = getManager();
checkState(manager, CONFIGURED);
// Get some things we need to create the SandboxedNode
NodeContainer tableCreator = findNodeContainer(m_tableCreator);
NodeContainer rowSplitter = findNodeContainer(m_rowSplitter);
PortObject[] inputData = new PortObject[2];
inputData[1] = tableCreator.getOutPort(1).getPortObject();
ExecutionMonitor exec = new ExecutionMonitor();
// Set the location and the WFM
File sandboxedDir = FileUtil.createTempDir(getClass().getSimpleName() + "-sandboxed");
// Create the SandboxedNode
SandboxedNodeCreator nodeCreator = new SandboxedNodeCreator(rowSplitter, inputData, m_sandboxedWM);
nodeCreator.setLocalWorkflowDir(CheckUtils.checkArgumentNotNull(sandboxedDir));
nodeCreator.setCopyData(true);
NodeContext.pushContext(rowSplitter);
NodeID workflowID;
try (SandboxedNode node = nodeCreator.createSandbox(exec)) {
workflowID = node.getSandboxNode(NodeContainer.class).getParent().getID();
} finally {
NodeContext.removeLastContext();
}
// Now, try to execute the original workflow. This should still work
executeAllAndWait();
checkState(manager, EXECUTED);
}
Aggregations