This is an automated email from the ASF dual-hosted git repository. sseifert pushed a commit to branch feature/SLING-7803-junit5 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-testing-sling-mock.git
commit 91a571a5a59842c9e35c302ed7b5edc4bb65837a Author: sseifert <[email protected]> AuthorDate: Mon Aug 6 15:00:42 2018 +0200 SLING-7803 move junit4-specific files to junit4 module --- core/pom.xml | 2 +- .../mock/sling/MockJcrSlingRepositoryTest.java | 4 +- .../testing/mock/sling/junit/SlingContext.java | 7 +++ .../mock/sling/junit/SlingContextBuilder.java | 7 +++ .../mock/sling/junit/SlingContextCallback.java | 7 +++ junit4/pom.xml | 55 ++++++++++++++++++++++ .../testing/mock/sling/junit/SlingContext.java | 0 .../mock/sling/junit/SlingContextBuilder.java | 0 .../mock/sling/junit/SlingContextCallback.java | 0 .../testing/mock/sling/junit/package-info.java | 0 .../sling/junit/SlingContextDefaultRRTypeTest.java | 0 .../testing/mock/sling/junit/SlingContextTest.java | 0 junit5/pom.xml | 50 ++++++++++++++++++++ 13 files changed, 129 insertions(+), 3 deletions(-) diff --git a/core/pom.xml b/core/pom.xml index 47701f2..4e8e14a 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -242,7 +242,7 @@ <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> - <scope>compile</scope> + <scope>test</scope> </dependency> <dependency> <groupId>org.mockito</groupId> diff --git a/core/src/test/java/org/apache/sling/testing/mock/sling/MockJcrSlingRepositoryTest.java b/core/src/test/java/org/apache/sling/testing/mock/sling/MockJcrSlingRepositoryTest.java index 902aaca..cf078af 100644 --- a/core/src/test/java/org/apache/sling/testing/mock/sling/MockJcrSlingRepositoryTest.java +++ b/core/src/test/java/org/apache/sling/testing/mock/sling/MockJcrSlingRepositoryTest.java @@ -25,7 +25,7 @@ import javax.jcr.Session; import org.apache.sling.jcr.api.SlingRepository; import org.apache.sling.testing.mock.jcr.MockJcr; -import org.apache.sling.testing.mock.osgi.junit.OsgiContext; +import org.apache.sling.testing.mock.sling.junit.SlingContext; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -33,7 +33,7 @@ import org.junit.Test; public class MockJcrSlingRepositoryTest { @Rule - public OsgiContext context = new OsgiContext(); + public SlingContext context = new SlingContext(); private SlingRepository repository; diff --git a/core/src/main/java/org/apache/sling/testing/mock/sling/junit/SlingContext.java b/core/src/test/java/org/apache/sling/testing/mock/sling/junit/SlingContext.java similarity index 94% copy from core/src/main/java/org/apache/sling/testing/mock/sling/junit/SlingContext.java copy to core/src/test/java/org/apache/sling/testing/mock/sling/junit/SlingContext.java index 9ceda62..241acfa 100644 --- a/core/src/main/java/org/apache/sling/testing/mock/sling/junit/SlingContext.java +++ b/core/src/test/java/org/apache/sling/testing/mock/sling/junit/SlingContext.java @@ -33,6 +33,13 @@ import org.junit.runner.Description; import org.junit.runners.model.Statement; import org.osgi.annotation.versioning.ProviderType; +/* + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * PLEASE NOTE: this file is copied from sling-mock.junit4 project to ease the unit tests in the core project. + * If you need change it in sling-mock.junit4, please update it her as well (and vice versa). + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + */ + /** * JUnit rule for setting up and tearing down Sling context objects for unit tests. * You can use {@link SlingContextBuilder} alternatively to the constructors on this class - it offers diff --git a/core/src/main/java/org/apache/sling/testing/mock/sling/junit/SlingContextBuilder.java b/core/src/test/java/org/apache/sling/testing/mock/sling/junit/SlingContextBuilder.java similarity index 93% copy from core/src/main/java/org/apache/sling/testing/mock/sling/junit/SlingContextBuilder.java copy to core/src/test/java/org/apache/sling/testing/mock/sling/junit/SlingContextBuilder.java index afe5cb5..24e8d29 100644 --- a/core/src/main/java/org/apache/sling/testing/mock/sling/junit/SlingContextBuilder.java +++ b/core/src/test/java/org/apache/sling/testing/mock/sling/junit/SlingContextBuilder.java @@ -28,6 +28,13 @@ import org.apache.sling.testing.mock.sling.ResourceResolverType; import org.jetbrains.annotations.NotNull; import org.osgi.annotation.versioning.ProviderType; +/* + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * PLEASE NOTE: this file is copied from sling-mock.junit4 project to ease the unit tests in the core project. + * If you need change it in sling-mock.junit4, please update it her as well (and vice versa). + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + */ + /** * Builder class for creating {@link SlingContext} instances with different sets of parameters. */ diff --git a/core/src/main/java/org/apache/sling/testing/mock/sling/junit/SlingContextCallback.java b/core/src/test/java/org/apache/sling/testing/mock/sling/junit/SlingContextCallback.java similarity index 74% copy from core/src/main/java/org/apache/sling/testing/mock/sling/junit/SlingContextCallback.java copy to core/src/test/java/org/apache/sling/testing/mock/sling/junit/SlingContextCallback.java index 79343c3..a69f469 100644 --- a/core/src/main/java/org/apache/sling/testing/mock/sling/junit/SlingContextCallback.java +++ b/core/src/test/java/org/apache/sling/testing/mock/sling/junit/SlingContextCallback.java @@ -21,6 +21,13 @@ package org.apache.sling.testing.mock.sling.junit; import org.apache.sling.testing.mock.osgi.context.ContextCallback; import org.osgi.annotation.versioning.ConsumerType; +/* + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * PLEASE NOTE: this file is copied from sling-mock.junit4 project to ease the unit tests in the core project. + * If you need change it in sling-mock.junit4, please update it her as well (and vice versa). + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + */ + /** * Callback interface for application-specific setup and teardown operations to * customize the {@link SlingContext} JUnit rule. diff --git a/junit4/pom.xml b/junit4/pom.xml index 94c041f..1d6c7c6 100644 --- a/junit4/pom.xml +++ b/junit4/pom.xml @@ -36,6 +36,61 @@ <dependencies> + <dependency> + <groupId>org.osgi</groupId> + <artifactId>org.osgi.annotation.versioning</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.osgi</groupId> + <artifactId>osgi.core</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.osgi</groupId> + <artifactId>osgi.cmpn</artifactId> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>org.apache.sling</groupId> + <artifactId>org.apache.sling.testing.sling-mock.core</artifactId> + <version>2.3.0-SNAPSHOT</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.apache.sling</groupId> + <artifactId>org.apache.sling.testing.sling-mock.core</artifactId> + <version>2.3.0-SNAPSHOT</version> + <classifier>tests</classifier> + <scope>test</scope> + </dependency> + + <!-- Nullability annotations --> + <dependency> + <groupId>org.jetbrains</groupId> + <artifactId>annotations</artifactId> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-core</artifactId> + <version>2.19.1</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.sling</groupId> + <artifactId>org.apache.sling.testing.logging-mock</artifactId> + <version>2.0.0</version> + <scope>test</scope> + </dependency> + </dependencies> <build> diff --git a/core/src/main/java/org/apache/sling/testing/mock/sling/junit/SlingContext.java b/junit4/src/main/java/org/apache/sling/testing/mock/sling/junit/SlingContext.java similarity index 100% rename from core/src/main/java/org/apache/sling/testing/mock/sling/junit/SlingContext.java rename to junit4/src/main/java/org/apache/sling/testing/mock/sling/junit/SlingContext.java diff --git a/core/src/main/java/org/apache/sling/testing/mock/sling/junit/SlingContextBuilder.java b/junit4/src/main/java/org/apache/sling/testing/mock/sling/junit/SlingContextBuilder.java similarity index 100% rename from core/src/main/java/org/apache/sling/testing/mock/sling/junit/SlingContextBuilder.java rename to junit4/src/main/java/org/apache/sling/testing/mock/sling/junit/SlingContextBuilder.java diff --git a/core/src/main/java/org/apache/sling/testing/mock/sling/junit/SlingContextCallback.java b/junit4/src/main/java/org/apache/sling/testing/mock/sling/junit/SlingContextCallback.java similarity index 100% rename from core/src/main/java/org/apache/sling/testing/mock/sling/junit/SlingContextCallback.java rename to junit4/src/main/java/org/apache/sling/testing/mock/sling/junit/SlingContextCallback.java diff --git a/core/src/main/java/org/apache/sling/testing/mock/sling/junit/package-info.java b/junit4/src/main/java/org/apache/sling/testing/mock/sling/junit/package-info.java similarity index 100% rename from core/src/main/java/org/apache/sling/testing/mock/sling/junit/package-info.java rename to junit4/src/main/java/org/apache/sling/testing/mock/sling/junit/package-info.java diff --git a/core/src/test/java/org/apache/sling/testing/mock/sling/junit/SlingContextDefaultRRTypeTest.java b/junit4/src/test/java/org/apache/sling/testing/mock/sling/junit/SlingContextDefaultRRTypeTest.java similarity index 100% rename from core/src/test/java/org/apache/sling/testing/mock/sling/junit/SlingContextDefaultRRTypeTest.java rename to junit4/src/test/java/org/apache/sling/testing/mock/sling/junit/SlingContextDefaultRRTypeTest.java diff --git a/core/src/test/java/org/apache/sling/testing/mock/sling/junit/SlingContextTest.java b/junit4/src/test/java/org/apache/sling/testing/mock/sling/junit/SlingContextTest.java similarity index 100% rename from core/src/test/java/org/apache/sling/testing/mock/sling/junit/SlingContextTest.java rename to junit4/src/test/java/org/apache/sling/testing/mock/sling/junit/SlingContextTest.java diff --git a/junit5/pom.xml b/junit5/pom.xml index fd3361b..c461f67 100644 --- a/junit5/pom.xml +++ b/junit5/pom.xml @@ -36,6 +36,56 @@ <dependencies> + <dependency> + <groupId>org.osgi</groupId> + <artifactId>org.osgi.annotation.versioning</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.osgi</groupId> + <artifactId>osgi.core</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.osgi</groupId> + <artifactId>osgi.cmpn</artifactId> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>org.apache.sling</groupId> + <artifactId>org.apache.sling.testing.sling-mock.core</artifactId> + <version>2.3.0-SNAPSHOT</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.apache.sling</groupId> + <artifactId>org.apache.sling.testing.sling-mock.core</artifactId> + <version>2.3.0-SNAPSHOT</version> + <classifier>tests</classifier> + <scope>test</scope> + </dependency> + + <!-- Nullability annotations --> + <dependency> + <groupId>org.jetbrains</groupId> + <artifactId>annotations</artifactId> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-core</artifactId> + <version>2.19.1</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.sling</groupId> + <artifactId>org.apache.sling.testing.logging-mock</artifactId> + <version>2.0.0</version> + <scope>test</scope> + </dependency> + </dependencies> <build>
