diff options
author | Alexander Kurtakov | 2015-01-27 09:35:54 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2015-01-27 11:04:54 +0000 |
commit | 7a1e68d8ff94110773f4137a7c2deb701b07f51e (patch) | |
tree | 89aecbd55ff257f0c733b5cc69ce6b5e268ec10d | |
parent | 0f25ba94704afd3740a10968752db96e4a5e22c5 (diff) | |
download | eclipse.platform.runtime-7a1e68d8ff94110773f4137a7c2deb701b07f51e.tar.gz eclipse.platform.runtime-7a1e68d8ff94110773f4137a7c2deb701b07f51e.tar.xz eclipse.platform.runtime-7a1e68d8ff94110773f4137a7c2deb701b07f51e.zip |
Bug 458490 - Cleanup o.e.core.tests.runtimeI20150203-1300I20150129-1830I20150128-2000I20150128-0900
* Use *Scope.INSTANCE instead of creating new Scope object
* Use not deprecated BundleTestingHelper.installBundle method.
* Remove unused variables
* Remove declared but not thrown exceptions
* Use FileLocator.resolve instead of deprecated Platform.resolve
* Use SafeRunner.run instead of deprecated Platform.run
* Migrate from deprecated junit.framework.Assert to org.junit.Assert
* Update launch configuration to use JUnit 4 runner
Change-Id: I60cdf1bbb09c10bde763a285fb4f2576064be583
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
20 files changed, 122 insertions, 107 deletions
diff --git a/tests/org.eclipse.core.tests.runtime/All Runtime Tests.launch b/tests/org.eclipse.core.tests.runtime/All Runtime Tests.launch index 5e0845586..97cbe8eff 100644 --- a/tests/org.eclipse.core.tests.runtime/All Runtime Tests.launch +++ b/tests/org.eclipse.core.tests.runtime/All Runtime Tests.launch @@ -27,7 +27,8 @@ <stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/> <booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/> <stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/> -<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit3"/> +<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/> +<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.core.tests.runtime.AutomatedTests"/> <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.core.tests.runtime"/> <stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/> diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/IScopeContextTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/IScopeContextTest.java index 08f30582b..37ee2d246 100644 --- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/IScopeContextTest.java +++ b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/IScopeContextTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2012 IBM Corporation and others. + * Copyright (c) 2004, 2015 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 @@ -7,6 +7,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Alexander Kurtakov <akurtako@redhat.com> - bug 458490 *******************************************************************************/ package org.eclipse.core.tests.internal.preferences; @@ -40,7 +41,7 @@ public class IScopeContextTest extends RuntimeTest { } public void testGetNode() { - IScopeContext context = new InstanceScope(); + IScopeContext context = InstanceScope.INSTANCE; // null try { diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/ExtensionRegistryStaticTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/ExtensionRegistryStaticTest.java index f48b187c8..9cca7f08c 100644 --- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/ExtensionRegistryStaticTest.java +++ b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/ExtensionRegistryStaticTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2012 IBM Corporation and others. + * Copyright (c) 2004, 2015 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 @@ -7,6 +7,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Alexander Kurtakov <akurtako@redhat.com> - bug 458490 *******************************************************************************/ package org.eclipse.core.tests.internal.registry; @@ -29,7 +30,7 @@ public class ExtensionRegistryStaticTest extends TestCase { public void testA() throws IOException, BundleException { //test the addition of an extension point String name = "A"; - Bundle bundle01 = BundleTestingHelper.installBundle(RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/test" + name); + Bundle bundle01 = BundleTestingHelper.installBundle("", RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/test" + name); BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {bundle01}); testExtensionPoint(name); } @@ -50,7 +51,7 @@ public class ExtensionRegistryStaticTest extends TestCase { public void testB() throws IOException, BundleException { //test the addition of an extension without extension point - Bundle bundle01 = BundleTestingHelper.installBundle(RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/testB/1"); + Bundle bundle01 = BundleTestingHelper.installBundle("", RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/testB/1"); BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {bundle01}); assertNull(Platform.getExtensionRegistry().getExtension("testB2", "xptB2", "ext1")); } @@ -58,7 +59,7 @@ public class ExtensionRegistryStaticTest extends TestCase { public void testBFromCache() throws IOException, BundleException { // Test the addition of an extension point when orphans extension exists assertNull(Platform.getExtensionRegistry().getExtension("testB2", "xptB2", "ext1")); - Bundle bundle02 = BundleTestingHelper.installBundle(RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/testB/2"); + Bundle bundle02 = BundleTestingHelper.installBundle("", RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/testB/2"); BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {bundle02}); testExtensionPoint("B2"); @@ -97,10 +98,10 @@ public class ExtensionRegistryStaticTest extends TestCase { public void testC() throws IOException, BundleException { //test the addition of an extension point then the addition of an extension - Bundle bundle01 = BundleTestingHelper.installBundle(RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/testC/1"); + Bundle bundle01 = BundleTestingHelper.installBundle("", RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/testC/1"); BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {bundle01}); testExtensionPoint("C1"); - Bundle bundle02 = BundleTestingHelper.installBundle(RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/testC/2"); + Bundle bundle02 = BundleTestingHelper.installBundle("", RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/testC/2"); BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {bundle02}); //Test the configurataion elements @@ -121,9 +122,9 @@ public class ExtensionRegistryStaticTest extends TestCase { public void testD() throws IOException, BundleException { //test the addition of an extension then the addition of an extension point - Bundle bundle02 = BundleTestingHelper.installBundle(RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/testD/2"); + Bundle bundle02 = BundleTestingHelper.installBundle("", RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/testD/2"); BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {bundle02}); - Bundle bundle01 = BundleTestingHelper.installBundle(RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/testD/1"); + Bundle bundle01 = BundleTestingHelper.installBundle("", RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/testD/1"); BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {bundle01}); testExtensionPoint("D1"); @@ -145,9 +146,9 @@ public class ExtensionRegistryStaticTest extends TestCase { public void testE() throws IOException, BundleException { //test the addition of an extension point and then add the extension through a fragment - Bundle bundle01 = BundleTestingHelper.installBundle(RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/testE/1"); + Bundle bundle01 = BundleTestingHelper.installBundle("", RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/testE/1"); BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {bundle01}); - Bundle bundle02 = BundleTestingHelper.installBundle(RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/testE/2"); + Bundle bundle02 = BundleTestingHelper.installBundle("", RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/testE/2"); BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {bundle02}); testExtensionPoint("E1"); @@ -169,9 +170,9 @@ public class ExtensionRegistryStaticTest extends TestCase { public void testF() throws IOException, BundleException { //test the addition of the extension through a fragment then the addition of an extension point - Bundle bundle02 = BundleTestingHelper.installBundle(RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/testF/2"); + Bundle bundle02 = BundleTestingHelper.installBundle("", RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/testF/2"); BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {bundle02}); - Bundle bundle01 = BundleTestingHelper.installBundle(RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/testF/1"); + Bundle bundle01 = BundleTestingHelper.installBundle("", RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/testF/1"); BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {bundle01}); testExtensionPoint("F1"); @@ -197,9 +198,9 @@ public class ExtensionRegistryStaticTest extends TestCase { public void testG() throws IOException, BundleException { //fragment contributing an extension point to a plugin that do not have extension or extension point - Bundle bundle01 = BundleTestingHelper.installBundle(RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/testG/1"); + Bundle bundle01 = BundleTestingHelper.installBundle("", RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/testG/1"); BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {bundle01}); - Bundle bundle02 = BundleTestingHelper.installBundle(RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/testG/2"); + Bundle bundle02 = BundleTestingHelper.installBundle("", RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/testG/2"); BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {bundle02}); assertNotNull(Platform.getExtensionRegistry().getExtensionPoint("testG1.xptG2")); @@ -216,11 +217,11 @@ public class ExtensionRegistryStaticTest extends TestCase { public void testH() throws IOException, BundleException { // fragment contributing an extension to a plugin that does not have extension or extension point - Bundle bundle01 = BundleTestingHelper.installBundle(RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/testH/1"); + Bundle bundle01 = BundleTestingHelper.installBundle("", RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/testH/1"); BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {bundle01}); - Bundle bundle02 = BundleTestingHelper.installBundle(RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/testH/2"); + Bundle bundle02 = BundleTestingHelper.installBundle("", RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/testH/2"); BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {bundle02}); - Bundle bundle03 = BundleTestingHelper.installBundle(RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/testH/3"); + Bundle bundle03 = BundleTestingHelper.installBundle("", RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/testH/3"); BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {bundle03}); testExtensionPoint("H1"); @@ -247,13 +248,13 @@ public class ExtensionRegistryStaticTest extends TestCase { } public void test71826() throws MalformedURLException, BundleException, IOException { - Bundle bundle01 = BundleTestingHelper.installBundle(RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/71826/fragmentF"); + Bundle bundle01 = BundleTestingHelper.installBundle("", RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/71826/fragmentF"); BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {bundle01}); - Bundle bundle02 = BundleTestingHelper.installBundle(RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/71826/pluginB"); + Bundle bundle02 = BundleTestingHelper.installBundle("", RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/71826/pluginB"); BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {bundle02}); - Bundle bundle03 = BundleTestingHelper.installBundle(RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/71826/pluginA"); + Bundle bundle03 = BundleTestingHelper.installBundle("", RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/71826/pluginA"); BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {bundle03}); IExtensionPoint xp = Platform.getExtensionRegistry().getExtensionPoint("71826A.xptE"); @@ -266,7 +267,7 @@ public class ExtensionRegistryStaticTest extends TestCase { public void testJ() throws MalformedURLException, BundleException, IOException { //Test the third level configuration elements - Bundle bundle01 = BundleTestingHelper.installBundle(RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/testI"); + Bundle bundle01 = BundleTestingHelper.installBundle("", RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/testI"); BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {bundle01}); IExtension ext = Platform.getExtensionRegistry().getExtension("testI.ext1"); @@ -301,26 +302,26 @@ public class ExtensionRegistryStaticTest extends TestCase { public void testNonSingletonBundle() throws MalformedURLException, BundleException, IOException { //Non singleton bundles are not supposed to be added - Bundle nonSingletonBundle = BundleTestingHelper.installBundle(RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/nonSingleton"); + Bundle nonSingletonBundle = BundleTestingHelper.installBundle("", RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/nonSingleton"); BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {nonSingletonBundle}); assertNull(Platform.getExtensionRegistry().getExtensionPoint("NonSingleton.ExtensionPoint")); } - + public void testSingletonFragment() throws MalformedURLException, BundleException, IOException { //Fragments to non singleton host can not contribute extension or extension points - Bundle fragmentToNonSingleton = BundleTestingHelper.installBundle(RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/fragmentToNonSingleton"); + Bundle fragmentToNonSingleton = BundleTestingHelper.installBundle("", RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/fragmentToNonSingleton"); BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {fragmentToNonSingleton}); assertNull(Platform.getExtensionRegistry().getExtensionPoint("NonSingleton.Bar")); } - + public void testNonSingletonFragment() throws MalformedURLException, BundleException, IOException { //Non singleton bundles are not supposed to be added - Bundle regular = BundleTestingHelper.installBundle(RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/nonSingletonFragment/plugin"); - Bundle nonSingletonFragment = BundleTestingHelper.installBundle(RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/nonSingletonFragment/fragment"); + Bundle regular = BundleTestingHelper.installBundle("", RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/nonSingletonFragment/plugin"); + Bundle nonSingletonFragment = BundleTestingHelper.installBundle("", RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/nonSingletonFragment/fragment"); BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {regular, nonSingletonFragment}); assertNull(Platform.getExtensionRegistry().getExtensionPoint("Regular.Bar")); } - + public static Test suite() { //Order is important TestSuite sameSession = new TestSuite(ExtensionRegistryStaticTest.class.getName()); diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/MultiLanguageTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/MultiLanguageTest.java index 868945079..800e0f871 100644 --- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/MultiLanguageTest.java +++ b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/MultiLanguageTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2012 IBM Corporation and others. + * Copyright (c) 2009, 2015 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 @@ -7,6 +7,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Alexander Kurtakov <akurtako@redhat.com> - bug 458490 *******************************************************************************/ package org.eclipse.core.tests.internal.registry; @@ -162,33 +163,27 @@ public class MultiLanguageTest extends TestCase { * Tests APIs that use implicit default Locale. */ public void testMultiLocaleService() { - ServiceRegistration registration = null; - try { - Object masterToken = new Object(); - // Create a multi-language extension registry - File[] registryLocations = new File[] {registryLocation}; - boolean[] readOnly = new boolean[] {false}; - RegistryStrategy strategy = RegistryFactory.createOSGiStrategy(registryLocations, readOnly, masterToken); - IExtensionRegistry localRegistry = RegistryFactory.createRegistry(strategy, masterToken, null); - assertTrue(localRegistry.isMultiLanguage()); - - // this is a direct test - checkTranslationsService(localRegistry, false); - - // test cache - localRegistry.stop(masterToken); - IExtensionRegistry registryCached = RegistryFactory.createRegistry(strategy, masterToken, null); - assertTrue(registryCached.isMultiLanguage()); - checkTranslationsService(registryCached, true); - registryCached.stop(masterToken); - } finally { - if (registration != null) - registration.unregister(); - } + Object masterToken = new Object(); + // Create a multi-language extension registry + File[] registryLocations = new File[] {registryLocation}; + boolean[] readOnly = new boolean[] {false}; + RegistryStrategy strategy = RegistryFactory.createOSGiStrategy(registryLocations, readOnly, masterToken); + IExtensionRegistry localRegistry = RegistryFactory.createRegistry(strategy, masterToken, null); + assertTrue(localRegistry.isMultiLanguage()); + + // this is a direct test + checkTranslationsService(localRegistry, false); + + // test cache + localRegistry.stop(masterToken); + IExtensionRegistry registryCached = RegistryFactory.createRegistry(strategy, masterToken, null); + assertTrue(registryCached.isMultiLanguage()); + checkTranslationsService(registryCached, true); + registryCached.stop(masterToken); } private void checkTranslationsService(IExtensionRegistry registry, boolean extended) { - ServiceRegistration registration = null; + ServiceRegistration<LocaleProvider> registration = null; try { IExtensionPoint extPoint = registry.getExtensionPoint("org.eclipse.test.registryMulti.PointA"); assertNotNull(extPoint); @@ -220,7 +215,7 @@ public class MultiLanguageTest extends TestCase { // locale set to German LocaleProviderTest localeProvider = new LocaleProviderTest(); - registration = RuntimeTestsPlugin.getContext().registerService(LocaleProvider.class.getName(), localeProvider, null); + registration = RuntimeTestsPlugin.getContext().registerService(LocaleProvider.class, localeProvider, null); localeProvider.currentLocale = new Locale("de_DE"); assertEquals(helloWorldGerman, extPoint.getLabel()); assertEquals(catsAndDogsGerman, extension.getLabel()); diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/StaleObjects.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/StaleObjects.java index 66d51dc19..398b9f9af 100644 --- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/StaleObjects.java +++ b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/StaleObjects.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2012 IBM Corporation and others. + * Copyright (c) 2004, 2015 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 @@ -7,6 +7,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Alexander Kurtakov <akurtako@redhat.com> - bug 458490 *******************************************************************************/ package org.eclipse.core.tests.internal.registry; @@ -44,7 +45,7 @@ public class StaleObjects extends TestCase { public synchronized void testA() throws IOException, BundleException { HandleCatcher listener = new HandleCatcher(); - Bundle bundle01 = BundleTestingHelper.installBundle(RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/testStale1"); + Bundle bundle01 = BundleTestingHelper.installBundle("", RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/testStale1"); BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {bundle01}); IExtension willBeStale = Platform.getExtensionRegistry().getExtension("testStale.ext1"); @@ -81,7 +82,7 @@ public class StaleObjects extends TestCase { //Outside of the event notification the handle from a removed object should be invalid gotException = false; - try { + try { while (listener2.getAcquiredHandle() == null) { try { wait(200); @@ -108,7 +109,7 @@ public class StaleObjects extends TestCase { } public void testStaleConfigurationElement() throws IOException, BundleException { - Bundle bundle01 = BundleTestingHelper.installBundle(RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/testStale2"); + Bundle bundle01 = BundleTestingHelper.installBundle("", RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/testStale2"); BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {bundle01}); IConfigurationElement ce = Platform.getExtensionRegistry().getExtension("testStale2.ext1").getConfigurationElements()[0]; diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/WaitingRegistryListener.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/WaitingRegistryListener.java index 89d0ffbea..d0035d74e 100644 --- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/WaitingRegistryListener.java +++ b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/WaitingRegistryListener.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2012 IBM Corporation and others. + * Copyright (c) 2007, 2015 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 @@ -7,6 +7,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Alexander Kurtakov <akurtako@redhat.com> - bug 458490 *******************************************************************************/ package org.eclipse.core.tests.internal.registry; @@ -24,8 +25,8 @@ public class WaitingRegistryListener extends Assert implements IRegistryEventLis final static long MIN_WAIT_TIME = 100; // minimum wait time in milliseconds - private List extensionIDs; // String[] - private List extPointIDs; // String[] + private List<String> extensionIDs; // String[] + private List<String> extPointIDs; // String[] private volatile boolean added; private volatile boolean removed; @@ -67,7 +68,7 @@ public class WaitingRegistryListener extends Assert implements IRegistryEventLis public synchronized String[] extensionsReceived(long timeout) { if (extensionIDs != null) - return (String[]) extensionIDs.toArray(new String[extensionIDs.size()]); + return extensionIDs.toArray(new String[extensionIDs.size()]); try { wait(timeout); } catch (InterruptedException e) { @@ -75,12 +76,12 @@ public class WaitingRegistryListener extends Assert implements IRegistryEventLis } if (extensionIDs == null) return null; - return (String[]) extensionIDs.toArray(new String[extensionIDs.size()]); + return extensionIDs.toArray(new String[extensionIDs.size()]); } public synchronized String[] extPointsReceived(long timeout) { if (extPointIDs != null) - return (String[]) extPointIDs.toArray(new String[extPointIDs.size()]); + return extPointIDs.toArray(new String[extPointIDs.size()]); try { wait(timeout); } catch (InterruptedException e) { @@ -88,7 +89,7 @@ public class WaitingRegistryListener extends Assert implements IRegistryEventLis } if (extPointIDs == null) return null; - return (String[]) extPointIDs.toArray(new String[extPointIDs.size()]); + return extPointIDs.toArray(new String[extPointIDs.size()]); } public synchronized int waitFor(int events, long maxTimeout) { @@ -153,7 +154,7 @@ public class WaitingRegistryListener extends Assert implements IRegistryEventLis } private void extensionsToString(IExtension[] extensions) { - extensionIDs = new ArrayList(extensions.length); + extensionIDs = new ArrayList<String>(extensions.length); for (int i = 0; i < extensions.length; i++) { IExtension extension = extensions[i]; extensionIDs.add(extension.getUniqueIdentifier()); @@ -180,7 +181,7 @@ public class WaitingRegistryListener extends Assert implements IRegistryEventLis } private void extPointsToString(IExtensionPoint[] extensionPoints) { - extPointIDs = new ArrayList(extensionPoints.length); + extPointIDs = new ArrayList<String>(extensionPoints.length); for (int i = 0; i < extensionPoints.length; i++) extPointIDs.add(extensionPoints[i].getUniqueIdentifier()); } diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/utils/ExeExtensionStrategy.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/utils/ExeExtensionStrategy.java index d63572617..8ea4c3902 100644 --- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/utils/ExeExtensionStrategy.java +++ b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/utils/ExeExtensionStrategy.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2012 IBM Corporation and others. + * Copyright (c) 2005, 2015 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 @@ -7,6 +7,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Alexander Kurtakov <akurtako@redhat.com> - bug 458490 *******************************************************************************/ package org.eclipse.core.tests.internal.registry.simple.utils; @@ -26,7 +27,7 @@ public class ExeExtensionStrategy extends RegistryStrategy { } public Object createExecutableExtension(RegistryContributor defaultContributor, String className, String requestedContributorName) { - Class classInstance = null; + Class<?> classInstance = null; try { classInstance = Class.forName(className); } catch (ClassNotFoundException e1) { diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/utils/SimpleRegistryListener.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/utils/SimpleRegistryListener.java index a531b8e57..4d6f3ecc6 100644 --- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/utils/SimpleRegistryListener.java +++ b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/simple/utils/SimpleRegistryListener.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2012 IBM Corporation and others. + * Copyright (c) 2005, 2015 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 @@ -7,6 +7,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Alexander Kurtakov <akurtako@redhat.com> - bug 458490 *******************************************************************************/ package org.eclipse.core.tests.internal.registry.simple.utils; @@ -21,7 +22,7 @@ import org.eclipse.core.runtime.*; */ public class SimpleRegistryListener implements IRegistryChangeListener { - private List events = new LinkedList(); + private List<IRegistryChangeEvent> events = new LinkedList<IRegistryChangeEvent>(); public synchronized void registryChanged(IRegistryChangeEvent newEvent) { events.add(newEvent); @@ -38,13 +39,13 @@ public class SimpleRegistryListener implements IRegistryChangeListener { */ public synchronized IRegistryChangeEvent getEvent(long timeout) { if (!events.isEmpty()) - return (IRegistryChangeEvent) events.remove(0); + return events.remove(0); try { wait(timeout); } catch (InterruptedException e) { // nothing to do } - return events.isEmpty() ? null : (IRegistryChangeEvent) events.remove(0); + return events.isEmpty() ? null : events.remove(0); } public void register(IExtensionRegistry registry) { diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/runtime/PlatformLogReader.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/runtime/PlatformLogReader.java index f2b2b7897..a68d33660 100644 --- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/runtime/PlatformLogReader.java +++ b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/runtime/PlatformLogReader.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2014 IBM Corporation and others. + * Copyright (c) 2000, 2015 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 @@ -7,6 +7,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Alexander Kurtakov <akurtako@redhat.com> - bug 458490 *******************************************************************************/ package org.eclipse.core.tests.internal.runtime; @@ -214,7 +215,7 @@ public class PlatformLogReader { } } - protected int readDepth() throws IOException { + protected int readDepth() { StringTokenizer tokens = new StringTokenizer(currentLine); // skip the keyword tokens.nextToken(); diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/runtime/PlatformURLLocalTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/runtime/PlatformURLLocalTest.java index 0a19c8401..42983ddf6 100644 --- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/runtime/PlatformURLLocalTest.java +++ b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/runtime/PlatformURLLocalTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2012 IBM Corporation and others. + * Copyright (c) 2005, 2015 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 @@ -7,6 +7,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Alexander Kurtakov <akurtako@redhat.com> - bug 458490 *******************************************************************************/ package org.eclipse.core.tests.internal.runtime; @@ -16,6 +17,7 @@ import java.net.MalformedURLException; import java.net.URL; import junit.framework.Test; import junit.framework.TestSuite; +import org.eclipse.core.runtime.FileLocator; import org.eclipse.core.runtime.Platform; import org.eclipse.core.tests.harness.BundleTestingHelper; import org.eclipse.core.tests.runtime.RuntimeTest; @@ -55,7 +57,7 @@ public class PlatformURLLocalTest extends RuntimeTest { } URL resolvedURL = null; try { - resolvedURL = Platform.resolve(platformURL); + resolvedURL = FileLocator.resolve(platformURL); } catch (IOException e) { fail("2.0", e); } @@ -79,7 +81,7 @@ public class PlatformURLLocalTest extends RuntimeTest { } URL resolvedURL = null; try { - resolvedURL = Platform.resolve(platformURL); + resolvedURL = FileLocator.resolve(platformURL); } catch (IOException e) { fail("2.0", e); } diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/runtime/PlatformURLSessionTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/runtime/PlatformURLSessionTest.java index 7b936fe40..d6f171ca3 100644 --- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/runtime/PlatformURLSessionTest.java +++ b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/runtime/PlatformURLSessionTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2012 IBM Corporation and others. + * Copyright (c) 2005, 2015 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 @@ -7,12 +7,14 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Alexander Kurtakov <akurtako@redhat.com> - bug 458490 *******************************************************************************/ package org.eclipse.core.tests.internal.runtime; import java.io.*; import java.net.*; import junit.framework.Test; +import org.eclipse.core.runtime.FileLocator; import org.eclipse.core.runtime.Platform; import org.eclipse.core.tests.runtime.RuntimeTest; import org.eclipse.core.tests.session.ConfigurationSessionTestSuite; @@ -201,7 +203,7 @@ public class PlatformURLSessionTest extends RuntimeTest { assertEquals("3.0", DATA_CHILD, readContents("3.1", both)); URL resolvedURL = null; try { - resolvedURL = Platform.resolve(none); + resolvedURL = FileLocator.resolve(none); } catch (IOException e) { fail("4.0", e); } diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/IAdapterManagerServiceTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/IAdapterManagerServiceTest.java index ffd63cd3f..6f2ef7e6b 100644 --- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/IAdapterManagerServiceTest.java +++ b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/IAdapterManagerServiceTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2012 IBM Corporation and others. + * Copyright (c) 2007, 2015 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 @@ -7,6 +7,7 @@ * * Contributors: * IBM - Initial API and implementation + * Alexander Kurtakov <akurtako@redhat.com> - bug 458490 *******************************************************************************/ package org.eclipse.core.tests.runtime; @@ -26,7 +27,7 @@ public class IAdapterManagerServiceTest extends TestCase { private static final String NON_EXISTING = "com.does.not.Exist"; private static final String TEST_ADAPTER = "org.eclipse.core.tests.runtime.TestAdapter"; - private ServiceTracker adapterManagerTracker = null; + private ServiceTracker<IAdapterManager, ?> adapterManagerTracker = null; public IAdapterManagerServiceTest(String name) { super(name); @@ -46,7 +47,7 @@ public class IAdapterManagerServiceTest extends TestCase { public IAdapterManager getAdapterManager() { if (adapterManagerTracker == null) { BundleContext context = RuntimeTestsPlugin.getContext(); - adapterManagerTracker = new ServiceTracker(context, IAdapterManager.class.getName(), null); + adapterManagerTracker = new ServiceTracker(context, IAdapterManager.class, null); adapterManagerTracker.open(); } return (IAdapterManager) adapterManagerTracker.getService(); diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/PlatformTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/PlatformTest.java index 65c9c4277..cbfa650d2 100644 --- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/PlatformTest.java +++ b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/PlatformTest.java @@ -24,7 +24,7 @@ import org.osgi.framework.ServiceReference; public class PlatformTest extends RuntimeTest { private FrameworkLog logService; - private ServiceReference logRef; + private ServiceReference<FrameworkLog> logRef; private java.io.File originalLocation; /** @@ -46,8 +46,8 @@ public class PlatformTest extends RuntimeTest { Platform.getLogFileLocation(); //setup reference to log service, and remember original log location - logRef = RuntimeTestsPlugin.getContext().getServiceReference(FrameworkLog.class.getName()); - logService = (FrameworkLog) RuntimeTestsPlugin.getContext().getService(logRef); + logRef = RuntimeTestsPlugin.getContext().getServiceReference(FrameworkLog.class); + logService = RuntimeTestsPlugin.getContext().getService(logRef); originalLocation = logService.getFile(); } @@ -134,7 +134,7 @@ public class PlatformTest extends RuntimeTest { } }; - Platform.run(runnable); + SafeRunner.run(runnable); Platform.removeLogListener(logListener); diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/SubMonitorTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/SubMonitorTest.java index d4676f961..1053f983c 100644 --- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/SubMonitorTest.java +++ b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/SubMonitorTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2014 IBM Corporation and others. + * Copyright (c) 2006, 2015 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 @@ -11,14 +11,15 @@ * Stefan Xenos - bug 174040 - SubMonitor#convert doesn't always set task name * Stefan Xenos - bug 206942 - Regression test for infinite progress reporting rate * IBM Corporation - bug 252446 - SubMonitor.newChild passes zero ticks to child + * Alexander Kurtakov <akurtako@redhat.com> - bug 458490 *******************************************************************************/ package org.eclipse.core.tests.runtime; import java.util.*; -import junit.framework.Assert; import junit.framework.TestCase; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.SubMonitor; +import org.junit.Assert; /** * diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/SubProgressTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/SubProgressTest.java index a2011495d..b223f05f5 100644 --- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/SubProgressTest.java +++ b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/SubProgressTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2014 IBM Corporation and others. + * Copyright (c) 2006, 2015 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 @@ -7,14 +7,15 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Alexander Kurtakov <akurtako@redhat.com> - bug 458490 *******************************************************************************/ package org.eclipse.core.tests.runtime; import java.util.*; -import junit.framework.Assert; import junit.framework.TestCase; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.SubProgressMonitor; +import org.junit.Assert; /** * diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/TestProgressMonitor.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/TestProgressMonitor.java index 8d7fccaa1..e8281874b 100644 --- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/TestProgressMonitor.java +++ b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/TestProgressMonitor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2012 IBM Corporation and others. + * Copyright (c) 2006, 2015 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 @@ -7,11 +7,12 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Alexander Kurtakov <akurtako@redhat.com> - bug 458490 *******************************************************************************/ package org.eclipse.core.tests.runtime; -import junit.framework.Assert; import org.eclipse.core.runtime.IProgressMonitor; +import org.junit.Assert; /** * diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/compatibility/PluginCompatibilityTests.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/compatibility/PluginCompatibilityTests.java index 7bf03080b..2975acf08 100644 --- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/compatibility/PluginCompatibilityTests.java +++ b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/compatibility/PluginCompatibilityTests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2012 IBM Corporation and others. + * Copyright (c) 2004, 2015 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 @@ -7,10 +7,10 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Alexander Kurtakov <akurtako@redhat.com> - bug 458490 *******************************************************************************/ package org.eclipse.core.tests.runtime.compatibility; -import java.io.IOException; import junit.framework.*; import org.eclipse.core.runtime.*; import org.eclipse.core.tests.harness.BundleTestingHelper; @@ -24,14 +24,14 @@ public class PluginCompatibilityTests extends TestCase { } // see bug 59013 - public void testPluginWithNoRuntimeLibrary() throws BundleException, IOException { + public void testPluginWithNoRuntimeLibrary() { assertNull("0.0", BundleTestingHelper.getBundles(RuntimeTestsPlugin.getContext(), "bundle01", "1.0")); BundleTestingHelper.runWithBundles("0.1", new Runnable() { public void run() { Bundle[] installed = BundleTestingHelper.getBundles(RuntimeTestsPlugin.getContext(), "bundle01", "1.0"); assertEquals("1.0", 1, installed.length); assertEquals("1.0", "bundle01", installed[0].getSymbolicName()); - assertEquals("1.1", new Version("1.0"), new Version((String) installed[0].getHeaders().get(Constants.BUNDLE_VERSION))); + assertEquals("1.1", new Version("1.0"), new Version(installed[0].getHeaders().get(Constants.BUNDLE_VERSION))); assertEquals("1.2", Bundle.RESOLVED, installed[0].getState()); IPluginDescriptor descriptor = Platform.getPluginRegistry().getPluginDescriptor("bundle01", new PluginVersionIdentifier("1.0")); assertNotNull("2.0", descriptor); diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/JobTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/JobTest.java index f47f18a87..64fa307fb 100644 --- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/JobTest.java +++ b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/JobTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2003, 2014 IBM Corporation and others. + * Copyright (c) 2003, 2015 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 @@ -10,17 +10,19 @@ * Stephan Wahlbrink - Test fix for bug 200997. * Dmitry Karasik - Test cases for bug 255384 * Jan Koehnlein - Test case for bug 60964 (454698) + * Alexander Kurtakov <akurtako@redhat.com> - bug 458490 *******************************************************************************/ package org.eclipse.core.tests.runtime.jobs; -import junit.framework.*; -import junit.framework.Assert; +import junit.framework.Test; +import junit.framework.TestSuite; import org.eclipse.core.internal.jobs.JobManager; import org.eclipse.core.internal.jobs.Worker; import org.eclipse.core.runtime.*; import org.eclipse.core.runtime.jobs.*; import org.eclipse.core.tests.harness.TestBarrier; import org.eclipse.core.tests.harness.TestJob; +import org.junit.Assert; /** * Tests the implemented get/set methods of the abstract class Job diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/TestLockListener.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/TestLockListener.java index a21bd9dd3..0c5224a4c 100644 --- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/TestLockListener.java +++ b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/jobs/TestLockListener.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2012 IBM Corporation and others. + * Copyright (c) 2007, 2015 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 @@ -7,11 +7,12 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Alexander Kurtakov <akurtako@redhat.com> - bug 458490 *******************************************************************************/ package org.eclipse.core.tests.runtime.jobs; -import junit.framework.Assert; import org.eclipse.core.runtime.jobs.LockListener; +import org.junit.Assert; /** * A lock listener used for testing that ensures wait/release calls are correctly paired. diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/perf/ContentTypePerformanceTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/perf/ContentTypePerformanceTest.java index 30ca41909..baed5b49d 100644 --- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/perf/ContentTypePerformanceTest.java +++ b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/perf/ContentTypePerformanceTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2012 IBM Corporation and others. + * Copyright (c) 2005, 2015 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 @@ -7,6 +7,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Alexander Kurtakov <akurtako@redhat.com> - bug 458490 *******************************************************************************/ package org.eclipse.core.tests.runtime.perf; @@ -246,7 +247,7 @@ public class ContentTypePerformanceTest extends RuntimeTest { } private void loadPreferences() { - new InstanceScope().getNode(CONTENT_TYPE_PREF_NODE); + InstanceScope.INSTANCE.getNode(CONTENT_TYPE_PREF_NODE); } /** Tests how much the size of the catalog affects the performance of content type matching by content analysis */ |