Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2012-03-19 20:29:01 +0000
committerThomas Watson2012-03-19 20:29:01 +0000
commitd484b47054e316cfbfba61e3178cecc24ac1d378 (patch)
treeae8cdd5198d9f3b1659344be16799abc448ff1f6 /bundles/org.eclipse.equinox.cm.test
parent96b97263b06ccef1ee05dd2957592f640bacb94b (diff)
downloadrt.equinox.bundles-d484b47054e316cfbfba61e3178cecc24ac1d378.tar.gz
rt.equinox.bundles-d484b47054e316cfbfba61e3178cecc24ac1d378.tar.xz
rt.equinox.bundles-d484b47054e316cfbfba61e3178cecc24ac1d378.zip
Diffstat (limited to 'bundles/org.eclipse.equinox.cm.test')
-rw-r--r--bundles/org.eclipse.equinox.cm.test/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/ManagedServiceTest.java46
2 files changed, 47 insertions, 1 deletions
diff --git a/bundles/org.eclipse.equinox.cm.test/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.cm.test/META-INF/MANIFEST.MF
index a1b9acaab..93f0f5c04 100644
--- a/bundles/org.eclipse.equinox.cm.test/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.cm.test/META-INF/MANIFEST.MF
@@ -5,8 +5,10 @@ Bundle-SymbolicName: org.eclipse.equinox.cm.test
Bundle-Version: 1.0.0
Bundle-Activator: org.eclipse.equinox.cm.test.Activator
Import-Package: junit.framework;version="3.8.1",
+ org.eclipse.equinox.log,
org.osgi.framework;version="1.3.0",
org.osgi.service.cm;version="1.2.0",
org.osgi.service.event;version="1.1.0",
+ org.osgi.service.log;version="1.3.0",
org.osgi.service.packageadmin;version="1.2.0"
Eclipse-LazyStart: true
diff --git a/bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/ManagedServiceTest.java b/bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/ManagedServiceTest.java
index 2d671c3b7..e1612ed3c 100644
--- a/bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/ManagedServiceTest.java
+++ b/bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/ManagedServiceTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 IBM Corporation and others
+ * Copyright (c) 2007, 2012 IBM Corporation and others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -13,8 +13,11 @@ package org.eclipse.equinox.cm.test;
import java.util.Dictionary;
import java.util.Properties;
import junit.framework.TestCase;
+import org.eclipse.equinox.log.ExtendedLogReaderService;
+import org.eclipse.equinox.log.LogFilter;
import org.osgi.framework.*;
import org.osgi.service.cm.*;
+import org.osgi.service.log.*;
public class ManagedServiceTest extends TestCase {
@@ -85,6 +88,47 @@ public class ManagedServiceTest extends TestCase {
config.delete();
}
+ public void testBug374637() throws Exception {
+
+ ManagedService ms = new ManagedService() {
+
+ public void updated(Dictionary properties) throws ConfigurationException {
+ // nothing
+ }
+ };
+
+ ExtendedLogReaderService reader = (ExtendedLogReaderService) Activator.getBundleContext().getService(Activator.getBundleContext().getServiceReference(ExtendedLogReaderService.class));
+ synchronized (lock) {
+ locked = false;
+ }
+ LogListener listener = new LogListener() {
+ public void logged(LogEntry entry) {
+ synchronized (lock) {
+ locked = true;
+ lock.notifyAll();
+ }
+ }
+ };
+ reader.addLogListener(listener, new LogFilter() {
+ public boolean isLoggable(Bundle bundle, String loggerName, int logLevel) {
+ return logLevel == LogService.LOG_ERROR;
+ }
+ });
+ Dictionary dict = new Properties();
+ dict.put(Constants.SERVICE_PID, "test");
+ ServiceRegistration reg1 = Activator.getBundleContext().registerService(ManagedService.class.getName(), ms, dict);
+ ServiceRegistration reg2 = Activator.getBundleContext().registerService(ManagedService.class.getName(), ms, dict);
+
+ reg1.unregister();
+ reg2.unregister();
+ reader.removeLogListener(listener);
+
+ synchronized (lock) {
+ lock.wait(1000);
+ assertFalse("Got a error log", locked);
+ }
+ }
+
public void testGeneralManagedService() throws Exception {
updateCount = 0;
ManagedService ms = new ManagedService() {

Back to the top