]> source.dussan.org Git - sonarqube.git/commitdiff
Migrate UI ITs
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Mon, 15 Feb 2016 14:19:25 +0000 (15:19 +0100)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Mon, 15 Feb 2016 16:04:48 +0000 (17:04 +0100)
52 files changed:
it/it-plugins/pom.xml
it/it-plugins/required-measures-widgets-plugin/pom.xml [new file with mode: 0644]
it/it-plugins/required-measures-widgets-plugin/src/main/java/org/sonar/samples/AbstractWidget.java [new file with mode: 0644]
it/it-plugins/required-measures-widgets-plugin/src/main/java/org/sonar/samples/RequiredMeasuresWidgetsDashboard.java [new file with mode: 0644]
it/it-plugins/required-measures-widgets-plugin/src/main/java/org/sonar/samples/RequiredMeasuresWidgetsPlugin.java [new file with mode: 0644]
it/it-plugins/required-measures-widgets-plugin/src/main/java/org/sonar/samples/WidgetMandatoryAndOneOfSatisfied.java [new file with mode: 0644]
it/it-plugins/required-measures-widgets-plugin/src/main/java/org/sonar/samples/WidgetMandatoryNotSatisfied.java [new file with mode: 0644]
it/it-plugins/required-measures-widgets-plugin/src/main/java/org/sonar/samples/WidgetMandatorySatisfied.java [new file with mode: 0644]
it/it-plugins/required-measures-widgets-plugin/src/main/java/org/sonar/samples/WidgetMandatorySatisfiedButNotOneOf.java [new file with mode: 0644]
it/it-plugins/required-measures-widgets-plugin/src/main/java/org/sonar/samples/WidgetNoConstraints.java [new file with mode: 0644]
it/it-plugins/required-measures-widgets-plugin/src/main/java/org/sonar/samples/WidgetOneOfNotSatisfied.java [new file with mode: 0644]
it/it-plugins/required-measures-widgets-plugin/src/main/java/org/sonar/samples/WidgetOneOfSatisfied.java [new file with mode: 0644]
it/it-plugins/required-measures-widgets-plugin/src/main/java/org/sonar/samples/WidgetOneOfSatisfiedButNotMandatory.java [new file with mode: 0644]
it/it-plugins/required-measures-widgets-plugin/src/main/resources/WidgetMandatoryAndOneOfSatisfied.html.erb [new file with mode: 0644]
it/it-plugins/required-measures-widgets-plugin/src/main/resources/WidgetMandatoryNotSatisfied.html.erb [new file with mode: 0644]
it/it-plugins/required-measures-widgets-plugin/src/main/resources/WidgetMandatorySatisfied.html.erb [new file with mode: 0644]
it/it-plugins/required-measures-widgets-plugin/src/main/resources/WidgetMandatorySatisfiedButNotOneOf.html.erb [new file with mode: 0644]
it/it-plugins/required-measures-widgets-plugin/src/main/resources/WidgetNoConstraints.html.erb [new file with mode: 0644]
it/it-plugins/required-measures-widgets-plugin/src/main/resources/WidgetOneOfNotSatisfied.html.erb [new file with mode: 0644]
it/it-plugins/required-measures-widgets-plugin/src/main/resources/WidgetOneOfSatisfied.html.erb [new file with mode: 0644]
it/it-plugins/required-measures-widgets-plugin/src/main/resources/WidgetOneOfSatisfiedButNotMandatory.html.erb [new file with mode: 0644]
it/it-plugins/ui-extensions-plugin/pom.xml [new file with mode: 0644]
it/it-plugins/ui-extensions-plugin/src/main/java/FakePageDecorations.java [new file with mode: 0644]
it/it-plugins/ui-extensions-plugin/src/main/java/ResourceConfigurationPage.java [new file with mode: 0644]
it/it-plugins/ui-extensions-plugin/src/main/java/RubyApiGlobalPage.java [new file with mode: 0644]
it/it-plugins/ui-extensions-plugin/src/main/java/RubyApiProjectPage.java [new file with mode: 0644]
it/it-plugins/ui-extensions-plugin/src/main/java/UiExtensionsPlugin.java [new file with mode: 0644]
it/it-plugins/ui-extensions-plugin/src/main/resources/fake_page_decoration.html.erb [new file with mode: 0644]
it/it-plugins/ui-extensions-plugin/src/main/resources/org/sonar/ror/uiextensionsplugin/app/controllers/fake_app_controller.rb [new file with mode: 0644]
it/it-plugins/ui-extensions-plugin/src/main/resources/org/sonar/ror/uiextensionsplugin/app/controllers/resource_configuration_sample_controller.rb [new file with mode: 0644]
it/it-plugins/ui-extensions-plugin/src/main/resources/org/sonar/ror/uiextensionsplugin/app/helpers/fake_app_helper.rb [new file with mode: 0644]
it/it-plugins/ui-extensions-plugin/src/main/resources/org/sonar/ror/uiextensionsplugin/app/views/fake_app/_advanced.html.erb [new file with mode: 0644]
it/it-plugins/ui-extensions-plugin/src/main/resources/org/sonar/ror/uiextensionsplugin/app/views/fake_app/index.html.erb [new file with mode: 0644]
it/it-plugins/ui-extensions-plugin/src/main/resources/org/sonar/ror/uiextensionsplugin/app/views/resource_configuration_sample/index.html.erb [new file with mode: 0644]
it/it-plugins/ui-extensions-plugin/src/main/resources/org/sonar/ror/uiextensionsplugin/init.rb [new file with mode: 0644]
it/it-plugins/ui-extensions-plugin/src/main/resources/ruby-api-global-page.erb [new file with mode: 0644]
it/it-plugins/ui-extensions-plugin/src/main/resources/ruby-api-project.page.rb [new file with mode: 0644]
it/it-plugins/ui-extensions-plugin/src/main/resources/static/cute.jpg [new file with mode: 0644]
it/it-plugins/ui-extensions-plugin/src/main/resources/static/file.html [new file with mode: 0644]
it/it-tests/src/test/java/it/Category4Suite.java
it/it-tests/src/test/java/it/componentDashboard/DashboardTest.java
it/it-tests/src/test/java/it/serverSystem/ServerSystemTest.java
it/it-tests/src/test/java/it/ui/UiTest.java [new file with mode: 0644]
it/it-tests/src/test/java/it/uiExtension/UiExtensionsTest.java [new file with mode: 0644]
it/it-tests/src/test/resources/componentDashboard/DashboardTest/dashboard_extension/display-widgets-according-to-required-measures.html [new file with mode: 0644]
it/it-tests/src/test/resources/ui/UiTest/footer.html [new file with mode: 0644]
it/it-tests/src/test/resources/uiExtension/UiExtensionsTest/page-decoration.html [new file with mode: 0644]
it/it-tests/src/test/resources/uiExtension/UiExtensionsTest/resource-configuration-extension.html [new file with mode: 0644]
it/it-tests/src/test/resources/uiExtension/UiExtensionsTest/ruby-api-tester.html [new file with mode: 0644]
it/it-tests/src/test/resources/uiExtension/UiExtensionsTest/ruby-rails-app-advanced.html [new file with mode: 0644]
it/it-tests/src/test/resources/uiExtension/UiExtensionsTest/ruby-rails-app.html [new file with mode: 0644]
it/it-tests/src/test/resources/uiExtension/UiExtensionsTest/static-files.html [new file with mode: 0644]

