Search in sources :

Example 6 with DataSet

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

the class ProjectMetricsScreenTest method testYearsSelector.

@Test
public void testYearsSelector() {
    Displayer displayer = presenter.getCommitsByYearDisplayer();
    DataSet dataSet = displayer.getDataSetHandler().getLastDataSet();
    assertDataSetValues(dataSet, new String[][] { { "2019", "4.00" } }, 0);
}
Also used : DataSet(org.dashbuilder.dataset.DataSet) RawDataSet(org.dashbuilder.dataset.RawDataSet) Displayer(org.dashbuilder.displayer.client.Displayer) AbstractDisplayer(org.dashbuilder.displayer.client.AbstractDisplayer) AbstractDisplayerTest(org.dashbuilder.displayer.client.AbstractDisplayerTest) Test(org.junit.Test)

Example 7 with DataSet

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

the class ProjectMetricsScreenTest method testDayOfWeekSelector.

@Test
public void testDayOfWeekSelector() {
    Displayer displayer = presenter.getCommitsByDayOfWeekDisplayer();
    DataSet dataSet = displayer.getDataSetHandler().getLastDataSet();
    assertDataSetValues(dataSet, new String[][] { { "1", "0.00" }, { "2", "0.00" }, { "3", "2.00" }, { "4", "1.00" }, { "5", "0.00" }, { "6", "0.00" }, { "7", "1.00" } }, 0);
}
Also used : DataSet(org.dashbuilder.dataset.DataSet) RawDataSet(org.dashbuilder.dataset.RawDataSet) Displayer(org.dashbuilder.displayer.client.Displayer) AbstractDisplayer(org.dashbuilder.displayer.client.AbstractDisplayer) AbstractDisplayerTest(org.dashbuilder.displayer.client.AbstractDisplayerTest) Test(org.junit.Test)

Example 8 with DataSet

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

the class ProjectMetricsScreenTest method testCommitsOverTime.

@Test
public void testCommitsOverTime() {
    Displayer displayer = presenter.getCommitsOverTimeDisplayer();
    DataSet dataSet = displayer.getDataSetHandler().getLastDataSet();
    assertDataSetValues(dataSet, new String[][] { { "2019-01", "1.00" }, { "2019-02", "0.00" }, { "2019-03", "1.00" }, { "2019-04", "1.00" }, { "2019-05", "0.00" }, { "2019-06", "1.00" } }, 0);
}
Also used : DataSet(org.dashbuilder.dataset.DataSet) RawDataSet(org.dashbuilder.dataset.RawDataSet) Displayer(org.dashbuilder.displayer.client.Displayer) AbstractDisplayer(org.dashbuilder.displayer.client.AbstractDisplayer) AbstractDisplayerTest(org.dashbuilder.displayer.client.AbstractDisplayerTest) Test(org.junit.Test)

Example 9 with DataSet

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

the class ContributorsManager method buildDataSet.

@Override
public DataSet buildDataSet(Map<String, String> params) {
    final DataSetBuilder dsBuilder = DataSetFactory.newDataSetBuilder();
    for (final DataColumnDef columnDef : dataSetdef.getColumns()) {
        dsBuilder.column(columnDef.getId(), columnDef.getColumnType());
    }
    final Collection<OrganizationalUnit> orgUnitList = organizationalUnitService.getOrganizationalUnits();
    for (final OrganizationalUnit orgUnit : orgUnitList) {
        final String org = orgUnit.getName();
        final Collection<WorkspaceProject> projects = projectService.getAllWorkspaceProjects(orgUnit);
        if (projects.isEmpty()) {
            // org
            dsBuilder.row(// org
            org, // repo
            null, // project
            null, // author
            null, // message
            "Empty organizational unit", // date
            null);
        } else {
            for (final WorkspaceProject project : projects) {
                final String repoAlias = project.getRepository().getAlias();
                final String projectName = project.getName();
                org.uberfire.backend.vfs.Path rootPath = project.getRootPath();
                final Path projectRoot = Paths.convert(rootPath);
                final List<VersionRecord> recordList = recordService.loadVersionRecords(projectRoot);
                if (recordList.isEmpty()) {
                    // org
                    dsBuilder.row(// org
                    org, // repo
                    repoAlias, // project
                    null, // author
                    null, // mesage
                    "Empty project", // date
                    null);
                } else {
                    for (VersionRecord record : recordList) {
                        String alias = record.author();
                        String author = authorMappings.getProperty(alias);
                        author = author == null ? alias : author;
                        String msg = record.comment();
                        Date date = record.date();
                        dsBuilder.row(org, repoAlias, projectName, author, msg, date);
                    }
                }
            }
        }
    }
    DataSet dataSet = dsBuilder.buildDataSet();
    dataSet.setUUID(GIT_CONTRIB);
    return dataSet;
}
Also used : Path(org.uberfire.java.nio.file.Path) OrganizationalUnit(org.guvnor.structure.organizationalunit.OrganizationalUnit) DataSet(org.dashbuilder.dataset.DataSet) WorkspaceProject(org.guvnor.common.services.project.model.WorkspaceProject) DataSetBuilder(org.dashbuilder.dataset.DataSetBuilder) Date(java.util.Date) VersionRecord(org.uberfire.java.nio.base.version.VersionRecord) DataColumnDef(org.dashbuilder.dataset.def.DataColumnDef)

