Search in sources :

Example 1 with NodeView

use of org.knime.core.node.NodeView in project knime-core by knime.

the class Bug_5630_DelayedNodeViewNotification method testExecuteAndClose.

/**
 * Opens a view, executes the workflows, closes the workflow and checks whether view updates after closing the
 * workflow are filtered.
 *
 * @throws Exception if an error occurs
 */
@Test
public void testExecuteAndClose() throws Exception {
    NativeNodeContainer crossTabNode = (NativeNodeContainer) findNodeContainer(m_crossTab2);
    assertNotNull(crossTabNode);
    NodeView<?> view = (NodeView<?>) crossTabNode.getView(0);
    Node.invokeOpenView(view, "Test View");
    ViewUtils.invokeLaterInEDT(new Runnable() {

        @Override
        public void run() {
            synchronized (Bug_5630_DelayedNodeViewNotification.this) {
                try {
                    Bug_5630_DelayedNodeViewNotification.this.wait(10000);
                } catch (InterruptedException e) {
                }
            }
        }
    });
    executeAllAndWait();
    checkState(m_crossTab2, InternalNodeContainerState.EXECUTED);
    closeWorkflow();
    synchronized (this) {
        notifyAll();
    }
    ViewUtils.invokeAndWaitInEDT(new Runnable() {

        @Override
        public void run() {
        }
    });
    if (!m_logEvents.isEmpty()) {
        StringBuilder errors = new StringBuilder();
        for (LoggingEvent ev : m_logEvents) {
            errors.append(ev.getRenderedMessage()).append("; ");
        }
        errors.delete(errors.length() - 2, errors.length());
        throw new Exception("Unexpected exception while executing test: " + errors.toString());
    }
}
Also used : LoggingEvent(org.apache.log4j.spi.LoggingEvent) NodeView(org.knime.core.node.NodeView) Test(org.junit.Test)

Aggregations

LoggingEvent (org.apache.log4j.spi.LoggingEvent)1 Test (org.junit.Test)1 NodeView (org.knime.core.node.NodeView)1