diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2012-11-04 19:35:00 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2012-11-04 19:35:00 +0100 |
commit | 0935f7db60ce855eff8f6f52313f96392ea10577 (patch) | |
tree | 2c0a694b0fe4a4b9997ad5d830ace09c7ba9d30c /sonar-deprecated | |
parent | d847b05486d0d05769ca3ca36607802e80b06dde (diff) | |
download | sonarqube-0935f7db60ce855eff8f6f52313f96392ea10577.tar.gz sonarqube-0935f7db60ce855eff8f6f52313f96392ea10577.zip |
Temporarily revert org.sonar.api.batch.AbstractCoverageExtension
Diffstat (limited to 'sonar-deprecated')
3 files changed, 98 insertions, 17 deletions
diff --git a/sonar-deprecated/pom.xml b/sonar-deprecated/pom.xml index be48c583afc..156a4667298 100644 --- a/sonar-deprecated/pom.xml +++ b/sonar-deprecated/pom.xml @@ -19,11 +19,6 @@ <artifactId>sonar-plugin-api</artifactId> </dependency> <dependency> - <groupId>xmlunit</groupId> - <artifactId>xmlunit</artifactId> - <scope>test</scope> - </dependency> - <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <scope>test</scope> @@ -34,18 +29,8 @@ <scope>test</scope> </dependency> <dependency> - <groupId>org.hamcrest</groupId> - <artifactId>hamcrest-all</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.dbunit</groupId> - <artifactId>dbunit</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-classic</artifactId> + <groupId>org.easytesting</groupId> + <artifactId>fest-assert</artifactId> <scope>test</scope> </dependency> </dependencies> diff --git a/sonar-deprecated/src/main/java/org/sonar/api/batch/AbstractCoverageExtension.java b/sonar-deprecated/src/main/java/org/sonar/api/batch/AbstractCoverageExtension.java new file mode 100644 index 00000000000..36e696d2f07 --- /dev/null +++ b/sonar-deprecated/src/main/java/org/sonar/api/batch/AbstractCoverageExtension.java @@ -0,0 +1,53 @@ +/* + * Sonar, open source software quality management tool. + * Copyright (C) 2008-2012 SonarSource + * mailto:contact AT sonarsource DOT com + * + * Sonar 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. + * + * Sonar 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 Sonar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +package org.sonar.api.batch; + +import org.sonar.api.resources.Project; + +/** + * This class implements the management of the code coverage engine if there are several. + * It is a pre-implementation for Sensors and Decorators + * + * @since 1.10 + * @deprecated since 2.6 was superseded by interface {@link CoverageExtension} + */ +@Deprecated +public abstract class AbstractCoverageExtension implements CoverageExtension { + + /** + * The plugin key to retrieve the coverage engine to be used + */ + public static final String PARAM_PLUGIN = "sonar.core.codeCoveragePlugin"; + + /** + * The default value for the code coverage plugin + */ + public static final String DEFAULT_PLUGIN = "cobertura"; + + public AbstractCoverageExtension() { + } + + /** + * Whether to implement the extension on the project + */ + public boolean shouldExecuteOnProject(Project project) { + return project.getAnalysisType().isDynamic(true); + } +} diff --git a/sonar-deprecated/src/test/java/org/sonar/api/batch/AbstractCoverageExtensionTest.java b/sonar-deprecated/src/test/java/org/sonar/api/batch/AbstractCoverageExtensionTest.java new file mode 100644 index 00000000000..4a1b303d87d --- /dev/null +++ b/sonar-deprecated/src/test/java/org/sonar/api/batch/AbstractCoverageExtensionTest.java @@ -0,0 +1,43 @@ +/* + * Sonar, open source software quality management tool. + * Copyright (C) 2008-2012 SonarSource + * mailto:contact AT sonarsource DOT com + * + * Sonar 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. + * + * Sonar 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 Sonar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +package org.sonar.api.batch; + +import org.junit.Test; +import org.sonar.api.resources.Project; + +import static org.fest.assertions.Assertions.assertThat; + +public class AbstractCoverageExtensionTest { + @Test + public void should_execute_if_dynamic_analysis() { + Project project = new Project("foo"); + AbstractCoverageExtension extension = new AbstractCoverageExtension() { + }; + + project.setAnalysisType(Project.AnalysisType.DYNAMIC); + assertThat(extension.shouldExecuteOnProject(project)).isTrue(); + + project.setAnalysisType(Project.AnalysisType.REUSE_REPORTS); + assertThat(extension.shouldExecuteOnProject(project)).isTrue(); + + project.setAnalysisType(Project.AnalysisType.STATIC); + assertThat(extension.shouldExecuteOnProject(project)).isFalse(); + } +} |