You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 10:22:00 UTC
[sling-org-apache-sling-testing-osgi-mock] annotated tag
org.apache.sling.testing.osgi-mock-2.3.0 created (now 4dd110b)
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a change to annotated tag org.apache.sling.testing.osgi-mock-2.3.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-testing-osgi-mock.git.
at 4dd110b (tag)
tagging cd83922e74b4131998ae364cf2911c6a292fbc64 (commit)
by Stefan Seifert
on Tue May 2 16:02:27 2017 +0000
- Log -----------------------------------------------------------------
org.apache.sling.testing.osgi-mock-2.3.0
-----------------------------------------------------------------------
This annotated tag includes the following new commits:
new e5ba840 SLING-4042 Donate sling-mock, jcr-mock, osgi-mock implementation
new e1ee5ad svn:ignore
new 8d20817 SLING-4042 move all mock projects to mocks/ subdirectory
new ad838b2 SLING-4042 add missing package-info files
new 740687d SLING-4042 make sure dependency injection is continued even if not all injections succeeded, and report root cause of invocation target exceptions
new 7e5bc2d SLING-4042 add README files
new 21a5152 add/update SCM urls
new 74be83a [maven-release-plugin] prepare release org.apache.sling.testing.osgi-mock-1.0.0
new d794a37 [maven-release-plugin] prepare for next development iteration
new 0a80e0c SLING-4090 Define package versions for Sling Mock, JCR Mock, OSGi Mock
new 59f74f6 SLING-4142 MockOsgi: Activate/Deactivate method does not support different signatures
new a822c76 SLING-4162 Introduce "OsgiContext" junit rule for OSGi and OsgiContextImpl
new b30dd56 SLING-4162 fix javadoc
new c40b2dd SLING-4163 OSGi Mock: Reference bind/unbind method picking order
new abe8b21 fix some javadoc copy&paste errors and formatting
new 7c2b519 SLING-4166 OSGi Mock: Support for "modified" SCR lifecycle method
new 4d131cd SLING-4166 update package version
new 907c7df SLING-4165 OSGi Mock: Fail-fast when calling methods requiring SCR metadata and this is not present
new 5538cda SLING-4201 MockOsgi.activate()/deactivate()/modified() should fail fast if method is declared but can't be found
new 50112aa SLING-4202 OSGi Mock: Fail-fast when mandatory references cannot be injected
new 70f5447 fix some javadoc errors/warnings
new d7f336c [maven-release-plugin] prepare release org.apache.sling.testing.osgi-mock-1.1.0
new 5022c27 [maven-release-plugin] prepare for next development iteration
new b910746 rename package-private class ReflectinServiceUtil to OsgiServiceUtil because it does not any longer use reflection to do it's job (no functional change)
new 68de5d4 SLING-4435 OSGi Mock: Cache reading of OSGi SCR Metadata files
new dc9866e SLING-4439 add support for unregistering services and prepare dynamic service reference handling
new e3e8bb1 SLING-4439 implement dynamic service registration
new e6baa2c SLING-4439 implement dynamic service registration
new a980473 SLING-4439 implement dynamic service registration
new e828e3d SLING-4439 implement dynamic service registration - support string array properties in osgi metadata as well - merge properties from osgi metadata with those specified on activation/registration call - support "old-style" scr component metadata file as well (and test this case)
new 5afcfc6 [maven-release-plugin] prepare release org.apache.sling.testing.osgi-mock-1.2.0
new cea3da7 [maven-release-plugin] prepare for next development iteration
new c389c24 SLING-4472 MockBundleContent.getProperty should return null
new 4900b9b Add missing licence headers and ignores for rat
new 174e654 SLING-4670 : SCR metadata can't be read if components element is missing
new c1ab86f SLING-4698 - Set parent.relativePath to empty for all modules
new ad91a5b SLING-4718 Support OSGi component name different from implementation class
new dd63020 SLING-4719 osgi-mock: Add Mock EventAdmin implementation
new aede0b4 SLING-4720 Add support for "Long" and "Boolean" property types in SCR metadata
new bd78f8a SLING-4725 osgi-mock: Make compatible to OSGi 5/6
new 9a4208d SLING-4470 introduce separate "logging-mock" project for default log configuration in mock tests, remove compile-dependency on slf4j-simple
new 61fec88 update dependencies for release
new 20100ff [maven-release-plugin] prepare release org.apache.sling.testing.osgi-mock-1.3.0
new 1e80946 [maven-release-plugin] prepare for next development iteration
new 62541d8 update to next development snapshot unit released artifacts are in maven central
new c5653dd SLING-4756 - ServiceListener notifications are not filtered
new cd84d7c SLING-4756 - ServiceListener notifications are not filtered
new 88790a8 SLING-4756 - ServiceListener notifications are not filtered
new 3704cb2 update to released mock versions
new 0f222f7 SLING-4769 Osgi Mock: Add support for bundle headers
new 5644c49 SLING-4756 add support for filtering via felix.framework FilterImpl implementation
new f4513f8 SLING-4771 Osgi Mock: Allow to set mock bundle symbolic name
new 9b26d4c OsgiServiceUtil: clarify exception message when no matching references were found
new 7da1c22 MockBundleTest - cast once in the @BeforeMethod instead of every test
new 4d21da0 SLING-4780 - Implement MockBundle.getLastModified
new 9248ced SLING-4781 - Implement MockBundle.getEntryPaths
new ed82c56 SLING-4781 - Implement MockBundle.getEntryPaths
new 456e603 SLING-4813 - Support CGLIB enhanced classes for Mockito based service mocks
new 8d9a404 [maven-release-plugin] prepare release org.apache.sling.testing.osgi-mock-1.4.0
new 1e43ffc [maven-release-plugin] prepare for next development iteration
new 2cd752f Update to Sling Parent 23
new 5e5797b Testing: remove superflous sling.java.version=6 as it's the default now
new 384b81a Update rat exclude rules
new a69eb1b @no-jira : test failed with a timeout on jenkins - tring with 2sec timeout
new 64dc2d0 SLING-4845 - MockBundleContext is not thread-safe
new 9260a58 SLING-4845 - MockBundleContext is not thread-safe
new e283546 set parent version to 24 and add empty relativePath where missing
new e996493 remove unused LOG variable
new 45d1dbc SLING-4901 osgi-mock: Add support for ComponentContext.getUsingBundle()
new ec78cea [maven-release-plugin] prepare release org.apache.sling.testing.osgi-mock-1.5.0
new b693d17 [maven-release-plugin] prepare for next development iteration
new 1e64d07 cosmetic: beautify error messages when setup/teardown fails
new 2b257a4 SLING-5083 osgi-mock: Eliminate compile dependency to org.apache.felix.scr.annotations
new ee4eeb2 SLING-5089 mock-osgi: Deactivate all services on shutdown
new 3747fc7 SLING-5089 deactivate services in reverse order
new 571dcdb SLING-5090 osgi-mock: Support ServiceFactory
new 29e4a32 SLING-5088 properly shutdown executor service in MockEventAdmin
new a80c2f8 SLING-5088 deprecate activate/deactivate methods without bundleContext parameter because there is a small risk for memory leaks
new 3e81888 cosmetic: fix javadoc errors
new 07870d2 Update the main reactor to parent 25
new 5f24bfb [maven-release-plugin] prepare release org.apache.sling.testing.osgi-mock-1.6.0
new b52bba4 [maven-release-plugin] prepare for next development iteration
new 5bdecdf SLING-5143 osgi-mock: MockBundleContext is not thread-safe when using iterators
new 3c17662 SLING-5198 osgi-mock: Add basic ConfigurationAdmin support
new 4aa8c55 [maven-release-plugin] prepare release org.apache.sling.testing.osgi-mock-1.7.0
new d38d8c1 [maven-release-plugin] prepare for next development iteration
new 505f211 SLING-5312 osgi-mock: Eliminate runtime-depenency to Felix SCR annotations
new 9618e26 SLING-5323 Update to OSGi R6
new 3f5a172 SLING-5324 osgi-mock: Support OSGi R6 field-based reference bindings
new bf51720 SLING-5325 osgi-mock: Support target filtering on DS references
new 5e0ac1d SLING-5323 no need to update to JDK 1.7, we stick with JDK 1.6.
new eb580c3 SLING-5327 refactor and unify lifecycle method handling (and fix missing argument variants for modified methods - should support the same as the activate method)
new db27b68 SLING-5327 osgi-mock: Support OSGi R6 Component propert types for configuration
new b29a918 SLING-5327 inline the required classes from org.apache.felix.scr
new 5d2ecfe SLING-5372 osgi-mock: MockBundleContext.getServices(Class,String) throws NPE when no services found
new 4e489a6 [maven-release-plugin] prepare release org.apache.sling.testing.osgi-mock-2.0.0
new 9c07ff3 [maven-release-plugin] prepare for next development iteration
new b3f468c SLING-5391 osgi-mock: Switch to osgi.core and osgi.cmpn dependencies
new 2efd6e6 Switch to parent pom 26
new 6759271 SLING-5453 implement MockBundleContext.getDataFile
new 7d50f99 SLING-5453 implement MockBundleContext.getDataFile
new c79ef61 SLING-5462 - demonstrate the wrong sorting of mock service references
new 0e10e45 SLING-5462 ensure service references are sorted ascending by service ranking, not descending
new fe2625e SLING-5462 switch to comparable implementation from commons.osgi and change wrong assumptions in unit test
new 09964b1 [maven-release-plugin] prepare release org.apache.sling.testing.osgi-mock-2.0.2
new a8a4072 [maven-release-plugin] prepare for next development iteration
new 8a090aa SLING-5544 osgi-mock: Catch RejectedExecutionException in MockEventAdmin
new 1c6b586 SLING-5667 MockBundleContext.getServiceReference(...) does not return service reference with highest ranking
new b251609 [maven-release-plugin] prepare release org.apache.sling.testing.osgi-mock-2.0.4
new eff1945 [maven-release-plugin] prepare for next development iteration
new 4f1cc0f SLING-5871 osgi-mock: Update to org.apache.felix.scr 2.0.4
new 9e41f2c SLING-5905 osgi-mock: Shade and relocate Sling and Felix Dependencies
new 6b59209 cosmetic: fix typo in error message
new 3171277 SLING-5905 some files from felix.framework where missing includes shaded source attachments
new 9583f78 SLING-5970 mocks: Update to Parent Pom 28
new a6a37d7 SLING-5970 switch to osgi annotations
new c5195c6 add git ignore files for testing projects
new 8ec500d SLING-6051 osgi-mock: Support passing map/dictionary properties with object vararg parameter
new 4dcc5a8 update dependencies
new 423c717 [maven-release-plugin] prepare release org.apache.sling.testing.osgi-mock-2.1.0
new e03a67a [maven-release-plugin] prepare for next development iteration
new 65c00bc update dependencies to latest snapshots until released versions are available in maven central
new 56f46e7 switch back to released versions
new 0265add update to parent 29
new 3038287 SLING-6356 osgi-mock: Fallback to default when reference field collection type is missing in SCR metadata
new dea5c88 SLING-6358 osgi-mock: OsgiContext.getServices should return correctly typed array when empty
new 3f1b5cf SLING-6359 osgi-mock, sling-mock: Make ContextCallback and ContextBuilder more flexible
new fbdc5fc fix javadoc errors
new 25f3e13 SLING-6359 context plugin support
new 2843214 SLING-6359 context plugin support
new e644885 SLING-6362 osgi-mock: ManifestScanner
new 9ec13c9 [maven-release-plugin] prepare release org.apache.sling.testing.osgi-mock-2.2.0
new 6195193 [maven-release-plugin] prepare for next development iteration
new c8f77a9 SLING-6386 osgi-mock: Avoid NPE when providing servicer properties with null values
new a419018 cosmetic: rename misspelled test classes
new b031eb1 SLING-6372 OSGi Mocks - Correctly handle static, greedy references
new e554907 [maven-release-plugin] prepare release org.apache.sling.testing.osgi-mock-2.2.2
new ad30a96 [maven-release-plugin] prepare for next development iteration
new 869e9ee SLING-6586 Loading SCR metadata fails for components with name != class name
new cd1fb8f use Sling Parent 30
new d12a31c fix compile errors after switchting to parent 30: - add scr annotation dependency where appropiate or remove maven-scr-plugin - switch to osgi versioning annotations
new dbbe410 SLING-6641 osgi-mock: MockOsgi.setConfigForPid convenience method
new 27e25ff SLING-6650 osgi-mock: Fallback to component name when service.pid property not set in SCR metadata
new e5e9177 SLING-6672 osgi-mock: Switch to OSGi annotations
new fec0840 [maven-release-plugin] prepare release org.apache.sling.testing.osgi-mock-2.2.4
new 688f989 [maven-release-plugin] prepare for next development iteration
new 3320d00 SLING-6811 osgi-mock: Support ServiceFactory and System Bundle
new e2314ac [maven-release-plugin] prepare release org.apache.sling.testing.osgi-mock-2.3.0
new cd83922 [maven-release-plugin] copy for tag org.apache.sling.testing.osgi-mock-2.3.0
The 149 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
--
To stop receiving notification emails like this one, please contact
['"commits@sling.apache.org" <co...@sling.apache.org>'].
[sling-org-apache-sling-testing-osgi-mock] 03/04:
[maven-release-plugin] prepare release
org.apache.sling.testing.osgi-mock-2.3.0
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.testing.osgi-mock-2.3.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-testing-osgi-mock.git
commit e2314acaefd9a215f55e83c263add382154d201f
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Tue May 2 16:02:14 2017 +0000
[maven-release-plugin] prepare release org.apache.sling.testing.osgi-mock-2.3.0
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/testing/mocks/osgi-mock@1793549 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/pom.xml b/pom.xml
index e7aba4c..a5b18ab 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,16 +28,16 @@
</parent>
<artifactId>org.apache.sling.testing.osgi-mock</artifactId>
- <version>2.2.5-SNAPSHOT</version>
+ <version>2.3.0</version>
<packaging>bundle</packaging>
<name>Apache Sling Testing OSGi Mock</name>
<description>Mock implementation of selected OSGi APIs.</description>
<scm>
- <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/testing/mocks/osgi-mock</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/testing/mocks/osgi-mock</developerConnection>
- <url>http://svn.apache.org/viewvc/sling/trunk/testing/mocks/osgi-mock</url>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.testing.osgi-mock-2.3.0</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.testing.osgi-mock-2.3.0</developerConnection>
+ <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.testing.osgi-mock-2.3.0</url>
</scm>
<dependencies>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-testing-osgi-mock] 04/04:
[maven-release-plugin] copy for tag
org.apache.sling.testing.osgi-mock-2.3.0
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.testing.osgi-mock-2.3.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-testing-osgi-mock.git
commit cd83922e74b4131998ae364cf2911c6a292fbc64
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Tue May 2 16:02:27 2017 +0000
[maven-release-plugin] copy for tag org.apache.sling.testing.osgi-mock-2.3.0
git-svn-id: https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.testing.osgi-mock-2.3.0@1793550 13f79535-47bb-0310-9956-ffa450edef68
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-testing-osgi-mock] 02/04: SLING-6811
osgi-mock: Support ServiceFactory and System Bundle
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.testing.osgi-mock-2.3.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-testing-osgi-mock.git
commit 3320d00ad5d53491337e2219d00eeffcb12331bc
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Fri Apr 28 15:37:14 2017 +0000
SLING-6811 osgi-mock: Support ServiceFactory and System Bundle
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/testing/mocks/osgi-mock@1793112 13f79535-47bb-0310-9956-ffa450edef68
---
.../apache/sling/testing/mock/osgi/MockBundle.java | 30 +++++++++++----
.../sling/testing/mock/osgi/MockBundleContext.java | 37 ++++++++++++------
.../testing/mock/osgi/MockServiceRegistration.java | 9 ++++-
.../testing/mock/osgi/MockBundleContextTest.java | 45 ++++++++++++++++++++++
4 files changed, 101 insertions(+), 20 deletions(-)
diff --git a/src/main/java/org/apache/sling/testing/mock/osgi/MockBundle.java b/src/main/java/org/apache/sling/testing/mock/osgi/MockBundle.java
index 1fc9483..89ad673 100644
--- a/src/main/java/org/apache/sling/testing/mock/osgi/MockBundle.java
+++ b/src/main/java/org/apache/sling/testing/mock/osgi/MockBundle.java
@@ -31,6 +31,7 @@ import java.util.Vector;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
import org.osgi.framework.ServiceReference;
import org.osgi.framework.Version;
@@ -46,16 +47,26 @@ public final class MockBundle implements Bundle {
private final long bundleId;
private final BundleContext bundleContext;
private Map<String, String> headers = ImmutableMap.<String, String>of();
- private String symbolicName = "mock-bundle";
+ private String symbolicName;
private long lastModified;
/**
* Constructor
* @param bundleContext Bundle context
+ * @param bundleId Bundle ID
*/
- public MockBundle(BundleContext bundleContext) {
- this.bundleId = ++bundleCounter;
+ MockBundle(BundleContext bundleContext, long bundleId) {
+ this.bundleId = bundleId;
this.bundleContext = bundleContext;
+ this.symbolicName = (bundleId == Constants.SYSTEM_BUNDLE_ID ? Constants.SYSTEM_BUNDLE_SYMBOLICNAME : "mock-bundle");
+ }
+
+ /**
+ * Constructor
+ * @param bundleContext Bundle context
+ */
+ public MockBundle(BundleContext bundleContext) {
+ this(bundleContext, ++bundleCounter);
}
@Override
@@ -174,14 +185,19 @@ public final class MockBundle implements Bundle {
return queryPath;
}
- // --- unsupported operations ---
@Override
- public Enumeration<URL> findEntries(final String path, final String filePattern, final boolean recurse) {
- throw new UnsupportedOperationException();
+ public String getLocation() {
+ if (bundleId == Constants.SYSTEM_BUNDLE_ID) {
+ return Constants.SYSTEM_BUNDLE_LOCATION;
+ }
+ else {
+ return null;
+ }
}
+ // --- unsupported operations ---
@Override
- public String getLocation() {
+ public Enumeration<URL> findEntries(final String path, final String filePattern, final boolean recurse) {
throw new UnsupportedOperationException();
}
diff --git a/src/main/java/org/apache/sling/testing/mock/osgi/MockBundleContext.java b/src/main/java/org/apache/sling/testing/mock/osgi/MockBundleContext.java
index 7c40afa..1c3033e 100644
--- a/src/main/java/org/apache/sling/testing/mock/osgi/MockBundleContext.java
+++ b/src/main/java/org/apache/sling/testing/mock/osgi/MockBundleContext.java
@@ -43,6 +43,7 @@ import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleEvent;
import org.osgi.framework.BundleListener;
+import org.osgi.framework.Constants;
import org.osgi.framework.Filter;
import org.osgi.framework.FrameworkListener;
import org.osgi.framework.InvalidSyntaxException;
@@ -68,8 +69,11 @@ class MockBundleContext implements BundleContext {
private final Queue<BundleListener> bundleListeners = new ConcurrentLinkedQueue<BundleListener>();
private final ConfigurationAdmin configAdmin = new MockConfigurationAdmin();
private File dataFileBaseDir;
+
+ private final Bundle systemBundle;
public MockBundleContext() {
+ this.systemBundle = new MockBundle(this, Constants.SYSTEM_BUNDLE_ID);
this.bundle = new MockBundle(this);
// register configuration admin by default
@@ -120,6 +124,12 @@ class MockBundleContext implements BundleContext {
return registration;
}
+ @SuppressWarnings("unchecked")
+ @Override
+ public <S> ServiceRegistration<S> registerService(Class<S> clazz, ServiceFactory<S> factory, Dictionary<String, ?> properties) {
+ return registerService(clazz.getName(), factory, properties);
+ }
+
/**
* Check for already registered services that may be affected by the service registration - either
* adding by additional optional references, or creating a conflict in the dependencies.
@@ -433,29 +443,32 @@ class MockBundleContext implements BundleContext {
}
}
- // --- unsupported operations ---
@Override
- public Bundle installBundle(final String s) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public Bundle installBundle(final String s, final InputStream inputStream) {
- throw new UnsupportedOperationException();
+ public Bundle getBundle(final long bundleId) {
+ if (bundleId == Constants.SYSTEM_BUNDLE_ID) {
+ return systemBundle;
+ }
+ // otherwise return null - no bundle found
+ return null;
}
@Override
- public Bundle getBundle(final long l) {
- throw new UnsupportedOperationException();
+ public Bundle getBundle(String location) {
+ if (StringUtils.equals(location, Constants.SYSTEM_BUNDLE_LOCATION)) {
+ return systemBundle;
+ }
+ // otherwise return null - no bundle found
+ return null;
}
+ // --- unsupported operations ---
@Override
- public Bundle getBundle(String location) {
+ public Bundle installBundle(final String s) {
throw new UnsupportedOperationException();
}
@Override
- public <S> ServiceRegistration<S> registerService(Class<S> clazz, ServiceFactory<S> factory, Dictionary<String, ?> properties) {
+ public Bundle installBundle(final String s, final InputStream inputStream) {
throw new UnsupportedOperationException();
}
diff --git a/src/main/java/org/apache/sling/testing/mock/osgi/MockServiceRegistration.java b/src/main/java/org/apache/sling/testing/mock/osgi/MockServiceRegistration.java
index 7141949..7a2e87d 100644
--- a/src/main/java/org/apache/sling/testing/mock/osgi/MockServiceRegistration.java
+++ b/src/main/java/org/apache/sling/testing/mock/osgi/MockServiceRegistration.java
@@ -101,8 +101,15 @@ class MockServiceRegistration<T> implements ServiceRegistration<T>, Comparable<M
return clazzes;
}
+ @SuppressWarnings("unchecked")
T getService() {
- return this.service;
+ if (this.service instanceof ServiceFactory) {
+ ServiceFactory<T> factory = (ServiceFactory<T>)this.service;
+ return factory.getService(this.bundleContext.getBundle(), this);
+ }
+ else {
+ return this.service;
+ }
}
@Override
diff --git a/src/test/java/org/apache/sling/testing/mock/osgi/MockBundleContextTest.java b/src/test/java/org/apache/sling/testing/mock/osgi/MockBundleContextTest.java
index 5dba8d6..8161dea 100644
--- a/src/test/java/org/apache/sling/testing/mock/osgi/MockBundleContextTest.java
+++ b/src/test/java/org/apache/sling/testing/mock/osgi/MockBundleContextTest.java
@@ -39,6 +39,7 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.runners.MockitoJUnitRunner;
+import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleEvent;
import org.osgi.framework.BundleListener;
@@ -46,6 +47,7 @@ import org.osgi.framework.Constants;
import org.osgi.framework.Filter;
import org.osgi.framework.InvalidSyntaxException;
import org.osgi.framework.ServiceEvent;
+import org.osgi.framework.ServiceFactory;
import org.osgi.framework.ServiceListener;
import org.osgi.framework.ServiceReference;
import org.osgi.framework.ServiceRegistration;
@@ -124,6 +126,30 @@ public class MockBundleContextTest {
}
@Test
+ public void testServiceFactoryRegistration() throws InvalidSyntaxException {
+ // prepare test services
+ Class<String> clazz = String.class;
+ final String service = "abc";
+ Dictionary<String, Object> properties1 = getServiceProperties(null);
+ ServiceRegistration reg = bundleContext.registerService(clazz, new ServiceFactory<String>() {
+ @Override
+ public String getService(Bundle bundle, ServiceRegistration<String> registration) {
+ return service;
+ }
+ @Override
+ public void ungetService(Bundle bundle, ServiceRegistration<String> registration, String service) {
+ // do nothing
+ }
+ }, properties1);
+
+ ServiceReference<String> ref = bundleContext.getServiceReference(clazz);
+ assertNotNull(ref);
+ assertSame(reg.getReference(), ref);
+ assertSame(service, bundleContext.getService(ref));
+ bundleContext.ungetService(ref);
+ }
+
+ @Test
public void testNoServiceReferences() throws InvalidSyntaxException {
ServiceReference<?>[] refs = bundleContext.getServiceReferences(String.class.getName(), null);
assertNull(refs);
@@ -233,4 +259,23 @@ public class MockBundleContextTest {
assertEquals(childFile.getParentFile(), rootFile);
}
+
+ @Test
+ public void testSystemBundleById() {
+ Bundle systemBundle = bundleContext.getBundle(Constants.SYSTEM_BUNDLE_ID);
+ assertNotNull(systemBundle);
+ assertEquals(Constants.SYSTEM_BUNDLE_ID, systemBundle.getBundleId());
+ assertEquals(Constants.SYSTEM_BUNDLE_SYMBOLICNAME, systemBundle.getSymbolicName());
+ assertEquals(Constants.SYSTEM_BUNDLE_LOCATION, systemBundle.getLocation());
+ }
+
+ @Test
+ public void testSystemBundleByLocation() {
+ Bundle systemBundle = bundleContext.getBundle(Constants.SYSTEM_BUNDLE_LOCATION);
+ assertNotNull(systemBundle);
+ assertEquals(Constants.SYSTEM_BUNDLE_ID, systemBundle.getBundleId());
+ assertEquals(Constants.SYSTEM_BUNDLE_SYMBOLICNAME, systemBundle.getSymbolicName());
+ assertEquals(Constants.SYSTEM_BUNDLE_LOCATION, systemBundle.getLocation());
+ }
+
}
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-testing-osgi-mock] 01/04:
[maven-release-plugin] prepare for next development iteration
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.testing.osgi-mock-2.3.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-testing-osgi-mock.git
commit 688f989ad5d91506b8aaffcb0fcad9b6eb458211
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Mon Mar 20 11:28:03 2017 +0000
[maven-release-plugin] prepare for next development iteration
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/testing/mocks/osgi-mock@1787722 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/pom.xml b/pom.xml
index 472da94..e7aba4c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,16 +28,16 @@
</parent>
<artifactId>org.apache.sling.testing.osgi-mock</artifactId>
- <version>2.2.4</version>
+ <version>2.2.5-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>Apache Sling Testing OSGi Mock</name>
<description>Mock implementation of selected OSGi APIs.</description>
<scm>
- <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.testing.osgi-mock-2.2.4</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.testing.osgi-mock-2.2.4</developerConnection>
- <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.testing.osgi-mock-2.2.4</url>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/testing/mocks/osgi-mock</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/testing/mocks/osgi-mock</developerConnection>
+ <url>http://svn.apache.org/viewvc/sling/trunk/testing/mocks/osgi-mock</url>
</scm>
<dependencies>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.