aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/sonar-xoo-plugin/src/main
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2014-10-14 10:16:08 +0200
committerJulien Lancelot <julien.lancelot@sonarsource.com>2014-10-14 10:16:08 +0200
commitbb621a7a349ddf4568d3ab592fe5a40d0297e6be (patch)
tree0cf7ab245cb6487b134be7a93e6c5452730a10b2 /plugins/sonar-xoo-plugin/src/main
parentd65c9957139e4b0da94f5cf797dfe98cfd62ce77 (diff)
parent3ac8de59552f3d38f9b952079cbffa8572840731 (diff)
downloadsonarqube-bb621a7a349ddf4568d3ab592fe5a40d0297e6be.tar.gz
sonarqube-bb621a7a349ddf4568d3ab592fe5a40d0297e6be.zip
Merge remote-tracking branch 'origin/branch-4.5'
Conflicts: plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/XooPlugin.java sonar-application/src/main/assembly/conf/sonar.properties sonar-application/src/test/java/org/sonar/application/JdbcSettingsTest.java sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql
Diffstat (limited to 'plugins/sonar-xoo-plugin/src/main')
-rw-r--r--plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/XooPlugin.java19
-rw-r--r--plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/rule/XooFakeExporter.java55
-rw-r--r--plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/rule/XooFakeImporter.java50
-rw-r--r--plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/rule/XooFakeImporterWithMessages.java47
4 files changed, 159 insertions, 12 deletions
diff --git a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/XooPlugin.java b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/XooPlugin.java
index 148a6df0b7c..d28dc487dec 100644
--- a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/XooPlugin.java
+++ b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/XooPlugin.java
@@ -20,17 +20,8 @@
package org.sonar.xoo;
import org.sonar.api.SonarPlugin;
-import org.sonar.xoo.lang.CoveragePerTestSensor;
-import org.sonar.xoo.lang.MeasureSensor;
-import org.sonar.xoo.lang.SymbolReferencesSensor;
-import org.sonar.xoo.lang.SyntaxHighlightingSensor;
-import org.sonar.xoo.lang.TestCaseSensor;
-import org.sonar.xoo.lang.XooTokenizerSensor;
-import org.sonar.xoo.rule.CreateIssueByInternalKeySensor;
-import org.sonar.xoo.rule.OneIssueOnDirPerFileSensor;
-import org.sonar.xoo.rule.OneIssuePerLineSensor;
-import org.sonar.xoo.rule.XooQualityProfile;
-import org.sonar.xoo.rule.XooRulesDefinition;
+import org.sonar.xoo.lang.*;
+import org.sonar.xoo.rule.*;
import org.sonar.xoo.scm.XooBlameCommand;
import org.sonar.xoo.scm.XooScmProvider;
@@ -52,6 +43,10 @@ public class XooPlugin extends SonarPlugin {
XooRulesDefinition.class,
XooQualityProfile.class,
+ XooFakeExporter.class,
+ XooFakeImporter.class,
+ XooFakeImporterWithMessages.class,
+
// SCM
XooScmProvider.class,
XooBlameCommand.class,
@@ -67,7 +62,7 @@ public class XooPlugin extends SonarPlugin {
OneIssuePerLineSensor.class,
OneIssueOnDirPerFileSensor.class,
CreateIssueByInternalKeySensor.class
- );
+ );
}
}
diff --git a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/rule/XooFakeExporter.java b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/rule/XooFakeExporter.java
new file mode 100644
index 00000000000..b8375db463f
--- /dev/null
+++ b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/rule/XooFakeExporter.java
@@ -0,0 +1,55 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube 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.
+ *
+ * SonarQube 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.xoo.rule;
+
+import org.sonar.api.profiles.ProfileExporter;
+import org.sonar.api.profiles.RulesProfile;
+import org.sonar.xoo.Xoo;
+
+import java.io.IOException;
+import java.io.Writer;
+
+/**
+ * Fake exporter just for test
+ */
+public class XooFakeExporter extends ProfileExporter {
+ public XooFakeExporter() {
+ super("XooFakeExporter", "Xoo Fake Exporter");
+ }
+
+ @Override
+ public String[] getSupportedLanguages() {
+ return new String[]{Xoo.KEY};
+ }
+
+ @Override
+ public String getMimeType() {
+ return "plain/custom";
+ }
+
+ @Override
+ public void exportProfile(RulesProfile profile, Writer writer) {
+ try {
+ writer.write("xoo -> " + profile.getName() + " -> " + profile.getActiveRules().size());
+ } catch (IOException e) {
+ throw new IllegalStateException(e);
+ }
+ }
+}
diff --git a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/rule/XooFakeImporter.java b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/rule/XooFakeImporter.java
new file mode 100644
index 00000000000..867c11100dc
--- /dev/null
+++ b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/rule/XooFakeImporter.java
@@ -0,0 +1,50 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube 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.
+ *
+ * SonarQube 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.xoo.rule;
+
+import org.sonar.api.profiles.ProfileImporter;
+import org.sonar.api.profiles.RulesProfile;
+import org.sonar.api.rules.Rule;
+import org.sonar.api.rules.RulePriority;
+import org.sonar.api.utils.ValidationMessages;
+import org.sonar.xoo.Xoo;
+
+import java.io.Reader;
+
+/**
+ * Fake importer just for test, it will NOT take into account the given file but will create some hard-coded rules
+ */
+public class XooFakeImporter extends ProfileImporter {
+ public XooFakeImporter() {
+ super("XooProfileImporter", "Xoo Profile Importer");
+ }
+
+ @Override
+ public String[] getSupportedLanguages() {
+ return new String[] {Xoo.KEY};
+ }
+
+ @Override
+ public RulesProfile importProfile(Reader reader, ValidationMessages messages) {
+ RulesProfile rulesProfile = RulesProfile.create();
+ rulesProfile.activateRule(Rule.create(XooRulesDefinition.XOO_REPOSITORY, "x1"), RulePriority.CRITICAL);
+ return rulesProfile;
+ }
+}
diff --git a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/rule/XooFakeImporterWithMessages.java b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/rule/XooFakeImporterWithMessages.java
new file mode 100644
index 00000000000..a11e3a2cca0
--- /dev/null
+++ b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/rule/XooFakeImporterWithMessages.java
@@ -0,0 +1,47 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube 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.
+ *
+ * SonarQube 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.xoo.rule;
+
+import org.sonar.api.profiles.ProfileImporter;
+import org.sonar.api.profiles.RulesProfile;
+import org.sonar.api.utils.ValidationMessages;
+
+import java.io.Reader;
+
+/**
+ * Fake importer just for test, it will NOT take into account the given file but will display some info and warning messages
+ */
+public class XooFakeImporterWithMessages extends ProfileImporter {
+ public XooFakeImporterWithMessages() {
+ super("XooFakeImporterWithMessages", "Xoo Profile Importer With Messages");
+ }
+
+ @Override
+ public String[] getSupportedLanguages() {
+ return new String[] {};
+ }
+
+ @Override
+ public RulesProfile importProfile(Reader reader, ValidationMessages messages) {
+ messages.addWarningText("a warning");
+ messages.addInfoText("an info");
+ return RulesProfile.create();
+ }
+}