Search in sources :

Example 11 with WorkflowLoadResult

use of org.knime.core.node.workflow.WorkflowPersistor.WorkflowLoadResult in project knime-core by knime.

the class BugAP3673_CredentialsQF_InheritFromWkf method testExecuteFlow.

/**
 * Test credentials that are set during load of workflow.
 */
@Test
public void testExecuteFlow() throws Exception {
    final TestWorkflowLoadHelper lH = new TestWorkflowLoadHelper("some-fixed-password");
    WorkflowLoadResult loadWorkflow = loadWorkflow(getDefaultWorkflowDirectory(), new ExecutionMonitor(), lH);
    setManager(loadWorkflow.getWorkflowManager());
    assertThat("Invalid prompt count - only workflow variables are expected to be prompted", lH.getPromptCount(), is(1));
    executeAllAndWait();
    checkState(getManager(), InternalNodeContainerState.EXECUTED);
}
Also used : ExecutionMonitor(org.knime.core.node.ExecutionMonitor) WorkflowLoadResult(org.knime.core.node.workflow.WorkflowPersistor.WorkflowLoadResult) Test(org.junit.Test)

Example 12 with WorkflowLoadResult

use of org.knime.core.node.workflow.WorkflowPersistor.WorkflowLoadResult in project knime-core by knime.

the class BugAP3673_CredentialsQF_InheritFromWkf method testExecuteFlowThenChangeCredentials.

/**
 * Test credentials that are set after workflow has been loaded (mimics behavior on the server).
 */
@Test
public void testExecuteFlowThenChangeCredentials() throws Exception {
    // provides no valid credentials, first execution supposed to fail
    WorkflowLoadResult loadWorkflow = loadWorkflow(getDefaultWorkflowDirectory(), new ExecutionMonitor());
    WorkflowManager wfm = loadWorkflow.getWorkflowManager();
    setManager(wfm);
    executeAllAndWait();
    checkState(getManager(), InternalNodeContainerState.IDLE);
    wfm.resetAndConfigureAll();
    wfm.updateCredentials(new Credentials("credentials-input", "some-fixed-username", "some-fixed-password"));
    executeAllAndWait();
    checkState(getManager(), InternalNodeContainerState.EXECUTED);
}
Also used : ExecutionMonitor(org.knime.core.node.ExecutionMonitor) WorkflowLoadResult(org.knime.core.node.workflow.WorkflowPersistor.WorkflowLoadResult) Test(org.junit.Test)

Example 13 with WorkflowLoadResult

use of org.knime.core.node.workflow.WorkflowPersistor.WorkflowLoadResult in project knime-core by knime.

the class BugAP5712_CloseWhileStreaming method testSaveLoadWhileExecuting.

@Test(timeout = 3000L)
public void testSaveLoadWhileExecuting() throws Exception {
    WorkflowManager manager = getManager();
    ReentrantLock execLock = BlockingRepository.get(LOCK_ID);
    execLock.lock();
    try {
        manager.executeAll();
        final NodeContainer streamNC = findNodeContainer(m_streamSubnode_5);
        waitWhile(streamNC, new Hold() {

            @Override
            protected boolean shouldHold() {
                return !streamNC.getInternalState().isExecutingRemotely();
            }
        });
        checkState(m_streamSubnode_5, EXECUTINGREMOTELY);
        checkState(m_tableView_4, UNCONFIGURED_MARKEDFOREXEC);
        manager.save(m_workflowDir, new ExecutionMonitor(), true);
        assertTrue(manager.canCancelAll());
        getLogger().error("Canceling...");
        manager.getParent().cancelExecution(manager);
        waitWhileInExecution();
    } finally {
        execLock.unlock();
    }
    closeWorkflow();
    assertNull(getManager());
    WorkflowLoadResult loadResult = initWorkflowFromTemp();
    assertFalse("should not have errors", loadResult.hasErrors());
    // when saving the workflow while executing we can't determine the correct 'safe' state of all nodes
    // in the wrapped metanode - most of them are configured but downstream of the transpose they are idle;
    // the framework saves them as IDLE and the load-routines will update the state ... and warn.
    assertTrue("should have warnings on state - unpredictable during #save", loadResult.hasWarningEntries());
    manager = getManager();
}
Also used : ReentrantLock(java.util.concurrent.locks.ReentrantLock) ExecutionMonitor(org.knime.core.node.ExecutionMonitor) WorkflowLoadResult(org.knime.core.node.workflow.WorkflowPersistor.WorkflowLoadResult) Test(org.junit.Test)

Example 14 with WorkflowLoadResult

use of org.knime.core.node.workflow.WorkflowPersistor.WorkflowLoadResult in project knime-core by knime.

the class BugAP6262_FileStoresInPortObjectCell method initWorkflowFromTemp.

private WorkflowLoadResult initWorkflowFromTemp() throws Exception {
    // will save the workflow in one of the test ...don't write SVN folder
    WorkflowLoadResult loadResult = loadWorkflow(m_workflowDir, new ExecutionMonitor());
    setManager(loadResult.getWorkflowManager());
    NodeID baseID = getManager().getID();
    m_predictorLoopStart_11 = new NodeID(baseID, 11);
    return loadResult;
}
Also used : ExecutionMonitor(org.knime.core.node.ExecutionMonitor) WorkflowLoadResult(org.knime.core.node.workflow.WorkflowPersistor.WorkflowLoadResult)

Example 15 with WorkflowLoadResult

use of org.knime.core.node.workflow.WorkflowPersistor.WorkflowLoadResult in project knime-core by knime.

the class BugAP7010_DataLoadedWithSandboxedNodeCreator method initWorkflowFromTemp.

private WorkflowLoadResult initWorkflowFromTemp() throws Exception {
    WorkflowLoadResult loadResult = loadWorkflow(m_workflowDir, new ExecutionMonitor());
    setManager(loadResult.getWorkflowManager());
    NodeID baseID = getManager().getID();
    m_tableCreator = new NodeID(baseID, 1);
    m_rowSplitter = new NodeID(baseID, 2);
    return loadResult;
}
Also used : ExecutionMonitor(org.knime.core.node.ExecutionMonitor) WorkflowLoadResult(org.knime.core.node.workflow.WorkflowPersistor.WorkflowLoadResult)

Aggregations

WorkflowLoadResult (org.knime.core.node.workflow.WorkflowPersistor.WorkflowLoadResult)17 ExecutionMonitor (org.knime.core.node.ExecutionMonitor)15 File (java.io.File)6 Test (org.junit.Test)6 IOException (java.io.IOException)4 InvalidSettingsException (org.knime.core.node.InvalidSettingsException)2 LoadVersion (org.knime.core.node.workflow.FileWorkflowPersistor.LoadVersion)2 Version (org.knime.core.util.Version)2 FileNotFoundException (java.io.FileNotFoundException)1 ReentrantLock (java.util.concurrent.locks.ReentrantLock)1 AssertionFailedError (junit.framework.AssertionFailedError)1 IStatus (org.eclipse.core.runtime.IStatus)1 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)1 Display (org.eclipse.swt.widgets.Display)1 BeforeClass (org.junit.BeforeClass)1 ReferencedFile (org.knime.core.internal.ReferencedFile)1 CanceledExecutionException (org.knime.core.node.CanceledExecutionException)1 NodeID (org.knime.core.node.workflow.NodeID)1 UnsupportedWorkflowVersionException (org.knime.core.node.workflow.UnsupportedWorkflowVersionException)1 WorkflowContext (org.knime.core.node.workflow.WorkflowContext)1