]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-7916 Remove built-in default project dashboard 1117/head
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>
Mon, 25 Jul 2016 09:24:22 +0000 (11:24 +0200)
committerTeryk Bellahsene <teryk.bellahsene@sonarsource.com>
Mon, 25 Jul 2016 13:21:54 +0000 (15:21 +0200)
it/it-tests/src/test/java/it/componentDashboard/DashboardTest.java
it/it-tests/src/test/resources/componentDashboard/DashboardTest/global_dashboard/default-dashboards.html
it/it-tests/src/test/resources/componentDashboard/DashboardTest/global_dashboard/order-project-default-dashboards.html [deleted file]
server/sonar-server/src/main/java/org/sonar/server/dashboard/template/ProjectCustomDashboard.java [deleted file]
server/sonar-server/src/main/java/org/sonar/server/dashboard/ws/DashboardsWs.java
server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java
server/sonar-server/src/test/java/org/sonar/server/dashboard/template/ProjectCustomDashboardTest.java [deleted file]
server/sonar-server/src/test/resources/org/sonar/server/dashboard/template/ProjectCustomDashboardTest/filters.xml [deleted file]

index 8c2d3bf345e6835aeda3775ea90a0788b28b0d6c..4ef6c3000e9df8d33796dd61cd6e12ccd31b926e 100644 (file)
@@ -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",
 
index 9a6439c22afe77db85682d892febce275314b7e4..3bc101132a439571a1753035ca07f301ed15e136 100644 (file)
        <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 (file)
index e0281f6..0000000
+++ /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 (file)
index be76a07..0000000
+++ /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;
-  }
-
-}
index 34677e1a6dc6bb8f9cf1a9f9404a3c8598338886..706d1a913e504f29f995d223460cd823f9a080a7 100644 (file)
@@ -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);
     }
index 34f76578c2e73a9ef35bd36ea68782f8ac8aec82..75620ab5bfb0cbd642a35f1ae699a6012cac5a11 100644 (file)
@@ -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 (file)
index 817b4ab..0000000
+++ /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 (file)
index 8ec92dd..0000000
+++ /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>