bug 330236: basic migration to Equinox 3.7. Some warnings still present.
diff --git a/build.versions b/build.versions
index 0c9d112..6f48a1e 100644
--- a/build.versions
+++ b/build.versions
@@ -1,3 +1,4 @@
org.aspectj=1.6.6.RELEASE
-org.osgi=4.1.0
+org.eclipse.osgi=3.7.0.v20101022
+org.eclipse.osgi.services=3.3.0.v20101018
org.junit=4.7.0
diff --git a/org.eclipse.virgo.teststubs.osgi/.classpath b/org.eclipse.virgo.teststubs.osgi/.classpath
index 4ed98a5..726ae1d 100644
--- a/org.eclipse.virgo.teststubs.osgi/.classpath
+++ b/org.eclipse.virgo.teststubs.osgi/.classpath
@@ -23,7 +23,7 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="var" path="TEST_STUBS_IVY_CACHE/org.junit/com.springsource.org.junit/4.7.0/com.springsource.org.junit-4.7.0.jar" sourcepath="/TEST_STUBS_IVY_CACHE/org.junit/com.springsource.org.junit/4.4.0/com.springsource.org.junit-sources-4.4.0.jar"/>
<classpathentry kind="con" path="org.eclipse.ajdt.core.ASPECTJRT_CONTAINER"/>
- <classpathentry kind="var" path="TEST_STUBS_IVY_CACHE/org.osgi/org.osgi.core/4.1.0/org.osgi.core-4.1.0.jar"/>
- <classpathentry kind="var" path="TEST_STUBS_IVY_CACHE/org.osgi/org.osgi.compendium/4.1.0/org.osgi.compendium-4.1.0.jar"/>
+ <classpathentry kind="var" path="TEST_STUBS_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20101022/org.eclipse.osgi-3.7.0.v20101022.jar" sourcepath="/TEST_STUBS_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20101022/org.eclipse.osgi-sources-3.7.0.v20101022.jar"/>
+ <classpathentry kind="var" path="TEST_STUBS_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi.services/3.3.0.v20101018/org.eclipse.osgi.services-3.3.0.v20101018.jar"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
diff --git a/org.eclipse.virgo.teststubs.osgi/ivy.xml b/org.eclipse.virgo.teststubs.osgi/ivy.xml
index 34b4d71..beb616f 100644
--- a/org.eclipse.virgo.teststubs.osgi/ivy.xml
+++ b/org.eclipse.virgo.teststubs.osgi/ivy.xml
@@ -19,8 +19,8 @@
<dependencies>
<dependency org="org.aspectj" name="com.springsource.org.aspectj.runtime" rev="${org.aspectj}" conf="compile->runtime"/>
<dependency org="org.junit" name="com.springsource.org.junit" rev="${org.junit}" conf="compile->runtime"/>
- <dependency org="org.osgi" name="org.osgi.core" rev="${org.osgi}" conf="compile->runtime"/>
- <dependency org="org.osgi" name="org.osgi.compendium" rev="${org.osgi}" conf="compile->runtime"/>
+ <dependency name='org.eclipse.osgi' rev='${org.eclipse.osgi}' org='org.eclipse.osgi' conf='compile->runtime'/>
+ <dependency org="org.eclipse.osgi" name="org.eclipse.osgi.services" rev="${org.eclipse.osgi.services}" conf="compile->runtime"/>
</dependencies>
</ivy-module>
diff --git a/org.eclipse.virgo.teststubs.osgi/src/main/java/org/eclipse/virgo/teststubs/osgi/framework/OSGiAssert.java b/org.eclipse.virgo.teststubs.osgi/src/main/java/org/eclipse/virgo/teststubs/osgi/framework/OSGiAssert.java
index 934f0f4..4ebadf3 100644
--- a/org.eclipse.virgo.teststubs.osgi/src/main/java/org/eclipse/virgo/teststubs/osgi/framework/OSGiAssert.java
+++ b/org.eclipse.virgo.teststubs.osgi/src/main/java/org/eclipse/virgo/teststubs/osgi/framework/OSGiAssert.java
@@ -104,7 +104,7 @@
public static void assertServiceRegistrationCount(StubBundleContext bundleContext, Class<?> type, int count) {
String typeName = type.getName();
int found = 0;
- for (ServiceRegistration serviceRegistration : bundleContext.getServiceRegistrations()) {
+ for (ServiceRegistration<?> serviceRegistration : bundleContext.getServiceRegistrations()) {
String[] objectClasses = (String[]) serviceRegistration.getReference().getProperty(Constants.OBJECTCLASS);
for (String objectClass : objectClasses) {
if (typeName.equals(objectClass)) {
diff --git a/org.eclipse.virgo.teststubs.osgi/src/main/java/org/eclipse/virgo/teststubs/osgi/framework/StubBundle.java b/org.eclipse.virgo.teststubs.osgi/src/main/java/org/eclipse/virgo/teststubs/osgi/framework/StubBundle.java
index a751786..fb17279 100644
--- a/org.eclipse.virgo.teststubs.osgi/src/main/java/org/eclipse/virgo/teststubs/osgi/framework/StubBundle.java
+++ b/org.eclipse.virgo.teststubs.osgi/src/main/java/org/eclipse/virgo/teststubs/osgi/framework/StubBundle.java
@@ -14,9 +14,11 @@
import static org.eclipse.virgo.teststubs.osgi.internal.Assert.assertNotNull;
import static org.eclipse.virgo.teststubs.osgi.internal.Duplicator.shallowCopy;
+import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
+import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.Dictionary;
import java.util.Enumeration;
@@ -32,7 +34,8 @@
import org.osgi.framework.Version;
/**
- * A stub testing implementation of {@link Bundle} as defined in section 6.1.4 of the OSGi Service Platform Core Specification.
+ * A stub testing implementation of {@link Bundle} as defined in section 6.1.4 of the OSGi Service Platform Core
+ * Specification.
* <p />
*
* <strong>Concurrent Semantics</strong><br />
@@ -711,4 +714,48 @@
}
}
+ /**
+ * {@inheritDoc}
+ */
+ public int compareTo(Bundle o) {
+ int bundleIdCompare = (new Long(o.getBundleId())).compareTo(this.bundleId);
+ if (bundleIdCompare != 0) {
+ return bundleIdCompare;
+ }
+ int symbolicNameCompare = o.getSymbolicName().compareTo(this.symbolicName);
+ if (symbolicNameCompare != 0) {
+ return symbolicNameCompare;
+ }
+ int bundleVersionCompare = o.getVersion().compareTo(this.version);
+ if (bundleVersionCompare != 0) {
+ return bundleVersionCompare;
+ }
+ int bundleLocationCompare = o.getLocation().compareTo(this.location);
+ if (bundleLocationCompare != 0) {
+ return bundleLocationCompare;
+ }
+ return 0;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Map<X509Certificate, List<X509Certificate>> getSignerCertificates(int signersType) {
+ return new HashMap<X509Certificate, List<X509Certificate>>();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public <A> A adapt(Class<A> type) {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public File getDataFile(String filename) {
+ return null;
+ }
+
}
diff --git a/org.eclipse.virgo.teststubs.osgi/src/main/java/org/eclipse/virgo/teststubs/osgi/framework/StubBundleContext.java b/org.eclipse.virgo.teststubs.osgi/src/main/java/org/eclipse/virgo/teststubs/osgi/framework/StubBundleContext.java
index 5f7a9f3..299b557 100644
--- a/org.eclipse.virgo.teststubs.osgi/src/main/java/org/eclipse/virgo/teststubs/osgi/framework/StubBundleContext.java
+++ b/org.eclipse.virgo.teststubs.osgi/src/main/java/org/eclipse/virgo/teststubs/osgi/framework/StubBundleContext.java
@@ -18,6 +18,7 @@
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collection;
import java.util.Dictionary;
import java.util.HashMap;
import java.util.List;
@@ -286,21 +287,21 @@
/**
* {@inheritDoc}
*/
- public Object getService(ServiceReference reference) {
+ public <S> S getService(ServiceReference<S> reference) {
synchronized (this.servicesMonitor) {
if (serviceUnregistered(reference)) {
return null;
}
- return this.services.get(reference);
+ return (S) this.services.get(reference);
}
}
/**
* {@inheritDoc}
*/
- public ServiceReference getServiceReference(String clazz) {
- ServiceReference[] serviceReferences = null;
+ public ServiceReference<?> getServiceReference(String clazz) {
+ ServiceReference<?>[] serviceReferences = null;
try {
serviceReferences = getServiceReferences(clazz, null);
} catch (InvalidSyntaxException e) {
@@ -382,7 +383,7 @@
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
- public ServiceRegistration registerService(String[] clazzes, Object service, Dictionary properties) {
+ public ServiceRegistration<?> registerService(String[] clazzes, Object service, Dictionary<String, ?> properties) {
StubServiceRegistration serviceRegistration = createServiceRegistration(clazzes, properties);
StubServiceReference serviceReference = createServiceReference(clazzes, service, serviceRegistration);
@@ -411,7 +412,7 @@
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
- public ServiceRegistration registerService(String clazz, Object service, Dictionary properties) {
+ public ServiceRegistration<?> registerService(String clazz, Object service, Dictionary<String, ?> properties) {
return registerService(new String[] { clazz }, service, properties);
}
@@ -504,7 +505,7 @@
/**
* {@inheritDoc}
*/
- public boolean ungetService(ServiceReference reference) {
+ public boolean ungetService(ServiceReference<?> reference) {
return !serviceUnregistered(reference);
}
@@ -520,4 +521,24 @@
private boolean serviceUnregistered(ServiceReference reference) {
return ((StubServiceReference) reference).getServiceRegistration().getUnregistered();
}
+
+ public <S> ServiceRegistration<S> registerService(Class<S> clazz, S service, Dictionary<String, ?> properties) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public <S> ServiceReference<S> getServiceReference(Class<S> clazz) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public <S> Collection<ServiceReference<S>> getServiceReferences(Class<S> clazz, String filter) throws InvalidSyntaxException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Bundle getBundle(String location) {
+ // TODO Auto-generated method stub
+ return null;
+ }
}
diff --git a/org.eclipse.virgo.teststubs.osgi/src/main/java/org/eclipse/virgo/teststubs/osgi/support/FalseFilter.java b/org.eclipse.virgo.teststubs.osgi/src/main/java/org/eclipse/virgo/teststubs/osgi/support/FalseFilter.java
index e3b0e6d..10fdb83 100644
--- a/org.eclipse.virgo.teststubs.osgi/src/main/java/org/eclipse/virgo/teststubs/osgi/support/FalseFilter.java
+++ b/org.eclipse.virgo.teststubs.osgi/src/main/java/org/eclipse/virgo/teststubs/osgi/support/FalseFilter.java
@@ -12,6 +12,7 @@
package org.eclipse.virgo.teststubs.osgi.support;
import java.util.Dictionary;
+import java.util.Map;
import org.osgi.framework.Filter;
import org.osgi.framework.ServiceReference;
@@ -53,23 +54,28 @@
/**
* {@inheritDoc}
*/
- public boolean match(ServiceReference reference) {
+ public boolean match(ServiceReference<?> reference) {
return false;
}
/**
* {@inheritDoc}
*/
- @SuppressWarnings("unchecked")
- public boolean match(Dictionary dictionary) {
+ public boolean match(Dictionary<String, ?> dictionary) {
return false;
}
/**
* {@inheritDoc}
*/
- @SuppressWarnings("unchecked")
- public boolean matchCase(Dictionary dictionary) {
+ public boolean matchCase(Dictionary<String, ?> dictionary) {
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean matches(Map<String, ?> map) {
return false;
}
diff --git a/org.eclipse.virgo.teststubs.osgi/src/main/java/org/eclipse/virgo/teststubs/osgi/support/ObjectClassFilter.java b/org.eclipse.virgo.teststubs.osgi/src/main/java/org/eclipse/virgo/teststubs/osgi/support/ObjectClassFilter.java
index 5e1ca2e..321f1f2 100644
--- a/org.eclipse.virgo.teststubs.osgi/src/main/java/org/eclipse/virgo/teststubs/osgi/support/ObjectClassFilter.java
+++ b/org.eclipse.virgo.teststubs.osgi/src/main/java/org/eclipse/virgo/teststubs/osgi/support/ObjectClassFilter.java
@@ -14,6 +14,7 @@
import static org.eclipse.virgo.teststubs.osgi.internal.Assert.assertNotNull;
import java.util.Dictionary;
+import java.util.Map;
import org.osgi.framework.Constants;
import org.osgi.framework.ServiceReference;
@@ -52,23 +53,21 @@
/**
* {@inheritDoc}
*/
- public boolean match(ServiceReference reference) {
+ public boolean match(ServiceReference<?> reference) {
return contains((String[]) reference.getProperty(Constants.OBJECTCLASS), this.className);
}
/**
* {@inheritDoc}
*/
- @SuppressWarnings("unchecked")
- public boolean match(Dictionary dictionary) {
+ public boolean match(Dictionary<String, ?> dictionary) {
return contains((String[]) dictionary.get(Constants.OBJECTCLASS), this.className);
}
/**
* {@inheritDoc}
*/
- @SuppressWarnings("unchecked")
- public boolean matchCase(Dictionary dictionary) {
+ public boolean matchCase(Dictionary<String, ?> dictionary) {
return match(dictionary);
}
@@ -78,6 +77,13 @@
public String getFilterString() {
return String.format(FILTER_STRING_FORMAT, this.className);
}
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean matches(Map<String, ?> map) {
+ return contains((String [])map.get(Constants.OBJECTCLASS), this.className);
+ }
private boolean contains(String[] strings, String toMatch) {
for (String string : strings) {
@@ -87,4 +93,5 @@
}
return false;
}
+
}
diff --git a/org.eclipse.virgo.teststubs.osgi/src/main/java/org/eclipse/virgo/teststubs/osgi/support/PropertiesFilter.java b/org.eclipse.virgo.teststubs.osgi/src/main/java/org/eclipse/virgo/teststubs/osgi/support/PropertiesFilter.java
index 3f3dde6..d857d8d 100644
--- a/org.eclipse.virgo.teststubs.osgi/src/main/java/org/eclipse/virgo/teststubs/osgi/support/PropertiesFilter.java
+++ b/org.eclipse.virgo.teststubs.osgi/src/main/java/org/eclipse/virgo/teststubs/osgi/support/PropertiesFilter.java
@@ -66,7 +66,7 @@
/**
* {@inheritDoc}
*/
- public boolean match(ServiceReference reference) {
+ public boolean match(ServiceReference<?> reference) {
for (Entry<String, Object> entry : this.properties.entrySet()) {
Object value = reference.getProperty(entry.getKey());
if (value == null || !value.equals(entry.getValue())) {
@@ -79,8 +79,7 @@
/**
* {@inheritDoc}
*/
- @SuppressWarnings("unchecked")
- public boolean match(Dictionary dictionary) {
+ public boolean match(Dictionary<String, ?> dictionary) {
for (Entry<String, Object> entry : this.properties.entrySet()) {
Object value = dictionary.get(entry.getKey());
if (value == null || !value.equals(entry.getValue())) {
@@ -93,8 +92,7 @@
/**
* {@inheritDoc}
*/
- @SuppressWarnings("unchecked")
- public boolean matchCase(Dictionary dictionary) {
+ public boolean matchCase(Dictionary<String, ?> dictionary) {
return match(dictionary);
}
@@ -129,4 +127,17 @@
return properties;
}
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean matches(Map<String, ?> map) {
+ for (Entry<String, Object> entry : this.properties.entrySet()) {
+ Object value = map.get(entry.getKey());
+ if (value == null || !value.equals(entry.getValue())) {
+ return false;
+ }
+ }
+ return true;
+ }
}
diff --git a/org.eclipse.virgo.teststubs.osgi/src/main/java/org/eclipse/virgo/teststubs/osgi/support/TrueFilter.java b/org.eclipse.virgo.teststubs.osgi/src/main/java/org/eclipse/virgo/teststubs/osgi/support/TrueFilter.java
index 267be62..e5cb68a 100644
--- a/org.eclipse.virgo.teststubs.osgi/src/main/java/org/eclipse/virgo/teststubs/osgi/support/TrueFilter.java
+++ b/org.eclipse.virgo.teststubs.osgi/src/main/java/org/eclipse/virgo/teststubs/osgi/support/TrueFilter.java
@@ -12,6 +12,7 @@
package org.eclipse.virgo.teststubs.osgi.support;
import java.util.Dictionary;
+import java.util.Map;
import org.osgi.framework.Filter;
import org.osgi.framework.ServiceReference;
@@ -43,33 +44,38 @@
this.filterString = filterString;
}
- /**
- * {@inheritDoc}
- */
- public boolean match(ServiceReference reference) {
- return true;
- }
-
- /**
- * {@inheritDoc}
- */
- @SuppressWarnings("unchecked")
- public boolean match(Dictionary dictionary) {
- return true;
- }
-
- /**
- * {@inheritDoc}
- */
- @SuppressWarnings("unchecked")
- public boolean matchCase(Dictionary dictionary) {
- return true;
- }
-
- /**
+ /**
* {@inheritDoc}
*/
public String getFilterString() {
return this.filterString;
}
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean match(ServiceReference<?> reference) {
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean match(Dictionary<String, ?> dictionary) {
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean matchCase(Dictionary<String, ?> dictionary) {
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean matches(Map<String, ?> map) {
+ return true;
+ }
}
diff --git a/org.eclipse.virgo.teststubs.osgi/src/main/resources/META-INF/MANIFEST.MF b/org.eclipse.virgo.teststubs.osgi/src/main/resources/META-INF/MANIFEST.MF
index 81616bf..5f567e8 100644
--- a/org.eclipse.virgo.teststubs.osgi/src/main/resources/META-INF/MANIFEST.MF
+++ b/org.eclipse.virgo.teststubs.osgi/src/main/resources/META-INF/MANIFEST.MF
@@ -1,15 +1,14 @@
Manifest-Version: 1.0
-Export-Package: com.springsource;version="1.0.0",com.springsource.osgi
- ;version="1.0.0",org.eclipse.virgo.teststubs.osgi.framework;version="
- 1.0.0";uses:="org.osgi.framework",org.eclipse.virgo.teststubs.osgi.se
- rvice.cm;version="1.0.0";uses:="org.osgi.framework,org.osgi.service.c
- m",org.eclipse.virgo.teststubs.osgi.service.event;version="1.0.0";use
- s:="org.osgi.service.event",org.eclipse.virgo.teststubs.osgi.service.
- event.internal;version="1.0.0";uses:="org.osgi.service.event",org.ecl
- ipse.virgo.teststubs.osgi.support;version="1.0.0";uses:="org.osgi.fra
- mework"
+Export-Package: org.eclipse.virgo.teststubs.osgi.framework;version="1.
+ 0.0";uses:="org.osgi.framework",org.eclipse.virgo.teststubs.osgi.serv
+ ice.cm;version="1.0.0";uses:="org.osgi.framework,org.osgi.service.cm"
+ ,org.eclipse.virgo.teststubs.osgi.service.event;version="1.0.0";uses:
+ ="org.osgi.service.event",org.eclipse.virgo.teststubs.osgi.service.ev
+ ent.internal;version="1.0.0";uses:="org.osgi.service.event",org.eclip
+ se.virgo.teststubs.osgi.support;version="1.0.0";uses:="org.osgi.frame
+ work"
Bundle-Version: 1.0.0
-Tool: Bundlor 1.0.0.M6
+Tool: Bundlor 1.0.0.RELEASE
Bundle-Name: OSGi Framework Test Stub Implementations
Bundle-ManifestVersion: 2
Import-Package: org.aspectj.internal.lang.annotation;version="[1.6.3.R
diff --git a/org.eclipse.virgo.teststubs.osgi/src/test/java/org/eclipse/virgo/teststubs/osgi/framework/StubBundleContextTests.java b/org.eclipse.virgo.teststubs.osgi/src/test/java/org/eclipse/virgo/teststubs/osgi/framework/StubBundleContextTests.java
index 4352d27..da23e1f 100644
--- a/org.eclipse.virgo.teststubs.osgi/src/test/java/org/eclipse/virgo/teststubs/osgi/framework/StubBundleContextTests.java
+++ b/org.eclipse.virgo.teststubs.osgi/src/test/java/org/eclipse/virgo/teststubs/osgi/framework/StubBundleContextTests.java
@@ -25,6 +25,7 @@
import java.util.Dictionary;
import java.util.Hashtable;
import java.util.List;
+import java.util.Map;
import org.junit.Test;
import org.osgi.framework.Bundle;
@@ -232,13 +233,13 @@
@Test
public void getServiceReferencesNullReturn() throws InvalidSyntaxException {
- assertNull(this.bundleContext.getServiceReferences(null, null));
+ assertNull(this.bundleContext.getServiceReferences((String)null, null));
}
@Test
public void getServiceReferencesNullClassNullFilter() throws InvalidSyntaxException {
this.bundleContext.registerService(Object.class.getName(), new Object(), null);
- assertEquals(1, this.bundleContext.getServiceReferences(null, null).length);
+ assertEquals(1, this.bundleContext.getServiceReferences((String)null, null).length);
}
@Test
@@ -262,20 +263,20 @@
@Test
public void getServiceReferenceNoValues() throws InvalidSyntaxException {
- assertNull(this.bundleContext.getServiceReference(null));
+ assertNull(this.bundleContext.getServiceReference((String)null));
}
@Test
public void getServiceReferenceOneValue() throws InvalidSyntaxException {
this.bundleContext.registerService(Object.class.getName(), new Object(), null);
- assertNotNull(this.bundleContext.getServiceReference(null));
+ assertNotNull(this.bundleContext.getServiceReference((String)null));
}
@Test
public void getServiceReferenceTwoValues() throws InvalidSyntaxException {
this.bundleContext.registerService(Object.class.getName(), new Object(), null);
this.bundleContext.registerService(Object.class.getName(), new Object(), null);
- assertNotNull(this.bundleContext.getServiceReference(null));
+ assertNotNull(this.bundleContext.getServiceReference((String)null));
}
private static class TestBundleListener implements BundleListener {
@@ -326,21 +327,40 @@
private static class TestFilter extends AbstractFilter {
- public boolean match(ServiceReference reference) {
+ /**
+ * {@inheritDoc}
+ */
+ public boolean match(ServiceReference<?> reference) {
return true;
}
- public boolean match(Dictionary dictionary) {
+ /**
+ * {@inheritDoc}
+ */
+ public boolean match(Dictionary<String, ?> dictionary) {
throw new UnsupportedOperationException();
}
- public boolean matchCase(Dictionary dictionary) {
+ /**
+ * {@inheritDoc}
+ */
+ public boolean matchCase(Dictionary<String, ?> dictionary) {
throw new UnsupportedOperationException();
}
+ /**
+ * {@inheritDoc}
+ */
public String getFilterString() {
return "testFilter";
}
+ /**
+ * {@inheritDoc}
+ */
+ public boolean matches(Map<String, ?> map) {
+ throw new UnsupportedOperationException();
+ }
+
}
}
diff --git a/org.eclipse.virgo.teststubs.osgi/src/test/java/org/eclipse/virgo/teststubs/osgi/service/event/StubEventAdminTests.java b/org.eclipse.virgo.teststubs.osgi/src/test/java/org/eclipse/virgo/teststubs/osgi/service/event/StubEventAdminTests.java
index e55c4ec..e616397 100644
--- a/org.eclipse.virgo.teststubs.osgi/src/test/java/org/eclipse/virgo/teststubs/osgi/service/event/StubEventAdminTests.java
+++ b/org.eclipse.virgo.teststubs.osgi/src/test/java/org/eclipse/virgo/teststubs/osgi/service/event/StubEventAdminTests.java
@@ -22,6 +22,7 @@
import java.lang.management.ThreadMXBean;
import java.util.Dictionary;
import java.util.Hashtable;
+import java.util.Map;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
@@ -77,7 +78,7 @@
public void awaitSendingTimeout() {
Event expected = new Event("topic", this.expectedProperties);
- this.eventAdmin.sendEvent(new Event("differentTopic", null));
+ this.eventAdmin.sendEvent(new Event("differentTopic", (Map<String,?>)null));
this.eventAdmin.postEvent(expected);
long start = System.currentTimeMillis();
@@ -90,7 +91,7 @@
public void awaitPostingTimeout() {
Event expected = new Event("topic", this.expectedProperties);
- this.eventAdmin.postEvent(new Event("differentTopic", null));
+ this.eventAdmin.postEvent(new Event("differentTopic", (Map<String,?>)null));
this.eventAdmin.sendEvent(expected);
long start = System.currentTimeMillis();
@@ -197,7 +198,7 @@
@Test
public void postEventMatchingOnTopic() {
Event posted = new Event("topic", this.properties);
- Event expected = new Event("topic", null);
+ Event expected = new Event("topic", (Map<String,?>)null);
this.eventAdmin.postEvent(posted);
assertNotNull(this.eventAdmin.awaitPostingOfEvent("topic", 1000));
@@ -206,7 +207,7 @@
@Test
public void sendEventMatchingOnTopic() {
Event sent = new Event("topic", this.properties);
- Event expected = new Event("topic", null);
+ Event expected = new Event("topic", (Map<String,?>)null);
this.eventAdmin.sendEvent(sent);
assertNotNull(this.eventAdmin.awaitSendingOfEvent("topic", 1000));
@@ -216,7 +217,7 @@
public void awaitSendingTimeoutMatchingOnTopic() {
Event expected = new Event("topic", this.expectedProperties);
- this.eventAdmin.sendEvent(new Event("differentTopic", null));
+ this.eventAdmin.sendEvent(new Event("differentTopic", (Map<String,?>)null));
this.eventAdmin.postEvent(expected);
long start = System.currentTimeMillis();
@@ -229,7 +230,7 @@
public void awaitPostingTimeoutMatchingOnTopic() {
Event expected = new Event("topic", this.expectedProperties);
- this.eventAdmin.postEvent(new Event("differentTopic", null));
+ this.eventAdmin.postEvent(new Event("differentTopic", (Map<String,?>)null));
this.eventAdmin.sendEvent(expected);
long start = System.currentTimeMillis();
diff --git a/org.eclipse.virgo.teststubs.osgi/src/test/java/org/eclipse/virgo/teststubs/osgi/service/event/internal/EventUtilsTests.java b/org.eclipse.virgo.teststubs.osgi/src/test/java/org/eclipse/virgo/teststubs/osgi/service/event/internal/EventUtilsTests.java
index 6d33fbf..948cf54 100644
--- a/org.eclipse.virgo.teststubs.osgi/src/test/java/org/eclipse/virgo/teststubs/osgi/service/event/internal/EventUtilsTests.java
+++ b/org.eclipse.virgo.teststubs.osgi/src/test/java/org/eclipse/virgo/teststubs/osgi/service/event/internal/EventUtilsTests.java
@@ -16,6 +16,7 @@
import java.util.Dictionary;
import java.util.Hashtable;
+import java.util.Map;
import org.junit.Test;
import org.osgi.service.event.Event;
@@ -116,12 +117,12 @@
@Test
public void eventsWithDifferentTopicsAreNotEqual() {
- assertFalse(EventUtils.eventsAreEqual(new Event("foo", null), new Event("bar", null)));
+ assertFalse(EventUtils.eventsAreEqual(new Event("foo", (Map<String, ?>)null), new Event("bar", (Map<String, ?>)null)));
}
@Test
public void eventsWithMatchingTopicsAndNoPropertiesAreEqual() {
- assertTrue(EventUtils.eventsAreEqual(new Event("foo", null), new Event("foo", null)));
+ assertTrue(EventUtils.eventsAreEqual(new Event("foo", (Map<String, ?>)null), new Event("foo", (Map<String, ?>)null)));
}
@Test
@@ -131,7 +132,7 @@
@Test
public void eventsWithMatchingTopicsAndDifferentNumberOfPropertiesAreNotEqual() {
- Dictionary properties = createProperties();
+ Dictionary<String, ?> properties = createProperties();
properties.remove("byteArray");
assertFalse(EventUtils.eventsAreEqual(new Event("foo", createProperties()), new Event("foo", properties)));
@@ -139,7 +140,7 @@
@Test
public void eventsWithMatchingTopicsAndDifferentPropertiesAreNotEqual() {
- Dictionary properties = createProperties();
+ Dictionary<String, Object> properties = createProperties();
properties.put("byteArray", new byte[] {6});
assertFalse(EventUtils.eventsAreEqual(new Event("foo", createProperties()), new Event("foo", properties)));
@@ -150,9 +151,8 @@
assertFalse(EventUtils.eventsAreEqual(new Event("foo", createProperties()), new Event("foo", properties)));
}
- @SuppressWarnings("unchecked")
- private Dictionary createProperties() {
- Dictionary properties = new Hashtable();
+ private Dictionary<String, Object> createProperties() {
+ Dictionary<String, Object> properties = new Hashtable<String, Object>();
properties.put("object", "alpha");
properties.put("booleanArray", new boolean[] {false, true});
diff --git a/org.eclipse.virgo.teststubs.osgi/src/test/java/org/eclipse/virgo/teststubs/osgi/support/ObjectClassFilterTests.java b/org.eclipse.virgo.teststubs.osgi/src/test/java/org/eclipse/virgo/teststubs/osgi/support/ObjectClassFilterTests.java
index ad18361..fc23ca5 100644
--- a/org.eclipse.virgo.teststubs.osgi/src/test/java/org/eclipse/virgo/teststubs/osgi/support/ObjectClassFilterTests.java
+++ b/org.eclipse.virgo.teststubs.osgi/src/test/java/org/eclipse/virgo/teststubs/osgi/support/ObjectClassFilterTests.java
@@ -34,7 +34,7 @@
@Test
public void matchServiceReference() {
- ServiceReference objectServiceReference = new ServiceReference() {
+ ServiceReference<Object> objectServiceReference = new ServiceReference<Object>() {
public int compareTo(Object reference) {
throw new UnsupportedOperationException();