use of com.genericworkflownodes.knime.config.reader.CTDConfigurationReader in project GenericKnimeNodes by genericworkflownodes.
the class CTDConfigurationWriterTest method testWrite.
@Test
public void testWrite() throws Exception {
CTDConfigurationReader reader = new CTDConfigurationReader();
INodeConfiguration config = reader.read(TestDataSource.class.getResourceAsStream("FileFilter.ctd"));
// write to test file
File tmp = File.createTempFile("testing_", ".ini");
tmp.deleteOnExit();
BufferedWriter buffered_file_writer = new BufferedWriter(new FileWriter(tmp));
CTDConfigurationWriter file_writer = new CTDConfigurationWriter(buffered_file_writer);
file_writer.write(config);
config = reader.read(new FileInputStream(tmp));
StringParameter mz = (StringParameter) config.getParameter("FileFilter.1.mz");
assertEquals("m/z range to extract (applies to ALL ms levels!)", mz.getDescription());
assertEquals(":", mz.getValue());
assertEquals("mz", mz.getKey());
IntegerListParameter levels = (IntegerListParameter) config.getParameter("FileFilter.1.peak_options.level");
assertNotNull(levels);
assertEquals("MS levels to extract", levels.getDescription());
assertEquals(3, levels.getValue().size());
assertEquals(1, levels.getValue().get(0).intValue());
assertEquals(2, levels.getValue().get(1).intValue());
assertEquals(3, levels.getValue().get(2).intValue());
assertEquals(false, levels.isAdvanced());
assertEquals(Integer.valueOf(1), levels.getLowerBound());
StringChoiceParameter int_precision = (StringChoiceParameter) config.getParameter("FileFilter.1.peak_options.int_precision");
assertEquals("32", int_precision.getValue());
assertEquals(3, int_precision.getAllowedValues().size());
BoolParameter no_progress = (BoolParameter) config.getParameter("FileFilter.1.no_progress");
assertEquals(false, no_progress.getValue());
assertEquals(true, no_progress.isAdvanced());
// Three inputs, one required, one optional with default, one optional without default
assertEquals(2, config.getInputPorts().size());
assertEquals("FileFilter.1.in", config.getInputPorts().get(0).getName());
}
use of com.genericworkflownodes.knime.config.reader.CTDConfigurationReader in project GenericKnimeNodes by genericworkflownodes.
the class DynamicGenericNodeSetFactory method getCategoryPath.
@Override
public String getCategoryPath(String id) {
String category;
File f = getPluginConfig().getBinaryManager().resolveToolDescriptorPath(m_idToFile.get(id));
try (InputStream cfgStream = new FileInputStream(f)) {
category = new CTDConfigurationReader().read(cfgStream).getCategory();
} catch (Exception e) {
logger.error("Could not read node category from CTD, using '/' instead.", e);
category = "";
}
return getCategoryPath() + "/" + category + "/" + getPluginConfig().getPluginVersion();
}
use of com.genericworkflownodes.knime.config.reader.CTDConfigurationReader in project GenericKnimeNodes by genericworkflownodes.
the class GenericToolWrapperTest method testCTDLoading.
@Test
public void testCTDLoading() throws Exception {
CTDConfigurationReader reader = new CTDConfigurationReader();
INodeConfiguration config = reader.read(TestDataSource.class.getResourceAsStream("test5.ctd"));
assertEquals(2, config.getCLI().getCLIElement().size());
CLIElement firstCLIElement = config.getCLI().getCLIElement().get(0);
assertEquals("-i", firstCLIElement.getOptionIdentifier());
assertEquals(false, firstCLIElement.isList());
assertEquals(false, firstCLIElement.isRequired());
assertEquals(1, firstCLIElement.getMapping().size());
assertEquals("blastall.i", firstCLIElement.getMapping().get(0).getReferenceName());
CLIElement secondCLIElement = config.getCLI().getCLIElement().get(1);
assertEquals("-d", secondCLIElement.getOptionIdentifier());
assertEquals(false, secondCLIElement.isList());
assertEquals(false, secondCLIElement.isRequired());
assertEquals(1, secondCLIElement.getMapping().size());
assertEquals("blastall.d", secondCLIElement.getMapping().get(0).getReferenceName());
}
Aggregations