diff options
author | David Gageot <david@gageot.net> | 2012-05-04 18:12:37 +0200 |
---|---|---|
committer | David Gageot <david@gageot.net> | 2012-05-04 18:23:50 +0200 |
commit | 1ff9677915d04fe5d9131eed029ee013824dcad2 (patch) | |
tree | 1f0194c29f2b2234d7cd05ba64ce7035483418e3 /plugins | |
parent | d479a2f1bc16482c9c7b9085066334a92e48928b (diff) | |
download | sonarqube-1ff9677915d04fe5d9131eed029ee013824dcad2.tar.gz sonarqube-1ff9677915d04fe5d9131eed029ee013824dcad2.zip |
SONAR-1927 Fix default dashboard and widget
Diffstat (limited to 'plugins')
3 files changed, 41 insertions, 1 deletions
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/dashboards/GlobalDashboard.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/dashboards/GlobalDashboard.java index 37eeff43599..e330209fc91 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/dashboards/GlobalDashboard.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/dashboards/GlobalDashboard.java @@ -37,6 +37,7 @@ public final class GlobalDashboard extends DashboardTemplate { @Override public Dashboard createDashboard() { Dashboard dashboard = Dashboard.create(); + dashboard.setGlobal(true); dashboard.setLayout(DashboardLayout.ONE_COLUMN); addWidget(dashboard); diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/GlobalWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/GlobalWidget.java index c806bee357b..c165e62f88e 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/GlobalWidget.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/GlobalWidget.java @@ -26,7 +26,7 @@ import org.sonar.api.web.RubyRailsWidget; import org.sonar.api.web.UserRole; import org.sonar.api.web.WidgetCategory; -@WidgetCategory("Information") +@WidgetCategory("Beta") @WidgetGlobal @UserRole(UserRole.USER) public class GlobalWidget extends AbstractRubyTemplate implements RubyRailsWidget { diff --git a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/dashboards/GlobalDashboardTest.java b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/dashboards/GlobalDashboardTest.java new file mode 100644 index 00000000000..d94f4cbd9a7 --- /dev/null +++ b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/dashboards/GlobalDashboardTest.java @@ -0,0 +1,39 @@ +/* + * Sonar, open source software quality management tool. + * Copyright (C) 2008-2012 SonarSource + * mailto:contact AT sonarsource DOT com + * + * Sonar 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. + * + * Sonar 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 Sonar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +package org.sonar.plugins.core.dashboards; + +import org.junit.Test; +import org.sonar.api.web.Dashboard; +import org.sonar.api.web.DashboardLayout; + +import static org.fest.assertions.Assertions.assertThat; + +public class GlobalDashboardTest { + @Test + public void should_create_dashboard() { + GlobalDashboard template = new GlobalDashboard(); + + Dashboard dashboard = template.createDashboard(); + + assertThat(template.getName()).isEqualTo("Global"); + assertThat(dashboard.getLayout()).isEqualTo(DashboardLayout.ONE_COLUMN); + assertThat(dashboard.getWidgets()).onProperty("id").containsOnly("global"); + } +} |