diff options
author | Thomas Watson | 2013-03-20 14:44:01 +0000 |
---|---|---|
committer | Thomas Watson | 2013-03-20 14:44:01 +0000 |
commit | 434cc30b833ee769659608b25acda9b046bc7cf4 (patch) | |
tree | a6d1a1c93fbdbbfed56c5a5d804a09ebddba519e /bundles | |
parent | af3b5254ab86d60d44812ec0409ec23cfa7dc328 (diff) | |
download | rt.equinox.framework-434cc30b833ee769659608b25acda9b046bc7cf4.tar.gz rt.equinox.framework-434cc30b833ee769659608b25acda9b046bc7cf4.tar.xz rt.equinox.framework-434cc30b833ee769659608b25acda9b046bc7cf4.zip |
Bug 403866 - Failure in LogServiceTest.testLogNegativeLevel
Diffstat (limited to 'bundles')
-rw-r--r-- | bundles/org.eclipse.osgi.tests/src/org/eclipse/equinox/log/test/LogReaderServiceTest.java | 6 | ||||
-rw-r--r-- | bundles/org.eclipse.osgi.tests/src/org/eclipse/equinox/log/test/TestListener.java | 19 |
2 files changed, 18 insertions, 7 deletions
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/equinox/log/test/LogReaderServiceTest.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/equinox/log/test/LogReaderServiceTest.java index 563a8b859..bcd1b926c 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/equinox/log/test/LogReaderServiceTest.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/equinox/log/test/LogReaderServiceTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2012 IBM Corporation and others All rights reserved. This + * Copyright (c) 2007, 2013 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 http://www.eclipse.org/legal/epl-v10.html @@ -106,7 +106,7 @@ public class LogReaderServiceTest extends AbstractBundleTests { // this is just a bundle that is harmless to start/stop Bundle testBundle = installer.installBundle("test.logging.a"); //$NON-NLS-1$ - TestListener listener = new TestListener(); + TestListener listener = new TestListener(testBundle); reader.addLogListener(listener); synchronized (listener) { testBundle.start(); @@ -139,7 +139,7 @@ public class LogReaderServiceTest extends AbstractBundleTests { public void testLogFrameworkEvent() throws Exception { Bundle testBundle = installer.installBundle("test.logging.a"); //$NON-NLS-1$ - TestListener listener = new TestListener(); + TestListener listener = new TestListener(testBundle); reader.addLogListener(listener); synchronized (listener) { installer.refreshPackages(new Bundle[] {testBundle}); diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/equinox/log/test/TestListener.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/equinox/log/test/TestListener.java index e176c7c3b..e4b2492a7 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/equinox/log/test/TestListener.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/equinox/log/test/TestListener.java @@ -1,22 +1,33 @@ /******************************************************************************* - * Copyright (c) 2007, 2012 IBM Corporation All rights reserved. This program + * Copyright (c) 2007, 2013 IBM Corporation 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 http://www.eclipse.org/legal/epl-v10.html *******************************************************************************/ package org.eclipse.equinox.log.test; -import junit.framework.Assert; import org.eclipse.equinox.log.ExtendedLogEntry; +import org.eclipse.osgi.tests.OSGiTestsActivator; +import org.junit.Assert; +import org.osgi.framework.Bundle; import org.osgi.service.log.LogEntry; import org.osgi.service.log.LogListener; class TestListener implements LogListener { + private final Bundle testBundle; LogEntry entry; + public TestListener() { + this(null); + } + + public TestListener(Bundle testBundle) { + this.testBundle = testBundle == null ? OSGiTestsActivator.getContext().getBundle() : testBundle; + } + public synchronized void logged(LogEntry entry) { - if (entry.getBundle().getBundleId() == 0) - return; // discard logs from the logImpl in the framework + if (!testBundle.equals(entry.getBundle())) + return; // discard logs from all other bundles this.entry = entry; notifyAll(); } |