diff options
author | Julien Lancelot <julien.lancelot@sonarsource.com> | 2015-10-07 14:12:10 +0200 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@sonarsource.com> | 2015-10-09 16:48:24 +0200 |
commit | f59052c8e1daed111d931893b2a08f9f5fa2a74a (patch) | |
tree | 247e34ce3bb90f2652a3fc0c4602990c66c76369 /it/it-plugins | |
parent | 74af3d8161ca9a767d9b6a7a2bdc3f5d29bd5003 (diff) | |
download | sonarqube-f59052c8e1daed111d931893b2a08f9f5fa2a74a.tar.gz sonarqube-f59052c8e1daed111d931893b2a08f9f5fa2a74a.zip |
SONAR-6717 Restore issues actions API
Diffstat (limited to 'it/it-plugins')
5 files changed, 142 insertions, 0 deletions
diff --git a/it/it-plugins/issue-action-plugin/pom.xml b/it/it-plugins/issue-action-plugin/pom.xml new file mode 100644 index 00000000000..6b176b8e5bd --- /dev/null +++ b/it/it-plugins/issue-action-plugin/pom.xml @@ -0,0 +1,40 @@ +<?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.it</groupId> + <artifactId>it-plugins</artifactId> + <version>5.2-SNAPSHOT</version> + </parent> + + <artifactId>issue-action-plugin</artifactId> + <packaging>sonar-plugin</packaging> + <name>Plugins :: Issue Action</name> + <version>1.0-SNAPSHOT</version> + + <dependencies> + <dependency> + <groupId>org.codehaus.sonar</groupId> + <artifactId>sonar-plugin-api</artifactId> + <version>${apiVersion}</version> + <scope>provided</scope> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.codehaus.sonar</groupId> + <artifactId>sonar-packaging-maven-plugin</artifactId> + <version>1.1</version> + <extensions>true</extensions> + <configuration> + <pluginClass>IssueActionPlugin</pluginClass> + <pluginKey>issueaction</pluginKey> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/it/it-plugins/issue-action-plugin/src/main/java/ActionDefinition.java b/it/it-plugins/issue-action-plugin/src/main/java/ActionDefinition.java new file mode 100644 index 00000000000..84f5e6c5a6a --- /dev/null +++ b/it/it-plugins/issue-action-plugin/src/main/java/ActionDefinition.java @@ -0,0 +1,46 @@ +/* + * 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. + */ + +import org.sonar.api.ServerExtension; +import org.sonar.api.issue.Issue; +import org.sonar.api.issue.action.Actions; +import org.sonar.api.issue.action.Function; +import org.sonar.api.issue.condition.HasResolution; + +public class ActionDefinition implements ServerExtension { + + private final Actions actions; + + public ActionDefinition(Actions actions) { + this.actions = actions; + } + + public void start() { + actions.add("fake") + .setConditions(new HasResolution(Issue.RESOLUTION_FIXED)) + .setFunctions(new Function() { + @Override + public void execute(Context context) { + context.setAttribute("fake", "fake action"); + context.addComment("New Comment from fake action"); + } + }); + } +} diff --git a/it/it-plugins/issue-action-plugin/src/main/java/IssueActionPlugin.java b/it/it-plugins/issue-action-plugin/src/main/java/IssueActionPlugin.java new file mode 100644 index 00000000000..d322d9f4d90 --- /dev/null +++ b/it/it-plugins/issue-action-plugin/src/main/java/IssueActionPlugin.java @@ -0,0 +1,34 @@ +/* + * 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. + */ + +import org.sonar.api.SonarPlugin; + +import java.util.Arrays; +import java.util.List; + +public class IssueActionPlugin extends SonarPlugin { + + public List getExtensions() { + return Arrays.asList( + ActionDefinition.class + ); + } + +} diff --git a/it/it-plugins/issue-action-plugin/src/main/resources/org/sonar/l10n/issueaction.properties b/it/it-plugins/issue-action-plugin/src/main/resources/org/sonar/l10n/issueaction.properties new file mode 100644 index 00000000000..f507ceed575 --- /dev/null +++ b/it/it-plugins/issue-action-plugin/src/main/resources/org/sonar/l10n/issueaction.properties @@ -0,0 +1,21 @@ +# +# 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. +# + +issue.action.fake.formlink=Fake diff --git a/it/it-plugins/pom.xml b/it/it-plugins/pom.xml index b0d7c374cef..984e022859d 100644 --- a/it/it-plugins/pom.xml +++ b/it/it-plugins/pom.xml @@ -35,6 +35,7 @@ <module>batch-plugin</module> <module>extension-lifecycle-plugin</module> <module>global-property-change-plugin</module> + <module>issue-action-plugin</module> <module>l10n-fr-pack</module> <module>license-plugin</module> <module>project-builder-plugin</module> |