]> source.dussan.org Git - sonarqube.git/commitdiff
Re-enable and complete PLI and PLSQL tests
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Wed, 5 Jul 2017 09:14:58 +0000 (11:14 +0200)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Wed, 5 Jul 2017 14:51:11 +0000 (16:51 +0200)
tests/projects/plugins/project/src/plsql/has-issues.sql [new file with mode: 0644]
tests/src/test/java/org/sonarqube/tests/plugins/PluginsTest.java
tests/src/test/java/org/sonarqube/tests/plugins/checks/PlsqlCheck.java [new file with mode: 0644]

diff --git a/tests/projects/plugins/project/src/plsql/has-issues.sql b/tests/projects/plugins/project/src/plsql/has-issues.sql
new file mode 100644 (file)
index 0000000..29a74b1
--- /dev/null
@@ -0,0 +1,9 @@
+-- plsql:SingleLineCommentsSyntaxCheck
+/* single line comment */
+
+-- plsql:UpperCaseReservedWordsCheck
+create TABLE ut_suite (
+   id INTEGER, -- comment
+   -- plsql:CharVarchar
+   name char(1)
+);
index 8c0d36f4d52ebc5e6313c35b9f29109b14e9cb38..50a43e322ec106e0da647a1dd72b055da5b28b14 100644 (file)
@@ -24,7 +24,10 @@ import com.sonar.orchestrator.Orchestrator;
 import com.sonar.orchestrator.OrchestratorBuilder;
 import com.sonar.orchestrator.build.BuildResult;
 import com.sonar.orchestrator.build.SonarScanner;
+import com.sonar.orchestrator.locator.URLLocation;
 import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Set;
@@ -42,6 +45,8 @@ import org.sonarqube.tests.plugins.checks.GroovyCheck;
 import org.sonarqube.tests.plugins.checks.JavaCheck;
 import org.sonarqube.tests.plugins.checks.JavascriptCheck;
 import org.sonarqube.tests.plugins.checks.PhpCheck;
+import org.sonarqube.tests.plugins.checks.PliCheck;
+import org.sonarqube.tests.plugins.checks.PlsqlCheck;
 import org.sonarqube.tests.plugins.checks.PythonCheck;
 import org.sonarqube.tests.plugins.checks.RpgCheck;
 import org.sonarqube.tests.plugins.checks.SwiftCheck;
@@ -72,8 +77,8 @@ public class PluginsTest {
     new JavaCheck(),
     new JavascriptCheck(),
     new PhpCheck(),
-    // SONAR-7618 SonarPLI 1.5.0.702 not compatible with CE not loading @ServerSide
-    // new PliCheck(),
+    new PliCheck(),
+    new PlsqlCheck(),
     new PythonCheck(),
     new RpgCheck(),
     new SwiftCheck(),
@@ -84,7 +89,7 @@ public class PluginsTest {
   private static Orchestrator ORCHESTRATOR;
 
   @BeforeClass
-  public static void startServer() {
+  public static void startServer() throws MalformedURLException {
     OrchestratorBuilder builder = Orchestrator.builderEnv()
       .setZipFile(byWildcardMavenFilename(new File("../sonar-application/target"), "sonar*.zip").getFile());
 
@@ -126,10 +131,10 @@ public class PluginsTest {
     installPlugin(builder, "lua");
     installPlugin(builder, "php");
     installPlugin(builder, "pitest");
-    // SONAR-7618 SonarPLI 1.5.0.702 not compatible with CE not loading @ServerSide
-    // installPlugin(builder, "pli");
-    // SONAR-7618 SonarPLSQL 2.9.0.901 not compatible with CE not loading @ServerSide
-    // installPlugin(builder, "plsql");
+    // SONAR-7618 SonarPLI release 1.5.0.702 not compatible with CE not loading @ServerSide. To be reset to LATEST_RELEASE as soon as SonarPLI 1.5.1 is released.
+    installPlugin(builder, new URL("https://sonarsource.bintray.com/CommercialDistribution/sonar-pli-plugin/sonar-pli-plugin-1.5.1.872.jar"));
+    // SONAR-7618 SonarPLSQL 2.9.0.901 not compatible with CE not loading @ServerSide. To be reset to LATEST_RELEASE as soon as SonarPLSQL 2.9.1 is released.
+    installPlugin(builder, new URL("https://sonarsource.bintray.com/CommercialDistribution/sonar-plsql-plugin/sonar-plsql-plugin-2.9.1.1051.jar"));
     installPlugin(builder, "pmd");
     // FIXME puppet plugin is temporarily disabled because it is not compatible with SQ 6.4 until usage of Colorizer API is removed
     installPlugin(builder, "python");
@@ -202,4 +207,7 @@ public class PluginsTest {
     builder.addPlugin(pluginKey);
   }
 
+  private static void installPlugin(OrchestratorBuilder builder, URL url) {
+    builder.addPlugin(URLLocation.create(url));
+  }
 }
diff --git a/tests/src/test/java/org/sonarqube/tests/plugins/checks/PlsqlCheck.java b/tests/src/test/java/org/sonarqube/tests/plugins/checks/PlsqlCheck.java
new file mode 100644 (file)
index 0000000..7e4b9d9
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info 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.sonarqube.tests.plugins.checks;
+
+public class PlsqlCheck implements Check {
+
+  public static final String DIR = "src/plsql";
+
+  @Override
+  public void validate(Validation validation) {
+    validation.mustHaveNonEmptySource(DIR);
+    validation.mustHaveSize(DIR);
+    validation.mustHaveComments(DIR);
+    validation.mustHaveComplexity(DIR);
+    validation.mustHaveIssues(DIR + "/has-issues.sql");
+  }
+}