use of org.knime.core.data.convert.map.ProducerRegistry in project knime-core by knime.
the class MappingFrameworkTest method availableProductionPathsTest.
/**
* Test getting all available production paths from {@link ProducerRegistry}
*/
@Test
public void availableProductionPathsTest() {
final ProducerRegistry<String, H2OSource> reg = MappingFramework.forSourceType(H2OSource.class);
final JavaToDataCellConverterRegistry convReg = JavaToDataCellConverterRegistry.getInstance();
assertTrue("Expected to be empty but is: " + reg.getAvailableProductionPaths().stream().map(pp -> Objects.toString(pp, "<null>")).collect(Collectors.joining("\n", "\"", "\"")), reg.getAvailableProductionPaths().isEmpty());
reg.register(intProducer);
final List<ProductionPath> paths = reg.getAvailableProductionPaths();
assertCollectionEquals(new Object[] { new ProductionPath(intProducer, convReg.getConverterFactories(Integer.class, IntCell.TYPE).stream().findFirst().get()), new ProductionPath(intProducer, convReg.getConverterFactories(Integer.class, LongCell.TYPE).stream().findFirst().get()), new ProductionPath(intProducer, convReg.getConverterFactories(Integer.class, DoubleCell.TYPE).stream().findFirst().get()) }, paths);
}
Aggregations