You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ss...@apache.org on 2019/01/28 13:59:53 UTC
[sling-org-apache-sling-testing-osgi-mock] branch master updated:
SLING-8244 upgrade shaded felix.scr to support R7 annotation config binding
This is an automated email from the ASF dual-hosted git repository.
sseifert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-testing-osgi-mock.git
The following commit(s) were added to refs/heads/master by this push:
new 79479bc SLING-8244 upgrade shaded felix.scr to support R7 annotation config binding
new 8744869 Merge pull request #5 from adamcin/adamcin/upgrade-shaded-felix-scr-to-support-R7-annotation-binding
79479bc is described below
commit 79479bcefa545db38ff4a83e150dd0417364cb5c
Author: Mark Adamcin <ad...@gmail.com>
AuthorDate: Fri Jan 25 14:31:55 2019 -0800
SLING-8244 upgrade shaded felix.scr to support R7 annotation config binding
---
core/pom.xml | 2 +-
.../OsgiServiceUtilActivateDeactivateTest.java | 23 +++++++++++++++-------
2 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/core/pom.xml b/core/pom.xml
index 3b54c58..7ca965d 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -113,7 +113,7 @@
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.scr</artifactId>
- <version>2.0.4</version>
+ <version>2.1.8</version>
<scope>compile</scope>
<exclusions>
<exclusion>
diff --git a/core/src/test/java/org/apache/sling/testing/mock/osgi/OsgiServiceUtilActivateDeactivateTest.java b/core/src/test/java/org/apache/sling/testing/mock/osgi/OsgiServiceUtilActivateDeactivateTest.java
index bed7b87..9e69984 100644
--- a/core/src/test/java/org/apache/sling/testing/mock/osgi/OsgiServiceUtilActivateDeactivateTest.java
+++ b/core/src/test/java/org/apache/sling/testing/mock/osgi/OsgiServiceUtilActivateDeactivateTest.java
@@ -25,6 +25,7 @@ import static org.junit.Assert.assertTrue;
import java.util.Map;
+import com.google.common.collect.ImmutableMap;
import org.junit.Test;
import org.osgi.framework.BundleContext;
import org.osgi.service.component.ComponentContext;
@@ -32,15 +33,15 @@ import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Deactivate;
-import com.google.common.collect.ImmutableMap;
-
/**
* Test different variants of activate/deactivate methods with varying signatures.
*/
@SuppressWarnings("null")
public class OsgiServiceUtilActivateDeactivateTest {
- private Map<String,Object> map = ImmutableMap.<String, Object>of("prop1", "value1");
+ private Map<String,Object> map = ImmutableMap.<String, Object>of("prop1", "value1",
+ "prop2.with.periods", "value2",
+ "prop3-with-hyphens", "value3");
private BundleContext bundleContext = MockOsgi.newBundleContext();
@Test
@@ -86,7 +87,7 @@ public class OsgiServiceUtilActivateDeactivateTest {
assertTrue(MockOsgi.activate(service, bundleContext, map));
assertTrue(service.isActivated());
assertEquals(map, ImmutableMap.copyOf(service.getMap()));
-
+
assertTrue(MockOsgi.deactivate(service, bundleContext, map));
assertFalse(service.isActivated());
}
@@ -125,7 +126,7 @@ public class OsgiServiceUtilActivateDeactivateTest {
assertSame(bundleContext, service.getComponentContext().getBundleContext());
assertSame(bundleContext, service.getBundleContext());
assertEquals(map, ImmutableMap.copyOf(service.getMap()));
-
+
assertTrue(MockOsgi.deactivate(service, bundleContext, map));
assertFalse(service.isActivated());
}
@@ -133,6 +134,14 @@ public class OsgiServiceUtilActivateDeactivateTest {
public @interface ServiceConfig {
String prop1();
+ String prop2_with_periods();
+ String prop3$_$with$_$hyphens();
+ }
+
+ static Map<String, Object> readAnnotationToMap(final ServiceConfig config) {
+ return ImmutableMap.of("prop1", config.prop1(),
+ "prop2.with.periods", config.prop2_with_periods(),
+ "prop3-with-hyphens", config.prop3$_$with$_$hyphens());
}
@Component
@@ -228,7 +237,7 @@ public class OsgiServiceUtilActivateDeactivateTest {
@Activate
private void activate(ServiceConfig config) {
this.activated = true;
- map = ImmutableMap.<String, Object>of("prop1", config.prop1());
+ map = readAnnotationToMap(config);
}
@Deactivate
@@ -322,7 +331,7 @@ public class OsgiServiceUtilActivateDeactivateTest {
this.activated = true;
this.componentContext = componentContext;
this.bundleContext = bundleContext;
- this.map = ImmutableMap.<String, Object>of("prop1", config.prop1());;
+ this.map = readAnnotationToMap(config);
}
@Deactivate