diff options
author | Teryk Bellahsene <teryk.bellahsene@sonarsource.com> | 2016-07-25 11:24:22 +0200 |
---|---|---|
committer | Teryk Bellahsene <teryk.bellahsene@sonarsource.com> | 2016-07-25 15:21:54 +0200 |
commit | 298b3f58af36a48512dedd058ddc4f4d1c122715 (patch) | |
tree | 6dad510d1d4633f1631611a54c9b5ee229c51cc4 | |
parent | bf0b1f78b38bdbff570232764135698e9e290e59 (diff) | |
download | sonarqube-298b3f58af36a48512dedd058ddc4f4d1c122715.tar.gz sonarqube-298b3f58af36a48512dedd058ddc4f4d1c122715.zip |
SONAR-7916 Remove built-in default project dashboard
8 files changed, 1 insertions, 320 deletions
diff --git a/it/it-tests/src/test/java/it/componentDashboard/DashboardTest.java b/it/it-tests/src/test/java/it/componentDashboard/DashboardTest.java index 8c2d3bf345e..4ef6c3000e9 100644 --- a/it/it-tests/src/test/java/it/componentDashboard/DashboardTest.java +++ b/it/it-tests/src/test/java/it/componentDashboard/DashboardTest.java @@ -58,9 +58,6 @@ public class DashboardTest { // SONAR-4630 "/componentDashboard/DashboardTest/global_dashboard/create-global-dashboards-error.html", - // SONAR-3461 - "/componentDashboard/DashboardTest/global_dashboard/order-project-default-dashboards.html", - // SONAR-3462 "/componentDashboard/DashboardTest/global_dashboard/order-global-dashboard.html", diff --git a/it/it-tests/src/test/resources/componentDashboard/DashboardTest/global_dashboard/default-dashboards.html b/it/it-tests/src/test/resources/componentDashboard/DashboardTest/global_dashboard/default-dashboards.html index 9a6439c22af..3bc101132a4 100644 --- a/it/it-tests/src/test/resources/componentDashboard/DashboardTest/global_dashboard/default-dashboards.html +++ b/it/it-tests/src/test/resources/componentDashboard/DashboardTest/global_dashboard/default-dashboards.html @@ -53,51 +53,6 @@ <td>remove-Home</td> <td></td> </tr> -<tr> - <td>waitForText</td> - <td>activeProject</td> - <td>*Custom*</td> -</tr> -<tr> - <td>assertNotText</td> - <td>shared</td> - <td>*Custom*</td> -</tr> -<tr> - <td>clickAndWait</td> - <td>id=remove-Custom</td> - <td></td> -</tr> -<tr> - <td>assertConfirmation</td> - <td>Are you sure to remove it from default dashboards?</td> - <td></td> -</tr> -<tr> - <td>waitForText</td> - <td>shared</td> - <td>*Custom*</td> -</tr> -<tr> - <td>assertNotText</td> - <td>activeProject</td> - <td>*Custom*</td> -</tr> -<tr> - <td>clickAndWait</td> - <td>add-Custom</td> - <td></td> -</tr> -<tr> - <td>waitForText</td> - <td>activeProject</td> - <td>*Custom*</td> -</tr> -<tr> - <td>assertNotText</td> - <td>shared</td> - <td>*Custom*</td> -</tr> </tbody> </table> </body> diff --git a/it/it-tests/src/test/resources/componentDashboard/DashboardTest/global_dashboard/order-project-default-dashboards.html b/it/it-tests/src/test/resources/componentDashboard/DashboardTest/global_dashboard/order-project-default-dashboards.html deleted file mode 100644 index e0281f68124..00000000000 --- a/it/it-tests/src/test/resources/componentDashboard/DashboardTest/global_dashboard/order-project-default-dashboards.html +++ /dev/null @@ -1,89 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head profile="http://selenium-ide.openqa.org/profiles/test-case"> - <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> - <title>order-project-default-dashboards</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> - <thead> - <tr> - <td rowspan="1" colspan="3">order-project-default-dashboards</td> - </tr> - </thead> - <tbody> - <tr> - <td>open</td> - <td>/sessions/login</td> - <td></td> -</tr> -<tr> - <td>type</td> - <td>login</td> - <td>admin</td> -</tr> -<tr> - <td>type</td> - <td>password</td> - <td>admin</td> -</tr> -<tr> - <td>clickAndWait</td> - <td>commit</td> - <td></td> -</tr> -<tr> - <td>open</td> - <td>/admin_dashboards</td> - <td></td> -</tr> -<tr> - <td>assertTextPresent</td> - <td>Project Dashboards</td> - <td></td> -</tr> -<tr> - <td>assertTable</td> - <td>id=activeProject.1.0</td> - <td>Custom</td> -</tr> -<tr> - <td>assertTable</td> - <td>id=activeProject.2.0</td> - <td>Fake<br /> Fake dashboard for integration tests</td> -</tr> -<tr> - <td>clickAndWait</td> - <td>id=up-Fake</td> - <td></td> -</tr> -<tr> - <td>assertTable</td> - <td>id=activeProject.1.0</td> - <td>Fake<br /> Fake dashboard for integration tests</td> -</tr> -<tr> - <td>assertTable</td> - <td>id=activeProject.2.0</td> - <td>Custom</td> -</tr> -<tr> - <td>clickAndWait</td> - <td>id=down-Fake</td> - <td></td> -</tr> -<tr> - <td>assertTable</td> - <td>id=activeProject.1.0</td> - <td>Custom</td> -</tr> -<tr> - <td>assertTable</td> - <td>id=activeProject.2.0</td> - <td>Fake<br /> Fake dashboard for integration tests</td> -</tr> -</tbody> -</table> -</body> -</html> diff --git a/server/sonar-server/src/main/java/org/sonar/server/dashboard/template/ProjectCustomDashboard.java b/server/sonar-server/src/main/java/org/sonar/server/dashboard/template/ProjectCustomDashboard.java deleted file mode 100644 index be76a07cd7f..00000000000 --- a/server/sonar-server/src/main/java/org/sonar/server/dashboard/template/ProjectCustomDashboard.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2016 SonarSource SA - * mailto:contact AT sonarsource DOT com - * - * This program 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. - * - * This program 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; - -/** - * Custom dashboard - * - * @since 2.13 - */ -public final class ProjectCustomDashboard extends DashboardTemplate { - - private final IssueFilterDao issueFilterDao; - - public ProjectCustomDashboard(IssueFilterDao issueFilterDao) { - this.issueFilterDao = issueFilterDao; - } - - @Override - public String getName() { - return "Custom"; - } - - @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) { - dashboard.addWidget("size", 1); - dashboard.addWidget("code_coverage", 1); - dashboard.addWidget("duplications", 1); - dashboard.addWidget("documentation_comments", 1); - } - - private void addSecondColumn(Dashboard dashboard) { - dashboard.addWidget("rules", 2); - dashboard.addWidget("timeline", 2); - IssueFilterDto unresolvedIssues = getIssueFilterByName("Unresolved Issues"); - dashboard.addWidget(ProjectIssueFilterWidget.ID, 2) - .setProperty(ProjectIssueFilterWidget.FILTER_PROPERTY, Long.toString(unresolvedIssues.getId())) - .setProperty(ProjectIssueFilterWidget.DISTRIBUTION_AXIS_PROPERTY, "createdAt"); - } - - 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/ws/DashboardsWs.java b/server/sonar-server/src/main/java/org/sonar/server/dashboard/ws/DashboardsWs.java index 34677e1a6dc..706d1a913e5 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/dashboard/ws/DashboardsWs.java +++ b/server/sonar-server/src/main/java/org/sonar/server/dashboard/ws/DashboardsWs.java @@ -34,6 +34,7 @@ public class DashboardsWs implements WebService { NewController controller = context.createController("api/dashboards"); controller.setSince("5.0"); controller.setDescription("Manage dashboards and widgets."); + for (DashboardsWsAction action : actions) { action.define(controller); } 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 34f76578c2e..75620ab5bfb 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 @@ -51,7 +51,6 @@ import org.sonar.server.component.DefaultRubyComponentService; import org.sonar.server.component.ws.ComponentsWsModule; import org.sonar.server.config.ws.PropertiesWs; import org.sonar.server.dashboard.template.GlobalDefaultDashboard; -import org.sonar.server.dashboard.template.ProjectCustomDashboard; import org.sonar.server.dashboard.widget.AlertsWidget; import org.sonar.server.dashboard.widget.BubbleChartWidget; import org.sonar.server.dashboard.widget.ComplexityWidget; @@ -331,7 +330,6 @@ public class PlatformLevel4 extends PlatformLevel { // Dashboard DashboardsWs.class, org.sonar.server.dashboard.ws.ShowAction.class, - ProjectCustomDashboard.class, GlobalDefaultDashboard.class, AlertsWidget.class, CoverageWidget.class, diff --git a/server/sonar-server/src/test/java/org/sonar/server/dashboard/template/ProjectCustomDashboardTest.java b/server/sonar-server/src/test/java/org/sonar/server/dashboard/template/ProjectCustomDashboardTest.java deleted file mode 100644 index 817b4ab68d4..00000000000 --- a/server/sonar-server/src/test/java/org/sonar/server/dashboard/template/ProjectCustomDashboardTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2016 SonarSource SA - * mailto:contact AT sonarsource DOT com - * - * This program 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. - * - * This program 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.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 static org.assertj.core.api.Assertions.assertThat; - - -public class ProjectCustomDashboardTest { - - @Rule - public DbTester dbTester = DbTester.create(System2.INSTANCE); - - ProjectCustomDashboard template; - - @Before - public void setUp() { - IssueFilterDao issueFilterDao = new IssueFilterDao(dbTester.myBatis()); - template = new ProjectCustomDashboard(issueFilterDao); - } - - @Test - public void should_have_a_name() { - assertThat(template.getName()).isEqualTo("Custom"); - } - - @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(7); - } - - @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/resources/org/sonar/server/dashboard/template/ProjectCustomDashboardTest/filters.xml b/server/sonar-server/src/test/resources/org/sonar/server/dashboard/template/ProjectCustomDashboardTest/filters.xml deleted file mode 100644 index 8ec92ddcdbf..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/dashboard/template/ProjectCustomDashboardTest/filters.xml +++ /dev/null @@ -1,33 +0,0 @@ -<dataset> - - <issue_filters - id="1" - name="Unresolved Issues" - user_login="[null]" - shared="[true]" - description="[null]" - data="resolved=false" - created_at="2011-04-25 01:15:00" - updated_at="2011-04-25 01:15:00" /> - - <issue_filters - id="2" - name="False Positive and Won't Fix Issues" - user_login="[null]" - shared="[true]" - description="[null]" - data="resolutions=FALSE-POSITIVE,WONTFIX" - created_at="2011-04-25 01:15:00" - updated_at="2011-04-25 01:15:00" /> - - <issue_filters - id="3" - name="My Unresolved Issues" - user_login="[null]" - shared="[true]" - description="[null]" - data="resolved=false|assignees=__me__" - created_at="2011-04-25 01:15:00" - updated_at="2011-04-25 01:15:00" /> - -</dataset> |