Skip to content

Commit

Permalink
tests: suppress deprecated API
Browse files Browse the repository at this point in the history
even deprecated API deserve its tests
  • Loading branch information
EcljpseB0T authored and jukzi committed Feb 14, 2024
1 parent 94f6237 commit b7d355b
Show file tree
Hide file tree
Showing 69 changed files with 94 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ public int indexOfSpecial(IStructuredTextExpert expert, String text, StructuredT
StructuredTextEnvironment.ORIENT_LTR);

@Test
@SuppressWarnings("deprecation") // isProcessingNeeded
public void testSomeMore() {
assertFalse(env1.isProcessingNeeded());
assertTrue(env2.isProcessingNeeded());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
/**
* Test cases for the Path class.
*/
@SuppressWarnings("deprecation") // SubProgressMonitor
public class ProgressMonitorWrapperTest {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@
import java.io.IOException;
import java.net.MalformedURLException;
import java.util.Arrays;
import org.eclipse.core.runtime.*;

import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.RegistryFactory;
import org.eclipse.core.tests.harness.BundleTestingHelper;
import org.junit.BeforeClass;
import org.junit.FixMethodOrder;
Expand Down Expand Up @@ -57,6 +61,7 @@ public void testAFromCache() {
testExtensionPoint("A");
}

@SuppressWarnings("deprecation") // getNamespace
private void testExtensionPoint(String name) {
assertNotNull(RegistryFactory.getRegistry().getExtensionPoint("test" + name + ".xpt" + name));
assertEquals(RegistryFactory.getRegistry().getExtensionPoint("test" + name + ".xpt" + name).getLabel(),
Expand Down Expand Up @@ -242,6 +247,7 @@ public void testF() throws IOException, BundleException {
}

@Test
@SuppressWarnings("deprecation") // getNamespace
public void testG() throws IOException, BundleException {
// fragment contributing an extension point to a plugin that do not have
// extension or extension point
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,34 @@

import java.io.File;
import java.util.Locale;

import org.eclipse.core.internal.registry.IRegistryConstants;
import org.eclipse.core.runtime.*;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.RegistryFactory;
import org.eclipse.core.runtime.spi.RegistryStrategy;
import org.eclipse.core.tests.harness.BundleTestingHelper;
import org.eclipse.core.tests.harness.FileSystemHelper;
import org.eclipse.osgi.service.localization.LocaleProvider;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.osgi.framework.*;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.FrameworkEvent;
import org.osgi.framework.FrameworkListener;
import org.osgi.framework.FrameworkUtil;
import org.osgi.framework.ServiceRegistration;
import org.osgi.service.packageadmin.PackageAdmin;
import org.osgi.util.tracker.ServiceTracker;

/**
* Run with no NL argument or with "-nl en".
*/
@SuppressWarnings("deprecation") // PackageAdmin
public class MultiLanguageTest {

class LocaleProviderTest implements LocaleProvider {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
/**
* The activator class controls the plug-in life cycle
*/
@SuppressWarnings("deprecation") // PackageAdmin
public class Activator implements BundleActivator {
public static String BUNDLE_COORDINATOR = "org.eclipse.equinox.coordinator"; //$NON-NLS-1$
public static String BUNDLE_EVENT = "org.eclipse.equinox.event"; //$NON-NLS-1$
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ public static ResolverHook newRegionResolverHook(RegionDigraph digraph) {
return (ResolverHook) newInstance(regionResolverHook, classParams, constructorArgs);
}

@SuppressWarnings("deprecation") // EventHook
public static org.osgi.framework.hooks.service.EventHook newRegionServiceEventHook(RegionDigraph digraph) {
Class<?> regionServiceEventHook = loadRegionImplClass(RegionServiceEventHook);
Class<?>[] classParams = new Class<?>[] { RegionDigraph.class };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ private void doTest(int iterations) throws IOException {
input.close();
}

@SuppressWarnings("deprecation") // VISIBLE_SERVICE_NAMESPACE
private RegionFilter createFilter(String... input) throws InvalidSyntaxException {
RegionFilterBuilder builder = digraph.createRegionFilterBuilder();
for (String param : input) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
/**
* This testcase was based on {@link RegionBundleFindHookTests}.
*/
@SuppressWarnings("deprecation") // EventHook, RegionFilter.VISIBLE_SERVICE_NAMESPACE
public class RegionServiceEventHookTests {

private static final String BUNDLE_X = "X";
Expand Down Expand Up @@ -57,7 +58,6 @@ public class RegionServiceEventHookTests {

private RegionDigraph digraph;

@SuppressWarnings("deprecation")
private EventHook serviceEventHook;

private Map<String, Region> regions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
/**
* This testcase was based on {@link RegionBundleFindHookTests}.
*/
@SuppressWarnings("deprecation") // RegionFilter.VISIBLE_SERVICE_NAMESPACE
public class RegionServiceFindHookTests {

private static final String BUNDLE_X = "X";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ protected void test() {
runner.run(this, fingerPrintName, 10, 2000);
}

@SuppressWarnings("deprecation") // VISIBLE_SERVICE_NAMESPACE
private void createRegions(final int numRegions) throws BundleException {
System.out.println("Starting region create: " + numRegions);
long time = System.currentTimeMillis();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import org.osgi.framework.wiring.*;
import org.osgi.util.tracker.ServiceTracker;

@SuppressWarnings("deprecation") // RegionFilter.VISIBLE_SERVICE_NAMESPACE
public class RegionSystemTests extends AbstractRegionSystemTest {

@Rule
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.osgi.framework.BundleContext;
import org.osgi.service.startlevel.StartLevel;

@SuppressWarnings("deprecation") // StartLevel
public class Activator implements BundleActivator {

public void start(BundleContext context) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ static public void stop(Framework equinox, int expected) {
}
}

@SuppressWarnings("deprecation") // STOPPED_BOOTCLASSPATH_MODIFIED
static private String getFrameworkEventType(int type) {
switch (type) {
case FrameworkEvent.ERROR:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ public void testUpdateWithStream02() throws Exception {
// make sure b1 is still last bundle in bundles list
Bundle[] bundles = OSGiTestsActivator.getContext().getBundles();
assertTrue("Wrong bundle at the end: " + bundles[bundles.length - 1], bundles[bundles.length - 1] == b1); //$NON-NLS-1$
@SuppressWarnings("deprecation") // getBundles
Bundle[] tests = installer.getPackageAdmin().getBundles(test.getSymbolicName(), null);
assertNotNull("null tests", tests); //$NON-NLS-1$
assertEquals("Wrong number", 1, tests.length); //$NON-NLS-1$
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
import org.osgi.service.packageadmin.PackageAdmin;
import org.osgi.service.startlevel.StartLevel;

@SuppressWarnings("deprecation") // StartLevel, PackageAdmin, ExportedPackage
public class ClassLoadingBundleTests extends AbstractBundleTests {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import org.osgi.service.packageadmin.ExportedPackage;
import org.osgi.service.packageadmin.PackageAdmin;

@SuppressWarnings("deprecation") // PackageAdmin, ExportedPackage
public class PackageAdminBundleTests extends AbstractBundleTests {
public class TestListener implements SynchronousBundleListener {
ArrayList events = new ArrayList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.osgi.service.packageadmin.ExportedPackage;
import org.osgi.service.packageadmin.PackageAdmin;

@SuppressWarnings("deprecation") // PackageAdmin, ExportedPackage
public class SubstituteExportsBundleTests extends AbstractBundleTests {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ public MovableConfigurationAreaTest(String name) {
* default the manifest generation area is under the configuration area (which
* is read-only here)
*/
@SuppressWarnings("deprecation") // installBundle
public void testAfterMoving() throws MalformedURLException, IOException, BundleException {
// try to install plug-in
// ensure it is not installed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public void test1stSessionFollowUp() throws IOException {
* default the manifest generation area is under the configuration area (which
* is read-only here)
*/
@SuppressWarnings("deprecation") // installBundle
public void test2ndSession() throws BundleException, IOException {
// try to install plug-in
// ensure it is not installed
Expand Down Expand Up @@ -108,6 +109,7 @@ public void test2ndSessionFollowUp() throws IOException {
* the manifest generation area is under the configuration area (which is
* read-only here)
*/
@SuppressWarnings("deprecation") // installBundle
public void test3rdSession() throws BundleException, IOException {
// install plug-in
// ensure it is not installed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import org.osgi.resource.Capability;
import org.osgi.service.packageadmin.PackageAdmin;

@SuppressWarnings("deprecation") // PackageAdmin
public class StorageHookTests extends AbstractFrameworkHookTests {
private static final String TEST_BUNDLE = "test";
private static final String HOOK_CONFIGURATOR_BUNDLE = "storage.hooks.a";
Expand Down Expand Up @@ -257,7 +258,6 @@ public void testAdaptModuleRevisionBuilder() throws Exception {
}

@Test
@SuppressWarnings("deprecation")
public void testFrameworkUtilHelper() throws Exception {
initAndStartFramework();
Class<?> frameworkUtilClass = classLoader.loadClass("org.osgi.framework.FrameworkUtil");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
/**
* Provisory home for tests that install plugins.
*/
@SuppressWarnings("deprecation") // PackageAdmin
public class InstallTests {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public synchronized FrameworkEvent getResult(long timeout) {
}

@Test
@SuppressWarnings("deprecation") // installBundle
public void testNonFatalException() {
FrameworkEventListenerWithResult fwkListener = new FrameworkEventListenerWithResult();
OSGiTestsActivator.getContext().addFrameworkListener(fwkListener);
Expand All @@ -82,6 +83,7 @@ public void testNonFatalException() {
}

@Test
@SuppressWarnings("deprecation") // installBundle
public void testFatalException() {
FrameworkEventListenerWithResult fwkListener = new FrameworkEventListenerWithResult();
OSGiTestsActivator.getContext().addFrameworkListener(fwkListener);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.eclipse.osgi.tests.services.resolver.AbstractStateTest;
import org.osgi.framework.Version;

@SuppressWarnings("deprecation") // StateObjectFactory.createBundleDescription()
public class BasePerformanceTest extends AbstractStateTest {
private Random random;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.junit.rules.TestName;
import org.osgi.framework.Constants;

@SuppressWarnings("deprecation") // Headers
public class CaseMapPerformanceTest {
@Rule
public TestName testName = new TestName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public class StatePerformanceTest extends BasePerformanceTest {
@Rule
public TestName testName = new TestName();

@SuppressWarnings("deprecation") // writeState
State storeAndRetrieve(State toStore) throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
toStore.getFactory().writeState(toStore, baos);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.junit.Test;
import org.osgi.framework.BundleException;

@SuppressWarnings("deprecation") // StateObjectFactory.createBundleDescription()
public class TestAttributes_001 extends AbstractStateTest {

BundleDescription bundle_1 = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.junit.Test;
import org.osgi.framework.BundleException;

@SuppressWarnings("deprecation") // StateObjectFactory.createBundleDescription()
public class TestBSN_001 extends AbstractStateTest {

BundleDescription bundle_1 = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.junit.Test;
import org.osgi.framework.BundleException;

@SuppressWarnings("deprecation") // StateObjectFactory.createBundleDescription()
public class TestCycle_001 extends AbstractStateTest {

BundleDescription bundle_1 = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.junit.Test;
import org.osgi.framework.BundleException;

@SuppressWarnings("deprecation") // StateObjectFactory.createBundleDescription()
public class TestCycle_002 extends AbstractStateTest {

BundleDescription bundle_1 = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.junit.Test;
import org.osgi.framework.BundleException;

@SuppressWarnings("deprecation") // StateObjectFactory.createBundleDescription()
public class TestCycle_003 extends AbstractStateTest {

BundleDescription bundle_1 = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.junit.Test;
import org.osgi.framework.BundleException;

@SuppressWarnings("deprecation") // StateObjectFactory.createBundleDescription()
public class TestCycle_004 extends AbstractStateTest {

BundleDescription bundle_1 = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.junit.Test;
import org.osgi.framework.BundleException;

@SuppressWarnings("deprecation") // StateObjectFactory.createBundleDescription()
public class TestCycle_005 extends AbstractStateTest {

BundleDescription bundle_1 = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.junit.Test;
import org.osgi.framework.BundleException;

@SuppressWarnings("deprecation") // StateObjectFactory.createBundleDescription()
public class TestCycle_006 extends AbstractStateTest {

BundleDescription bundle_1 = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.junit.Test;
import org.osgi.framework.BundleException;

@SuppressWarnings("deprecation") // StateObjectFactory.createBundleDescription()
public class TestDynamic_001 extends AbstractStateTest {

BundleDescription bundle_1 = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.junit.Test;
import org.osgi.framework.BundleException;

@SuppressWarnings("deprecation") // StateObjectFactory.createBundleDescription()
public class TestDynamic_002 extends AbstractStateTest {

BundleDescription bundle_1 = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.junit.Test;
import org.osgi.framework.BundleException;

@SuppressWarnings("deprecation") // StateObjectFactory.createBundleDescription()
public class TestDynamic_003 extends AbstractStateTest {

BundleDescription bundle_1 = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.junit.Test;
import org.osgi.framework.BundleException;

@SuppressWarnings("deprecation") // StateObjectFactory.createBundleDescription()
public class TestDynamic_004 extends AbstractStateTest {

BundleDescription bundle_1 = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.junit.Test;
import org.osgi.framework.BundleException;

@SuppressWarnings("deprecation") // StateObjectFactory.createBundleDescription()
public class TestDynamic_005 extends AbstractStateTest {

BundleDescription bundle_1 = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.junit.Test;
import org.osgi.framework.BundleException;

@SuppressWarnings("deprecation") // StateObjectFactory.createBundleDescription()
public class TestDynamic_006 extends AbstractStateTest {

BundleDescription bundle_1 = null;
Expand Down
Loading

0 comments on commit b7d355b

Please sign in to comment.