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);
}
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);
}
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);
}
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;
}
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);
}
Aggregations