index a44beb0b8f2dd8bbed261f72533f7ef95f5d891e..dfaf77516f2e02e9bbff74039cf6cc92b14afef8 100644 (file)
     <module>project-builder-plugin</module>
     <module>property-relocation-plugin</module>
     <module>property-sets-plugin</module>
+    <module>required-measures-widgets-plugin</module>
     <module>security-plugin</module>
     <module>server-plugin</module>
     <module>settings-encryption-plugin</module>
     <module>settings-plugin</module>
     <module>sonar-fake-plugin</module>
     <module>sonar-subcategories-plugin</module>
+    <module>ui-extensions-plugin</module>
     <module>issue-filter-plugin</module>
   </modules>
 </project>
diff --git a/it/it-plugins/required-measures-widgets-plugin/pom.xml b/it/it-plugins/required-measures-widgets-plugin/pom.xml
new file mode 100644 (file)
index 0000000..050e8c8
--- /dev/null
@@ -0,0 +1,39 @@
+<?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>required-measures-widgets-plugin</artifactId>
+  <packaging>sonar-plugin</packaging>
+  <version>1.0-SNAPSHOT</version>
+  <description>Plugins :: RequiredMeasures Widgets plugin</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>
+        <version>1.15</version>
+        <extensions>true</extensions>
+        <configuration>
+          <pluginClass>org.sonar.samples.RequiredMeasuresWidgetsPlugin</pluginClass>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>
diff --git a/it/it-plugins/required-measures-widgets-plugin/src/main/java/org/sonar/samples/AbstractWidget.java b/it/it-plugins/required-measures-widgets-plugin/src/main/java/org/sonar/samples/AbstractWidget.java
new file mode 100644 (file)
index 0000000..e142c13
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * 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.
+ */
+package org.sonar.samples;
+
+import org.sonar.api.web.AbstractRubyTemplate;
+import org.sonar.api.web.RubyRailsWidget;
+
+public abstract class AbstractWidget extends AbstractRubyTemplate implements RubyRailsWidget {
+
+  public String getId() {
+    return this.getClass().getSimpleName();
+  }
+
+  public String getTitle() {
+    return getId();
+  }
+
+  @Override
+  protected String getTemplatePath() {
+    return "/" + getId() + ".html.erb";
+  }
+}
diff --git a/it/it-plugins/required-measures-widgets-plugin/src/main/java/org/sonar/samples/RequiredMeasuresWidgetsDashboard.java b/it/it-plugins/required-measures-widgets-plugin/src/main/java/org/sonar/samples/RequiredMeasuresWidgetsDashboard.java
new file mode 100644 (file)
index 0000000..5799449
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * 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.
+ */
+package org.sonar.samples;
+
+import org.sonar.api.web.Dashboard;
+import org.sonar.api.web.DashboardLayout;
+import org.sonar.api.web.DashboardTemplate;
+
+public final class RequiredMeasuresWidgetsDashboard extends DashboardTemplate {
+
+  @Override
+  public String getName() {
+    return "RequiredMeasuresWidgetsDashboard";
+  }
+
+  @Override
+  public Dashboard createDashboard() {
+    Dashboard dashboard = Dashboard.create();
+    dashboard.setLayout(DashboardLayout.TWO_COLUMNS);
+    dashboard.addWidget("WidgetMandatoryAndOneOfSatisfied", 1);
+    dashboard.addWidget("WidgetMandatoryNotSatisfied", 1);
+    dashboard.addWidget("WidgetMandatorySatisfied", 1);
+    dashboard.addWidget("WidgetMandatorySatisfiedButNotOneOf", 1);
+    dashboard.addWidget("WidgetNoConstraints", 1);
+    dashboard.addWidget("WidgetOneOfNotSatisfied", 1);
+    dashboard.addWidget("WidgetOneOfSatisfied", 1);
+    dashboard.addWidget("WidgetOneOfSatisfiedButNotMandatory", 1);
+    return dashboard;
+  }
+
+}
diff --git a/it/it-plugins/required-measures-widgets-plugin/src/main/java/org/sonar/samples/RequiredMeasuresWidgetsPlugin.java b/it/it-plugins/required-measures-widgets-plugin/src/main/java/org/sonar/samples/RequiredMeasuresWidgetsPlugin.java
new file mode 100644 (file)
index 0000000..b428663
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * 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.
+ */
+package org.sonar.samples;
+
+import java.util.Arrays;
+import java.util.List;
+import org.sonar.api.SonarPlugin;
+
+public final class RequiredMeasuresWidgetsPlugin extends SonarPlugin {
+  @SuppressWarnings({"unchecked", "rawtypes"})
+  public List getExtensions() {
+    return Arrays.asList(RequiredMeasuresWidgetsDashboard.class,
+        WidgetMandatoryAndOneOfSatisfied.class, WidgetMandatoryNotSatisfied.class,
+        WidgetMandatorySatisfied.class, WidgetMandatorySatisfiedButNotOneOf.class,
+        WidgetNoConstraints.class, WidgetOneOfNotSatisfied.class,
+        WidgetOneOfSatisfied.class, WidgetOneOfSatisfiedButNotMandatory.class);
+  }
+}
diff --git a/it/it-plugins/required-measures-widgets-plugin/src/main/java/org/sonar/samples/WidgetMandatoryAndOneOfSatisfied.java b/it/it-plugins/required-measures-widgets-plugin/src/main/java/org/sonar/samples/WidgetMandatoryAndOneOfSatisfied.java
new file mode 100644 (file)
index 0000000..fcda901
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+package org.sonar.samples;
+
+import org.sonar.api.web.RequiredMeasures;
+
+@RequiredMeasures(allOf = {"lines", "complexity"}, anyOf = {"non-core-metric", "lines", "complexity"})
+public class WidgetMandatoryAndOneOfSatisfied extends AbstractWidget {
+}
diff --git a/it/it-plugins/required-measures-widgets-plugin/src/main/java/org/sonar/samples/WidgetMandatoryNotSatisfied.java b/it/it-plugins/required-measures-widgets-plugin/src/main/java/org/sonar/samples/WidgetMandatoryNotSatisfied.java
new file mode 100644 (file)
index 0000000..07bc267
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+package org.sonar.samples;
+
+import org.sonar.api.web.RequiredMeasures;
+
+@RequiredMeasures(allOf = {"lines", "non-core-metric"})
+public class WidgetMandatoryNotSatisfied extends AbstractWidget {
+}
diff --git a/it/it-plugins/required-measures-widgets-plugin/src/main/java/org/sonar/samples/WidgetMandatorySatisfied.java b/it/it-plugins/required-measures-widgets-plugin/src/main/java/org/sonar/samples/WidgetMandatorySatisfied.java
new file mode 100644 (file)
index 0000000..83931b8
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+package org.sonar.samples;
+
+import org.sonar.api.web.RequiredMeasures;
+
+@RequiredMeasures(allOf={"lines", "complexity"})
+public class WidgetMandatorySatisfied extends AbstractWidget {
+}
diff --git a/it/it-plugins/required-measures-widgets-plugin/src/main/java/org/sonar/samples/WidgetMandatorySatisfiedButNotOneOf.java b/it/it-plugins/required-measures-widgets-plugin/src/main/java/org/sonar/samples/WidgetMandatorySatisfiedButNotOneOf.java
new file mode 100644 (file)
index 0000000..938490f
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+package org.sonar.samples;
+
+import org.sonar.api.web.RequiredMeasures;
+
+@RequiredMeasures(allOf={"lines", "complexity"}, anyOf={"non-core-metric1", "non-core-metric2", "non-core-metric3"})
+public class WidgetMandatorySatisfiedButNotOneOf extends AbstractWidget {
+}
diff --git a/it/it-plugins/required-measures-widgets-plugin/src/main/java/org/sonar/samples/WidgetNoConstraints.java b/it/it-plugins/required-measures-widgets-plugin/src/main/java/org/sonar/samples/WidgetNoConstraints.java
new file mode 100644 (file)
index 0000000..ae2cc61
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * 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.
+ */
+package org.sonar.samples;
+
+
+/**
+ * Widget without @RequiredMeasures annotation => should always be displayed
+ */
+public class WidgetNoConstraints extends AbstractWidget {
+}
diff --git a/it/it-plugins/required-measures-widgets-plugin/src/main/java/org/sonar/samples/WidgetOneOfNotSatisfied.java b/it/it-plugins/required-measures-widgets-plugin/src/main/java/org/sonar/samples/WidgetOneOfNotSatisfied.java
new file mode 100644 (file)
index 0000000..9322e59
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+package org.sonar.samples;
+
+import org.sonar.api.web.RequiredMeasures;
+
+@RequiredMeasures(anyOf={"non-core-metric1", "non-core-metric2", "non-core-metric3"})
+public class WidgetOneOfNotSatisfied extends AbstractWidget {
+}
diff --git a/it/it-plugins/required-measures-widgets-plugin/src/main/java/org/sonar/samples/WidgetOneOfSatisfied.java b/it/it-plugins/required-measures-widgets-plugin/src/main/java/org/sonar/samples/WidgetOneOfSatisfied.java
new file mode 100644 (file)
index 0000000..fa22bd1
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+package org.sonar.samples;
+
+import org.sonar.api.web.RequiredMeasures;
+
+@RequiredMeasures(anyOf={"non-core-metric", "lines", "complexity"})
+public class WidgetOneOfSatisfied extends AbstractWidget {
+}
diff --git a/it/it-plugins/required-measures-widgets-plugin/src/main/java/org/sonar/samples/WidgetOneOfSatisfiedButNotMandatory.java b/it/it-plugins/required-measures-widgets-plugin/src/main/java/org/sonar/samples/WidgetOneOfSatisfiedButNotMandatory.java
new file mode 100644 (file)
index 0000000..27916c1
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+package org.sonar.samples;
+
+import org.sonar.api.web.RequiredMeasures;
+
+@RequiredMeasures(allOf={"non-core-metric", "complexity"}, anyOf={"lines", "ncloc"})
+public class WidgetOneOfSatisfiedButNotMandatory extends AbstractWidget {
+}
diff --git a/it/it-plugins/required-measures-widgets-plugin/src/main/resources/WidgetMandatoryAndOneOfSatisfied.html.erb b/it/it-plugins/required-measures-widgets-plugin/src/main/resources/WidgetMandatoryAndOneOfSatisfied.html.erb
new file mode 100644 (file)
index 0000000..95741e8
--- /dev/null
@@ -0,0 +1 @@
+<b>WidgetMandatoryAndOneOfSatisfied</b>
\ No newline at end of file
diff --git a/it/it-plugins/required-measures-widgets-plugin/src/main/resources/WidgetMandatoryNotSatisfied.html.erb b/it/it-plugins/required-measures-widgets-plugin/src/main/resources/WidgetMandatoryNotSatisfied.html.erb
new file mode 100644 (file)
index 0000000..a112014
--- /dev/null
@@ -0,0 +1,2 @@
+<b>WidgetMandatoryNotSatisfied</b>
+<b>SHOULD NOT BE DISPLAYED</b>
\ No newline at end of file
diff --git a/it/it-plugins/required-measures-widgets-plugin/src/main/resources/WidgetMandatorySatisfied.html.erb b/it/it-plugins/required-measures-widgets-plugin/src/main/resources/WidgetMandatorySatisfied.html.erb
new file mode 100644 (file)
index 0000000..3d363b6
--- /dev/null
@@ -0,0 +1 @@
+<b>WidgetMandatorySatisfied</b>
\ No newline at end of file
diff --git a/it/it-plugins/required-measures-widgets-plugin/src/main/resources/WidgetMandatorySatisfiedButNotOneOf.html.erb b/it/it-plugins/required-measures-widgets-plugin/src/main/resources/WidgetMandatorySatisfiedButNotOneOf.html.erb
new file mode 100644 (file)
index 0000000..69e734e
--- /dev/null
@@ -0,0 +1,2 @@
+<b>WidgetMandatorySatisfiedButNotOneOf</b>
+<b>SHOULD NOT BE DISPLAYED</b>
\ No newline at end of file
diff --git a/it/it-plugins/required-measures-widgets-plugin/src/main/resources/WidgetNoConstraints.html.erb b/it/it-plugins/required-measures-widgets-plugin/src/main/resources/WidgetNoConstraints.html.erb
new file mode 100644 (file)
index 0000000..6279775
--- /dev/null
@@ -0,0 +1 @@
+<b>WidgetNoConstraints</b>
\ No newline at end of file
diff --git a/it/it-plugins/required-measures-widgets-plugin/src/main/resources/WidgetOneOfNotSatisfied.html.erb b/it/it-plugins/required-measures-widgets-plugin/src/main/resources/WidgetOneOfNotSatisfied.html.erb
new file mode 100644 (file)
index 0000000..583581f
--- /dev/null
@@ -0,0 +1,2 @@
+<b>WidgetOneOfNotSatisfied</b>
+<b>SHOULD NOT BE DISPLAYED</b>
\ No newline at end of file
diff --git a/it/it-plugins/required-measures-widgets-plugin/src/main/resources/WidgetOneOfSatisfied.html.erb b/it/it-plugins/required-measures-widgets-plugin/src/main/resources/WidgetOneOfSatisfied.html.erb
new file mode 100644 (file)
index 0000000..0bdb613
--- /dev/null
@@ -0,0 +1 @@
+<b>WidgetOneOfSatisfied</b>
\ No newline at end of file
diff --git a/it/it-plugins/required-measures-widgets-plugin/src/main/resources/WidgetOneOfSatisfiedButNotMandatory.html.erb b/it/it-plugins/required-measures-widgets-plugin/src/main/resources/WidgetOneOfSatisfiedButNotMandatory.html.erb
new file mode 100644 (file)
index 0000000..3769dd8
--- /dev/null
@@ -0,0 +1,2 @@
+<b>WidgetOneOfSatisfiedButNotMandatory</b>
+<b>SHOULD NOT BE DISPLAYED</b>
\ No newline at end of file
diff --git a/it/it-plugins/ui-extensions-plugin/pom.xml b/it/it-plugins/ui-extensions-plugin/pom.xml
new file mode 100644 (file)
index 0000000..aa84393
--- /dev/null
@@ -0,0 +1,39 @@
+<?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>ui-extensions-plugin</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <packaging>sonar-plugin</packaging>
+  <name>SonarQube Integration Tests :: Plugins :: UI extensions</name>
+  <description>Main plugin for UT extensions 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>
+        <version>1.15</version>
+        <extensions>true</extensions>
+        <configuration>
+          <pluginClass>UiExtensionsPlugin</pluginClass>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>
diff --git a/it/it-plugins/ui-extensions-plugin/src/main/java/FakePageDecorations.java b/it/it-plugins/ui-extensions-plugin/src/main/java/FakePageDecorations.java
new file mode 100644 (file)
index 0000000..bc05bb2
--- /dev/null
@@ -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 org.sonar.api.web.PageDecoration;
+
+public class FakePageDecorations extends PageDecoration {
+
+  @Override
+  protected String getTemplatePath() {
+    return "/fake_page_decoration.html.erb";
+  }
+}
diff --git a/it/it-plugins/ui-extensions-plugin/src/main/java/ResourceConfigurationPage.java b/it/it-plugins/ui-extensions-plugin/src/main/java/ResourceConfigurationPage.java
new file mode 100644 (file)
index 0000000..b804359
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * 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.resources.Qualifiers;
+import org.sonar.api.web.NavigationSection;
+import org.sonar.api.web.Page;
+import org.sonar.api.web.ResourceQualifier;
+import org.sonar.api.web.UserRole;
+
+@NavigationSection(NavigationSection.RESOURCE_CONFIGURATION)
+@UserRole(UserRole.ADMIN)
+@ResourceQualifier({Qualifiers.PROJECT})
+public class ResourceConfigurationPage implements Page {
+
+  public String getId() {
+    return "/resource_configuration_sample";
+  }
+
+  public String getTitle() {
+    return "Resource Configuration";
+  }
+
+}
diff --git a/it/it-plugins/ui-extensions-plugin/src/main/java/RubyApiGlobalPage.java b/it/it-plugins/ui-extensions-plugin/src/main/java/RubyApiGlobalPage.java
new file mode 100644 (file)
index 0000000..37c3ae6
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * 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.NavigationSection;
+import org.sonar.api.web.RubyRailsPage;
+
+@NavigationSection({NavigationSection.HOME})
+public class RubyApiGlobalPage extends AbstractRubyTemplate implements RubyRailsPage {
+
+  public String getId() {
+    return getClass().getName();
+  }
+
+  public String getTitle() {
+    return "Ruby API Global Page";
+  }
+
+  @Override
+  public String getTemplatePath() {
+    return "/ruby-api-global-page.erb";
+  }
+
+}
diff --git a/it/it-plugins/ui-extensions-plugin/src/main/java/RubyApiProjectPage.java b/it/it-plugins/ui-extensions-plugin/src/main/java/RubyApiProjectPage.java
new file mode 100644 (file)
index 0000000..c868215
--- /dev/null
@@ -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.AbstractRubyTemplate;
+import org.sonar.api.web.NavigationSection;
+import org.sonar.api.web.RubyRailsPage;
+import org.sonar.api.web.UserRole;
+
+@NavigationSection({NavigationSection.RESOURCE})
+@UserRole(UserRole.USER)
+public class RubyApiProjectPage extends AbstractRubyTemplate implements RubyRailsPage {
+
+  public String getId() {
+    return getClass().getName();
+  }
+
+  public String getTitle() {
+    return "Ruby API Project Page";
+  }
+
+  @Override
+  public String getTemplatePath() {
+    return "/ruby-api-project-page.erb";
+  }
+
+}
diff --git a/it/it-plugins/ui-extensions-plugin/src/main/java/UiExtensionsPlugin.java b/it/it-plugins/ui-extensions-plugin/src/main/java/UiExtensionsPlugin.java
new file mode 100644 (file)
index 0000000..e75149e
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * 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 UiExtensionsPlugin extends SonarPlugin {
+  public List getExtensions() {
+    return Arrays.asList(
+      FakePageDecorations.class,
+      RubyApiGlobalPage.class,
+      RubyApiProjectPage.class,
+      ResourceConfigurationPage.class
+    );
+  }
+}
diff --git a/it/it-plugins/ui-extensions-plugin/src/main/resources/fake_page_decoration.html.erb b/it/it-plugins/ui-extensions-plugin/src/main/resources/fake_page_decoration.html.erb
new file mode 100644 (file)
index 0000000..e888224
--- /dev/null
@@ -0,0 +1,22 @@
+<% content_for :script do %>
+  <script>
+    function fakeFooter() {
+      $j('#fake-footer').html("Footer generated by plugin");
+    }
+  </script>
+<% end %>
+
+
+
+<% content_for :header do %>
+  <div id="fake-header">Header generated by plugin</div>
+<% end %>
+
+
+
+<% content_for :footer do %>
+  <div id="fake-footer"></div>
+  <script>
+    fakeFooter();
+  </script>
+<% end %>
diff --git a/it/it-plugins/ui-extensions-plugin/src/main/resources/org/sonar/ror/uiextensionsplugin/app/controllers/fake_app_controller.rb b/it/it-plugins/ui-extensions-plugin/src/main/resources/org/sonar/ror/uiextensionsplugin/app/controllers/fake_app_controller.rb
new file mode 100644 (file)
index 0000000..6442fac
--- /dev/null
@@ -0,0 +1,10 @@
+class FakeAppController < ApplicationController
+  SECTION=Navigation::SECTION_HOME
+  def index
+    @title = 'Fake application'
+  end
+
+  def advanced
+    render :partial => 'fake_app/advanced', :locals => {:properties => Property.find(:all)}
+  end
+end
diff --git a/it/it-plugins/ui-extensions-plugin/src/main/resources/org/sonar/ror/uiextensionsplugin/app/controllers/resource_configuration_sample_controller.rb b/it/it-plugins/ui-extensions-plugin/src/main/resources/org/sonar/ror/uiextensionsplugin/app/controllers/resource_configuration_sample_controller.rb
new file mode 100644 (file)
index 0000000..9d735a0
--- /dev/null
@@ -0,0 +1,9 @@
+class ResourceConfigurationSampleController < ApplicationController
+
+  SECTION=Navigation::SECTION_RESOURCE
+
+  def index
+    init_resource_for_role(:user, :resource) if params[:resource]
+  end
+
+end
diff --git a/it/it-plugins/ui-extensions-plugin/src/main/resources/org/sonar/ror/uiextensionsplugin/app/helpers/fake_app_helper.rb b/it/it-plugins/ui-extensions-plugin/src/main/resources/org/sonar/ror/uiextensionsplugin/app/helpers/fake_app_helper.rb
new file mode 100644 (file)
index 0000000..dbe0021
--- /dev/null
@@ -0,0 +1,5 @@
+module FakeAppHelper
+  def call_helper
+    'message generated by helper'
+  end
+end
diff --git a/it/it-plugins/ui-extensions-plugin/src/main/resources/org/sonar/ror/uiextensionsplugin/app/views/fake_app/_advanced.html.erb b/it/it-plugins/ui-extensions-plugin/src/main/resources/org/sonar/ror/uiextensionsplugin/app/views/fake_app/_advanced.html.erb
new file mode 100644 (file)
index 0000000..082cd4c
--- /dev/null
@@ -0,0 +1,9 @@
+<div id="fake-div">
+
+<p>This page requests database and use RoR partial</p>
+
+<% unless properties.empty? %>
+  <p>Database connection OK</p>
+<% end %>
+
+</div>
\ No newline at end of file
diff --git a/it/it-plugins/ui-extensions-plugin/src/main/resources/org/sonar/ror/uiextensionsplugin/app/views/fake_app/index.html.erb b/it/it-plugins/ui-extensions-plugin/src/main/resources/org/sonar/ror/uiextensionsplugin/app/views/fake_app/index.html.erb
new file mode 100644 (file)
index 0000000..3686424
--- /dev/null
@@ -0,0 +1,2 @@
+<span id="fake-app"><%= @title -%></span>
+<span id="helper-test"><%= call_helper -%></span>
diff --git a/it/it-plugins/ui-extensions-plugin/src/main/resources/org/sonar/ror/uiextensionsplugin/app/views/resource_configuration_sample/index.html.erb b/it/it-plugins/ui-extensions-plugin/src/main/resources/org/sonar/ror/uiextensionsplugin/app/views/resource_configuration_sample/index.html.erb
new file mode 100644 (file)
index 0000000..b2b22ef
--- /dev/null
@@ -0,0 +1,2 @@
+<div>Hello <%= @resource.key %> ! </div>
+
diff --git a/it/it-plugins/ui-extensions-plugin/src/main/resources/org/sonar/ror/uiextensionsplugin/init.rb b/it/it-plugins/ui-extensions-plugin/src/main/resources/org/sonar/ror/uiextensionsplugin/init.rb
new file mode 100644 (file)
index 0000000..65006be
--- /dev/null
@@ -0,0 +1 @@
+# initialization script
\ No newline at end of file
diff --git a/it/it-plugins/ui-extensions-plugin/src/main/resources/ruby-api-global-page.erb b/it/it-plugins/ui-extensions-plugin/src/main/resources/ruby-api-global-page.erb
new file mode 100644 (file)
index 0000000..40aea86
--- /dev/null
@@ -0,0 +1,33 @@
+<h1>Ruby API Global Page</h1>
+
+<% success=true %>
+
+<% if logged_in? %>
+  <h2>User Properties</h2>
+  <ul id="user_properties">
+      <%
+        current_user.set_property({:prop_key => 'foo', :text_value => 'bar'})
+        test=current_user.property_value('foo')=='bar'
+        success&=test
+      %>
+      <li>create: <%= 'OK' if test -%></li>
+
+      <%
+        current_user.delete_property('foo')
+        test=current_user.property('foo').nil?
+        success&=test
+      %>
+      <li>delete: <%= 'OK' if test -%></li>
+
+      <%
+        current_user.set_property({:prop_key => 'foo', :text_value => 'bar'})
+        current_user.set_property({:prop_key => 'foo', :text_value => 'newbar'})
+        test=current_user.property_value('foo')=='newbar'
+        success&=test
+      %>
+      <li>update: <%= 'OK' if test -%></li>
+  </ul>
+<% end %>
+
+<br/>
+<p>Result: <span id="ruby-api-result"><%= success ? 'OK' : 'FAIL' %></span></p>
diff --git a/it/it-plugins/ui-extensions-plugin/src/main/resources/ruby-api-project.page.rb b/it/it-plugins/ui-extensions-plugin/src/main/resources/ruby-api-project.page.rb
new file mode 100644 (file)
index 0000000..7cbc55a
--- /dev/null
@@ -0,0 +1,3 @@
+<h1>Ruby API Project</h1>
+
+<p>Project name is: <span id="ruby-api-project"><%= @project.name -%></span></p>
diff --git a/it/it-plugins/ui-extensions-plugin/src/main/resources/static/cute.jpg b/it/it-plugins/ui-extensions-plugin/src/main/resources/static/cute.jpg
new file mode 100644 (file)
index 0000000..20f59bc
Binary files /dev/null and b/it/it-plugins/ui-extensions-plugin/src/main/resources/static/cute.jpg differ
diff --git a/it/it-plugins/ui-extensions-plugin/src/main/resources/static/file.html b/it/it-plugins/ui-extensions-plugin/src/main/resources/static/file.html
new file mode 100644 (file)
index 0000000..6b0300e
--- /dev/null
@@ -0,0 +1,6 @@
+<html>
+  <body>
+    Text from static resource
+    <img id="cute-image" src="cute.jpg"/>
+  </body>
+</html>
index 5dfc77d90a406e2ee2c33f3f13e508888cf3fc87..ee4802b478da82699d77b81be71ec28047b2a688 100644 (file)
@@ -33,6 +33,8 @@ import it.duplication.DuplicationsTest;
 import it.projectComparison.ProjectComparisonTest;
 import it.projectEvent.EventTest;
 import it.serverSystem.ServerSystemTest;
