Skip to content

Commit 6533b12

Browse files
CopilotHannesWell
authored andcommitted
Fix afterAll clean-up in ds.annotations.tests WorkspaceSetupExtension
And use Files.move() instead of less reliably File.renameTo().
1 parent becd86c commit 6533b12

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

ds/org.eclipse.pde.ds.annotations.tests/src/org/eclipse/pde/ds/internal/annotations/tests/WorkspaceSetupExtension.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package org.eclipse.pde.ds.internal.annotations.tests;
22

3-
import java.io.File;
43
import java.io.IOException;
54
import java.io.InputStream;
65
import java.nio.file.Files;
@@ -64,9 +63,10 @@ public IStatus runInWorkspace(IProgressMonitor m) throws CoreException {
6463
Path projectLocation = Files.createDirectories(wsRoot.resolve(project.getName()));
6564
copyResources(bundle, entry.getValue(), projectLocation);
6665
Files.createDirectories(projectLocation.resolve("OSGI-INF"));
67-
File projectFile = projectLocation.resolve("test.project").toFile();
68-
if (projectFile.isFile()) {
69-
projectFile.renameTo(projectLocation.resolve(".project").toFile());
66+
Path projectFile = projectLocation.resolve("test.project");
67+
if (Files.isRegularFile(projectFile)) {
68+
Files.move(projectFile, projectLocation.resolve(".project"),
69+
StandardCopyOption.REPLACE_EXISTING);
7070
}
7171
} catch (IOException e) {
7272
throw new CoreException(Status.error("Error copying test project content.", e));
@@ -96,8 +96,8 @@ public void afterAll(ExtensionContext context) throws Exception {
9696
Job wsJob = new WorkspaceJob("Test Workspace Cleanup") {
9797
@Override
9898
public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
99-
for (String projectId : PROJECTS.keySet()) {
100-
IProject project = wsRoot.getProject("ds.annotations." + projectId);
99+
for (String projectName : PROJECTS.keySet()) {
100+
IProject project = wsRoot.getProject(projectName);
101101
if (project.exists()) {
102102
project.delete(true, true, monitor);
103103
}

0 commit comments

Comments
 (0)