diff options
author | Julien Lancelot <julien.lancelot@sonarsource.com> | 2016-02-12 14:42:19 +0100 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@sonarsource.com> | 2016-02-15 09:09:03 +0100 |
commit | 32f6a67a429623f9ccc14944f11aa75260441aed (patch) | |
tree | 96b09fa392bf161ee8f39de00978e8a6c0b49adc /it/it-plugins | |
parent | aa82282b15b0ea160d1e227ec1532b4cb7b49520 (diff) | |
download | sonarqube-32f6a67a429623f9ccc14944f11aa75260441aed.tar.gz sonarqube-32f6a67a429623f9ccc14944f11aa75260441aed.zip |
Move DashboardTest ITs
Diffstat (limited to 'it/it-plugins')
8 files changed, 172 insertions, 0 deletions
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 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.sonarsource.sonarqube</groupId> + <artifactId>it-plugins</artifactId> + <version>5.5-SNAPSHOT</version> + </parent> + + <artifactId>dashboard-plugin</artifactId> + <version>1.0-SNAPSHOT</version> + <packaging>sonar-plugin</packaging> + <name>SonarQube Integration Tests :: Plugins :: UI</name> + <description>Main plugin for UI tests</description> + + <dependencies> + <dependency> + <groupId>org.sonarsource.sonarqube</groupId> + <artifactId>sonar-plugin-api</artifactId> + <version>${apiVersion}</version> + <scope>provided</scope> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.sonarsource.sonar-packaging-maven-plugin</groupId> + <artifactId>sonar-packaging-maven-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <pluginClass>UiPlugin</pluginClass> + </configuration> + </plugin> + </plugins> + </build> +</project> 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 @@ +<table> + <thead> + <tr> + <th>Property</th> + <th>Value</th> + </tr> + </thead> + <tr> + <td>mandatoryString</td> + <td><%= widget_properties['mandatoryString'] -%></td> + </tr> + <tr> + <td>mandatoryInt</td> + <td><%= widget_properties['mandatoryInt'] -%></td> + </tr> +</table> 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 @@ <module>access-secured-props-plugin</module> <module>base-auth-plugin</module> <module>batch-plugin</module> + <module>dashboard-plugin</module> <module>extension-lifecycle-plugin</module> <module>global-property-change-plugin</module> <module>issue-action-plugin</module> |