Search in sources :

Example 1 with DataTypeRegistry

use of org.knime.core.data.DataTypeRegistry in project knime-core by knime.

the class ValueSchemaTest method testSchemaSaveLoadRegisteredDataTypes.

/**
 * Test saving and loading a schema with all registered DataTypes
 */
@Test
public void testSchemaSaveLoadRegisteredDataTypes() {
    final DataTypeRegistry registry = DataTypeRegistry.getInstance();
    final Collection<DataType> dataTypes = registry.availableDataTypes();
    for (final DataType type : dataTypes) {
        final Optional<Class<? extends ValueFactory<?, ?>>> optFactoryClass = registry.getValueFactoryFor(type);
        final Class<? extends ValueFactory<?, ?>> factoryClass = optFactoryClass.isPresent() ? optFactoryClass.get() : DictEncodedDataCellValueFactory.class;
        try {
            testSchemaSaveLoadDataType(type, factoryClass);
        } catch (final Exception e) {
            // Add information about the DataType which failed.
            throw new AssertionError("The ValueFactory could not be saved and loaded for the DataType '" + type + "' with the cell class '" + type.getCellClass() + "'.", e);
        }
    }
}
Also used : DataTypeRegistry(org.knime.core.data.DataTypeRegistry) DataType(org.knime.core.data.DataType) StringSparseListValueFactory(org.knime.core.data.v2.value.StringSparseListValueFactory) BooleanSetValueFactory(org.knime.core.data.v2.value.BooleanSetValueFactory) LongListValueFactory(org.knime.core.data.v2.value.LongListValueFactory) IntSetValueFactory(org.knime.core.data.v2.value.IntSetValueFactory) BooleanListValueFactory(org.knime.core.data.v2.value.BooleanListValueFactory) StringSetValueFactory(org.knime.core.data.v2.value.StringSetValueFactory) IntSparseListValueFactory(org.knime.core.data.v2.value.IntSparseListValueFactory) DoubleListValueFactory(org.knime.core.data.v2.value.DoubleListValueFactory) StringListValueFactory(org.knime.core.data.v2.value.StringListValueFactory) DoubleSparseListValueFactory(org.knime.core.data.v2.value.DoubleSparseListValueFactory) BooleanSparseListValueFactory(org.knime.core.data.v2.value.BooleanSparseListValueFactory) DoubleSetValueFactory(org.knime.core.data.v2.value.DoubleSetValueFactory) LongSparseListValueFactory(org.knime.core.data.v2.value.LongSparseListValueFactory) LongSetValueFactory(org.knime.core.data.v2.value.LongSetValueFactory) IntListValueFactory(org.knime.core.data.v2.value.IntListValueFactory) DictEncodedDataCellValueFactory(org.knime.core.data.v2.value.cell.DictEncodedDataCellValueFactory) InvalidSettingsException(org.knime.core.node.InvalidSettingsException) IOException(java.io.IOException) Test(org.junit.Test)

Aggregations

IOException (java.io.IOException)1 Test (org.junit.Test)1 DataType (org.knime.core.data.DataType)1 DataTypeRegistry (org.knime.core.data.DataTypeRegistry)1 BooleanListValueFactory (org.knime.core.data.v2.value.BooleanListValueFactory)1 BooleanSetValueFactory (org.knime.core.data.v2.value.BooleanSetValueFactory)1 BooleanSparseListValueFactory (org.knime.core.data.v2.value.BooleanSparseListValueFactory)1 DoubleListValueFactory (org.knime.core.data.v2.value.DoubleListValueFactory)1 DoubleSetValueFactory (org.knime.core.data.v2.value.DoubleSetValueFactory)1 DoubleSparseListValueFactory (org.knime.core.data.v2.value.DoubleSparseListValueFactory)1 IntListValueFactory (org.knime.core.data.v2.value.IntListValueFactory)1 IntSetValueFactory (org.knime.core.data.v2.value.IntSetValueFactory)1 IntSparseListValueFactory (org.knime.core.data.v2.value.IntSparseListValueFactory)1 LongListValueFactory (org.knime.core.data.v2.value.LongListValueFactory)1 LongSetValueFactory (org.knime.core.data.v2.value.LongSetValueFactory)1 LongSparseListValueFactory (org.knime.core.data.v2.value.LongSparseListValueFactory)1 StringListValueFactory (org.knime.core.data.v2.value.StringListValueFactory)1 StringSetValueFactory (org.knime.core.data.v2.value.StringSetValueFactory)1 StringSparseListValueFactory (org.knime.core.data.v2.value.StringSparseListValueFactory)1 DictEncodedDataCellValueFactory (org.knime.core.data.v2.value.cell.DictEncodedDataCellValueFactory)1