use of org.knime.core.node.NodeAndBundleInformationPersistor in project knime-core by knime.
the class Bug5207_BundleVersionInWorkflow method testBundleVersionAfterReexecute.
@Test
public void testBundleVersionAfterReexecute() throws Exception {
reset(m_tableCreator1);
// table creator is executed and must have version as from execution time (which was faked but still...)
NativeNodeContainer tableCreatorNC = (NativeNodeContainer) getManager().getNodeContainer(m_tableCreator1);
NodeAndBundleInformationPersistor tableBundleInfo = tableCreatorNC.getNodeAndBundleInformation();
Bundle tableBundle = FrameworkUtil.getBundle(tableCreatorNC.getNodeModel().getClass());
assertEquals(tableBundle.getVersion().toString(), tableBundleInfo.getBundleVersion().get().toString());
assertEquals(tableBundle.getSymbolicName(), tableBundleInfo.getBundleSymbolicName().get());
executeAndWait(m_tableCreator1);
tableBundleInfo = tableCreatorNC.getNodeAndBundleInformation();
assertEquals(tableBundle.getVersion().toString(), tableBundleInfo.getBundleVersion().get().toString());
}
use of org.knime.core.node.NodeAndBundleInformationPersistor in project knime-core by knime.
the class FileNativeNodeContainerPersistor method preLoadNodeContainer.
/**
* {@inheritDoc}
*/
@Override
public void preLoadNodeContainer(final WorkflowPersistor parentPersistor, final NodeSettingsRO parentSettings, final LoadResult result) throws InvalidSettingsException, IOException {
super.preLoadNodeContainer(parentPersistor, parentSettings, result);
m_parentPersistor = parentPersistor;
NodeSettingsRO settings = getNodeSettings();
String error;
NodeAndBundleInformationPersistor nodeInfo;
try {
nodeInfo = loadNodeFactoryInfo(parentSettings, settings);
} catch (InvalidSettingsException e) {
setDirtyAfterLoad();
throw e;
}
NodeSettingsRO additionalFactorySettings;
try {
additionalFactorySettings = loadAdditionalFactorySettings(settings);
} catch (Exception e) {
error = "Unable to load additional factory settings for \"" + nodeInfo + "\"";
setDirtyAfterLoad();
throw new InvalidSettingsException(error, e);
}
NodeFactory<NodeModel> nodeFactory;
try {
nodeFactory = loadNodeFactory(nodeInfo.getFactoryClassNotNull());
} catch (Exception e) {
// setDirtyAfterLoad(); // don't set dirty, missing node placeholder will be used instead
throw new NodeFactoryUnknownException(nodeInfo, additionalFactorySettings, e);
}
try {
if (additionalFactorySettings != null) {
nodeFactory.loadAdditionalFactorySettings(additionalFactorySettings);
}
} catch (Exception e) {
error = "Unable to load additional factory settings into node factory (node \"" + nodeInfo + "\")";
getLogger().error(error);
throw new NodeFactoryUnknownException(error, nodeInfo, additionalFactorySettings, e);
}
m_nodeAndBundleInformation = nodeInfo;
m_node = new Node(nodeFactory, loadCreationConfig(settings, nodeFactory).orElse(null));
}
Aggregations