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 | |
parent | cd582e700b3ceda2de457733db6cd2417b5346c9 (diff) | |
download | sonarqube-f3f4dc6d61173b16906cf6741cc628abd4c0b996.tar.gz sonarqube-f3f4dc6d61173b16906cf6741cc628abd4c0b996.zip |
Profile dbTests enables only the tests involving a database
30 files changed, 103 insertions, 175 deletions
diff --git a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/IssueTrackingDecoratorTest.java b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/IssueTrackingDecoratorTest.java index 99d3cdcdd63..f9a9c64eef3 100644 --- a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/IssueTrackingDecoratorTest.java +++ b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/IssueTrackingDecoratorTest.java @@ -45,7 +45,6 @@ import org.sonar.core.issue.IssueUpdater; import org.sonar.core.issue.db.IssueChangeDto; import org.sonar.core.issue.db.IssueDto; import org.sonar.core.issue.workflow.IssueWorkflow; -import org.sonar.core.persistence.AbstractDaoTestCase; import org.sonar.java.api.JavaClass; import java.util.Arrays; @@ -61,15 +60,9 @@ import static org.mockito.Matchers.anyString; import static org.mockito.Matchers.argThat; import static org.mockito.Matchers.eq; import static org.mockito.Matchers.isA; -import static org.mockito.Mockito.RETURNS_MOCKS; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; -import static org.mockito.Mockito.when; - -public class IssueTrackingDecoratorTest extends AbstractDaoTestCase { +import static org.mockito.Mockito.*; + +public class IssueTrackingDecoratorTest { IssueTrackingDecorator decorator; IssueCache issueCache = mock(IssueCache.class, RETURNS_MOCKS); diff --git a/plugins/sonar-l10n-en-plugin/pom.xml b/plugins/sonar-l10n-en-plugin/pom.xml index 123fe68fa51..b73653fb170 100644 --- a/plugins/sonar-l10n-en-plugin/pom.xml +++ b/plugins/sonar-l10n-en-plugin/pom.xml @@ -42,18 +42,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.hamcrest</groupId> - <artifactId>hamcrest-all</artifactId> + <groupId>org.codehaus.sonar</groupId> + <artifactId>sonar-testing-harness</artifactId> <scope>test</scope> </dependency> </dependencies> @@ -487,6 +487,7 @@ <systemPropertyVariables> <java.io.tmpdir>${project.build.directory}</java.io.tmpdir> </systemPropertyVariables> + <groups>${junitGroups}</groups> </configuration> </plugin> <plugin> @@ -1447,6 +1448,7 @@ </activation> <properties> <skipWebTests>true</skipWebTests> + <junitGroups>org.sonar.test.DbTests</junitGroups> </properties> <dependencies> <dependency> 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> diff --git a/sonar-batch-protocol/pom.xml b/sonar-batch-protocol/pom.xml index dc589fc2552..3584c2d52d3 100644 --- a/sonar-batch-protocol/pom.xml +++ b/sonar-batch-protocol/pom.xml @@ -25,13 +25,8 @@ <!-- unit tests --> <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.easytesting</groupId> - <artifactId>fest-assert</artifactId> + <groupId>org.codehaus.sonar</groupId> + <artifactId>sonar-testing-harness</artifactId> <scope>test</scope> </dependency> <dependency> diff --git a/sonar-colorizer/pom.xml b/sonar-colorizer/pom.xml index 1ce734ddc01..e5ced4532a2 100644 --- a/sonar-colorizer/pom.xml +++ b/sonar-colorizer/pom.xml @@ -30,21 +30,11 @@ </dependency> <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.hamcrest</groupId> - <artifactId>hamcrest-all</artifactId> - <version>1.3</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.easytesting</groupId> - <artifactId>fest-assert</artifactId> + <groupId>org.codehaus.sonar</groupId> + <artifactId>sonar-testing-harness</artifactId> <scope>test</scope> </dependency> + </dependencies> </project> diff --git a/sonar-core/src/test/java/org/sonar/core/persistence/AbstractDaoTestCase.java b/sonar-core/src/test/java/org/sonar/core/persistence/AbstractDaoTestCase.java index cdcf00ddf1a..b965f4c0164 100644 --- a/sonar-core/src/test/java/org/sonar/core/persistence/AbstractDaoTestCase.java +++ b/sonar-core/src/test/java/org/sonar/core/persistence/AbstractDaoTestCase.java @@ -43,12 +43,14 @@ import org.dbunit.operation.DatabaseOperation; import org.junit.Assert; import org.junit.Before; import org.junit.BeforeClass; +import org.junit.experimental.categories.Category; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.sonar.api.config.Settings; import org.sonar.core.cluster.NullQueue; import org.sonar.core.config.Logback; import org.sonar.core.persistence.dialect.MySql; +import org.sonar.test.DbTests; import java.io.File; import java.io.IOException; @@ -63,6 +65,7 @@ import java.util.Properties; import static org.junit.Assert.fail; +@Category(DbTests.class) public abstract class AbstractDaoTestCase { private static final Logger LOG = LoggerFactory.getLogger(AbstractDaoTestCase.class); diff --git a/sonar-core/src/test/java/org/sonar/core/persistence/TestDatabase.java b/sonar-core/src/test/java/org/sonar/core/persistence/TestDatabase.java index 4a52ab4ecb0..a7ee7d9153d 100644 --- a/sonar-core/src/test/java/org/sonar/core/persistence/TestDatabase.java +++ b/sonar-core/src/test/java/org/sonar/core/persistence/TestDatabase.java @@ -70,6 +70,9 @@ import static org.junit.Assert.fail; * This class should be call using @ClassRule in order to create the schema once (ft @Rule is used * the schema will be recreated before each test). * Data will be truncated each time you call prepareDbUnit(). + * <p/> + * File using <code>TestDatabase</code> must be annotated with {@link org.sonar.test.DbTests} so + * that they can be executed on all supported DBs. */ public class TestDatabase extends ExternalResource { diff --git a/sonar-deprecated/pom.xml b/sonar-deprecated/pom.xml index 8e2cabea40c..9b856c20605 100644 --- a/sonar-deprecated/pom.xml +++ b/sonar-deprecated/pom.xml @@ -27,13 +27,8 @@ <!-- unit test --> <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> @@ -43,16 +38,5 @@ <version>${project.version}</version> <scope>test</scope> </dependency> - - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-core</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.easytesting</groupId> - <artifactId>fest-assert</artifactId> - <scope>test</scope> - </dependency> </dependencies> </project> diff --git a/sonar-duplications/pom.xml b/sonar-duplications/pom.xml index fd6f71fb09e..13201649d75 100644 --- a/sonar-duplications/pom.xml +++ b/sonar-duplications/pom.xml @@ -54,18 +54,8 @@ </exclusions> </dependency> <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.hamcrest</groupId> - <artifactId>hamcrest-all</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-core</artifactId> + <groupId>org.codehaus.sonar</groupId> + <artifactId>sonar-testing-harness</artifactId> <scope>test</scope> </dependency> <dependency> @@ -73,11 +63,6 @@ <artifactId>logback-classic</artifactId> <scope>test</scope> </dependency> - <dependency> - <groupId>org.easytesting</groupId> - <artifactId>fest-assert</artifactId> - <scope>test</scope> - </dependency> </dependencies> <build> diff --git a/sonar-graph/pom.xml b/sonar-graph/pom.xml index 45ea19a418d..18c8612f3c8 100644 --- a/sonar-graph/pom.xml +++ b/sonar-graph/pom.xml @@ -27,18 +27,8 @@ </dependency> <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.hamcrest</groupId> - <artifactId>hamcrest-all</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.easytesting</groupId> - <artifactId>fest-assert</artifactId> + <groupId>org.codehaus.sonar</groupId> + <artifactId>sonar-testing-harness</artifactId> <scope>test</scope> </dependency> </dependencies> diff --git a/sonar-home/pom.xml b/sonar-home/pom.xml index 3af8c484f2b..55127f8dd4f 100644 --- a/sonar-home/pom.xml +++ b/sonar-home/pom.xml @@ -44,18 +44,8 @@ </dependency> <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.hamcrest</groupId> - <artifactId>hamcrest-all</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.easytesting</groupId> - <artifactId>fest-assert</artifactId> + <groupId>org.codehaus.sonar</groupId> + <artifactId>sonar-testing-harness</artifactId> <scope>test</scope> </dependency> <dependency> @@ -65,11 +55,6 @@ <scope>test</scope> </dependency> <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-core</artifactId> - <scope>test</scope> - </dependency> - <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> <scope>test</scope> diff --git a/sonar-markdown/pom.xml b/sonar-markdown/pom.xml index f8b39d0de58..8883090bc1a 100644 --- a/sonar-markdown/pom.xml +++ b/sonar-markdown/pom.xml @@ -26,23 +26,13 @@ <artifactId>slf4j-api</artifactId> </dependency> <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> <scope>test</scope> </dependency> <dependency> - <groupId>org.easytesting</groupId> - <artifactId>fest-assert</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/sonar-testing-harness/src/main/java/org/sonar/test/DbTests.java b/sonar-testing-harness/src/main/java/org/sonar/test/DbTests.java new file mode 100644 index 00000000000..8ae56594662 --- /dev/null +++ b/sonar-testing-harness/src/main/java/org/sonar/test/DbTests.java @@ -0,0 +1,27 @@ +/* + * 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. + */ +package org.sonar.test; + +/** + * JUnit category declared on all the tests that interact with database. These tests + * are executed on all the supported DB, not only on the default embedded H2. + */ +public interface DbTests { +} |