Merge pull request #5 from adamcin/adamcin/upgrade-shaded-felix-scr-to-support-R7-annotation-binding
SLING-8244 upgrade shaded felix.scr to support R7 annotation config binding
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 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.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 @@
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 @@
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 @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 @@
@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 @@
this.activated = true;
this.componentContext = componentContext;
this.bundleContext = bundleContext;
- this.map = ImmutableMap.<String, Object>of("prop1", config.prop1());;
+ this.map = readAnnotationToMap(config);
}
@Deactivate