Search in sources :

Example 1 with FactoryPlaceholder

use of org.knime.core.data.convert.util.SerializeUtil.FactoryPlaceholder in project knime-core by knime.

the class SerializeUtilTest method testPlaceholders.

@Test
public void testPlaceholders() throws InvalidSettingsException {
    final NodeSettings testSettings = new NodeSettings(getClass().getName());
    final DefinitelyNotRegisteredFactory theMissingFactory = new DefinitelyNotRegisteredFactory();
    SerializeUtil.storeConverterFactory(theMissingFactory, testSettings, "missing-factory");
    Optional<DataCellToJavaConverterFactory<?, ?>> missingFactory = SerializeUtil.loadDataCellToJavaConverterFactory(testSettings, "missing-factory");
    assertFalse(missingFactory.isPresent());
    final FactoryPlaceholder placeholder = SerializeUtil.getPlaceholder(testSettings, "missing-factory");
    assertEquals(theMissingFactory.getName(), placeholder.getName());
    assertEquals(theMissingFactory.getSourceType().getName(), placeholder.getSourceTypeName());
    assertEquals(theMissingFactory.getDestinationType().getName(), placeholder.getDestinationTypeName());
    assertEquals(theMissingFactory.getIdentifier(), placeholder.getIdentifier());
}
Also used : NodeSettings(org.knime.core.node.NodeSettings) FactoryPlaceholder(org.knime.core.data.convert.util.SerializeUtil.FactoryPlaceholder) SimpleDataCellToJavaConverterFactory(org.knime.core.data.convert.java.SimpleDataCellToJavaConverterFactory) DataCellToJavaConverterFactory(org.knime.core.data.convert.java.DataCellToJavaConverterFactory) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 DataCellToJavaConverterFactory (org.knime.core.data.convert.java.DataCellToJavaConverterFactory)1 SimpleDataCellToJavaConverterFactory (org.knime.core.data.convert.java.SimpleDataCellToJavaConverterFactory)1 FactoryPlaceholder (org.knime.core.data.convert.util.SerializeUtil.FactoryPlaceholder)1 NodeSettings (org.knime.core.node.NodeSettings)1