SLING-10046 switch to individual OSGi artifacts and make them compile scope
declare versions from ~2018 in parent pom
diff --git a/core/pom.xml b/core/pom.xml
index 3c57e79..c8c4cd6 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -36,37 +36,48 @@
<dependency>
<groupId>org.osgi</groupId>
- <artifactId>osgi.core</artifactId>
- <scope>provided</scope>
+ <artifactId>org.osgi.framework</artifactId>
+ <scope>compile</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
- <artifactId>osgi.cmpn</artifactId>
- <scope>provided</scope>
+ <artifactId>org.osgi.service.component</artifactId>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.service.cm</artifactId>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.service.event</artifactId>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.service.log</artifactId>
+ <scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.commons.osgi</artifactId>
- <version>2.4.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
- <version>4.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
- <version>3.6</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
- <version>2.5</version>
<scope>compile</scope>
</dependency>
@@ -113,6 +124,7 @@
<version>5.6.10</version>
<scope>compile</scope>
</dependency>
+
<!-- Artifact is shaded and inlined, only some classes included (see below) -->
<dependency>
<groupId>org.apache.felix</groupId>
@@ -126,7 +138,7 @@
</exclusion>
</exclusions>
</dependency>
-
+
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
diff --git a/core/src/main/java/org/apache/sling/testing/mock/osgi/MapUtil.java b/core/src/main/java/org/apache/sling/testing/mock/osgi/MapUtil.java
index 30d1ac2..000d13c 100644
--- a/core/src/main/java/org/apache/sling/testing/mock/osgi/MapUtil.java
+++ b/core/src/main/java/org/apache/sling/testing/mock/osgi/MapUtil.java
@@ -92,7 +92,7 @@
* @param args Key/value pairs
* @return Map
*/
- @SuppressWarnings({ "unchecked", "null" })
+ @SuppressWarnings("unchecked")
public static @NotNull Map<String, Object> toMap(@NotNull Object @NotNull ... args) {
if (args == null || args.length == 0) {
return Collections.emptyMap();
diff --git a/core/src/main/java/org/apache/sling/testing/mock/osgi/MockComponentContext.java b/core/src/main/java/org/apache/sling/testing/mock/osgi/MockComponentContext.java
index a00ec72..a240ea9 100644
--- a/core/src/main/java/org/apache/sling/testing/mock/osgi/MockComponentContext.java
+++ b/core/src/main/java/org/apache/sling/testing/mock/osgi/MockComponentContext.java
@@ -74,7 +74,7 @@
// --- unsupported operations ---
@Override
- public ComponentInstance getComponentInstance() {
+ public <S> ComponentInstance<S> getComponentInstance() {
throw new UnsupportedOperationException();
}
@@ -84,7 +84,7 @@
}
@Override
- public Object locateService(final String name) {
+ public <S> S locateService(final String name) {
throw new UnsupportedOperationException();
}
diff --git a/core/src/main/java/org/apache/sling/testing/mock/osgi/MockConfiguration.java b/core/src/main/java/org/apache/sling/testing/mock/osgi/MockConfiguration.java
index 7bcac56..cfc249c 100644
--- a/core/src/main/java/org/apache/sling/testing/mock/osgi/MockConfiguration.java
+++ b/core/src/main/java/org/apache/sling/testing/mock/osgi/MockConfiguration.java
@@ -18,10 +18,13 @@
*/
package org.apache.sling.testing.mock.osgi;
+import java.io.IOException;
import java.util.Dictionary;
import java.util.Hashtable;
+import java.util.Set;
import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceReference;
import org.osgi.service.cm.Configuration;
/**
@@ -105,4 +108,29 @@
throw new UnsupportedOperationException();
}
+ @Override
+ public Dictionary<String, Object> getProcessedProperties(ServiceReference<?> reference) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public boolean updateIfDifferent(Dictionary<String, ?> properties) throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void addAttributes(ConfigurationAttribute... attrs) throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public Set<ConfigurationAttribute> getAttributes() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void removeAttributes(ConfigurationAttribute... attrs) throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
}
diff --git a/core/src/main/java/org/apache/sling/testing/mock/osgi/MockConfigurationAdmin.java b/core/src/main/java/org/apache/sling/testing/mock/osgi/MockConfigurationAdmin.java
index f195c1c..c6146f8 100644
--- a/core/src/main/java/org/apache/sling/testing/mock/osgi/MockConfigurationAdmin.java
+++ b/core/src/main/java/org/apache/sling/testing/mock/osgi/MockConfigurationAdmin.java
@@ -18,6 +18,7 @@
*/
package org.apache.sling.testing.mock.osgi;
+import java.io.IOException;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
@@ -59,4 +60,14 @@
throw new UnsupportedOperationException();
}
+ @Override
+ public Configuration getFactoryConfiguration(String factoryPid, String name, String location) throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public Configuration getFactoryConfiguration(String factoryPid, String name) throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
}
diff --git a/core/src/main/java/org/apache/sling/testing/mock/osgi/context/ContextPlugins.java b/core/src/main/java/org/apache/sling/testing/mock/osgi/context/ContextPlugins.java
index d4bd102..f341819 100644
--- a/core/src/main/java/org/apache/sling/testing/mock/osgi/context/ContextPlugins.java
+++ b/core/src/main/java/org/apache/sling/testing/mock/osgi/context/ContextPlugins.java
@@ -68,7 +68,7 @@
* @param <T> context type
* @param plugin Plugin
*/
- @SuppressWarnings({ "null", "unused" })
+ @SuppressWarnings("unused")
@SafeVarargs
public final <T extends OsgiContextImpl> void addPlugin(@NotNull ContextPlugin<T> @NotNull ... plugin) {
for (final ContextPlugin<T> item : plugin) {
@@ -84,7 +84,7 @@
* @param <T> context type
* @param beforeSetUpCallback Allows the application to register an own callback function that is called before the built-in setup rules are executed.
*/
- @SuppressWarnings({ "null", "unused" })
+ @SuppressWarnings("unused")
@SafeVarargs
public final <T extends OsgiContextImpl> void addBeforeSetUpCallback(@NotNull final ContextCallback<T> @NotNull ... beforeSetUpCallback) {
for (final ContextCallback<T> item : beforeSetUpCallback) {
@@ -109,7 +109,7 @@
* @param <T> context type
* @param afterSetUpCallback Allows the application to register an own callback function that is called after the built-in setup rules are executed.
*/
- @SuppressWarnings({ "null", "unused" })
+ @SuppressWarnings("unused")
@SafeVarargs
public final <T extends OsgiContextImpl> void addAfterSetUpCallback(@NotNull final ContextCallback<T> @NotNull ... afterSetUpCallback) {
for (final ContextCallback<T> item : afterSetUpCallback) {
@@ -134,7 +134,7 @@
* @param <T> context type
* @param beforeTearDownCallback Allows the application to register an own callback function that is called before the built-in teardown rules are executed.
*/
- @SuppressWarnings({ "null", "unused" })
+ @SuppressWarnings("unused")
@SafeVarargs
public final <T extends OsgiContextImpl> void addBeforeTearDownCallback(@NotNull final ContextCallback<T> @NotNull ... beforeTearDownCallback) {
for (final ContextCallback<T> item : beforeTearDownCallback) {
@@ -159,7 +159,7 @@
* @param <T> context type
* @param afterTearDownCallback Allows the application to register an own callback function that is after before the built-in teardown rules are executed.
*/
- @SuppressWarnings({ "null", "unused" })
+ @SuppressWarnings("unused")
@SafeVarargs
public final <T extends OsgiContextImpl> void addAfterTearDownCallback(@NotNull final ContextCallback<T> @NotNull ... afterTearDownCallback) {
for (final ContextCallback<T> item : afterTearDownCallback) {
diff --git a/junit4/pom.xml b/junit4/pom.xml
index 2d08139..554b004 100644
--- a/junit4/pom.xml
+++ b/junit4/pom.xml
@@ -49,17 +49,6 @@
</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.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
diff --git a/junit5/pom.xml b/junit5/pom.xml
index b006272..d8afb05 100644
--- a/junit5/pom.xml
+++ b/junit5/pom.xml
@@ -49,17 +49,6 @@
</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.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
diff --git a/parent/pom.xml b/parent/pom.xml
index b67b451..9a17d66 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -41,6 +41,11 @@
<artifactId>org.osgi.annotation.versioning</artifactId>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.service.component.annotations</artifactId>
+ <scope>provided</scope>
+ </dependency>
<!-- Nullability annotations -->
<dependency>
@@ -55,6 +60,53 @@
<dependencies>
<dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.framework</artifactId>
+ <version>1.8.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.service.component</artifactId>
+ <version>1.4.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.service.cm</artifactId>
+ <version>1.6.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.service.event</artifactId>
+ <version>1.3.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.service.log</artifactId>
+ <version>1.3.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.sling</groupId>
+ <artifactId>org.apache.sling.commons.osgi</artifactId>
+ <version>2.4.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-collections4</artifactId>
+ <version>4.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ <version>3.6</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>2.5</version>
+ </dependency>
+
+ <dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>3.7.0</version>