Search in sources :

Example 6 with DataColumn

use of org.dashbuilder.dataset.DataColumn in project kie-wb-common by kiegroup.

the class DataManagementServiceImplTest method testGetDisplayerSettings.

@Test
public void testGetDisplayerSettings() {
    expectedDataSetUUID = DATASOURCE_UUID + SEPARATOR + SCHEMA + SEPARATOR + TABLE;
    DataSetLookup expectedLookup = new DataSetLookup();
    expectedLookup.setDataSetUUID(expectedDataSetUUID);
    DataSet expectedSet = mock(DataSet.class);
    List<DataColumn> dataColumns = new ArrayList<>();
    for (int i = 0; i < COLUMNS_COUNT; i++) {
        DataColumn dataColumn = mock(DataColumn.class);
        when(dataColumn.getId()).thenReturn(DATA_COLUMN + String.valueOf(i));
        dataColumns.add(dataColumn);
    }
    when(expectedSet.getColumns()).thenReturn(dataColumns);
    when(dataSetManager.lookupDataSet(expectedLookup)).thenReturn(expectedSet);
    DisplayerSettings settings = dataManagementService.getDisplayerSettings(DATASOURCE_UUID, SCHEMA, TABLE);
    verify(dataSetDefRegistry, times(1)).registerDataSetDef(dataSetDefCaptor.capture());
    verifyDataSetDef(dataSetDefCaptor.getValue());
    verifySettings(settings);
}
Also used : DataSet(org.dashbuilder.dataset.DataSet) DataColumn(org.dashbuilder.dataset.DataColumn) ArrayList(java.util.ArrayList) DisplayerSettings(org.dashbuilder.displayer.DisplayerSettings) DataSetLookup(org.dashbuilder.dataset.DataSetLookup) Test(org.junit.Test)

Example 7 with DataColumn

use of org.dashbuilder.dataset.DataColumn in project jbpm by kiegroup.

the class AbstractQueryMapper method getColumnDoubleValue.

protected Double getColumnDoubleValue(DataSet currentDataSet, String columnId, int index) {
    DataColumn column = currentDataSet.getColumnById(columnId);
    if (column == null) {
        return null;
    }
    Object value = column.getValues().get(index);
    return value != null ? ((Number) value).doubleValue() : null;
}
Also used : DataColumn(org.dashbuilder.dataset.DataColumn)

Aggregations

DataColumn (org.dashbuilder.dataset.DataColumn)7 DataSet (org.dashbuilder.dataset.DataSet)3 DataSetLookup (org.dashbuilder.dataset.DataSetLookup)2 Test (org.junit.Test)2 ArrayList (java.util.ArrayList)1 DataSetMetadata (org.dashbuilder.dataset.DataSetMetadata)1 DataSetDef (org.dashbuilder.dataset.def.DataSetDef)1 DisplayerSettings (org.dashbuilder.displayer.DisplayerSettings)1 TableDisplayerSettingsBuilder (org.dashbuilder.displayer.TableDisplayerSettingsBuilder)1 GenericPortableException (org.guvnor.common.services.shared.exceptions.GenericPortableException)1 DataSourceDeploymentInfo (org.kie.workbench.common.screens.datasource.management.model.DataSourceDeploymentInfo)1