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 2021/03/08 15:55:21 UTC
[sling-org-apache-sling-testing-osgi-mock] branch master updated:
refactoring: move sample OSGI components to separate classes no need to add
license files to auto-generated OSGi metadata files
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 1054c9c refactoring: move sample OSGI components to separate classes no need to add license files to auto-generated OSGi metadata files
1054c9c is described below
commit 1054c9cf1547de47130962ad67d41675da0dcd8d
Author: Stefan Seifert <st...@users.noreply.github.com>
AuthorDate: Mon Mar 8 16:48:22 2021 +0100
refactoring: move sample OSGI components to separate classes
no need to add license files to auto-generated OSGi metadata files
---
core/pom.xml | 1 +
.../OsgiServiceUtilActivateDeactivateTest.java | 243 +--------------------
.../mock/osgi/context/OsgiContextImplTest.java | 20 +-
.../osgi/sample/osgicontextimpl/MyComponent.java | 31 +++
.../osgi/sample/osgicontextimpl/MyService.java | 25 +++
.../activatedeactivate/Service1.java | 52 +++++
.../activatedeactivate/Service2.java | 52 +++++
.../activatedeactivate/Service3.java | 53 +++++
.../activatedeactivate/Service4.java | 61 ++++++
.../activatedeactivate/Service5.java | 44 ++++
.../activatedeactivate/Service6.java | 69 ++++++
.../activatedeactivate/Service7.java | 78 +++++++
.../activatedeactivate/ServiceConfig.java | 29 +++
....osgi.OsgiServiceUtilActivateDeactivateTest.xml | 42 ----
...sting.mock.osgi.context.OsgiContextImplTest.xml | 27 ---
...ock.osgi.sample.osgicontextimpl.MyComponent.xml | 7 +
...gi.sample.osgiserviceutil.RankedServiceFive.xml | 18 --
...sgi.sample.osgiserviceutil.RankedServiceTen.xml | 18 --
...g.mock.osgi.sample.osgiserviceutil.Service1.xml | 18 --
...g.mock.osgi.sample.osgiserviceutil.Service2.xml | 18 --
...g.mock.osgi.sample.osgiserviceutil.Service3.xml | 18 --
....osgi.sample.osgiserviceutil.Service3OsgiR6.xml | 18 --
...le.osgiserviceutil.Service3StaticGreedyImpl.xml | 18 --
...g.mock.osgi.sample.osgiserviceutil.Service4.xml | 18 --
...g.mock.osgi.sample.osgiserviceutil.Service5.xml | 18 --
...viceutil.Service6VolatileMultipleReferences.xml | 18 --
...osgi.sample.osgiserviceutil.ServiceFactory1.xml | 18 --
...osgiserviceutil.activatedeactivate.Service1.xml | 4 +
...osgiserviceutil.activatedeactivate.Service2.xml | 4 +
...osgiserviceutil.activatedeactivate.Service3.xml | 4 +
...osgiserviceutil.activatedeactivate.Service4.xml | 4 +
...osgiserviceutil.activatedeactivate.Service5.xml | 4 +
...osgiserviceutil.activatedeactivate.Service6.xml | 4 +
...osgiserviceutil.activatedeactivate.Service7.xml | 4 +
.../test/resources/OSGI-INF/serviceComponents.xml | 18 --
35 files changed, 541 insertions(+), 537 deletions(-)
diff --git a/core/pom.xml b/core/pom.xml
index 38b301e..5967869 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -199,6 +199,7 @@
<artifactId>apache-rat-plugin</artifactId>
<configuration>
<excludes>
+ <exclude>src/test/resources/OSGI-INF/*</exclude>
<exclude>src/test/resources/META-INF/test.txt</exclude>
<exclude>src/test/resources/bundleData/nested/first.txt</exclude>
<exclude>src/test/resources/bundleData/nested/second.txt</exclude>
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 0bcaa9a..47b3502 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,13 +25,17 @@ import static org.junit.Assert.assertTrue;
import java.util.Map;
-import com.google.common.collect.ImmutableMap;
+import org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.activatedeactivate.Service1;
+import org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.activatedeactivate.Service2;
+import org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.activatedeactivate.Service3;
+import org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.activatedeactivate.Service4;
+import org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.activatedeactivate.Service5;
+import org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.activatedeactivate.Service6;
+import org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.activatedeactivate.Service7;
import org.junit.Test;
import org.osgi.framework.BundleContext;
-import org.osgi.service.component.ComponentContext;
-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.
@@ -130,233 +134,4 @@ public class OsgiServiceUtilActivateDeactivateTest {
assertFalse(service.isActivated());
}
-
- 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
- public static class Service1 {
-
- private boolean activated;
- private ComponentContext componentContext;
-
- @Activate
- private void activate(ComponentContext ctx) {
- this.activated = true;
- this.componentContext = ctx;
- }
-
- @Deactivate
- private void deactivate(ComponentContext ctx) {
- this.activated = false;
- this.componentContext = null;
- }
-
- public boolean isActivated() {
- return activated;
- }
-
- public ComponentContext getComponentContext() {
- return componentContext;
- }
-
- }
-
- @Component
- public static class Service2 {
-
- private boolean activated;
- private BundleContext bundleContext;
-
- @Activate
- private void activate(BundleContext ctx) {
- this.activated = true;
- this.bundleContext = ctx;
- }
-
- @Deactivate
- private void deactivate(BundleContext ctx) {
- this.activated = false;
- this.bundleContext = null;
- }
-
- public boolean isActivated() {
- return activated;
- }
-
- public BundleContext getBundleContext() {
- return bundleContext;
- }
-
- }
-
- @Component
- public static class Service3 {
-
- private boolean activated;
- private Map<String, Object> map;
-
- @Activate
- private void activate(Map<String,Object> map) {
- this.activated = true;
- this.map = map;
- }
-
- @Deactivate
- private void deactivate(Map<String,Object> map) {
- this.activated = false;
- this.map = null;
- }
-
- public boolean isActivated() {
- return activated;
- }
-
- public Map<String, Object> getMap() {
- return map;
- }
-
- }
-
- @Component
- public static class Service4 {
-
- private boolean activated;
- private Map<String, Object> map;
-
- @Activate
- private void activate(ServiceConfig config) {
- this.activated = true;
- map = readAnnotationToMap(config);
- }
-
- @Deactivate
- private void deactivate(int value) {
- this.activated = false;
- }
-
- public boolean isActivated() {
- return activated;
- }
-
- public Map<String, Object> getMap() {
- return map;
- }
-
- }
-
- @Component
- public static class Service5 {
-
- private boolean activated;
-
- @Activate
- private void activate() {
- this.activated = true;
- }
-
- @Deactivate
- private void deactivate(Integer value) {
- this.activated = false;
- }
-
- public boolean isActivated() {
- return activated;
- }
-
- }
-
- @Component
- public static class Service6 {
-
- private boolean activated;
- private ComponentContext componentContext;
- private BundleContext bundleContext;
- private Map<String,Object> map;
-
- @Activate
- private void activate(ComponentContext componentContext, BundleContext bundleContext, Map<String,Object> map) {
- this.activated = true;
- this.componentContext = componentContext;
- this.bundleContext = bundleContext;
- this.map = map;
- }
-
- @Deactivate
- private void deactivate(Map<String,Object> map, BundleContext bundleContext, int value1, Integer value2) {
- this.activated = false;
- this.componentContext = null;
- this.bundleContext = null;
- this.map = null;
- }
-
- public boolean isActivated() {
- return activated;
- }
-
- public ComponentContext getComponentContext() {
- return componentContext;
- }
-
- public BundleContext getBundleContext() {
- return bundleContext;
- }
-
- public Map<String, Object> getMap() {
- return map;
- }
-
- }
-
- @Component
- public static class Service7 {
-
- private boolean activated;
- private ComponentContext componentContext;
- private BundleContext bundleContext;
- private Map<String,Object> map;
-
- @Activate
- private void activate(ComponentContext componentContext, ServiceConfig config, BundleContext bundleContext) {
- this.activated = true;
- this.componentContext = componentContext;
- this.bundleContext = bundleContext;
- this.map = readAnnotationToMap(config);
- }
-
- @Deactivate
- private void deactivate() {
- this.activated = false;
- this.componentContext = null;
- this.bundleContext = null;
- this.map = null;
- }
-
- public boolean isActivated() {
- return activated;
- }
-
- public ComponentContext getComponentContext() {
- return componentContext;
- }
-
- public BundleContext getBundleContext() {
- return bundleContext;
- }
-
- public Map<String, Object> getMap() {
- return map;
- }
-
- }
-
}
diff --git a/core/src/test/java/org/apache/sling/testing/mock/osgi/context/OsgiContextImplTest.java b/core/src/test/java/org/apache/sling/testing/mock/osgi/context/OsgiContextImplTest.java
index 862b305..7ac9731 100644
--- a/core/src/test/java/org/apache/sling/testing/mock/osgi/context/OsgiContextImplTest.java
+++ b/core/src/test/java/org/apache/sling/testing/mock/osgi/context/OsgiContextImplTest.java
@@ -29,6 +29,8 @@ import java.util.Map;
import java.util.Set;
import org.apache.sling.testing.mock.osgi.NoScrMetadataException;
+import org.apache.sling.testing.mock.osgi.sample.osgicontextimpl.MyComponent;
+import org.apache.sling.testing.mock.osgi.sample.osgicontextimpl.MyService;
import org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.Service3;
import org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.ServiceInterface1;
import org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.ServiceInterface2;
@@ -37,7 +39,6 @@ import org.junit.Before;
import org.junit.Test;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
-import org.osgi.service.component.annotations.Component;
import org.osgi.util.tracker.ServiceTracker;
@SuppressWarnings("null")
@@ -178,21 +179,4 @@ public class OsgiContextImplTest {
tracker.close();
}
-
- @Component(
- service = MyService.class
- )
- public static class MyComponent implements MyService {
-
- @Override
- public String foo() {
- return "bar";
- }
- }
-
- public interface MyService {
-
- String foo();
-
- }
}
diff --git a/core/src/test/java/org/apache/sling/testing/mock/osgi/sample/osgicontextimpl/MyComponent.java b/core/src/test/java/org/apache/sling/testing/mock/osgi/sample/osgicontextimpl/MyComponent.java
new file mode 100644
index 0000000..d8ba2ac
--- /dev/null
+++ b/core/src/test/java/org/apache/sling/testing/mock/osgi/sample/osgicontextimpl/MyComponent.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.testing.mock.osgi.sample.osgicontextimpl;
+
+import org.osgi.service.component.annotations.Component;
+
+@Component(service = MyService.class)
+public class MyComponent implements MyService {
+
+ @Override
+ public String foo() {
+ return "bar";
+ }
+
+}
diff --git a/core/src/test/java/org/apache/sling/testing/mock/osgi/sample/osgicontextimpl/MyService.java b/core/src/test/java/org/apache/sling/testing/mock/osgi/sample/osgicontextimpl/MyService.java
new file mode 100644
index 0000000..9dd7b8e
--- /dev/null
+++ b/core/src/test/java/org/apache/sling/testing/mock/osgi/sample/osgicontextimpl/MyService.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.testing.mock.osgi.sample.osgicontextimpl;
+
+public interface MyService {
+
+ String foo();
+
+}
\ No newline at end of file
diff --git a/core/src/test/java/org/apache/sling/testing/mock/osgi/sample/osgiserviceutil/activatedeactivate/Service1.java b/core/src/test/java/org/apache/sling/testing/mock/osgi/sample/osgiserviceutil/activatedeactivate/Service1.java
new file mode 100644
index 0000000..60d13cc
--- /dev/null
+++ b/core/src/test/java/org/apache/sling/testing/mock/osgi/sample/osgiserviceutil/activatedeactivate/Service1.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.activatedeactivate;
+
+import org.osgi.service.component.ComponentContext;
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Deactivate;
+
+@Component
+public class Service1 {
+
+ private boolean activated;
+ private ComponentContext componentContext;
+
+ @Activate
+ private void activate(ComponentContext ctx) {
+ this.activated = true;
+ this.componentContext = ctx;
+ }
+
+ @Deactivate
+ private void deactivate(ComponentContext ctx) {
+ this.activated = false;
+ this.componentContext = null;
+ }
+
+ public boolean isActivated() {
+ return activated;
+ }
+
+ public ComponentContext getComponentContext() {
+ return componentContext;
+ }
+
+}
diff --git a/core/src/test/java/org/apache/sling/testing/mock/osgi/sample/osgiserviceutil/activatedeactivate/Service2.java b/core/src/test/java/org/apache/sling/testing/mock/osgi/sample/osgiserviceutil/activatedeactivate/Service2.java
new file mode 100644
index 0000000..137b909
--- /dev/null
+++ b/core/src/test/java/org/apache/sling/testing/mock/osgi/sample/osgiserviceutil/activatedeactivate/Service2.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.activatedeactivate;
+
+import org.osgi.framework.BundleContext;
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Deactivate;
+
+@Component
+public class Service2 {
+
+ private boolean activated;
+ private BundleContext bundleContext;
+
+ @Activate
+ private void activate(BundleContext ctx) {
+ this.activated = true;
+ this.bundleContext = ctx;
+ }
+
+ @Deactivate
+ private void deactivate(BundleContext ctx) {
+ this.activated = false;
+ this.bundleContext = null;
+ }
+
+ public boolean isActivated() {
+ return activated;
+ }
+
+ public BundleContext getBundleContext() {
+ return bundleContext;
+ }
+
+}
diff --git a/core/src/test/java/org/apache/sling/testing/mock/osgi/sample/osgiserviceutil/activatedeactivate/Service3.java b/core/src/test/java/org/apache/sling/testing/mock/osgi/sample/osgiserviceutil/activatedeactivate/Service3.java
new file mode 100644
index 0000000..9418ee5
--- /dev/null
+++ b/core/src/test/java/org/apache/sling/testing/mock/osgi/sample/osgiserviceutil/activatedeactivate/Service3.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.activatedeactivate;
+
+import java.util.Map;
+
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Deactivate;
+
+@Component
+public class Service3 {
+
+ private boolean activated;
+ private Map<String, Object> map;
+
+ @Activate
+ private void activate(Map<String,Object> map) {
+ this.activated = true;
+ this.map = map;
+ }
+
+ @Deactivate
+ private void deactivate(Map<String,Object> map) {
+ this.activated = false;
+ this.map = null;
+ }
+
+ public boolean isActivated() {
+ return activated;
+ }
+
+ public Map<String, Object> getMap() {
+ return map;
+ }
+
+}
diff --git a/core/src/test/java/org/apache/sling/testing/mock/osgi/sample/osgiserviceutil/activatedeactivate/Service4.java b/core/src/test/java/org/apache/sling/testing/mock/osgi/sample/osgiserviceutil/activatedeactivate/Service4.java
new file mode 100644
index 0000000..84165f2
--- /dev/null
+++ b/core/src/test/java/org/apache/sling/testing/mock/osgi/sample/osgiserviceutil/activatedeactivate/Service4.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.activatedeactivate;
+
+import java.util.Map;
+
+import org.apache.commons.collections4.map.HashedMap;
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Deactivate;
+
+@Component
+public class Service4 {
+
+ private boolean activated;
+ private Map<String, Object> map;
+
+ @Activate
+ private void activate(ServiceConfig config) {
+ this.activated = true;
+ map = readAnnotationToMap(config);
+ }
+
+ @Deactivate
+ private void deactivate(int value) {
+ this.activated = false;
+ }
+
+ public boolean isActivated() {
+ return activated;
+ }
+
+ public Map<String, Object> getMap() {
+ return map;
+ }
+
+ static Map<String, Object> readAnnotationToMap(final ServiceConfig config) {
+ Map<String,Object> map = new HashedMap<>();
+ map.put("prop1", config.prop1());
+ map.put("prop2.with.periods", config.prop2_with_periods());
+ map.put("prop3-with-hyphens", config.prop3$_$with$_$hyphens());
+ return map;
+ }
+
+}
diff --git a/core/src/test/java/org/apache/sling/testing/mock/osgi/sample/osgiserviceutil/activatedeactivate/Service5.java b/core/src/test/java/org/apache/sling/testing/mock/osgi/sample/osgiserviceutil/activatedeactivate/Service5.java
new file mode 100644
index 0000000..8636bd2
--- /dev/null
+++ b/core/src/test/java/org/apache/sling/testing/mock/osgi/sample/osgiserviceutil/activatedeactivate/Service5.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.activatedeactivate;
+
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Deactivate;
+
+@Component
+public class Service5 {
+
+ private boolean activated;
+
+ @Activate
+ private void activate() {
+ this.activated = true;
+ }
+
+ @Deactivate
+ private void deactivate(Integer value) {
+ this.activated = false;
+ }
+
+ public boolean isActivated() {
+ return activated;
+ }
+
+}
diff --git a/core/src/test/java/org/apache/sling/testing/mock/osgi/sample/osgiserviceutil/activatedeactivate/Service6.java b/core/src/test/java/org/apache/sling/testing/mock/osgi/sample/osgiserviceutil/activatedeactivate/Service6.java
new file mode 100644
index 0000000..3a1e54d
--- /dev/null
+++ b/core/src/test/java/org/apache/sling/testing/mock/osgi/sample/osgiserviceutil/activatedeactivate/Service6.java
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.activatedeactivate;
+
+import java.util.Map;
+
+import org.osgi.framework.BundleContext;
+import org.osgi.service.component.ComponentContext;
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Deactivate;
+
+@Component
+public class Service6 {
+
+ private boolean activated;
+ private ComponentContext componentContext;
+ private BundleContext bundleContext;
+ private Map<String,Object> map;
+
+ @Activate
+ private void activate(ComponentContext componentContext, BundleContext bundleContext, Map<String,Object> map) {
+ this.activated = true;
+ this.componentContext = componentContext;
+ this.bundleContext = bundleContext;
+ this.map = map;
+ }
+
+ @Deactivate
+ private void deactivate(Map<String,Object> map, BundleContext bundleContext, int value1, Integer value2) {
+ this.activated = false;
+ this.componentContext = null;
+ this.bundleContext = null;
+ this.map = null;
+ }
+
+ public boolean isActivated() {
+ return activated;
+ }
+
+ public ComponentContext getComponentContext() {
+ return componentContext;
+ }
+
+ public BundleContext getBundleContext() {
+ return bundleContext;
+ }
+
+ public Map<String, Object> getMap() {
+ return map;
+ }
+
+}
diff --git a/core/src/test/java/org/apache/sling/testing/mock/osgi/sample/osgiserviceutil/activatedeactivate/Service7.java b/core/src/test/java/org/apache/sling/testing/mock/osgi/sample/osgiserviceutil/activatedeactivate/Service7.java
new file mode 100644
index 0000000..b7837be
--- /dev/null
+++ b/core/src/test/java/org/apache/sling/testing/mock/osgi/sample/osgiserviceutil/activatedeactivate/Service7.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.activatedeactivate;
+
+import java.util.Map;
+
+import org.apache.commons.collections4.map.HashedMap;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.component.ComponentContext;
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Deactivate;
+
+@Component
+public class Service7 {
+
+ private boolean activated;
+ private ComponentContext componentContext;
+ private BundleContext bundleContext;
+ private Map<String,Object> map;
+
+ @Activate
+ private void activate(ComponentContext componentContext, ServiceConfig config, BundleContext bundleContext) {
+ this.activated = true;
+ this.componentContext = componentContext;
+ this.bundleContext = bundleContext;
+ this.map = readAnnotationToMap(config);
+ }
+
+ @Deactivate
+ private void deactivate() {
+ this.activated = false;
+ this.componentContext = null;
+ this.bundleContext = null;
+ this.map = null;
+ }
+
+ public boolean isActivated() {
+ return activated;
+ }
+
+ public ComponentContext getComponentContext() {
+ return componentContext;
+ }
+
+ public BundleContext getBundleContext() {
+ return bundleContext;
+ }
+
+ public Map<String, Object> getMap() {
+ return map;
+ }
+
+ static Map<String, Object> readAnnotationToMap(final ServiceConfig config) {
+ Map<String,Object> map = new HashedMap<>();
+ map.put("prop1", config.prop1());
+ map.put("prop2.with.periods", config.prop2_with_periods());
+ map.put("prop3-with-hyphens", config.prop3$_$with$_$hyphens());
+ return map;
+ }
+
+}
diff --git a/core/src/test/java/org/apache/sling/testing/mock/osgi/sample/osgiserviceutil/activatedeactivate/ServiceConfig.java b/core/src/test/java/org/apache/sling/testing/mock/osgi/sample/osgiserviceutil/activatedeactivate/ServiceConfig.java
new file mode 100644
index 0000000..ad25c6a
--- /dev/null
+++ b/core/src/test/java/org/apache/sling/testing/mock/osgi/sample/osgiserviceutil/activatedeactivate/ServiceConfig.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.activatedeactivate;
+
+public @interface ServiceConfig {
+
+ String prop1();
+
+ String prop2_with_periods();
+
+ String prop3$_$with$_$hyphens();
+
+}
diff --git a/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.OsgiServiceUtilActivateDeactivateTest.xml b/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.OsgiServiceUtilActivateDeactivateTest.xml
deleted file mode 100644
index a869506..0000000
--- a/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.OsgiServiceUtilActivateDeactivateTest.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-<components xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0">
- <scr:component name="org.apache.sling.testing.mock.osgi.OsgiServiceUtilActivateDeactivateTest$Service1" activate="activate" deactivate="deactivate">
- <implementation class="org.apache.sling.testing.mock.osgi.OsgiServiceUtilActivateDeactivateTest$Service1"/>
- </scr:component>
- <scr:component name="org.apache.sling.testing.mock.osgi.OsgiServiceUtilActivateDeactivateTest$Service2" activate="activate" deactivate="deactivate">
- <implementation class="org.apache.sling.testing.mock.osgi.OsgiServiceUtilActivateDeactivateTest$Service2"/>
- </scr:component>
- <scr:component name="org.apache.sling.testing.mock.osgi.OsgiServiceUtilActivateDeactivateTest$Service3" activate="activate" deactivate="deactivate">
- <implementation class="org.apache.sling.testing.mock.osgi.OsgiServiceUtilActivateDeactivateTest$Service3"/>
- </scr:component>
- <scr:component name="org.apache.sling.testing.mock.osgi.OsgiServiceUtilActivateDeactivateTest$Service4" activate="activate" deactivate="deactivate">
- <implementation class="org.apache.sling.testing.mock.osgi.OsgiServiceUtilActivateDeactivateTest$Service4"/>
- </scr:component>
- <scr:component name="org.apache.sling.testing.mock.osgi.OsgiServiceUtilActivateDeactivateTest$Service5" activate="activate" deactivate="deactivate">
- <implementation class="org.apache.sling.testing.mock.osgi.OsgiServiceUtilActivateDeactivateTest$Service5"/>
- </scr:component>
- <scr:component name="org.apache.sling.testing.mock.osgi.OsgiServiceUtilActivateDeactivateTest$Service6" activate="activate" deactivate="deactivate">
- <implementation class="org.apache.sling.testing.mock.osgi.OsgiServiceUtilActivateDeactivateTest$Service6"/>
- </scr:component>
- <scr:component name="org.apache.sling.testing.mock.osgi.OsgiServiceUtilActivateDeactivateTest$Service7" activate="activate" deactivate="deactivate">
- <implementation class="org.apache.sling.testing.mock.osgi.OsgiServiceUtilActivateDeactivateTest$Service7"/>
- </scr:component>
-</components>
diff --git a/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.context.OsgiContextImplTest.xml b/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.context.OsgiContextImplTest.xml
deleted file mode 100644
index 60037ea..0000000
--- a/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.context.OsgiContextImplTest.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-<components xmlns:scr="http://www.osgi.org/xmlns/scr/v1.3.0">
- <scr:component name="org.apache.sling.testing.mock.osgi.context.OsgiContextImplTest$MyComponent">
- <implementation class="org.apache.sling.testing.mock.osgi.context.OsgiContextImplTest$MyComponent"/>
- <service>
- <provide interface="org.apache.sling.testing.mock.osgi.context.OsgiContextImplTest$MyService"/>
- </service>
- </scr:component>
-</components>
diff --git a/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgicontextimpl.MyComponent.xml b/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgicontextimpl.MyComponent.xml
new file mode 100644
index 0000000..82ec950
--- /dev/null
+++ b/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgicontextimpl.MyComponent.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.3.0" name="org.apache.sling.testing.mock.osgi.sample.osgicontextimpl.MyComponent">
+ <service>
+ <provide interface="org.apache.sling.testing.mock.osgi.sample.osgicontextimpl.MyService"/>
+ </service>
+ <implementation class="org.apache.sling.testing.mock.osgi.sample.osgicontextimpl.MyComponent"/>
+</scr:component>
diff --git a/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.RankedServiceFive.xml b/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.RankedServiceFive.xml
index 5985c59..c3b30c3 100644
--- a/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.RankedServiceFive.xml
+++ b/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.RankedServiceFive.xml
@@ -1,22 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.3.0" name="org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.RankedServiceFive" activate="activate">
<property name="service.ranking" type="Integer" value="5"/>
<service>
diff --git a/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.RankedServiceTen.xml b/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.RankedServiceTen.xml
index b8257c2..7f5a0c1 100644
--- a/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.RankedServiceTen.xml
+++ b/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.RankedServiceTen.xml
@@ -1,22 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.3.0" name="org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.RankedServiceTen" activate="activate">
<property name="service.ranking" type="Integer" value="10"/>
<service>
diff --git a/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.Service1.xml b/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.Service1.xml
index 2758f75..5608fbe 100644
--- a/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.Service1.xml
+++ b/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.Service1.xml
@@ -1,22 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.3.0" name="org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.Service1">
<property name="service.ranking" type="Integer" value="100"/>
<service>
diff --git a/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.Service2.xml b/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.Service2.xml
index 8b6370c..d46f2da 100644
--- a/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.Service2.xml
+++ b/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.Service2.xml
@@ -1,22 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.3.0" name="org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.Service2">
<property name="service.ranking" type="Integer" value="200"/>
<service>
diff --git a/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.Service3.xml b/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.Service3.xml
index 0efef0a..19c747d 100644
--- a/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.Service3.xml
+++ b/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.Service3.xml
@@ -1,22 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.3.0" name="org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.Service3" activate="activate" deactivate="deactivate" modified="modified">
<reference name="reference1" policy="dynamic" interface="org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.ServiceInterface1" bind="bindReference1" unbind="unbindReference1" field="reference1"/>
<reference name="reference1Optional" cardinality="0..1" policy="dynamic" interface="org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.ServiceInterface1Optional" bind="bindReference1Optional" unbind="unbindReference1Optional" field="reference1Optional"/>
diff --git a/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.Service3OsgiR6.xml b/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.Service3OsgiR6.xml
index 187df0e..a410d01 100644
--- a/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.Service3OsgiR6.xml
+++ b/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.Service3OsgiR6.xml
@@ -1,22 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.3.0" name="org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.Service3OsgiR6" activate="activate" deactivate="deactivate" modified="modified">
<reference name="reference1" interface="org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.ServiceInterface1" field="reference1"/>
<reference name="reference1Optional" cardinality="0..1" policy="dynamic" interface="org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.ServiceInterface1Optional" field="reference1Optional"/>
diff --git a/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.Service3StaticGreedyImpl.xml b/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.Service3StaticGreedyImpl.xml
index ba68488..5f960cc 100644
--- a/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.Service3StaticGreedyImpl.xml
+++ b/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.Service3StaticGreedyImpl.xml
@@ -1,22 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.3.0" name="org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.Service3StaticGreedyImpl" activate="activate" deactivate="deactivate" modified="modified">
<service>
<provide interface="org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.Service3StaticGreedy"/>
diff --git a/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.Service4.xml b/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.Service4.xml
index 9497e60..831898f 100644
--- a/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.Service4.xml
+++ b/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.Service4.xml
@@ -1,22 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.3.0" name="org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.Service4">
<reference name="customName" interface="org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.ServiceInterface1" bind="customBind" unbind="customUnbind"/>
<implementation class="org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.Service4"/>
diff --git a/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.Service5.xml b/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.Service5.xml
index 432eaff..f5e8893 100644
--- a/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.Service5.xml
+++ b/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.Service5.xml
@@ -1,22 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.3.0" name="org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.Service5">
<service>
<provide interface="org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.ServiceInterface5"/>
diff --git a/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.Service6VolatileMultipleReferences.xml b/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.Service6VolatileMultipleReferences.xml
index 6f04ffd..419bbb6 100644
--- a/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.Service6VolatileMultipleReferences.xml
+++ b/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.Service6VolatileMultipleReferences.xml
@@ -1,22 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.3.0" name="org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.Service6VolatileMultipleReferences">
<service>
<provide interface="org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.Service6VolatileMultipleReferences"/>
diff --git a/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.ServiceFactory1.xml b/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.ServiceFactory1.xml
index 8923fd5..216eceb 100644
--- a/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.ServiceFactory1.xml
+++ b/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.ServiceFactory1.xml
@@ -1,22 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.3.0" name="org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.ServiceFactory1">
<service scope="bundle">
<provide interface="org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.ServiceFactory1"/>
diff --git a/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.activatedeactivate.Service1.xml b/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.activatedeactivate.Service1.xml
new file mode 100644
index 0000000..0d17608
--- /dev/null
+++ b/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.activatedeactivate.Service1.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.3.0" name="org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.activatedeactivate.Service1" activate="activate" deactivate="deactivate">
+ <implementation class="org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.activatedeactivate.Service1"/>
+</scr:component>
diff --git a/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.activatedeactivate.Service2.xml b/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.activatedeactivate.Service2.xml
new file mode 100644
index 0000000..1a0be63
--- /dev/null
+++ b/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.activatedeactivate.Service2.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.3.0" name="org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.activatedeactivate.Service2" activate="activate" deactivate="deactivate">
+ <implementation class="org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.activatedeactivate.Service2"/>
+</scr:component>
diff --git a/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.activatedeactivate.Service3.xml b/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.activatedeactivate.Service3.xml
new file mode 100644
index 0000000..ce9f4be
--- /dev/null
+++ b/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.activatedeactivate.Service3.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.3.0" name="org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.activatedeactivate.Service3" activate="activate" deactivate="deactivate">
+ <implementation class="org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.activatedeactivate.Service3"/>
+</scr:component>
diff --git a/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.activatedeactivate.Service4.xml b/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.activatedeactivate.Service4.xml
new file mode 100644
index 0000000..ead5546
--- /dev/null
+++ b/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.activatedeactivate.Service4.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.3.0" name="org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.activatedeactivate.Service4" activate="activate" deactivate="deactivate">
+ <implementation class="org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.activatedeactivate.Service4"/>
+</scr:component>
diff --git a/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.activatedeactivate.Service5.xml b/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.activatedeactivate.Service5.xml
new file mode 100644
index 0000000..9851215
--- /dev/null
+++ b/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.activatedeactivate.Service5.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.3.0" name="org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.activatedeactivate.Service5" activate="activate" deactivate="deactivate">
+ <implementation class="org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.activatedeactivate.Service5"/>
+</scr:component>
diff --git a/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.activatedeactivate.Service6.xml b/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.activatedeactivate.Service6.xml
new file mode 100644
index 0000000..80c3024
--- /dev/null
+++ b/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.activatedeactivate.Service6.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.3.0" name="org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.activatedeactivate.Service6" activate="activate" deactivate="deactivate">
+ <implementation class="org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.activatedeactivate.Service6"/>
+</scr:component>
diff --git a/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.activatedeactivate.Service7.xml b/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.activatedeactivate.Service7.xml
new file mode 100644
index 0000000..dc12e58
--- /dev/null
+++ b/core/src/test/resources/OSGI-INF/org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.activatedeactivate.Service7.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.3.0" name="org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.activatedeactivate.Service7" activate="activate" deactivate="deactivate">
+ <implementation class="org.apache.sling.testing.mock.osgi.sample.osgiserviceutil.activatedeactivate.Service7"/>
+</scr:component>
diff --git a/core/src/test/resources/OSGI-INF/serviceComponents.xml b/core/src/test/resources/OSGI-INF/serviceComponents.xml
index 3cc116e..066fd14 100644
--- a/core/src/test/resources/OSGI-INF/serviceComponents.xml
+++ b/core/src/test/resources/OSGI-INF/serviceComponents.xml
@@ -1,22 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
<!-- This file follows the old SCR convention using a fixed name "serviceComponents.xml" -->
<components xmlns:scr="http://www.osgi.org/xmlns/scr/v1.3.0">
<scr:component name="org.apache.sling.testing.mock.osgi.OsgiMetadataUtilTest$ServiceWithMetadata">