[cleanup] Remove class SubProgressSubclass and related test Change-Id: I5d8f4587e27541e48cddb32c8631d71c1d3273ee Signed-off-by: Karsten Thoms <karsten.thoms@itemis.de>
diff --git a/tests/org.eclipse.core.tests.runtime/META-INF/MANIFEST.MF b/tests/org.eclipse.core.tests.runtime/META-INF/MANIFEST.MF index bb3ab53..dca304d 100644 --- a/tests/org.eclipse.core.tests.runtime/META-INF/MANIFEST.MF +++ b/tests/org.eclipse.core.tests.runtime/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: Eclipse Core Tests Runtime Bundle-SymbolicName: org.eclipse.core.tests.runtime; singleton:=true -Bundle-Version: 3.11.400.qualifier +Bundle-Version: 3.11.500.qualifier Bundle-Activator: org.eclipse.core.tests.runtime.RuntimeTestsPlugin Bundle-Vendor: Eclipse.org Export-Package: org.eclipse.core.tests.internal.preferences,
diff --git a/tests/org.eclipse.core.tests.runtime/pom.xml b/tests/org.eclipse.core.tests.runtime/pom.xml index 195e04e..4a08235 100644 --- a/tests/org.eclipse.core.tests.runtime/pom.xml +++ b/tests/org.eclipse.core.tests.runtime/pom.xml
@@ -20,7 +20,7 @@ </parent> <groupId>org.eclipse.core</groupId> <artifactId>org.eclipse.core.tests.runtime</artifactId> - <version>3.11.400-SNAPSHOT</version> + <version>3.11.500-SNAPSHOT</version> <packaging>eclipse-test-plugin</packaging> <properties> <defaultSigning-excludeInnerJars>true</defaultSigning-excludeInnerJars>
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/SubProgressSubclass.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/SubProgressSubclass.java deleted file mode 100644 index 0201a21..0000000 --- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/SubProgressSubclass.java +++ /dev/null
@@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2015 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.core.tests.runtime; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.SubProgressMonitor; - -/** - * @deprecated to suppress deprecation warnings - */ -public class SubProgressSubclass extends SubProgressMonitor { - - public int internalWorkedCalls = 0; - - public SubProgressSubclass(IProgressMonitor monitor, int ticks, int style) { - super(monitor, ticks, style); - } - - public SubProgressSubclass(IProgressMonitor monitor, int ticks) { - super(monitor, ticks); - } - - @Override - public void internalWorked(double work) { - internalWorkedCalls++; - super.internalWorked(work); - } - -}
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 bf97fb1..5ffabf0 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
@@ -76,40 +76,24 @@ * @param monitor * @param depth */ + @Deprecated public static void callDoneOnChain(IProgressMonitor monitor, int depth) { IProgressMonitor current = monitor; for (int count = 0; count < depth; count++) { current.done(); - if (!(current instanceof SubProgressMonitor)) + if (!(current instanceof SubProgressMonitor)) { return; + } SubProgressMonitor cur = (SubProgressMonitor) current; current = cur.getWrappedProgressMonitor(); } } /** - * Test behaviors that subclasses of SubProgressMonitor will expect from their base class. - * @deprecated to suppress deprecation warnings - */ - public void testCustomSubclass() { - TestProgressMonitor top = new TestProgressMonitor(); - top.beginTask("", 1000); - - SubProgressSubclass customSubclass = new SubProgressSubclass(top, 1000); - customSubclass.beginTask("", 10000); - - for (int count = 0; count < 10000; count++) - customSubclass.worked(1); - - Assert.assertEquals("If there is a custom subclass of SubProgressMonitor, all calls to worked() should delegate to internalWorked", 10000, customSubclass.internalWorkedCalls); - customSubclass.done(); - top.done(); - } - - /** * Tests the style bits in SubProgressMonitor * @deprecated to suppress deprecation warnings */ + @Deprecated public void testStyles() { int[] styles = new int[] {0, SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL, SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK | SubProgressMonitor.SUPPRESS_SUBTASK_LABEL}; @@ -159,8 +143,9 @@ for (Map.Entry<String, String[]> entry : results.entrySet()) { String[] expectedResult = expected.get(entry.getKey()); String[] value = entry.getValue(); - if (compareArray(value, expectedResult)) + if (compareArray(value, expectedResult)) { continue; + } System.out.print("expected.put(\"" + entry.getKey() + "\", new String[] {"); failure = entry.getKey(); @@ -168,17 +153,20 @@ System.out.println(list + "});"); } - if (failure != null) // Now actually throw an assertation if one of the results failed + if (failure != null) { Assert.assertEquals(failure, concatArray(expected.get(failure)), concatArray(results.get(failure))); + } } private boolean compareArray(String[] value, String[] expectedResult) { - if (value.length != expectedResult.length) + if (value.length != expectedResult.length) { return false; + } for (int i = 0; i < expectedResult.length; i++) { String next = expectedResult[i]; - if (!next.equals(value[i])) + if (!next.equals(value[i])) { return false; + } } return true; } @@ -187,8 +175,9 @@ StringBuilder buf = new StringBuilder(); boolean isFirst = true; for (String nextValue : value) { - if (!isFirst) + if (!isFirst) { buf.append(", "); + } isFirst = false; buf.append("\"" + nextValue + "\""); } @@ -212,6 +201,7 @@ * parents in floating point mode) * @deprecated to suppress deprecation warnings */ + @Deprecated public void testConstructorNestingFP() { TestProgressMonitor top = new TestProgressMonitor(); top.beginTask("", 2000); @@ -260,6 +250,7 @@ * in int mode. * @deprecated to suppress deprecation warnings */ + @Deprecated public void testConstructorNestingInt() { TestProgressMonitor top = new TestProgressMonitor(); top.beginTask("", 2000); @@ -306,6 +297,7 @@ * Tests the automatic cleanup when progress monitors are created via their constructor * @deprecated to suppress deprecation warnings */ + @Deprecated public void testParallelChildren() { TestProgressMonitor top = new TestProgressMonitor(); top.beginTask("", 1000); @@ -343,6 +335,7 @@ /** * @deprecated to suppress deprecation warnings */ + @Deprecated public void testCancellation() { TestProgressMonitor root = new TestProgressMonitor(); root.beginTask("", 1000); @@ -405,6 +398,7 @@ * @param depth * @return the innermost SubProgressMonitor */ + @Deprecated private static SubProgressMonitor createSubProgressChain(IProgressMonitor parent, int depth) { SubProgressMonitor current; do { @@ -425,8 +419,9 @@ */ private static void reportWorkInLoop(IProgressMonitor monitor, int loopSize) { monitor.beginTask("", loopSize); - for (int i = 0; i < loopSize; i++) + for (int i = 0; i < loopSize; i++) { monitor.worked(1); + } } /** @@ -438,8 +433,9 @@ */ private static void reportFloatingPointWorkInLoop(IProgressMonitor monitor, int loopSize) { monitor.beginTask("", loopSize); - for (int i = 0; i < loopSize; i++) + for (int i = 0; i < loopSize; i++) { monitor.internalWorked(1.0d); + } } /** @@ -453,6 +449,7 @@ * @param monitor progress monitor (callers are responsible for calling done() if necessary) * @param loopSize total size of the recursion tree */ + @Deprecated public static void reportWorkInBalancedTree(IProgressMonitor monitor, int loopSize) { monitor.beginTask("", 100); int leftBranch = loopSize / 2; @@ -489,6 +486,7 @@ * @param monitor progress monitor (callers are responsible for calling done() if necessary) * @param loopSize total size of the recursion tree */ + @Deprecated public static void createBalancedTree(IProgressMonitor monitor, int loopSize) { monitor.beginTask("", 100); int leftBranch = loopSize / 2; @@ -513,6 +511,7 @@ * * @deprecated to suppress deprecation warnings */ + @Deprecated public static void runTestWorked(IProgressMonitor monitor) { SubProgressMonitor nestedMonitor = createSubProgressChain(monitor, SubProgressTest.CHAIN_DEPTH); reportWorkInLoop(nestedMonitor, SubProgressTest.PROGRESS_SIZE); @@ -525,6 +524,7 @@ * * @deprecated to suppress deprecation warnings */ + @Deprecated public static void runTestInternalWorked(IProgressMonitor monitor) { SubProgressMonitor nestedMonitor = createSubProgressChain(monitor, SubProgressTest.CHAIN_DEPTH); reportFloatingPointWorkInLoop(nestedMonitor, SubProgressTest.PROGRESS_SIZE); @@ -537,6 +537,7 @@ * * @deprecated to suppress deprecation warnings */ + @Deprecated public static void runTestTypicalUsage(IProgressMonitor monitor) { SubProgressMonitor nestedMonitor = createSubProgressChain(monitor, SubProgressTest.CHAIN_DEPTH); reportWorkInBalancedTree(nestedMonitor, SubProgressTest.PROGRESS_SIZE); @@ -554,6 +555,7 @@ * * @deprecated to suppress deprecation warnings */ + @Deprecated public static void runTestCreateTree(IProgressMonitor monitor) { SubProgressMonitor nestedMonitor = createSubProgressChain(monitor, SubProgressTest.CHAIN_DEPTH); createBalancedTree(nestedMonitor, SubProgressTest.PROGRESS_SIZE); @@ -569,6 +571,7 @@ * * @deprecated to suppress deprecation warnings */ + @Deprecated private static void createChildrenUnderParent(IProgressMonitor monitor, int progressSize) { monitor.beginTask("", progressSize);