diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2014-12-10 22:10:44 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2014-12-10 22:10:44 +0100 |
commit | f3f4dc6d61173b16906cf6741cc628abd4c0b996 (patch) | |
tree | 806b00754ab2846c2cfbc524c1b05d3601865665 /server | |
parent | cd582e700b3ceda2de457733db6cd2417b5346c9 (diff) | |
download | sonarqube-f3f4dc6d61173b16906cf6741cc628abd4c0b996.tar.gz sonarqube-f3f4dc6d61173b16906cf6741cc628abd4c0b996.zip |
Profile dbTests enables only the tests involving a database
Diffstat (limited to 'server')
17 files changed, 48 insertions, 57 deletions
diff --git a/server/sonar-process-monitor/pom.xml b/server/sonar-process-monitor/pom.xml index abd0fa013be..10131e432cd 100644 --- a/server/sonar-process-monitor/pom.xml +++ b/server/sonar-process-monitor/pom.xml @@ -45,23 +45,8 @@ </dependency> <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.easytesting</groupId> - <artifactId>fest-assert</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-core</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.hamcrest</groupId> - <artifactId>hamcrest-all</artifactId> + <groupId>org.codehaus.sonar</groupId> + <artifactId>sonar-testing-harness</artifactId> <scope>test</scope> </dependency> <dependency> diff --git a/server/sonar-search/pom.xml b/server/sonar-search/pom.xml index 41af5b83755..26d3b355560 100644 --- a/server/sonar-search/pom.xml +++ b/server/sonar-search/pom.xml @@ -47,23 +47,8 @@ <scope>test</scope> </dependency> <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.easytesting</groupId> - <artifactId>fest-assert</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-core</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.hamcrest</groupId> - <artifactId>hamcrest-all</artifactId> + <groupId>org.codehaus.sonar</groupId> + <artifactId>sonar-testing-harness</artifactId> <scope>test</scope> </dependency> </dependencies> diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/SwitchSnapshotStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/SwitchSnapshotStepTest.java index 19ce4de5f1f..5bc487ee278 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/SwitchSnapshotStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/SwitchSnapshotStepTest.java @@ -24,6 +24,7 @@ import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; +import org.junit.experimental.categories.Category; import org.sonar.api.utils.DateUtils; import org.sonar.api.utils.System2; import org.sonar.core.computation.db.AnalysisReportDto; @@ -32,10 +33,12 @@ import org.sonar.core.persistence.MyBatis; import org.sonar.core.persistence.TestDatabase; import org.sonar.server.component.ComponentTesting; import org.sonar.server.component.db.SnapshotDao; +import org.sonar.test.DbTests; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; +@Category(DbTests.class) public class SwitchSnapshotStepTest { @Rule public TestDatabase db = new TestDatabase(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/db/AnalysisReportDaoTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/db/AnalysisReportDaoTest.java index d10772367a9..ff2cc13bd31 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/db/AnalysisReportDaoTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/db/AnalysisReportDaoTest.java @@ -24,12 +24,14 @@ import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; +import org.junit.experimental.categories.Category; import org.sonar.api.utils.DateUtils; import org.sonar.api.utils.System2; import org.sonar.core.computation.db.AnalysisReportDto; import org.sonar.core.persistence.DbSession; import org.sonar.core.persistence.MyBatis; import org.sonar.core.persistence.TestDatabase; +import org.sonar.test.DbTests; import java.util.Date; import java.util.HashMap; @@ -41,6 +43,7 @@ import static org.mockito.Mockito.when; import static org.sonar.core.computation.db.AnalysisReportDto.Status.PENDING; import static org.sonar.core.computation.db.AnalysisReportDto.Status.WORKING; +@Category(DbTests.class) public class AnalysisReportDaoTest { private static final String DEFAULT_PROJECT_KEY = "123456789-987654321"; private static final long DEFAULT_SNAPSHOT_ID = 123L; diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/BaseDaoTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/BaseDaoTest.java index a519fb49ee5..22ed213e34c 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/db/BaseDaoTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/db/BaseDaoTest.java @@ -24,6 +24,7 @@ import org.junit.Before; import org.junit.BeforeClass; import org.junit.ClassRule; import org.junit.Test; +import org.junit.experimental.categories.Category; import org.sonar.api.utils.System2; import org.sonar.api.utils.internal.Uuids; import org.sonar.core.persistence.DbSession; @@ -32,11 +33,13 @@ import org.sonar.core.persistence.TestDatabase; import org.sonar.server.db.fake.FakeDao; import org.sonar.server.db.fake.FakeDto; import org.sonar.server.db.fake.FakeMapper; +import org.sonar.test.DbTests; import java.util.Date; import static org.fest.assertions.Assertions.assertThat; +@Category(DbTests.class) public class BaseDaoTest { @ClassRule diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/DbClientTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/DbClientTest.java index a6e3c3713d5..25379750ce9 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/db/DbClientTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/db/DbClientTest.java @@ -21,6 +21,7 @@ package org.sonar.server.db; import org.junit.Rule; import org.junit.Test; +import org.junit.experimental.categories.Category; import org.sonar.api.utils.System2; import org.sonar.core.persistence.DbSession; import org.sonar.core.persistence.MyBatis; @@ -28,9 +29,11 @@ import org.sonar.core.persistence.TestDatabase; import org.sonar.core.qualityprofile.db.QualityProfileDao; import org.sonar.server.qualityprofile.db.ActiveRuleDao; import org.sonar.server.rule.db.RuleDao; +import org.sonar.test.DbTests; import static org.fest.assertions.Assertions.assertThat; +@Category(DbTests.class) public class DbClientTest { @Rule diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/ResultSetIteratorTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/ResultSetIteratorTest.java index fad6135bc30..188ec5237ea 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/db/ResultSetIteratorTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/db/ResultSetIteratorTest.java @@ -24,7 +24,9 @@ import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; +import org.junit.experimental.categories.Category; import org.sonar.core.persistence.TestDatabase; +import org.sonar.test.DbTests; import java.sql.Connection; import java.sql.PreparedStatement; @@ -34,6 +36,7 @@ import java.sql.SQLException; import static org.fest.assertions.Assertions.assertThat; import static org.fest.assertions.Fail.fail; +@Category(DbTests.class) public class ResultSetIteratorTest { @Rule diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/BaseDataChangeTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/BaseDataChangeTest.java index f34f3675c76..ea8c3b285e7 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/BaseDataChangeTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/BaseDataChangeTest.java @@ -22,9 +22,11 @@ package org.sonar.server.db.migrations; import org.junit.Before; import org.junit.ClassRule; import org.junit.Test; +import org.junit.experimental.categories.Category; import org.sonar.core.persistence.AbstractDaoTestCase; import org.sonar.core.persistence.BatchSession; import org.sonar.core.persistence.TestDatabase; +import org.sonar.test.DbTests; import java.sql.SQLException; import java.util.ArrayList; @@ -34,6 +36,7 @@ import java.util.concurrent.atomic.AtomicBoolean; import static org.fest.assertions.Assertions.assertThat; import static org.fest.assertions.Fail.fail; +@Category(DbTests.class) public class BaseDataChangeTest extends AbstractDaoTestCase { @ClassRule diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueAuthorizationDaoTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueAuthorizationDaoTest.java index e0312a185c7..25c37440573 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueAuthorizationDaoTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueAuthorizationDaoTest.java @@ -26,14 +26,17 @@ import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; +import org.junit.experimental.categories.Category; import org.sonar.core.persistence.TestDatabase; import org.sonar.server.db.DbClient; +import org.sonar.test.DbTests; import java.sql.Connection; import java.util.Collection; import static org.fest.assertions.Assertions.assertThat; +@Category(DbTests.class) public class IssueAuthorizationDaoTest { @Rule diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueAuthorizationIndexerTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueAuthorizationIndexerTest.java index d05db36d9e3..933ad9aa10a 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueAuthorizationIndexerTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueAuthorizationIndexerTest.java @@ -22,10 +22,12 @@ package org.sonar.server.issue.index; import org.elasticsearch.search.SearchHit; import org.junit.Rule; import org.junit.Test; +import org.junit.experimental.categories.Category; import org.sonar.api.config.Settings; import org.sonar.core.persistence.TestDatabase; import org.sonar.server.db.DbClient; import org.sonar.server.es.EsTester; +import org.sonar.test.DbTests; import java.util.Arrays; import java.util.Collection; @@ -33,6 +35,7 @@ import java.util.List; import static org.fest.assertions.Assertions.assertThat; +@Category(DbTests.class) public class IssueAuthorizationIndexerTest { @Rule diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexerTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexerTest.java index 70544f861e2..1267d481346 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexerTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexerTest.java @@ -22,16 +22,19 @@ package org.sonar.server.issue.index; import com.google.common.collect.Iterators; import org.junit.Rule; import org.junit.Test; +import org.junit.experimental.categories.Category; import org.sonar.api.config.Settings; import org.sonar.api.rule.RuleKey; import org.sonar.core.persistence.TestDatabase; import org.sonar.server.db.DbClient; import org.sonar.server.es.EsTester; +import org.sonar.test.DbTests; import java.util.List; import static org.fest.assertions.Assertions.assertThat; +@Category(DbTests.class) public class IssueIndexerTest { @Rule diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueResultSetIteratorTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueResultSetIteratorTest.java index 0e9a3d23f97..a2145dc2f46 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueResultSetIteratorTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueResultSetIteratorTest.java @@ -20,26 +20,23 @@ package org.sonar.server.issue.index; import com.google.common.base.Function; -import com.google.common.base.Functions; import com.google.common.collect.Maps; -import org.apache.commons.collections.ComparatorUtils; -import com.google.common.collect.Lists; import org.apache.commons.dbutils.DbUtils; import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; +import org.junit.experimental.categories.Category; import org.sonar.core.persistence.TestDatabase; import org.sonar.server.db.DbClient; +import org.sonar.test.DbTests; import java.sql.Connection; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; import java.util.Map; import static org.fest.assertions.Assertions.assertThat; +@Category(DbTests.class) public class IssueResultSetIteratorTest { @Rule diff --git a/server/sonar-server/src/test/java/org/sonar/server/measure/MeasureFilterExecutorTest.java b/server/sonar-server/src/test/java/org/sonar/server/measure/MeasureFilterExecutorTest.java index e404c0eec02..df7c9668386 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/measure/MeasureFilterExecutorTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/measure/MeasureFilterExecutorTest.java @@ -22,6 +22,7 @@ package org.sonar.server.measure; import org.junit.Before; import org.junit.ClassRule; import org.junit.Test; +import org.junit.experimental.categories.Category; import org.sonar.api.measures.CoreMetrics; import org.sonar.api.measures.Metric; import org.sonar.api.utils.DateUtils; @@ -29,6 +30,7 @@ import org.sonar.api.utils.System2; import org.sonar.core.component.SnapshotDto; import org.sonar.core.persistence.TestDatabase; import org.sonar.core.resource.ResourceDao; +import org.sonar.test.DbTests; import java.sql.SQLException; import java.util.Arrays; @@ -37,6 +39,7 @@ import java.util.List; import static com.google.common.collect.Lists.newArrayList; import static org.fest.assertions.Assertions.assertThat; +@Category(DbTests.class) public class MeasureFilterExecutorTest { private static final long JAVA_PROJECT_ID = 1L; diff --git a/server/sonar-server/src/test/java/org/sonar/server/source/index/SourceLineIndexerTest.java b/server/sonar-server/src/test/java/org/sonar/server/source/index/SourceLineIndexerTest.java index cc195db8434..fb7a8eb818e 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/source/index/SourceLineIndexerTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/source/index/SourceLineIndexerTest.java @@ -32,12 +32,14 @@ import org.fest.assertions.MapAssert; import org.junit.Before; import org.junit.Rule; import org.junit.Test; +import org.junit.experimental.categories.Category; import org.sonar.api.config.Settings; import org.sonar.api.utils.DateUtils; import org.sonar.core.persistence.TestDatabase; import org.sonar.server.db.DbClient; import org.sonar.server.es.EsTester; import org.sonar.server.search.BaseNormalizer; +import org.sonar.test.DbTests; import org.sonar.test.TestUtils; import java.io.FileInputStream; @@ -48,6 +50,7 @@ import java.util.Map; import static org.fest.assertions.Assertions.assertThat; import static org.sonar.server.source.index.SourceLineIndexDefinition.*; +@Category(DbTests.class) public class SourceLineIndexerTest { @Rule diff --git a/server/sonar-server/src/test/java/org/sonar/server/source/index/SourceLineResultSetIteratorTest.java b/server/sonar-server/src/test/java/org/sonar/server/source/index/SourceLineResultSetIteratorTest.java index 17c9998b6e8..10af252eabb 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/source/index/SourceLineResultSetIteratorTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/source/index/SourceLineResultSetIteratorTest.java @@ -23,8 +23,10 @@ import org.junit.After; import org.junit.Before; import org.junit.ClassRule; import org.junit.Test; +import org.junit.experimental.categories.Category; import org.sonar.core.persistence.TestDatabase; import org.sonar.server.db.DbClient; +import org.sonar.test.DbTests; import java.sql.Connection; import java.sql.PreparedStatement; @@ -32,6 +34,7 @@ import java.sql.PreparedStatement; import static org.fest.assertions.Assertions.assertThat; import static org.fest.assertions.Fail.fail; +@Category(DbTests.class) public class SourceLineResultSetIteratorTest { @ClassRule diff --git a/server/sonar-server/src/test/java/org/sonar/server/startup/CopyRequirementsFromCharacteristicsToRulesTest.java b/server/sonar-server/src/test/java/org/sonar/server/startup/CopyRequirementsFromCharacteristicsToRulesTest.java index ac7dcd807dc..573bc3af406 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/startup/CopyRequirementsFromCharacteristicsToRulesTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/startup/CopyRequirementsFromCharacteristicsToRulesTest.java @@ -22,6 +22,7 @@ package org.sonar.server.startup; import org.junit.Before; import org.junit.ClassRule; import org.junit.Test; +import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; @@ -32,10 +33,12 @@ import org.sonar.core.rule.RuleDto; import org.sonar.core.template.LoadedTemplateDao; import org.sonar.server.db.DbClient; import org.sonar.server.rule.db.RuleDao; +import org.sonar.test.DbTests; import static org.fest.assertions.Assertions.assertThat; import static org.mockito.Mockito.when; +@Category(DbTests.class) @RunWith(MockitoJUnitRunner.class) public class CopyRequirementsFromCharacteristicsToRulesTest { diff --git a/server/sonar-ws-client/pom.xml b/server/sonar-ws-client/pom.xml index d7261ef9118..ca2fa7225b0 100644 --- a/server/sonar-ws-client/pom.xml +++ b/server/sonar-ws-client/pom.xml @@ -47,13 +47,8 @@ <!-- unit tests --> <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.hamcrest</groupId> - <artifactId>hamcrest-all</artifactId> + <groupId>org.codehaus.sonar</groupId> + <artifactId>sonar-testing-harness</artifactId> <scope>test</scope> </dependency> <dependency> @@ -62,11 +57,6 @@ <scope>test</scope> </dependency> <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-core</artifactId> - <scope>test</scope> - </dependency> - <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> <scope>test</scope> @@ -92,11 +82,6 @@ <scope>test</scope> </dependency> <dependency> - <groupId>org.easytesting</groupId> - <artifactId>fest-assert</artifactId> - <scope>test</scope> - </dependency> - <dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> <scope>test</scope> |