Example 10 with DataSet

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

the class ContributorsManagerTest method testBuildDataSet.

@Test
public void testBuildDataSet() throws Exception {
    DataSet dataSet = contributorsManager.buildDataSet(null);
    assertEquals(68, dataSet.getRowCount());
    assertEquals(6, dataSet.getColumns().size());
    DataColumn column = dataSet.getColumns().get(0);
    assertEquals(ColumnType.LABEL, column.getColumnType());
    assertEquals(COLUMN_ORG, column.getId());
    column = dataSet.getColumns().get(1);
    assertEquals(ColumnType.LABEL, column.getColumnType());
    assertEquals(COLUMN_REPO, column.getId());
    column = dataSet.getColumns().get(2);
    assertEquals(ColumnType.LABEL, column.getColumnType());
    assertEquals(COLUMN_PROJECT, column.getId());
    column = dataSet.getColumns().get(3);
    assertEquals(ColumnType.LABEL, column.getColumnType());
    assertEquals(COLUMN_AUTHOR, column.getId());
    column = dataSet.getColumns().get(4);
    assertEquals(ColumnType.TEXT, column.getColumnType());
    assertEquals(COLUMN_MSG, column.getId());
    column = dataSet.getColumns().get(5);
    assertEquals(ColumnType.DATE, column.getColumnType());
    assertEquals(COLUMN_DATE, column.getId());
    DataSetMetadata metadata = dataSet.getMetadata();
    assertNotNull(metadata);
}
Also used : DataSet(org.dashbuilder.dataset.DataSet) DataColumn(org.dashbuilder.dataset.DataColumn) DataSetMetadata(org.dashbuilder.dataset.DataSetMetadata) Test(org.junit.Test)

Aggregations

DataSet (org.dashbuilder.dataset.DataSet)41 Test (org.junit.Test)27 AbstractDisplayerTest (org.dashbuilder.displayer.client.AbstractDisplayerTest)25 AbstractDisplayer (org.dashbuilder.displayer.client.AbstractDisplayer)17 Displayer (org.dashbuilder.displayer.client.Displayer)13 ArrayList (java.util.ArrayList)12 RawDataSet (org.dashbuilder.dataset.RawDataSet)11 HashMap (java.util.HashMap)6 SelectorDisplayer (org.dashbuilder.renderer.client.selector.SelectorDisplayer)6 DataColumn (org.dashbuilder.dataset.DataColumn)3 DataSetLookup (org.dashbuilder.dataset.DataSetLookup)2 ProcessInstanceWithVarsDesc (org.jbpm.services.api.model.ProcessInstanceWithVarsDesc)2 UserTaskInstanceWithPotOwnerDesc (org.jbpm.services.api.model.UserTaskInstanceWithPotOwnerDesc)2 UserTaskInstanceWithVarsDesc (org.jbpm.services.api.model.UserTaskInstanceWithVarsDesc)2 Date (java.util.Date)1 List (java.util.List)1 DataSetBuilder (org.dashbuilder.dataset.DataSetBuilder)1 DataSetMetadata (org.dashbuilder.dataset.DataSetMetadata)1 DataColumnDef (org.dashbuilder.dataset.def.DataColumnDef)1 DataSetDef (org.dashbuilder.dataset.def.DataSetDef)1