]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-7030 Drop most default hardcoded built-in dashboards
authorStas Vilchik <vilchiks@gmail.com>
Wed, 2 Dec 2015 09:52:21 +0000 (10:52 +0100)
committerStas Vilchik <vilchiks@gmail.com>
Wed, 2 Dec 2015 09:52:21 +0000 (10:52 +0100)
server/sonar-server/src/main/java/org/sonar/server/dashboard/template/ProjectDefaultDashboard.java
server/sonar-server/src/main/java/org/sonar/server/dashboard/template/ProjectIssuesDashboard.java [deleted file]
server/sonar-server/src/main/java/org/sonar/server/dashboard/template/ProjectTimeMachineDashboard.java [deleted file]
server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java
server/sonar-server/src/test/java/org/sonar/server/dashboard/template/ProjectDefaultDashboardTest.java
server/sonar-server/src/test/java/org/sonar/server/dashboard/template/ProjectIssuesDashboardTest.java [deleted file]
server/sonar-server/src/test/java/org/sonar/server/dashboard/template/ProjectTimeMachineDashboardTest.java [deleted file]
server/sonar-server/src/test/resources/org/sonar/server/dashboard/template/ProjectDefaultDashboardTest/filters.xml [new file with mode: 0644]
server/sonar-server/src/test/resources/org/sonar/server/dashboard/template/ProjectIssuesDashboardTest/filters.xml [deleted file]
sonar-core/src/main/resources/org/sonar/l10n/core.properties

index 7f022ea37a21f3abe2fecc9763f66d19529a9960..3803fb2db63286ab98ea6fc3800452f4ccdf1991 100644 (file)
  */
 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 (file)
index 7474844..0000000
+++ /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 (file)
index 13c8503..0000000
+++ /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;
-  }
-
-}
index dd41ae98635f3812950c4502eeedff0e262e16cf..b56b22f6cad1223bedec1c3ada8d279488c9478b 100644 (file)
@@ -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,
index 2050d5c78c5c24fe0c728242785761208d47e464..55d1b2120f324a78fa31faacfbef7c15091e3581 100644 (file)
  */
 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 (file)
index 3d4e9f0..0000000
+++ /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 (file)
index 84f96ed..0000000
+++ /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/ProjectDefaultDashboardTest/filters.xml b/server/sonar-server/src/test/resources/org/sonar/server/dashboard/template/ProjectDefaultDashboardTest/filters.xml
new file mode 100644 (file)
index 0000000..8ec92dd
--- /dev/null
@@ -0,0 +1,33 @@
+<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>
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/ProjectIssuesDashboardTest/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>
index cbacec307173a1daadf00d9ce6e683a6d60a2c85..4643b44bacaa5fd9a41b923d3cda9fe99000b115 100644 (file)
@@ -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
 
 #------------------------------------------------------------------------------
 #