From 168a13451ca48f213bfd8555b584bbceb6559568 Mon Sep 17 00:00:00 2001 From: Michael Bangas Date: Mon, 11 Sep 2023 13:57:58 +0200 Subject: [PATCH] Delete tests in org.eclipse.core.tests.resources #525 In this commit, the deactivated performance tests "_testPerformanceManyResources()" and "_testPerformanceOneResource()" from MarkerTest.java in org.eclipse.core.tests.resources are deleted because they are not real test methods but rather used for code measuring and printing the time for processing operations on markers. See also https://github.com/eclipse-platform/eclipse.platform/pull/605#issuecomment-1713565424. Contributes to #525 --- .../core/tests/resources/MarkerTest.java | 154 ------------------ 1 file changed, 154 deletions(-) diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/MarkerTest.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/MarkerTest.java index ef73b2fde6a..9d3747d8d54 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/MarkerTest.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/MarkerTest.java @@ -24,7 +24,6 @@ import java.io.InputStream; import java.io.OutputStream; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.Hashtable; @@ -151,159 +150,6 @@ private void addResourceChangeListener(MarkersChangeListener listener) { } } - public void _testPerformanceManyResources() { - debug("testPerformanceManyResources"); - long start; - long stop; - - // cleanup old resources and create our own - IResource[] testResources = null; - try { - getWorkspace().getRoot().delete(false, getMonitor()); - testResources = createLargeHierarchy(); - } catch (CoreException e) { - fail("0.0", e); - } - - // header info - final int markersPerResource = 20; - final int numMarkers = testResources.length * markersPerResource; - display("\nNumber of resources: " + testResources.length); - display("Markers per resource: " + markersPerResource); - display("Total Number of Markers: " + numMarkers); - - // Create an array with a bunch of markers. - IWorkspaceRunnable body = monitor -> { - IResourceVisitor visitor = resource -> { - for (int i = 0; i < markersPerResource; i++) { - resource.createMarker(IMarker.PROBLEM); - } - return true; - }; - getWorkspace().getRoot().accept(visitor); - }; - try { - start = System.currentTimeMillis(); - getWorkspace().run(body, getMonitor()); - stop = System.currentTimeMillis(); - display("Task: creating markers"); - display(start, stop); - } catch (CoreException e) { - fail("0.0", e); - } - - // gather the markers for use. don't time this one. - final IMarker[] markers = new IMarker[numMarkers]; - try { - IMarker[] temp = getWorkspace().getRoot().findMarkers(null, true, IResource.DEPTH_INFINITE); - assertEquals("0.1", numMarkers, temp.length); - System.arraycopy(temp, 0, markers, 0, temp.length); - } catch (CoreException e) { - fail("0.2", e); - } - - // create attributes on each marker - body = monitor -> { - for (IMarker marker : markers) { - marker.setAttribute(IMarker.MESSAGE, getRandomString()); - } - }; - try { - start = System.currentTimeMillis(); - getWorkspace().run(body, getMonitor()); - stop = System.currentTimeMillis(); - display("Task: setting an attribute on each marker"); - display(start, stop); - } catch (CoreException e) { - fail("1.0", e); - } - - // get the attribute from each marker - body = monitor -> { - for (IMarker marker : markers) { - marker.getAttribute(IMarker.MESSAGE); - } - }; - try { - start = System.currentTimeMillis(); - getWorkspace().run(body, getMonitor()); - stop = System.currentTimeMillis(); - display("Task: getting an attribute on each marker"); - display(start, stop); - } catch (CoreException e) { - fail("2.0", e); - } - } - - public void _testPerformanceOneResource() { - debug("testPerformanceOneResource"); - long start; - long stop; - final int numMarkers = 4000; - - // header info - display("Number of resources: 1"); - display("Number of Markers: " + numMarkers); - - // Create an array with a bunch of markers. - final IMarker markers[] = new IMarker[numMarkers]; - IWorkspaceRunnable body = monitor -> { - IResource resource = getWorkspace().getRoot(); - for (int i = 0; i < markers.length; i++) { - markers[i] = resource.createMarker(IMarker.PROBLEM); - } - }; - try { - start = System.currentTimeMillis(); - getWorkspace().run(body, getMonitor()); - stop = System.currentTimeMillis(); - display("Task: creating markers"); - display(start, stop); - } catch (CoreException e) { - fail("0.0", e); - } - - // create attributes on each marker - body = monitor -> { - for (IMarker marker : markers) { - marker.setAttribute(IMarker.MESSAGE, getRandomString()); - } - }; - try { - start = System.currentTimeMillis(); - getWorkspace().run(body, getMonitor()); - stop = System.currentTimeMillis(); - display("Task: setting an attribute on each marker"); - display(start, stop); - } catch (CoreException e) { - fail("1.0", e); - } - - java.util.Comparator c = (o1, o2) -> { - try { - String name1 = (String) o1.getAttribute(IMarker.MESSAGE); - String name2 = (String) o2.getAttribute(IMarker.MESSAGE); - if (name1 == null) { - name1 = ""; - } - if (name2 == null) { - name2 = ""; - } - int result = name1.compareToIgnoreCase(name2); - return result; - } catch (CoreException e) { - fail("2.0", e); - } - // avoid compiler error - return -1; - }; - start = System.currentTimeMillis(); - Arrays.sort(markers, c); - stop = System.currentTimeMillis(); - display("Task: sort arrays based on MESSAGE attribute"); - display(start, stop); - } - protected void addChildren(ArrayList result, IPath root, int breadth, int depth) { for (int i = 1; i < breadth + 1; i++) { IPath child = root.append(i + "");