summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@gmail.com>2013-01-29 10:40:36 +0100
committerSimon Brandhof <simon.brandhof@gmail.com>2013-01-29 12:28:32 +0100
commitb53e3b99f8eaeffe73eab4eb4fd8514e41ea4dfd (patch)
treefdacf976950581f6750e34ec2b0ac10bd9838327
parentafa0528377e18a5d40f8771f5093729d81e80e6e (diff)
downloadsonarqube-b53e3b99f8eaeffe73eab4eb4fd8514e41ea4dfd.tar.gz
sonarqube-b53e3b99f8eaeffe73eab4eb4fd8514e41ea4dfd.zip
SONAR-2501 remove org.sonar.api.tests
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/bootstrap/InspectionModule.java2
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/tests/FileTest.java83
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/tests/ProjectTests.java35
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/tests/ProjectTestsImpl.java86
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/tests/Test.java107
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/tests/ProjectTestsImplTest.java72
6 files changed, 0 insertions, 385 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/InspectionModule.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/InspectionModule.java
index c22a9132eff..bd91ce3d85e 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/InspectionModule.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/InspectionModule.java
@@ -26,7 +26,6 @@ import org.sonar.api.batch.bootstrap.ProjectDefinition;
import org.sonar.api.profiles.RulesProfile;
import org.sonar.api.resources.Languages;
import org.sonar.api.resources.Project;
-import org.sonar.api.tests.ProjectTestsImpl;
import org.sonar.batch.DefaultProfileLoader;
import org.sonar.batch.DefaultProjectClasspath;
import org.sonar.batch.DefaultProjectFileSystem2;
@@ -102,7 +101,6 @@ public class InspectionModule extends Module {
container.addSingleton(DefaultModelFinder.class);
container.addSingleton(DefaultProfileLoader.class);
container.addSingleton(DryRunExporter.class);
- container.addSingleton(ProjectTestsImpl.class);
container.addPicoAdapter(new ProfileProvider());
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/tests/FileTest.java b/sonar-plugin-api/src/main/java/org/sonar/api/tests/FileTest.java
deleted file mode 100644
index 1d31426600c..00000000000
--- a/sonar-plugin-api/src/main/java/org/sonar/api/tests/FileTest.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * 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.tests;
-
-import org.apache.commons.lang.builder.ToStringBuilder;
-import org.apache.commons.lang.builder.ToStringStyle;
-
-import java.util.List;
-
-import static com.google.common.collect.Lists.newArrayList;
-
-public class FileTest {
-
- private String key;
-
- private List<Test> tests;
-
- public FileTest(String key) {
- this.key = key;
- tests = newArrayList();
- }
-
- public String getKey() {
- return key;
- }
-
- public List<Test> getTests() {
- return tests;
- }
-
- public void addTest(Test test) {
- tests.add(test);
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
-
- FileTest fileTest = (FileTest) o;
-
- if (!key.equals(fileTest.key)) {
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- return key.hashCode();
- }
-
- @Override
- public String toString() {
- return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
- .append("key", key)
- .append("tests", tests)
- .toString();
- }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/tests/ProjectTests.java b/sonar-plugin-api/src/main/java/org/sonar/api/tests/ProjectTests.java
deleted file mode 100644
index b09e5824314..00000000000
--- a/sonar-plugin-api/src/main/java/org/sonar/api/tests/ProjectTests.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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.tests;
-
-import java.util.Collection;
-
-/**
- *
- * @since 3.5
- */
-public interface ProjectTests {
-
- void addTest(String fileTestKey, Test test);
-
- void cover(String fileTestKey, String test, String mainFile, Collection<Integer> lines);
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/tests/ProjectTestsImpl.java b/sonar-plugin-api/src/main/java/org/sonar/api/tests/ProjectTestsImpl.java
deleted file mode 100644
index 24c14fa9dba..00000000000
--- a/sonar-plugin-api/src/main/java/org/sonar/api/tests/ProjectTestsImpl.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * 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.tests;
-
-import com.google.common.base.Predicate;
-import com.google.common.collect.Iterables;
-import org.apache.commons.lang.builder.ToStringBuilder;
-import org.apache.commons.lang.builder.ToStringStyle;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.sonar.api.BatchExtension;
-
-import java.util.Collection;
-import java.util.List;
-
-import static com.google.common.collect.Lists.newArrayList;
-
-public class ProjectTestsImpl implements ProjectTests, BatchExtension {
-
- private static final Logger LOG = LoggerFactory.getLogger(ProjectTestsImpl.class);
- private List<FileTest> fileTests;
-
- public ProjectTestsImpl() {
- fileTests = newArrayList();
- }
-
- public void addTest(String fileTestKey, Test test) {
- FileTest fileTest = getFileTest(fileTestKey);
- fileTest.addTest(test);
-
- LOG.info("Added a new test : " + toString());
- }
-
- public void cover(String fileTestKey, String test, String mainFile, Collection<Integer> lines) {
- FileTest fileTest = find(fileTestKey);
- if (fileTest != null) {
- LOG.info("Covering - File test : " + fileTestKey + ", test : " + test + ", file : " + mainFile + ", lines : " + Iterables.toString(lines));
- }
- }
-
- public List<FileTest> getFileTests() {
- return fileTests;
- }
-
- private FileTest getFileTest(final String key) {
- FileTest fileTest = find(key);
- if (fileTest == null) {
- fileTest = new FileTest(key);
- fileTests.add(fileTest);
- }
- return fileTest;
- }
-
- private FileTest find(final String key) {
- return Iterables.find(fileTests, new Predicate<FileTest>() {
- public boolean apply(FileTest fileTest) {
- return fileTest.getKey().equals(key);
- }
- }, null);
- }
-
- @Override
- public String toString() {
- return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
- .append("fileTests", fileTests)
- .toString();
- }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/tests/Test.java b/sonar-plugin-api/src/main/java/org/sonar/api/tests/Test.java
deleted file mode 100644
index 89badb93808..00000000000
--- a/sonar-plugin-api/src/main/java/org/sonar/api/tests/Test.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * 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.tests;
-
-import org.apache.commons.lang.builder.ToStringBuilder;
-import org.apache.commons.lang.builder.ToStringStyle;
-
-public class Test {
-
- private String name;
- private String stackTrace;
- private String message;
- private long durationMilliseconds;
- private String status;
-
- public Test(String name) {
- this.name = name;
- }
-
- public long getDurationMilliseconds() {
- return durationMilliseconds;
- }
-
- public Test setDurationMilliseconds(long durationMilliseconds) {
- this.durationMilliseconds = durationMilliseconds;
- return this;
- }
-
- public String getStatus() {
- return status;
- }
-
- public Test setStatus(String status) {
- this.status = status;
- return this;
- }
-
- public String getStackTrace() {
- return stackTrace;
- }
-
- public Test setStackTrace(String stackTrace) {
- this.stackTrace = stackTrace;
- return this;
- }
-
- public String getMessage() {
- return message;
- }
-
- public Test setMessage(String message) {
- this.message = message;
- return this;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
-
- Test test = (Test) o;
-
- if (!name.equals(test.name)) {
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- return name.hashCode();
- }
-
- @Override
- public String toString() {
- return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
- .append("name", name)
- .append("durationMilliseconds", durationMilliseconds)
- .append("status", status)
- .append("message", message)
- .append("stackTrace", stackTrace)
- .toString();
- }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/tests/ProjectTestsImplTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/tests/ProjectTestsImplTest.java
deleted file mode 100644
index ea28af3dac1..00000000000
--- a/sonar-plugin-api/src/test/java/org/sonar/api/tests/ProjectTestsImplTest.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * 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.tests;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import static com.google.common.collect.Lists.newArrayList;
-import static org.fest.assertions.Assertions.assertThat;
-
-public class ProjectTestsImplTest {
-
- private ProjectTestsImpl projectTests;
-
- @Before
- public void before(){
- projectTests = new ProjectTestsImpl();
- }
-
- @Test
- public void should_add_new_test() throws Exception {
- org.sonar.api.tests.Test test = new org.sonar.api.tests.Test("test")
- .setStatus("ok")
- .setMessage("message")
- .setStackTrace("stacktrace")
- .setDurationMilliseconds(10)
- ;
- projectTests.addTest("key", test);
- assertThat(projectTests.getFileTests()).hasSize(1);
- assertThat(projectTests.getFileTests().get(0)).isEqualTo(new FileTest("key"));
- assertThat(projectTests.getFileTests().get(0).getTests()).hasSize(1);
- assertThat(projectTests.getFileTests().get(0).getTests().get(0)).isEqualTo(test);
- }
-
- @Test
- public void should_add_new_test_on_existing_file_test() throws Exception {
- org.sonar.api.tests.Test test = new org.sonar.api.tests.Test("test").setStatus("ok");
- projectTests.addTest("key", test);
-
- org.sonar.api.tests.Test test2 = new org.sonar.api.tests.Test("test2").setStatus("ok");
- projectTests.addTest("key", test2);
-
- assertThat(projectTests.getFileTests()).hasSize(1);
- assertThat(projectTests.getFileTests().get(0).getTests()).hasSize(2);
- }
-
- @Test
- public void should_add_coverage_info() throws Exception {
- org.sonar.api.tests.Test test = new org.sonar.api.tests.Test("test").setStatus("ok");
- projectTests.addTest("key", test);
-
- projectTests.cover("key", "test", "mainFile", newArrayList(1, 2));
- }
-}