From 32f6a67a429623f9ccc14944f11aa75260441aed Mon Sep 17 00:00:00 2001 From: Julien Lancelot Date: Fri, 12 Feb 2016 14:42:19 +0100 Subject: Move DashboardTest ITs --- it/it-plugins/dashboard-plugin/pom.xml | 37 +++++++++++++++++ .../src/main/java/FakeDashboardTemplate.java | 42 ++++++++++++++++++++ .../dashboard-plugin/src/main/java/UiPlugin.java | 28 +++++++++++++ .../main/java/WidgetWithMandatoryProperties.java | 46 ++++++++++++++++++++++ .../org/sonar/l10n/dashboardplugin.properties | 1 + .../org/sonar/l10n/dashboardplugin_fr.properties | 1 + .../widget-with-mandatory-properties.html.erb | 16 ++++++++ it/it-plugins/pom.xml | 1 + 8 files changed, 172 insertions(+) create mode 100644 it/it-plugins/dashboard-plugin/pom.xml create mode 100644 it/it-plugins/dashboard-plugin/src/main/java/FakeDashboardTemplate.java create mode 100644 it/it-plugins/dashboard-plugin/src/main/java/UiPlugin.java create mode 100644 it/it-plugins/dashboard-plugin/src/main/java/WidgetWithMandatoryProperties.java create mode 100644 it/it-plugins/dashboard-plugin/src/main/resources/org/sonar/l10n/dashboardplugin.properties create mode 100644 it/it-plugins/dashboard-plugin/src/main/resources/org/sonar/l10n/dashboardplugin_fr.properties create mode 100644 it/it-plugins/dashboard-plugin/src/main/resources/widgets/widget-with-mandatory-properties.html.erb (limited to 'it/it-plugins') diff --git a/it/it-plugins/dashboard-plugin/pom.xml b/it/it-plugins/dashboard-plugin/pom.xml new file mode 100644 index 00000000000..469554e8c10 --- /dev/null +++ b/it/it-plugins/dashboard-plugin/pom.xml @@ -0,0 +1,37 @@ + + + 4.0.0 + + org.sonarsource.sonarqube + it-plugins + 5.5-SNAPSHOT + + + dashboard-plugin + 1.0-SNAPSHOT + sonar-plugin + SonarQube Integration Tests :: Plugins :: UI + Main plugin for UI tests + + + + org.sonarsource.sonarqube + sonar-plugin-api + ${apiVersion} + provided + + + + + + + org.sonarsource.sonar-packaging-maven-plugin + sonar-packaging-maven-plugin + true + + UiPlugin + + + + + diff --git a/it/it-plugins/dashboard-plugin/src/main/java/FakeDashboardTemplate.java b/it/it-plugins/dashboard-plugin/src/main/java/FakeDashboardTemplate.java new file mode 100644 index 00000000000..581201a495e --- /dev/null +++ b/it/it-plugins/dashboard-plugin/src/main/java/FakeDashboardTemplate.java @@ -0,0 +1,42 @@ +/* + * 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. + */ +import org.sonar.api.web.Dashboard; +import org.sonar.api.web.DashboardLayout; +import org.sonar.api.web.DashboardTemplate; + +public class FakeDashboardTemplate extends DashboardTemplate { + + @Override + public Dashboard createDashboard() { + Dashboard dashboard = Dashboard.create() + .setLayout(DashboardLayout.TWO_COLUMNS_30_70) + .setDescription("Fake dashboard for integration tests"); + dashboard.addWidget("lcom4", 1); + dashboard.addWidget("description", 1); + dashboard.addWidget("documentation_comments", 2); + dashboard.addWidget("complexity", 3); // should be ignored because the layout is 2 columns + return dashboard; + } + + @Override + public String getName() { + return "Fake"; + } +} diff --git a/it/it-plugins/dashboard-plugin/src/main/java/UiPlugin.java b/it/it-plugins/dashboard-plugin/src/main/java/UiPlugin.java new file mode 100644 index 00000000000..79495a14c55 --- /dev/null +++ b/it/it-plugins/dashboard-plugin/src/main/java/UiPlugin.java @@ -0,0 +1,28 @@ +/* + * 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. + */ +import java.util.Arrays; +import java.util.List; +import org.sonar.api.SonarPlugin; + +public class UiPlugin extends SonarPlugin { + public List getExtensions() { + return Arrays.asList(FakeDashboardTemplate.class, WidgetWithMandatoryProperties.class); + } +} diff --git a/it/it-plugins/dashboard-plugin/src/main/java/WidgetWithMandatoryProperties.java b/it/it-plugins/dashboard-plugin/src/main/java/WidgetWithMandatoryProperties.java new file mode 100644 index 00000000000..eb966a33901 --- /dev/null +++ b/it/it-plugins/dashboard-plugin/src/main/java/WidgetWithMandatoryProperties.java @@ -0,0 +1,46 @@ +/* + * 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. + */ +import org.sonar.api.web.AbstractRubyTemplate; +import org.sonar.api.web.RubyRailsWidget; +import org.sonar.api.web.WidgetProperties; +import org.sonar.api.web.WidgetProperty; +import org.sonar.api.web.WidgetPropertyType; + +@WidgetProperties({ + @WidgetProperty(key = "mandatoryString", optional = false), + @WidgetProperty(key = "mandatoryInt", optional = false, type = WidgetPropertyType.INTEGER) + +}) +public class WidgetWithMandatoryProperties extends AbstractRubyTemplate implements RubyRailsWidget { + + public String getId() { + return "widget-with-mandatory-properties"; + } + + public String getTitle() { + return "Widget with Mandatory Properties"; + } + + @Override + protected String getTemplatePath() { + return "/widgets/widget-with-mandatory-properties.html.erb"; + } +} + diff --git a/it/it-plugins/dashboard-plugin/src/main/resources/org/sonar/l10n/dashboardplugin.properties b/it/it-plugins/dashboard-plugin/src/main/resources/org/sonar/l10n/dashboardplugin.properties new file mode 100644 index 00000000000..8db961d7486 --- /dev/null +++ b/it/it-plugins/dashboard-plugin/src/main/resources/org/sonar/l10n/dashboardplugin.properties @@ -0,0 +1 @@ +dashboard.Fake.name=Fake \ No newline at end of file diff --git a/it/it-plugins/dashboard-plugin/src/main/resources/org/sonar/l10n/dashboardplugin_fr.properties b/it/it-plugins/dashboard-plugin/src/main/resources/org/sonar/l10n/dashboardplugin_fr.properties new file mode 100644 index 00000000000..4bbe9f6250b --- /dev/null +++ b/it/it-plugins/dashboard-plugin/src/main/resources/org/sonar/l10n/dashboardplugin_fr.properties @@ -0,0 +1 @@ +dashboard.Fake.name=Artificiel \ No newline at end of file diff --git a/it/it-plugins/dashboard-plugin/src/main/resources/widgets/widget-with-mandatory-properties.html.erb b/it/it-plugins/dashboard-plugin/src/main/resources/widgets/widget-with-mandatory-properties.html.erb new file mode 100644 index 00000000000..5e57af614da --- /dev/null +++ b/it/it-plugins/dashboard-plugin/src/main/resources/widgets/widget-with-mandatory-properties.html.erb @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + +
PropertyValue
mandatoryString<%= widget_properties['mandatoryString'] -%>
mandatoryInt<%= widget_properties['mandatoryInt'] -%>
diff --git a/it/it-plugins/pom.xml b/it/it-plugins/pom.xml index fa1df6e5231..a44beb0b8f2 100644 --- a/it/it-plugins/pom.xml +++ b/it/it-plugins/pom.xml @@ -33,6 +33,7 @@ access-secured-props-plugin base-auth-plugin batch-plugin + dashboard-plugin extension-lifecycle-plugin global-property-change-plugin issue-action-plugin -- cgit v1.2.3