Search in sources :

Example 1 with LargeBlobCell

use of org.knime.testing.data.blob.LargeBlobCell in project knime-core by knime.

the class BlobsInSetCellWorkflowTest method createBDT.

/**
 * {@inheritDoc}
 */
@Override
protected BufferedDataTable createBDT(final ExecutionContext exec) {
    DataType t = ListCell.getCollectionType(DataType.getType(DataCell.class));
    BufferedDataContainer c = exec.createDataContainer(new DataTableSpec(new DataColumnSpecCreator("Sequence", t).createSpec()));
    for (int i = 0; i < ROW_COUNT; i++) {
        String s = "someName_" + i;
        // every other a ordinary string cell
        Collection<DataCell> cells = new ArrayList<DataCell>();
        for (int j = 0; j < LIST_SIZE * 2; j++) {
            String val = "Row_" + i + "; Cell index " + j;
            if (j % 2 == 0) {
                cells.add(new LargeBlobCell(val, LargeBlobCell.SIZE_OF_CELL));
            } else {
                cells.add(new StringCell(val));
            }
        }
        ListCell cell = CollectionCellFactory.createListCell(cells);
        c.addRowToTable(new DefaultRow(s, cell));
    }
    c.close();
    return c.getTable();
}
Also used : DataTableSpec(org.knime.core.data.DataTableSpec) DataColumnSpecCreator(org.knime.core.data.DataColumnSpecCreator) BufferedDataContainer(org.knime.core.node.BufferedDataContainer) ListCell(org.knime.core.data.collection.ListCell) ArrayList(java.util.ArrayList) LargeBlobCell(org.knime.testing.data.blob.LargeBlobCell) StringCell(org.knime.core.data.def.StringCell) DataType(org.knime.core.data.DataType) DataCell(org.knime.core.data.DataCell) DefaultRow(org.knime.core.data.def.DefaultRow)

Example 2 with LargeBlobCell

use of org.knime.testing.data.blob.LargeBlobCell in project knime-core by knime.

the class BlobReferenceInWorkflowTest method createBDT.

/**
 * {@inheritDoc}
 */
@Override
public BufferedDataTable createBDT(final ExecutionContext exec) {
    BufferedDataContainer c = exec.createDataContainer(new DataTableSpec(new DataColumnSpecCreator("Blobs", LargeBlobCell.TYPE).createSpec()));
    for (int i = 0; i < BLOB_COUNT; i++) {
        String s = "someName_" + i;
        c.addRowToTable(new DefaultRow(s, new LargeBlobCell(s, LargeBlobCell.SIZE_OF_CELL)));
    }
    c.close();
    return c.getTable();
}
Also used : DataTableSpec(org.knime.core.data.DataTableSpec) DataColumnSpecCreator(org.knime.core.data.DataColumnSpecCreator) BufferedDataContainer(org.knime.core.node.BufferedDataContainer) DefaultRow(org.knime.core.data.def.DefaultRow) LargeBlobCell(org.knime.testing.data.blob.LargeBlobCell)

Example 3 with LargeBlobCell

use of org.knime.testing.data.blob.LargeBlobCell in project knime-core by knime.

the class BlobsInSetCellPartiallySingletonsWorkflowTest method createBDT.

/**
 * {@inheritDoc}
 */
@Override
protected BufferedDataTable createBDT(final ExecutionContext exec) {
    DataType t = ListCell.getCollectionType(DataType.getType(DataCell.class));
    BufferedDataContainer c = exec.createDataContainer(new DataTableSpec(new DataColumnSpecCreator("Sequence", t).createSpec()));
    LargeBlobCell singleton = new LargeBlobCell("singleton", LargeBlobCell.SIZE_OF_CELL);
    for (int i = 0; i < ROW_COUNT; i++) {
        String s = "someName_" + i;
        // every other a ordinary string cell
        Collection<DataCell> cells = new ArrayList<DataCell>();
        for (int j = 0; j < 4; j++) {
            String val = "Row_" + i + "; Cell index " + j;
            switch(j) {
                case 0:
                    cells.add(singleton);
                    break;
                case 1:
                case 3:
                    cells.add(new StringCell(val));
                    break;
                case 2:
                    cells.add(new LargeBlobCell(val, LargeBlobCell.SIZE_OF_CELL));
                    break;
                default:
                    fail("invalid index");
            }
        }
        ListCell cell = CollectionCellFactory.createListCell(cells);
        c.addRowToTable(new DefaultRow(s, cell));
    }
    c.close();
    return c.getTable();
}
Also used : DataTableSpec(org.knime.core.data.DataTableSpec) DataColumnSpecCreator(org.knime.core.data.DataColumnSpecCreator) BufferedDataContainer(org.knime.core.node.BufferedDataContainer) ListCell(org.knime.core.data.collection.ListCell) ArrayList(java.util.ArrayList) LargeBlobCell(org.knime.testing.data.blob.LargeBlobCell) StringCell(org.knime.core.data.def.StringCell) DataType(org.knime.core.data.DataType) DataCell(org.knime.core.data.DataCell) DefaultRow(org.knime.core.data.def.DefaultRow)

Example 4 with LargeBlobCell

use of org.knime.testing.data.blob.LargeBlobCell in project knime-core by knime.

the class OneBlobManyTimesInTableWorkflowTest method createBDT.

/**
 * {@inheritDoc}
 */
@Override
public BufferedDataTable createBDT(final ExecutionContext exec) {
    BufferedDataContainer c = exec.createDataContainer(new DataTableSpec(new DataColumnSpecCreator("Blobs", LargeBlobCell.TYPE).createSpec()));
    LargeBlobCell cell = new LargeBlobCell("This is a big cell", LargeBlobCell.SIZE_OF_CELL);
    for (int i = 0; i < ROW_COUNT; i++) {
        String s = "someName_" + i;
        c.addRowToTable(new DefaultRow(s, cell));
    }
    c.close();
    return c.getTable();
}
Also used : DataTableSpec(org.knime.core.data.DataTableSpec) DataColumnSpecCreator(org.knime.core.data.DataColumnSpecCreator) BufferedDataContainer(org.knime.core.node.BufferedDataContainer) LargeBlobCell(org.knime.testing.data.blob.LargeBlobCell) DefaultRow(org.knime.core.data.def.DefaultRow)

Aggregations

DataColumnSpecCreator (org.knime.core.data.DataColumnSpecCreator)4 DataTableSpec (org.knime.core.data.DataTableSpec)4 DefaultRow (org.knime.core.data.def.DefaultRow)4 BufferedDataContainer (org.knime.core.node.BufferedDataContainer)4 LargeBlobCell (org.knime.testing.data.blob.LargeBlobCell)4 ArrayList (java.util.ArrayList)2 DataCell (org.knime.core.data.DataCell)2 DataType (org.knime.core.data.DataType)2 ListCell (org.knime.core.data.collection.ListCell)2 StringCell (org.knime.core.data.def.StringCell)2