diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2015-12-04 09:04:17 +0100 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2015-12-04 09:04:17 +0100 |
commit | 766e3444a280b1c2b3af41827e69faa1806b1ccf (patch) | |
tree | 123d056ae9bbd91da4526c885c67e5dc9344087b | |
parent | 8d60a119dc62a8b3351f0c063f8308811b223218 (diff) | |
parent | 25b322acdcfe294d50f015f6685901331f33333a (diff) | |
download | sonarqube-766e3444a280b1c2b3af41827e69faa1806b1ccf.tar.gz sonarqube-766e3444a280b1c2b3af41827e69faa1806b1ccf.zip |
Merge pull request #665 from SonarSource/feature/drop-dashboards
SONAR-7030 Drop most default hardcoded built-in dashboards
12 files changed, 58 insertions, 425 deletions
diff --git a/it/it-tests/src/test/java/it/Category1Suite.java b/it/it-tests/src/test/java/it/Category1Suite.java index 4608ad5b899..97489650fcc 100644 --- a/it/it-tests/src/test/java/it/Category1Suite.java +++ b/it/it-tests/src/test/java/it/Category1Suite.java @@ -52,7 +52,6 @@ import it.measureHistory.HistoryUiTest; import it.measureHistory.SincePreviousVersionHistoryTest; import it.measureHistory.SinceXDaysHistoryTest; import it.measureHistory.TimeMachineTest; -import it.measureHistory.TimeMachineUiTest; import it.projectAdministration.BulkDeletionTest; import it.projectAdministration.ProjectAdministrationTest; import it.projectOverview.ProjectOverviewTest; @@ -101,7 +100,6 @@ import static util.ItUtils.xooPlugin; SincePreviousVersionHistoryTest.class, SinceXDaysHistoryTest.class, TimeMachineTest.class, - TimeMachineUiTest.class, // action plan ActionPlanTest.class, ActionPlanUiTest.class diff --git a/it/it-tests/src/test/java/it/i18n/I18nTest.java b/it/it-tests/src/test/java/it/i18n/I18nTest.java index a75f17aa4a0..94f8c357064 100644 --- a/it/it-tests/src/test/java/it/i18n/I18nTest.java +++ b/it/it-tests/src/test/java/it/i18n/I18nTest.java @@ -26,6 +26,7 @@ import com.sonar.orchestrator.selenium.Selenese; import it.Category1Suite; import org.junit.Before; import org.junit.ClassRule; +import org.junit.Ignore; import org.junit.Test; import util.selenium.SeleneseTest; @@ -43,8 +44,11 @@ public class I18nTest { /** * TODO This test should use a fake widget that display a fake metric with decimals instead of using provided metric + * Ignored because there is not a good idea to force a display language by GET parameter + * The displayed language is based on browser/system locale */ @Test + @Ignore public void test_localization() { orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample"))); diff --git a/it/it-tests/src/test/java/it/measureHistory/TimeMachineUiTest.java b/it/it-tests/src/test/java/it/measureHistory/TimeMachineUiTest.java deleted file mode 100644 index eed6744f14a..00000000000 --- a/it/it-tests/src/test/java/it/measureHistory/TimeMachineUiTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package it.measureHistory; - -import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; -import com.sonar.orchestrator.selenium.Selenese; -import it.Category1Suite; -import org.junit.Before; -import org.junit.ClassRule; -import org.junit.Test; -import util.selenium.SeleneseTest; - -import static util.ItUtils.projectDir; - -public class TimeMachineUiTest { - - @ClassRule - public static Orchestrator orchestrator = Category1Suite.ORCHESTRATOR; - - @Before - public void setUp() throws Exception { - orchestrator.resetData(); - orchestrator.getServer().provisionProject("sample", "sample"); - orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "empty"); - } - - private static void analyzeProject(String date, String version) { - orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample")) - .setProperties("sonar.projectDate", date) - .setProperties("sonar.projectVersion", version) - ); - } - - // SONAR-3006 - @Test - public void test_time_machine_dashboard() { - analyzeProject("2012-09-01", "0.7"); - analyzeProject("2012-10-15", "0.8"); - analyzeProject("2012-11-30", "0.9"); - analyzeProject("2012-12-31", "1.0-SNAPSHOT"); - - new SeleneseTest(Selenese.builder().setHtmlTestsInClasspath("timemachine", - "/measureHistory/TimeMachineUiTest/should-display-timemachine-dashboard.html" - ).build()).runOn(orchestrator); - } - -} diff --git a/server/sonar-server/src/main/java/org/sonar/server/dashboard/template/ProjectDefaultDashboard.java b/server/sonar-server/src/main/java/org/sonar/server/dashboard/template/ProjectDefaultDashboard.java index 7f022ea37a2..3803fb2db63 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/dashboard/template/ProjectDefaultDashboard.java +++ b/server/sonar-server/src/main/java/org/sonar/server/dashboard/template/ProjectDefaultDashboard.java @@ -19,9 +19,13 @@ */ package org.sonar.server.dashboard.template; +import com.google.common.base.Preconditions; import org.sonar.api.web.Dashboard; import org.sonar.api.web.DashboardLayout; import org.sonar.api.web.DashboardTemplate; +import org.sonar.db.issue.IssueFilterDao; +import org.sonar.db.issue.IssueFilterDto; +import org.sonar.server.dashboard.widget.ProjectIssueFilterWidget; /** * Default dashboard @@ -30,6 +34,12 @@ import org.sonar.api.web.DashboardTemplate; */ public final class ProjectDefaultDashboard extends DashboardTemplate { + private final IssueFilterDao issueFilterDao; + + public ProjectDefaultDashboard(IssueFilterDao issueFilterDao) { + this.issueFilterDao = issueFilterDao; + } + @Override public String getName() { return "Dashboard"; @@ -45,18 +55,22 @@ public final class ProjectDefaultDashboard extends DashboardTemplate { } private void addFirstColumn(Dashboard dashboard) { - dashboard.addWidget("size", 1); - dashboard.addWidget("duplications", 1); - dashboard.addWidget("complexity", 1); - dashboard.addWidget("events", 1); - dashboard.addWidget("description", 1); + dashboard.addWidget("technical_debt_pyramid", 1); } private void addSecondColumn(Dashboard dashboard) { - dashboard.addWidget("debt_overview", 2); - dashboard.addWidget("rules", 2); - dashboard.addWidget("alerts", 2); - dashboard.addWidget("code_coverage", 2); + IssueFilterDto unresolvedIssues = getIssueFilterByName("Unresolved Issues"); + + dashboard.addWidget(ProjectIssueFilterWidget.ID, 2) + .setProperty(ProjectIssueFilterWidget.FILTER_PROPERTY, Long.toString(unresolvedIssues.getId())) + .setProperty(ProjectIssueFilterWidget.DISTRIBUTION_AXIS_PROPERTY, "severities") + .setProperty(ProjectIssueFilterWidget.DISPLAY_MODE, "debt"); + } + + private IssueFilterDto getIssueFilterByName(String name) { + IssueFilterDto filter = issueFilterDao.selectProvidedFilterByName(name); + Preconditions.checkState(filter != null, String.format("Could not find a provided issue filter with name '%s'", name)); + return filter; } } diff --git a/server/sonar-server/src/main/java/org/sonar/server/dashboard/template/ProjectIssuesDashboard.java b/server/sonar-server/src/main/java/org/sonar/server/dashboard/template/ProjectIssuesDashboard.java deleted file mode 100644 index 7474844bb75..00000000000 --- a/server/sonar-server/src/main/java/org/sonar/server/dashboard/template/ProjectIssuesDashboard.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonar.server.dashboard.template; - -import com.google.common.base.Preconditions; -import org.sonar.api.web.Dashboard; -import org.sonar.api.web.DashboardLayout; -import org.sonar.api.web.DashboardTemplate; -import org.sonar.db.issue.IssueFilterDao; -import org.sonar.db.issue.IssueFilterDto; -import org.sonar.server.dashboard.widget.ProjectIssueFilterWidget; - -/** - * Issues dashboard for Sonar - * - * @since 3.6 - */ -public final class ProjectIssuesDashboard extends DashboardTemplate { - - private final IssueFilterDao issueFilterDao; - - public ProjectIssuesDashboard(IssueFilterDao issueFilterDao) { - this.issueFilterDao = issueFilterDao; - } - - @Override - public String getName() { - return "Issues"; - } - - @Override - public Dashboard createDashboard() { - Dashboard dashboard = Dashboard.create(); - dashboard.setLayout(DashboardLayout.TWO_COLUMNS); - - IssueFilterDto unresolvedIssues = getIssueFilterByName("Unresolved Issues"); - IssueFilterDto hiddenDebt = getIssueFilterByName("False Positive and Won't Fix Issues"); - IssueFilterDto myUnresolvedIssues = getIssueFilterByName("My Unresolved Issues"); - - addFirstColumn(dashboard, unresolvedIssues); - addSecondColumn(dashboard, unresolvedIssues, hiddenDebt, myUnresolvedIssues); - return dashboard; - } - - private IssueFilterDto getIssueFilterByName(String name) { - IssueFilterDto filter = issueFilterDao.selectProvidedFilterByName(name); - Preconditions.checkState(filter != null, String.format("Could not find a provided issue filter with name '%s'", name)); - return filter; - } - - private void addFirstColumn(Dashboard dashboard, IssueFilterDto unresolvedIssues) { - // Unresolved issues by status - dashboard.addWidget(ProjectIssueFilterWidget.ID, 1) - .setProperty(ProjectIssueFilterWidget.FILTER_PROPERTY, Long.toString(unresolvedIssues.getId())) - .setProperty(ProjectIssueFilterWidget.DISTRIBUTION_AXIS_PROPERTY, "statuses"); - // Action plans - dashboard.addWidget("action_plans", 1); - } - - private void addSecondColumn(Dashboard dashboard, IssueFilterDto unresolvedIssues, IssueFilterDto hiddenDebt, IssueFilterDto myUnresolvedIssues) { - // Unresolved issues by assignee - dashboard.addWidget(ProjectIssueFilterWidget.ID, 2) - .setProperty(ProjectIssueFilterWidget.FILTER_PROPERTY, Long.toString(unresolvedIssues.getId())) - .setProperty(ProjectIssueFilterWidget.DISTRIBUTION_AXIS_PROPERTY, "assignees"); - // My unresolved issues - dashboard.addWidget(ProjectIssueFilterWidget.ID, 2) - .setProperty("filter", Long.toString(myUnresolvedIssues.getId())); - // False positive and won't fix issues by resolution - dashboard.addWidget(ProjectIssueFilterWidget.ID, 2) - .setProperty(ProjectIssueFilterWidget.FILTER_PROPERTY, Long.toString(hiddenDebt.getId())) - .setProperty(ProjectIssueFilterWidget.DISTRIBUTION_AXIS_PROPERTY, "resolutions"); - } - -} diff --git a/server/sonar-server/src/main/java/org/sonar/server/dashboard/template/ProjectTimeMachineDashboard.java b/server/sonar-server/src/main/java/org/sonar/server/dashboard/template/ProjectTimeMachineDashboard.java deleted file mode 100644 index 13c85036c1d..00000000000 --- a/server/sonar-server/src/main/java/org/sonar/server/dashboard/template/ProjectTimeMachineDashboard.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonar.server.dashboard.template; - -import org.sonar.api.measures.CoreMetrics; -import org.sonar.api.web.Dashboard; -import org.sonar.api.web.Dashboard.Widget; -import org.sonar.api.web.DashboardLayout; -import org.sonar.api.web.DashboardTemplate; - -/** - * Time Machine dashboard - * - * @since 3.0 - */ -public final class ProjectTimeMachineDashboard extends DashboardTemplate { - - private static final String METRIC1 = "metric1"; - private static final String METRIC2 = "metric2"; - private static final String METRIC3 = "metric3"; - private static final String METRIC4 = "metric4"; - private static final String METRIC5 = "metric5"; - private static final String METRIC6 = "metric6"; - private static final String METRIC7 = "metric7"; - private static final String METRIC8 = "metric8"; - - @Override - public String getName() { - return "TimeMachine"; - } - - @Override - public Dashboard createDashboard() { - Dashboard dashboard = Dashboard.create(); - dashboard.setLayout(DashboardLayout.TWO_COLUMNS); - addFirstColumn(dashboard); - addSecondColumn(dashboard); - return dashboard; - } - - private static void addFirstColumn(Dashboard dashboard) { - Widget timelineWidget = dashboard.addWidget("timeline", 1); - timelineWidget.setProperty(METRIC1, CoreMetrics.COMPLEXITY_KEY); - timelineWidget.setProperty(METRIC2, CoreMetrics.TECHNICAL_DEBT_KEY); - timelineWidget.setProperty(METRIC3, CoreMetrics.COVERAGE_KEY); - - Widget sizeTimeMachineWidget = addTimeMachineWidgetOnFirstColumn(dashboard); - sizeTimeMachineWidget.setProperty(METRIC1, CoreMetrics.NCLOC_KEY); - sizeTimeMachineWidget.setProperty(METRIC2, CoreMetrics.LINES_KEY); - sizeTimeMachineWidget.setProperty(METRIC3, CoreMetrics.STATEMENTS_KEY); - sizeTimeMachineWidget.setProperty(METRIC4, CoreMetrics.FILES_KEY); - sizeTimeMachineWidget.setProperty(METRIC5, CoreMetrics.CLASSES_KEY); - sizeTimeMachineWidget.setProperty(METRIC6, CoreMetrics.FUNCTIONS_KEY); - sizeTimeMachineWidget.setProperty(METRIC7, CoreMetrics.ACCESSORS_KEY); - - Widget commentsTimeMachineWidget = addTimeMachineWidgetOnFirstColumn(dashboard); - commentsTimeMachineWidget.setProperty(METRIC1, CoreMetrics.COMMENT_LINES_DENSITY_KEY); - commentsTimeMachineWidget.setProperty(METRIC2, CoreMetrics.COMMENT_LINES_KEY); - commentsTimeMachineWidget.setProperty(METRIC3, CoreMetrics.PUBLIC_DOCUMENTED_API_DENSITY_KEY); - commentsTimeMachineWidget.setProperty(METRIC4, CoreMetrics.PUBLIC_UNDOCUMENTED_API_KEY); - - Widget duplicationTimeMachineWidget = addTimeMachineWidgetOnFirstColumn(dashboard); - duplicationTimeMachineWidget.setProperty(METRIC1, CoreMetrics.DUPLICATED_LINES_DENSITY_KEY); - duplicationTimeMachineWidget.setProperty(METRIC2, CoreMetrics.DUPLICATED_LINES_KEY); - duplicationTimeMachineWidget.setProperty(METRIC3, CoreMetrics.DUPLICATED_BLOCKS_KEY); - duplicationTimeMachineWidget.setProperty(METRIC4, CoreMetrics.DUPLICATED_FILES_KEY); - } - - private static void addSecondColumn(Dashboard dashboard) { - Widget rulesTimeMachineWidget = addTimeMachineWidgetOnSecondColumn(dashboard); - rulesTimeMachineWidget.setProperty(METRIC1, CoreMetrics.VIOLATIONS_KEY); - rulesTimeMachineWidget.setProperty(METRIC2, CoreMetrics.BLOCKER_VIOLATIONS_KEY); - rulesTimeMachineWidget.setProperty(METRIC3, CoreMetrics.CRITICAL_VIOLATIONS_KEY); - rulesTimeMachineWidget.setProperty(METRIC4, CoreMetrics.MAJOR_VIOLATIONS_KEY); - rulesTimeMachineWidget.setProperty(METRIC5, CoreMetrics.MINOR_VIOLATIONS_KEY); - rulesTimeMachineWidget.setProperty(METRIC6, CoreMetrics.INFO_VIOLATIONS_KEY); - rulesTimeMachineWidget.setProperty(METRIC7, CoreMetrics.TECHNICAL_DEBT_KEY); - - Widget complexityTimeMachineWidget = addTimeMachineWidgetOnSecondColumn(dashboard); - complexityTimeMachineWidget.setProperty(METRIC1, CoreMetrics.COMPLEXITY_KEY); - complexityTimeMachineWidget.setProperty(METRIC2, CoreMetrics.FUNCTION_COMPLEXITY_KEY); - complexityTimeMachineWidget.setProperty(METRIC3, CoreMetrics.CLASS_COMPLEXITY_KEY); - complexityTimeMachineWidget.setProperty(METRIC4, CoreMetrics.FILE_COMPLEXITY_KEY); - - Widget testsTimeMachineWidget = addTimeMachineWidgetOnSecondColumn(dashboard); - testsTimeMachineWidget.setProperty(METRIC1, CoreMetrics.COVERAGE_KEY); - testsTimeMachineWidget.setProperty(METRIC2, CoreMetrics.LINE_COVERAGE_KEY); - testsTimeMachineWidget.setProperty(METRIC3, CoreMetrics.BRANCH_COVERAGE_KEY); - testsTimeMachineWidget.setProperty(METRIC4, CoreMetrics.TEST_SUCCESS_DENSITY_KEY); - testsTimeMachineWidget.setProperty(METRIC5, CoreMetrics.TEST_FAILURES_KEY); - testsTimeMachineWidget.setProperty(METRIC6, CoreMetrics.TEST_ERRORS_KEY); - testsTimeMachineWidget.setProperty(METRIC7, CoreMetrics.TESTS_KEY); - testsTimeMachineWidget.setProperty(METRIC8, CoreMetrics.TEST_EXECUTION_TIME_KEY); - } - - private static Widget addTimeMachineWidgetOnFirstColumn(Dashboard dashboard) { - return addTimeMachineWidget(dashboard, 1); - } - - private static Widget addTimeMachineWidgetOnSecondColumn(Dashboard dashboard) { - return addTimeMachineWidget(dashboard, 2); - } - - private static Widget addTimeMachineWidget(Dashboard dashboard, int columnIndex) { - Widget widget = dashboard.addWidget("time_machine", columnIndex); - widget.setProperty("displaySparkLine", "true"); - return widget; - } - -} diff --git a/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java b/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java index 6637c814fed..de74d22e9fe 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java +++ b/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java @@ -67,8 +67,6 @@ import org.sonar.server.computation.ws.CeWsModule; import org.sonar.server.config.ws.PropertiesWs; import org.sonar.server.dashboard.template.GlobalDefaultDashboard; import org.sonar.server.dashboard.template.ProjectDefaultDashboard; -import org.sonar.server.dashboard.template.ProjectIssuesDashboard; -import org.sonar.server.dashboard.template.ProjectTimeMachineDashboard; import org.sonar.server.dashboard.widget.ActionPlansWidget; import org.sonar.server.dashboard.widget.AlertsWidget; import org.sonar.server.dashboard.widget.BubbleChartWidget; @@ -355,8 +353,6 @@ public class PlatformLevel4 extends PlatformLevel { DashboardsWs.class, org.sonar.server.dashboard.ws.ShowAction.class, ProjectDefaultDashboard.class, - ProjectIssuesDashboard.class, - ProjectTimeMachineDashboard.class, GlobalDefaultDashboard.class, AlertsWidget.class, CoverageWidget.class, diff --git a/server/sonar-server/src/test/java/org/sonar/server/dashboard/template/ProjectDefaultDashboardTest.java b/server/sonar-server/src/test/java/org/sonar/server/dashboard/template/ProjectDefaultDashboardTest.java index 2050d5c78c5..55d1b2120f3 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/dashboard/template/ProjectDefaultDashboardTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/dashboard/template/ProjectDefaultDashboardTest.java @@ -19,14 +19,32 @@ */ package org.sonar.server.dashboard.template; +import org.junit.Before; +import org.junit.Rule; import org.junit.Test; +import org.junit.experimental.categories.Category; +import org.sonar.api.utils.System2; import org.sonar.api.web.Dashboard; import org.sonar.api.web.DashboardLayout; +import org.sonar.db.DbTester; +import org.sonar.db.issue.IssueFilterDao; +import org.sonar.test.DbTests; import static org.assertj.core.api.Assertions.assertThat; +@Category(DbTests.class) public class ProjectDefaultDashboardTest { - ProjectDefaultDashboard template = new ProjectDefaultDashboard(); + + @Rule + public DbTester dbTester = DbTester.create(System2.INSTANCE); + + ProjectDefaultDashboard template; + + @Before + public void setUp() { + IssueFilterDao issueFilterDao = new IssueFilterDao(dbTester.myBatis()); + template = new ProjectDefaultDashboard(issueFilterDao); + } @Test public void should_have_a_name() { @@ -35,9 +53,19 @@ public class ProjectDefaultDashboardTest { @Test public void should_create_dashboard() { + dbTester.prepareDbUnit(getClass(), "filters.xml"); Dashboard dashboard = template.createDashboard(); assertThat(dashboard.getLayout()).isEqualTo(DashboardLayout.TWO_COLUMNS); - assertThat(dashboard.getWidgets()).hasSize(9); + assertThat(dashboard.getWidgets()).hasSize(2); + } + + @Test + public void should_provide_clean_error_message_on_failure() { + try { + template.createDashboard(); + } catch (IllegalStateException illegalState) { + assertThat(illegalState).hasMessage("Could not find a provided issue filter with name 'Unresolved Issues'"); + } } } diff --git a/server/sonar-server/src/test/java/org/sonar/server/dashboard/template/ProjectIssuesDashboardTest.java b/server/sonar-server/src/test/java/org/sonar/server/dashboard/template/ProjectIssuesDashboardTest.java deleted file mode 100644 index 3d4e9f03381..00000000000 --- a/server/sonar-server/src/test/java/org/sonar/server/dashboard/template/ProjectIssuesDashboardTest.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -package org.sonar.server.dashboard.template; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.experimental.categories.Category; -import org.sonar.api.utils.System2; -import org.sonar.api.web.Dashboard; -import org.sonar.api.web.DashboardLayout; -import org.sonar.db.DbTester; -import org.sonar.db.issue.IssueFilterDao; -import org.sonar.test.DbTests; - -import static org.assertj.core.api.Assertions.assertThat; - -@Category(DbTests.class) -public class ProjectIssuesDashboardTest { - - @Rule - public DbTester dbTester = DbTester.create(System2.INSTANCE); - - ProjectIssuesDashboard template; - - @Before - public void setUp() { - IssueFilterDao issueFilterDao = new IssueFilterDao(dbTester.myBatis()); - template = new ProjectIssuesDashboard(issueFilterDao); - } - - @Test - public void should_have_a_name() { - assertThat(template.getName()).isEqualTo("Issues"); - } - - @Test - public void should_create_dashboard() { - dbTester.prepareDbUnit(getClass(), "filters.xml"); - Dashboard dashboard = template.createDashboard(); - - assertThat(dashboard.getLayout()).isEqualTo(DashboardLayout.TWO_COLUMNS); - assertThat(dashboard.getWidgets()).hasSize(5); - } - - @Test - public void should_provide_clean_error_message_on_failure() { - try { - template.createDashboard(); - } catch (IllegalStateException illegalState) { - assertThat(illegalState).hasMessage("Could not find a provided issue filter with name 'Unresolved Issues'"); - } - } -} diff --git a/server/sonar-server/src/test/java/org/sonar/server/dashboard/template/ProjectTimeMachineDashboardTest.java b/server/sonar-server/src/test/java/org/sonar/server/dashboard/template/ProjectTimeMachineDashboardTest.java deleted file mode 100644 index 84f96ed662d..00000000000 --- a/server/sonar-server/src/test/java/org/sonar/server/dashboard/template/ProjectTimeMachineDashboardTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonar.server.dashboard.template; - -import org.junit.Test; -import org.sonar.api.web.Dashboard; -import org.sonar.api.web.Dashboard.Widget; -import org.sonar.api.web.DashboardLayout; - -import static org.assertj.core.api.Assertions.assertThat; - -public class ProjectTimeMachineDashboardTest { - ProjectTimeMachineDashboard template = new ProjectTimeMachineDashboard(); - - @Test - public void should_have_a_name() { - assertThat(template.getName()).isEqualTo("TimeMachine"); - } - - @Test - public void should_create_dashboard() { - Dashboard dashboard = template.createDashboard(); - - assertThat(dashboard.getLayout()).isEqualTo(DashboardLayout.TWO_COLUMNS); - assertThat(dashboard.getWidgets()).hasSize(7); - - for (Widget widget : dashboard.getWidgets()) { - if (widget.getId().equals("time_machine")) { - assertThat(widget.getProperty("displaySparkLine")).isEqualTo("true"); - } - } - } -} diff --git a/server/sonar-server/src/test/resources/org/sonar/server/dashboard/template/ProjectIssuesDashboardTest/filters.xml b/server/sonar-server/src/test/resources/org/sonar/server/dashboard/template/ProjectDefaultDashboardTest/filters.xml index 8ec92ddcdbf..8ec92ddcdbf 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/dashboard/template/ProjectIssuesDashboardTest/filters.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/dashboard/template/ProjectDefaultDashboardTest/filters.xml diff --git a/sonar-core/src/main/resources/org/sonar/l10n/core.properties b/sonar-core/src/main/resources/org/sonar/l10n/core.properties index f1035cffbed..d5fbc5624e7 100644 --- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties +++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties @@ -1054,11 +1054,9 @@ property.category.scm=SCM #------------------------------------------------------------------------------ # Default dashboard -dashboard.Dashboard.name=Main Dashboard +dashboard.Dashboard.name=Custom dashboard.Hotspots.name=Hotspots dashboard.Reviews.name=Reviews -dashboard.Issues.name=Issues Report -dashboard.TimeMachine.name=Time Machine #------------------------------------------------------------------------------ # |