Skip to content

Commit

Permalink
Merge pull request wildfly#17836 from lvydra/WFLY-13682
Browse files Browse the repository at this point in the history
[WFLY-13682] JBossWSStringReplaceTestCase.incorrectValueOfModifyWsdlAddressOpeningElement failed intermittently on Windows
  • Loading branch information
bstansberry authored Apr 28, 2024
2 parents 86cf964 + 8a6263f commit 17194cc
Showing 1 changed file with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@
import org.wildfly.test.integration.vdx.utils.server.ServerBase;
import org.wildfly.test.integration.vdx.utils.server.Server;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.util.concurrent.TimeUnit;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
Expand Down Expand Up @@ -76,7 +78,7 @@ private void archiveServerLogAndDeleteIt(Path pathToArchiveDirectory) throws Exc

// copy server.log files for standalone or host-controller.log for domain
Files.copy(container().getServerLogPath(), pathToArchiveDirectory.resolve(container().getServerLogPath().getFileName()), StandardCopyOption.REPLACE_EXISTING);
Files.delete(container().getServerLogPath());
deleteFile(container().getServerLogPath(), 5000);
}

private void createAndSetTestArchiveDirectoryToContainer(Path testArchiveDirectory) throws Exception {
Expand All @@ -86,4 +88,19 @@ private void createAndSetTestArchiveDirectoryToContainer(Path testArchiveDirecto
}
container().setTestArchiveDirectory(testArchiveDirectory);
}

private void deleteFile(Path path, int timeout) throws IOException, InterruptedException {
long done = System.currentTimeMillis() + timeout;
while (true) {
try {
Files.delete(path);
break;
} catch (IOException e) {
if (System.currentTimeMillis() > done) {
throw e;
}
}
TimeUnit.MILLISECONDS.sleep(500);
}
}
}

0 comments on commit 17194cc

Please sign in to comment.