summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid W. Miller2012-05-03 14:34:17 (EDT)
committer Roberto E. Escobar2012-05-03 14:34:17 (EDT)
commitedebd23b8302281b68635625f6f45969886ed133 (patch)
treee0ab43fe76a362fed54b5fe2cce069fe5d619c31
parent9492527af255130a527aa738e2a5138e07eca0a0 (diff)
downloadorg.eclipse.osee-edebd23b8302281b68635625f6f45969886ed133.zip
org.eclipse.osee-edebd23b8302281b68635625f6f45969886ed133.tar.gz
org.eclipse.osee-edebd23b8302281b68635625f6f45969886ed133.tar.bz2
refinement: Replace ServiceTracker with ServiceReference in OsgiUtil
-rw-r--r--plugins/org.eclipse.osee.orcs.db.mock/src/org/eclipse/osee/orcs/db/mock/OsgiUtil.java11
1 files changed, 6 insertions, 5 deletions
diff --git a/plugins/org.eclipse.osee.orcs.db.mock/src/org/eclipse/osee/orcs/db/mock/OsgiUtil.java b/plugins/org.eclipse.osee.orcs.db.mock/src/org/eclipse/osee/orcs/db/mock/OsgiUtil.java
index 4b6e609..b4de3ec 100644
--- a/plugins/org.eclipse.osee.orcs.db.mock/src/org/eclipse/osee/orcs/db/mock/OsgiUtil.java
+++ b/plugins/org.eclipse.osee.orcs.db.mock/src/org/eclipse/osee/orcs/db/mock/OsgiUtil.java
@@ -18,8 +18,8 @@ import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
import org.osgi.framework.FrameworkUtil;
+import org.osgi.framework.ServiceReference;
import org.osgi.framework.ServiceRegistration;
-import org.osgi.util.tracker.ServiceTracker;
/**
* @author Roberto E. Escobar
@@ -42,15 +42,16 @@ public final class OsgiUtil {
OseeExceptions.wrapAndThrow(ex);
}
}
+
BundleContext context = bundle.getBundleContext();
Assert.assertNotNull(context);
- ServiceTracker<T, T> tracker = new ServiceTracker<T, T>(context, clazz, null);
- tracker.open(true);
- T service = tracker.getService();
- tracker.close();
+ ServiceReference<T> reference = context.getServiceReference(clazz);
+ Assert.assertNotNull(reference);
+ T service = context.getService(reference);
Assert.assertNotNull(service);
+
return service;
}