diff options
author | Sébastien Lesaint <sebastien.lesaint@sonarsource.com> | 2016-04-01 18:34:16 +0200 |
---|---|---|
committer | Sébastien Lesaint <sebastien.lesaint@sonarsource.com> | 2016-04-06 15:42:53 +0200 |
commit | 1f69c8dd6cf99519d927cb8f7938d37dc3ac5b14 (patch) | |
tree | 274de8773b2b988a463ae7bd3d2762c3520cc558 /it/it-plugins | |
parent | a1418d7865db81d7b56acd00bc4dc3194df9b45d (diff) | |
download | sonarqube-1f69c8dd6cf99519d927cb8f7938d37dc3ac5b14.tar.gz sonarqube-1f69c8dd6cf99519d927cb8f7938d37dc3ac5b14.zip |
SONAR-7488 add ITs for PostProjectAnalysisTask
Diffstat (limited to 'it/it-plugins')
-rw-r--r-- | it/it-plugins/pom.xml | 1 | ||||
-rw-r--r-- | it/it-plugins/posttask-plugin/pom.xml | 39 | ||||
-rw-r--r-- | it/it-plugins/posttask-plugin/src/main/java/PostProjectAnalysisTaskImpl.java | 41 | ||||
-rw-r--r-- | it/it-plugins/posttask-plugin/src/main/java/PostTaskPlugin.java | 28 |
4 files changed, 109 insertions, 0 deletions
diff --git a/it/it-plugins/pom.xml b/it/it-plugins/pom.xml index 71023da0185..bee94bef359 100644 --- a/it/it-plugins/pom.xml +++ b/it/it-plugins/pom.xml @@ -51,5 +51,6 @@ <module>sonar-subcategories-plugin</module> <module>ui-extensions-plugin</module> <module>issue-filter-plugin</module> + <module>posttask-plugin</module> </modules> </project> diff --git a/it/it-plugins/posttask-plugin/pom.xml b/it/it-plugins/posttask-plugin/pom.xml new file mode 100644 index 00000000000..1933cb710df --- /dev/null +++ b/it/it-plugins/posttask-plugin/pom.xml @@ -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>posttask-plugin</artifactId> + <version>1.0-SNAPSHOT</version> + <packaging>sonar-plugin</packaging> + <name>SonarQube Integration Tests :: Plugins :: PostTask</name> + <description>Plugin testing the Compute Engine Post Task API</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>PostTaskPlugin</pluginClass> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/it/it-plugins/posttask-plugin/src/main/java/PostProjectAnalysisTaskImpl.java b/it/it-plugins/posttask-plugin/src/main/java/PostProjectAnalysisTaskImpl.java new file mode 100644 index 00000000000..79633f6061f --- /dev/null +++ b/it/it-plugins/posttask-plugin/src/main/java/PostProjectAnalysisTaskImpl.java @@ -0,0 +1,41 @@ +/* + * 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.ce.posttask.CeTask; +import org.sonar.api.ce.posttask.PostProjectAnalysisTask; +import org.sonar.api.ce.posttask.Project; +import org.sonar.api.ce.posttask.QualityGate; +import org.sonar.api.utils.log.Logger; +import org.sonar.api.utils.log.Loggers; + +public class PostProjectAnalysisTaskImpl implements PostProjectAnalysisTask { + private static final Logger LOG = Loggers.get(PostProjectAnalysisTaskImpl.class); + + @Override + public void finished(ProjectAnalysis analysis) { + CeTask ceTask = analysis.getCeTask(); + Project project = analysis.getProject(); + QualityGate qualityGate = analysis.getQualityGate(); + LOG.info("POSTASKPLUGIN: finished() CeTask[{}] Project[{}] Date[{}] QualityGate[{}]", + ceTask.getStatus(), + project.getKey(), + analysis.getDate().getTime(), + qualityGate == null ? null : qualityGate.getStatus()); + } +} diff --git a/it/it-plugins/posttask-plugin/src/main/java/PostTaskPlugin.java b/it/it-plugins/posttask-plugin/src/main/java/PostTaskPlugin.java new file mode 100644 index 00000000000..df813bb6599 --- /dev/null +++ b/it/it-plugins/posttask-plugin/src/main/java/PostTaskPlugin.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 PostTaskPlugin extends SonarPlugin { + public List getExtensions() { + return Arrays.asList(PostProjectAnalysisTaskImpl.class); + } +} |