Skip to content

Commit 67a075b

Browse files
committed
Move utility method ResourceTest#setBuildOrder() to only consumers #903
The method ResourceTest#setBuildOrder() has two consuming paths in the inheritance hierarchy, one concrete test class and one abstract test class that is lower in the type hierarchy. This change pushes down the utility method to clean up the REsourceTest inheritance hierarchy. Contributes to #903
1 parent 9b3c91d commit 67a075b

File tree

3 files changed

+22
-13
lines changed

3 files changed

+22
-13
lines changed

resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/builders/AbstractBuilderTest.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,13 @@
1515
package org.eclipse.core.tests.internal.builders;
1616

1717
import java.util.Map;
18-
import org.eclipse.core.resources.*;
18+
import java.util.stream.Stream;
19+
import org.eclipse.core.resources.ICommand;
20+
import org.eclipse.core.resources.IFile;
21+
import org.eclipse.core.resources.IProject;
22+
import org.eclipse.core.resources.IProjectDescription;
23+
import org.eclipse.core.resources.IWorkspace;
24+
import org.eclipse.core.resources.IWorkspaceDescription;
1925
import org.eclipse.core.runtime.CoreException;
2026
import org.eclipse.core.tests.resources.ResourceTest;
2127

@@ -65,4 +71,14 @@ protected void dirty(IFile file) throws CoreException {
6571
file.setContents(getRandomContents(), true, true, getMonitor());
6672
}
6773

74+
/**
75+
* Sets the workspace build order to just contain the given projects.
76+
*/
77+
protected void setBuildOrder(IProject... projects) throws CoreException {
78+
IWorkspace workspace = getWorkspace();
79+
IWorkspaceDescription desc = workspace.getDescription();
80+
desc.setBuildOrder(Stream.of(projects).map(IProject::getName).toArray(String[]::new));
81+
workspace.setDescription(desc);
82+
}
83+
6884
}

resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/ResourceTest.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
import java.util.HashSet;
3535
import java.util.Set;
3636
import java.util.concurrent.atomic.AtomicBoolean;
37-
import java.util.stream.Stream;
3837
import org.eclipse.core.filesystem.EFS;
3938
import org.eclipse.core.filesystem.IFileInfo;
4039
import org.eclipse.core.filesystem.IFileStore;
@@ -940,16 +939,6 @@ protected void setAutoBuilding(boolean enabled) throws CoreException {
940939
waitForBuild();
941940
}
942941

943-
/**
944-
* Sets the workspace build order to just contain the given projects.
945-
*/
946-
protected void setBuildOrder(IProject... projects) throws CoreException {
947-
IWorkspace workspace = getWorkspace();
948-
IWorkspaceDescription desc = workspace.getDescription();
949-
desc.setBuildOrder(Stream.of(projects).map(IProject::getName).toArray(String[]::new));
950-
workspace.setDescription(desc);
951-
}
952-
953942
/**
954943
* Blocks the calling thread until autobuild completes.
955944
*/

resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/session/TestBuilderDeltaSerialization.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import org.eclipse.core.resources.IProject;
2424
import org.eclipse.core.resources.IProjectDescription;
2525
import org.eclipse.core.resources.IResource;
26+
import org.eclipse.core.resources.IWorkspaceDescription;
2627
import org.eclipse.core.resources.IWorkspaceRoot;
2728
import org.eclipse.core.resources.IncrementalProjectBuilder;
2829
import org.eclipse.core.runtime.CoreException;
@@ -66,7 +67,10 @@ public void test1() throws CoreException {
6667
unsortedFile1.setContents(new ByteArrayInputStream(new byte[] { 1, 4, 3 }), true, true, null);
6768
unsortedFile2.setContents(new ByteArrayInputStream(new byte[] { 1, 4, 3 }), true, true, null);
6869

69-
setBuildOrder(project1, project2);
70+
// set build order
71+
IWorkspaceDescription workspaceDescription = workspace.getDescription();
72+
workspaceDescription.setBuildOrder(new String[] { project1.getName(), project2.getName() });
73+
workspace.setDescription(workspaceDescription);
7074
setAutoBuilding(false);
7175

7276
// configure builder for project1

0 commit comments

Comments
 (0)