@WidgetScope(GLOBAL)
@WidgetProperties({
@WidgetProperty(key = MeasureFilterListWidget.FILTER_PROPERTY, type = WidgetPropertyType.FILTER, optional = false),
- @WidgetProperty(key = MeasureFilterListWidget.PAGE_SIZE_PROPERTY, type = WidgetPropertyType.INTEGER, optional = true)
+ @WidgetProperty(key = MeasureFilterListWidget.PAGE_SIZE_PROPERTY, type = WidgetPropertyType.INTEGER, defaultValue = "30")
}
)
public class MeasureFilterListWidget extends AbstractRubyTemplate implements RubyRailsWidget {
}
public String getTitle() {
- return "Treemap of components";
+ return "Treemap of Components";
}
@Override
-<h3>Welcome to Sonar Dashboard</h3>
-<p>Since you are able to read this, it means that you have successfully started your Sonar server. Well done!</p>
-<p>If you have not removed this text, it also means that you have not yet played much with Sonar. So here are a few pointers for your next step:</p>
-<ul class="bullet">
- <li>Do you now want to <a href="http://docs.codehaus.org/x/P4LEBg">run analysis</a> on a project?</li>
- <li>Maybe start <a href="http://docs.codehaus.org/x/EYDECQ">customizing dashboards</a>?</li>
- <li>Or simply browse the <a href="http://docs.codehaus.org/x/EoDEBg">complete documentation</a>?</li>
- <li>If you have a question or an issue, please report it on the <a href="http://www.sonarsource.org/support/support/">mailing list</a>.</li>
-</ul>
\ No newline at end of file
+<%= message('widget.welcome.html') -%>
\ No newline at end of file
import org.junit.Test;
import org.sonar.api.web.Filter;
+import org.sonar.plugins.core.CorePlugin;
import static org.fest.assertions.Assertions.assertThat;
assertThat(filter.getCriteria()).isEmpty();
assertThat(filter.getColumns()).hasSize(3);
}
+
+ @Test
+ public void should_be_registered_as_an_extension() {
+ assertThat(new CorePlugin().getExtensions()).contains(MyFavouritesFilter.class);
+ }
}
import org.junit.Test;
import org.sonar.api.web.Filter;
+import org.sonar.plugins.core.CorePlugin;
import static org.fest.assertions.Assertions.assertThat;
@Test
public void should_create_filter() {
ProjectFilter template = new ProjectFilter();
-
+
Filter filter = template.createFilter();
assertThat(template.getName()).isEqualTo("Projects");
assertThat(filter.getCriteria()).hasSize(1);
assertThat(filter.getColumns()).hasSize(7);
}
+
+ @Test
+ public void should_be_registered_as_an_extension() {
+ assertThat(new CorePlugin().getExtensions()).contains(ProjectFilter.class);
+ }
}
package org.sonar.plugins.core.widgets;
import org.junit.Test;
+import org.sonar.plugins.core.CorePlugin;
import static org.fest.assertions.Assertions.assertThat;
}
@Test
- public void should_use_relative_path_for_template() {
+ public void should_find_template() {
CoverageWidget widget = new CoverageWidget();
+ assertThat(WelcomeWidget.class.getResource(widget.getTemplatePath())).isNotNull();
+ }
- assertThat(widget.getTemplatePath()).startsWith("/");
+ @Test
+ public void should_be_registered_as_an_extension() {
+ assertThat(new CorePlugin().getExtensions()).contains(CoverageWidget.class);
}
}
*/
package org.sonar.plugins.core.widgets;
+import com.google.common.io.Resources;
import org.junit.Test;
+import org.sonar.plugins.core.CorePlugin;
import static org.fest.assertions.Assertions.assertThat;
}
@Test
- public void should_use_relative_path_for_template() {
+ public void should_find_template() {
ItCoverageWidget widget = new ItCoverageWidget();
+ assertThat(ItCoverageWidget.class.getResource(widget.getTemplatePath())).isNotNull();
+ }
- assertThat(widget.getTemplatePath()).startsWith("/");
+ @Test
+ public void should_be_registered_as_an_extension() {
+ assertThat(new CorePlugin().getExtensions()).contains(ItCoverageWidget.class);
}
}
--- /dev/null
+/*
+ * 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.widgets;
+
+import org.junit.Test;
+import org.sonar.plugins.core.CorePlugin;
+
+import static org.fest.assertions.Assertions.assertThat;
+
+public class TreemapWidgetTest {
+ @Test
+ public void should_define_widget() {
+ TreemapWidget widget = new TreemapWidget();
+
+ assertThat(widget.getId()).isEqualTo("treemap-widget");
+ assertThat(widget.getTitle()).isEqualTo("Treemap of Components");
+ }
+
+ @Test
+ public void should_find_template() {
+ TreemapWidget widget = new TreemapWidget();
+ assertThat(WelcomeWidget.class.getResource(widget.getTemplatePath())).isNotNull();
+ }
+
+ @Test
+ public void should_be_registered_as_an_extension() {
+ assertThat(new CorePlugin().getExtensions()).contains(TreemapWidget.class);
+ }
+}
--- /dev/null
+/*
+ * 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.widgets;
+
+import org.junit.Test;
+import org.sonar.plugins.core.CorePlugin;
+
+import static org.fest.assertions.Assertions.assertThat;
+
+public class WelcomeWidgetTest {
+ @Test
+ public void should_define_widget() {
+ WelcomeWidget widget = new WelcomeWidget();
+
+ assertThat(widget.getId()).isEqualTo("welcome");
+ assertThat(widget.getTitle()).isEqualTo("Welcome");
+ }
+
+ @Test
+ public void should_find_template() {
+ WelcomeWidget widget = new WelcomeWidget();
+ assertThat(WelcomeWidget.class.getResource(widget.getTemplatePath())).isNotNull();
+ }
+
+ @Test
+ public void should_be_registered_as_an_extension() {
+ assertThat(new CorePlugin().getExtensions()).contains(WelcomeWidget.class);
+ }
+}