use of org.knime.core.node.NodeSettings in project knime-core by knime.
the class NameFilterConfigurationTest method testSomeMissing.
@Test
public void testSomeMissing() throws Exception {
NameFilterConfiguration conf = createConfiguration(EnforceOption.EnforceExclusion);
testSomeMissing(conf);
NodeSettings s = new NodeSettings("foobar");
conf.saveConfiguration(s);
conf = new NameFilterConfiguration("ignored");
conf.loadConfigurationInModel(s);
testSomeMissing(conf);
}
use of org.knime.core.node.NodeSettings in project knime-core by knime.
the class Bug4754_settingsValidationBeforeReset method testLoadBogusIntoNativeNode.
/**
* Try to load invalid settings into native node.
* @throws Exception ...
*/
@Test
public void testLoadBogusIntoNativeNode() throws Exception {
WorkflowManager manager = getManager();
checkStateOfMany(InternalNodeContainerState.CONFIGURED, m_tableCreator_1, m_rowSampler_4, m_tableChecker_5);
NodeSettings s = new NodeSettings("native-node");
manager.saveNodeSettings(m_rowSampler_4, s);
NodeSettings bogusSettings = new NodeSettings("native-node");
s.copyTo(bogusSettings);
breakFirstIntSettings(bogusSettings);
executeAllAndWait();
checkState(manager, InternalNodeContainerState.EXECUTED);
try {
manager.loadNodeSettings(m_rowSampler_4, bogusSettings);
fail("not expected to reach this point");
} catch (InvalidSettingsException ise) {
// expected
}
checkStateOfMany(InternalNodeContainerState.EXECUTED, m_tableCreator_1, m_rowSampler_4, m_tableChecker_5);
reset(m_tableCreator_1);
executeAllAndWait();
checkState(manager, InternalNodeContainerState.EXECUTED);
}
use of org.knime.core.node.NodeSettings in project knime-core by knime.
the class Bug4754_settingsValidationBeforeReset method testLoadBogusIntoMetaNode.
/**
**Disabled** as meta nodes do no reasonable settings validation yet. Currently no bug open to "fix" it as
* the old quickform nodes in conjunction with meta nodes are likely not be deprecated in the future.
* @throws Exception ...
*/
@Test
public void testLoadBogusIntoMetaNode() throws Exception {
Assume.assumeTrue("No settings validation in metanodes (yet)", false);
WorkflowManager manager = getManager();
checkStateOfMany(InternalNodeContainerState.CONFIGURED, m_tableCreator_1, m_metaNode_2, m_tableChecker_5);
NodeSettings s = new NodeSettings("meta-node");
manager.saveNodeSettings(m_metaNode_2, s);
NodeSettings bogusSettings = new NodeSettings("meta-node");
s.copyTo(bogusSettings);
executeAllAndWait();
checkState(manager, InternalNodeContainerState.EXECUTED);
try {
manager.loadNodeSettings(m_metaNode_2, bogusSettings);
fail("not expected to reach this point");
} catch (InvalidSettingsException ise) {
// expected
}
checkStateOfMany(InternalNodeContainerState.EXECUTED, m_tableCreator_1, m_metaNode_2, m_tableChecker_5);
reset(m_tableCreator_1);
executeAllAndWait();
checkState(manager, InternalNodeContainerState.EXECUTED);
}
use of org.knime.core.node.NodeSettings in project knime-core by knime.
the class AppendedRowsNodeModel method saveInternals.
/**
* {@inheritDoc}
*/
@Override
protected void saveInternals(final File nodeInternDir, final ExecutionMonitor exec) throws IOException, CanceledExecutionException {
if (m_enableHiliting) {
final NodeSettings config = new NodeSettings("hilite_mapping");
((DefaultHiLiteMapper) m_hiliteTranslator.getMapper()).save(config);
config.saveToXML(new GZIPOutputStream(new FileOutputStream(new File(nodeInternDir, "hilite_mapping.xml.gz"))));
}
}
use of org.knime.core.node.NodeSettings in project knime-core by knime.
the class BasisFunctionLearnerNodeModel method saveInternals.
/**
* {@inheritDoc}
*/
@Override
protected void saveInternals(final File internDir, final ExecutionMonitor exec) throws IOException, CanceledExecutionException {
assert (m_modelInfo != null);
// save model info
exec.checkCanceled();
exec.setProgress(0.1, "Saving model information");
File file = new File(internDir, MODEL_INFO_FILE_NAME);
m_modelInfo.saveToXML(new GZIPOutputStream(new BufferedOutputStream(new FileOutputStream(file))));
// save hilite mapping
exec.checkCanceled();
exec.setProgress(0.5, "Saving hilite mapping");
NodeSettings mapSettings = new NodeSettings(HILITE_MAPPING_FILE_NAME);
DefaultHiLiteMapper mapper = (DefaultHiLiteMapper) m_translator.getMapper();
mapper.save(mapSettings);
File mappingFile = new File(internDir, HILITE_MAPPING_FILE_NAME);
mapSettings.saveToXML(new GZIPOutputStream(new BufferedOutputStream(new FileOutputStream(mappingFile))));
}
Aggregations