+import it.ui.UiTest;
+import it.uiExtension.UiExtensionsTest;
 import it.user.BaseIdentityProviderTest;
 import it.user.FavouriteTest;
 import it.user.ForceAuthenticationTest;
@@ -77,7 +79,11 @@ import static util.ItUtils.xooPlugin;
   // project comparison
   ProjectComparisonTest.class,
   // component search
-  AllProjectsTest.class
+  AllProjectsTest.class,
+  // ui
+  UiTest.class,
+  // ui extensions
+  UiExtensionsTest.class
 })
 public class Category4Suite {
 
@@ -93,6 +99,10 @@ public class Category4Suite {
 
     // Used in DashboardTest
     .addPlugin(pluginArtifact("dashboard-plugin"))
+    .addPlugin(pluginArtifact("required-measures-widgets-plugin"))
+
+    // Used in UiExtensionsTest
+    .addPlugin(pluginArtifact("ui-extensions-plugin"))
 
     .build();
 }
index b4e57a57af93298ab6e00904e5b168d855337c79..b22bcc3807f40336505455d4352490e3ae77e0a9 100644 (file)
@@ -47,6 +47,8 @@ public class DashboardTest {
     seleniumSuite("dashboard_extension",
       "/componentDashboard/DashboardTest/dashboard_extension/dashboard-should-be-registered.html",
       "/componentDashboard/DashboardTest/dashboard_extension/test-location-of-widgets.html",
+      // SONAR-3323
+      "/componentDashboard/DashboardTest/dashboard_extension/display-widgets-according-to-required-measures.html",
 
       // SSF-19
       "/componentDashboard/DashboardTest/dashboard_extension/xss.html");
index 578958f4ade093e35d73753b78849496b245812f..412b8b07c071c453545ba6e9f72ca23fef2a3aaf 100644 (file)
@@ -108,6 +108,28 @@ public class ServerSystemTest {
     new SeleneseTest(selenese).runOn(orchestrator);
   }
 
+  @Test
+  public void http_response_should_be_gzipped() throws IOException {
+    HttpClient httpclient = new DefaultHttpClient();
+    try {
+      HttpGet get = new HttpGet(orchestrator.getServer().getUrl());
+      HttpResponse response = httpclient.execute(get);
+
+      assertThat(response.getStatusLine().getStatusCode()).isEqualTo(200);
+      assertThat(response.getLastHeader("Content-Encoding")).isNull();
+      EntityUtils.consume(response.getEntity());
+
+      get = new HttpGet(orchestrator.getServer().getUrl());
+      get.addHeader("Accept-Encoding", "gzip, deflate");
+      response = httpclient.execute(get);
+      assertThat(response.getLastHeader("Content-Encoding").getValue()).isEqualTo("gzip");
+      EntityUtils.consume(response.getEntity());
+
+    } finally {
+      httpclient.getConnectionManager().shutdown();
+    }
+  }
+
   /**
    * SONAR-3962
    */
diff --git a/it/it-tests/src/test/java/it/ui/UiTest.java b/it/it-tests/src/test/java/it/ui/UiTest.java
new file mode 100644 (file)
index 0000000..ac3bc9c
--- /dev/null
@@ -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.
+ */
+package it.ui;
+
+import com.sonar.orchestrator.Orchestrator;
+import com.sonar.orchestrator.selenium.Selenese;
+import it.Category4Suite;
+import org.junit.ClassRule;
+import org.junit.Test;
+import util.selenium.SeleneseTest;
+
+public class UiTest {
+
+  @ClassRule
+  public static Orchestrator orchestrator = Category4Suite.ORCHESTRATOR;
+
+  @Test
+  public void test_footer() {
+    new SeleneseTest(
+      Selenese.builder().setHtmlTestsInClasspath("ui-footer",
+        "/ui/UiTest/footer.html"
+      ).build()).runOn(orchestrator);
+  }
+
+}
diff --git a/it/it-tests/src/test/java/it/uiExtension/UiExtensionsTest.java b/it/it-tests/src/test/java/it/uiExtension/UiExtensionsTest.java
new file mode 100644 (file)
index 0000000..decffda
--- /dev/null
@@ -0,0 +1,106 @@
+/*
+ * 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.
+ */
+package it.uiExtension;
+
+import com.sonar.orchestrator.Orchestrator;
+import com.sonar.orchestrator.selenium.Selenese;
+import it.Category4Suite;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.util.EntityUtils;
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
+import org.junit.Test;
+import util.selenium.SeleneseTest;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class UiExtensionsTest {
+
+  @ClassRule
+  public static Orchestrator orchestrator = Category4Suite.ORCHESTRATOR;
+
+  @BeforeClass
+  public static void setUp() throws Exception {
+    orchestrator.resetData();
+    orchestrator.getServer().provisionProject("sample", "Sample");
+  }
+
+  @Test
+  public void test_static_files() {
+    new SeleneseTest(
+      Selenese.builder().setHtmlTestsInClasspath("ui-static-files",
+        "/uiExtension/UiExtensionsTest/static-files.html"
+        ).build()).runOn(orchestrator);
+  }
+
+  /**
+   * SONAR-3555
+   */
+  @Test
+  public void content_type_of_static_files_is_set() throws Exception {
+    HttpClient httpclient = new DefaultHttpClient();
+    try {
+      HttpGet get = new HttpGet(orchestrator.getServer().getUrl() + "/static/uiextensionsplugin/cute.jpg");
+      HttpResponse response = httpclient.execute(get);
+      assertThat(response.getLastHeader("Content-Type").getValue()).isEqualTo("image/jpeg");
+
+      EntityUtils.consume(response.getEntity());
+
+    } finally {
+      httpclient.getConnectionManager().shutdown();
+    }
+  }
+
+  /**
+   * SONAR-2376
+   */
+  @Test
+  public void test_page_decoration() {
+    new SeleneseTest(
+      Selenese.builder().setHtmlTestsInClasspath("ui-page-decoration",
+        "/uiExtension/UiExtensionsTest/page-decoration.html"
+        ).build()).runOn(orchestrator);
+  }
+
+  @Test
+  public void test_ruby_extensions() {
+    Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("ui-ruby-extensions",
+      "/uiExtension/UiExtensionsTest/ruby-api-tester.html",
+      "/uiExtension/UiExtensionsTest/ruby-rails-app.html",
+      "/uiExtension/UiExtensionsTest/ruby-rails-app-advanced.html"
+      ).build();
+    orchestrator.executeSelenese(selenese);
+  }
+
+  /**
+   * SONAR-4173
+   */
+  @Test
+  public void test_resource_configuration_extension() {
+    new SeleneseTest(
+      Selenese.builder().setHtmlTestsInClasspath("resource-configuration-extension",
+        "/uiExtension/UiExtensionsTest/resource-configuration-extension.html"
+        ).build()).runOn(orchestrator);
+  }
+
+}
diff --git a/it/it-tests/src/test/resources/componentDashboard/DashboardTest/dashboard_extension/display-widgets-according-to-required-measures.html b/it/it-tests/src/test/resources/componentDashboard/DashboardTest/dashboard_extension/display-widgets-according-to-required-measures.html
new file mode 100644 (file)
index 0000000..161dba0
--- /dev/null
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+  <thead>
+  <tr>
+    <td rowspan="1" colspan="3">should-display-widgets-according-to-required-measures</td>
+  </tr>
+  </thead>
+  <tbody>
+  <tr>
+    <td>open</td>
+    <td>
+      /dashboard/index/sample:src/main/xoo/sample?name=RequiredMeasuresWidgetsDashboard
+    </td>
+    <td></td>
+  </tr>
+  <tr>
+    <td>waitForText</td>
+    <td>dashboard</td>
+    <td>*WidgetMandatoryAndOneOfSatisfied*WidgetMandatorySatisfied*WidgetNoConstraints*WidgetOneOfSatisfied*</td>
+  </tr>
+  </tbody>
+</table>
+</body>
+</html>
diff --git a/it/it-tests/src/test/resources/ui/UiTest/footer.html b/it/it-tests/src/test/resources/ui/UiTest/footer.html
new file mode 100644 (file)
index 0000000..d31fd4b
--- /dev/null
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+  <thead>
+  <tr>
+    <td rowspan="1" colspan="3">footer</td>
+  </tr>
+  </thead>
+  <tbody>
+  <tr>
+    <td>open</td>
+    <td>/</td>
+    <td></td>
+  </tr>
+  <tr>
+    <td>assertText</td>
+    <td>footer</td>
+    <td>*This application is based on SonarQubeâ„¢ but is not an official version provided by SonarSource SA*</td>
+  </tr>
+  <tr>
+    <td>assertText</td>
+    <td>footer</td>
+    <td>*Version *.*-SNAPSHOT* - Community - Documentation - Get Support - Plugins*</td>
+  </tr>
+  </tbody>
+</table>
+</body>
+</html>
diff --git a/it/it-tests/src/test/resources/uiExtension/UiExtensionsTest/page-decoration.html b/it/it-tests/src/test/resources/uiExtension/UiExtensionsTest/page-decoration.html
new file mode 100644 (file)
index 0000000..a50beaf
--- /dev/null
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
+  <title>page-decoration</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+  <tbody>
+  <tr>
+       <td>open</td>
+       <td>/</td>
+       <td></td>
+</tr>
+<tr>
+       <td>assertText</td>
+       <td>fake-header</td>
+       <td>Header generated by plugin</td>
+</tr>
+<tr>
+       <td>assertText</td>
+       <td>fake-footer</td>
+       <td>*Footer generated by plugin*</td>
+</tr>
+</tbody>
+</table>
+</body>
+</html>
diff --git a/it/it-tests/src/test/resources/uiExtension/UiExtensionsTest/resource-configuration-extension.html b/it/it-tests/src/test/resources/uiExtension/UiExtensionsTest/resource-configuration-extension.html
new file mode 100644 (file)
index 0000000..4cfbd4f
--- /dev/null
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
+  <title>resource-configuration-extension</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+  <thead>
+  <tr>
+    <td rowspan="1" colspan="3">ruby-api</td>
+  </tr>
+  </thead>
+  <tbody>
+  <tr>
+    <td>open</td>
+    <td>/sessions/login</td>
+    <td></td>
+  </tr>
+  <tr>
+    <td>type</td>
+    <td>login</td>
+    <td>admin</td>
+  </tr>
+  <tr>
+    <td>type</td>
+    <td>password</td>
+    <td>admin</td>
+  </tr>
+  <tr>
+    <td>clickAndWait</td>
+    <td>commit</td>
+    <td></td>
+  </tr>
+  <tr>
+    <td>open</td>
+    <td>/resource_configuration_sample?resource=sample</td>
+    <td></td>
+  </tr>
+  <tr>
+    <td>assertText</td>
+    <td>content</td>
+    <td>*sample*</td>
+  </tr>
+  </tbody>
+</table>
+</body>
+</html>
diff --git a/it/it-tests/src/test/resources/uiExtension/UiExtensionsTest/ruby-api-tester.html b/it/it-tests/src/test/resources/uiExtension/UiExtensionsTest/ruby-api-tester.html
new file mode 100644 (file)
index 0000000..b9adf52
--- /dev/null
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
+  <title>ruby-api</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+  <thead>
+  <tr>
+    <td rowspan="1" colspan="3">ruby-api</td>
+  </tr>
+  </thead>
+  <tbody>
+  <tr>
+    <td>open</td>
+    <td>/</td>
+    <td></td>
+  </tr>
+  <tr>
+    <td>waitForElementPresent</td>
+    <td>link=Ruby API Global Page</td>
+    <td></td>
+  </tr>
+  <tr>
+    <td>clickAndWait</td>
+    <td>link=Ruby API Global Page</td>
+    <td></td>
+  </tr>
+  <tr>
+    <td>assertText</td>
+    <td>ruby-api-result</td>
+    <td>OK</td>
+  </tr>
+  </tbody>
+</table>
+</body>
+</html>
diff --git a/it/it-tests/src/test/resources/uiExtension/UiExtensionsTest/ruby-rails-app-advanced.html b/it/it-tests/src/test/resources/uiExtension/UiExtensionsTest/ruby-rails-app-advanced.html
new file mode 100644 (file)
index 0000000..025c14a
--- /dev/null
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
+  <title>ruby-rails-app</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+  <tbody>
+  <tr>
+    <td>open</td>
+    <td>/fake_app/advanced</td>
+    <td></td>
+  </tr>
+  <tr>
+    <td>assertText</td>
+    <td>fake-div</td>
+    <td>*This page requests database and use RoR partial*</td>
+  </tr>
+  <tr>
+    <td>assertText</td>
+    <td>fake-div</td>
+    <td>*Database connection OK*</td>
+  </tr>
+  </tbody>
+</table>
+</body>
+</html>
diff --git a/it/it-tests/src/test/resources/uiExtension/UiExtensionsTest/ruby-rails-app.html b/it/it-tests/src/test/resources/uiExtension/UiExtensionsTest/ruby-rails-app.html
new file mode 100644 (file)
index 0000000..4581cd7
--- /dev/null
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
+  <title>ruby-rails-app</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+  <tbody>
+  <tr>
+    <td>open</td>
+    <td>/fake_app</td>
+    <td></td>
+  </tr>
+  <tr>
+    <td>assertText</td>
+    <td>fake-app</td>
+    <td>Fake application</td>
+  </tr>
+  <tr>
+    <td>assertText</td>
+    <td>helper-test</td>
+    <td>message generated by helper</td>
+  </tr>
+  </tbody>
+</table>
+</body>
+</html>
diff --git a/it/it-tests/src/test/resources/uiExtension/UiExtensionsTest/static-files.html b/it/it-tests/src/test/resources/uiExtension/UiExtensionsTest/static-files.html
new file mode 100644 (file)
index 0000000..7b002f9
--- /dev/null
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
+  <title>static-files</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+  <tbody>
+  <tr>
+    <td>open</td>
+    <td>/static/uiextensionsplugin/file.html</td>
+    <td></td>
+  </tr>
+  <tr>
+    <td>assertText</td>
+    <td>//body</td>
+    <td>Text from static resource</td>
+  </tr>
+  </tbody>
+</table>
+</body>
+</html>