Skip to content
This repository was archived by the owner on May 28, 2018. It is now read-only.

Commit f37ae88

Browse files
author
Michal Gajdos
committed
Added some delay to multipart tests to make sure temporary files are properly deleted.
Change-Id: I6f82acbd316599f14249ae937d6646ab31f8fdee Signed-off-by: Michal Gajdos <[email protected]>
1 parent c22a523 commit f37ae88

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

media/multipart/src/test/java/org/glassfish/jersey/media/multipart/internal/FormDataMultiPartReaderWriterTest.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -706,6 +706,9 @@ public void testInjectedFileNotCopied(@Mocked final BodyPartEntity entity) throw
706706

707707
// Make sure that the temp file has been removed.
708708
final String pathname = response.readEntity(String.class);
709+
// Wait a second to make sure the file doesn't exist.
710+
Thread.sleep(1000);
711+
709712
assertThat("Temporary file, " + pathname + ", on the server has not been removed",
710713
new File(pathname).exists(), is(false));
711714
}
@@ -726,6 +729,9 @@ public void tempFileDeletedAfterSuccessfulProcessing() throws Exception {
726729

727730
// Make sure that the temp file has been removed.
728731
final String pathname = response.readEntity(String.class);
732+
// Wait a second to make sure the file doesn't exist.
733+
Thread.sleep(1000);
734+
729735
assertThat("Temporary file, " + pathname + ", on the server has not been removed",
730736
new File(pathname).exists(), is(false));
731737
}
@@ -746,6 +752,9 @@ public void tempFileDeletedAfterExceptionInMethod() throws Exception {
746752

747753
// Make sure that the temp file has been removed.
748754
final String pathname = response.readEntity(String.class);
755+
// Wait a second to make sure the file doesn't exist.
756+
Thread.sleep(1000);
757+
749758
assertThat("Temporary file, " + pathname + ", on the server has not been removed",
750759
new File(pathname).exists(), is(false));
751760
}

tests/integration/jersey-2846/src/test/java/org/glassfish/jersey/tests/integration/jersey2846/Jersey2846ITCase.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,8 @@ public void _test(final String path, final int status, final Object entity) thro
138138

139139
// Get Response ...
140140
assertThat(response.getStatus(), is(status));
141+
// Wait a second to make sure the files don't exist.
142+
Thread.sleep(1000);
141143

142144
// Make sure that the message and it's parts have been closed and temporary files deleted.
143145
assertThat("Temporary files were not deleted", matchingTempFiles(tempDir), is(expectedTempFiles));

0 commit comments

Comments
 (0)