@@ -95,10 +95,12 @@ void testFileSystemFetchWithoutAdditionalUri() throws Exception {
9595 }
9696
9797 @ Test
98- void testFileSystemFetchWithAdditionalUri () throws Exception {
98+ void testFileSystemFetchWithAdditionalUri (@ TempDir Path pseudoJarDir ) throws Exception {
9999 File sourceFile = TestingUtils .getClassFile (getClass ());
100100 String uriStr = "file://" + sourceFile .toURI ().getPath ();
101- File additionalSrcFile = getFlinkClientsJar ();
101+ File additionalSrcFile =
102+ Files .createTempFile (pseudoJarDir , "testFileSystemFetchWithAdditionalUri" , ".jar" )
103+ .toFile ();
102104 String additionalUriStr = "file://" + additionalSrcFile .toURI ().getPath ();
103105
104106 ArtifactFetchManager fetchMgr = new ArtifactFetchManager (configuration );
@@ -112,12 +114,12 @@ void testFileSystemFetchWithAdditionalUri() throws Exception {
112114 }
113115
114116 @ Test
115- void testHttpFetch () throws Exception {
117+ void testHttpFetch (@ TempDir Path pseudoJarDir ) throws Exception {
116118 configuration .set (ArtifactFetchOptions .RAW_HTTP_ENABLED , true );
117119 HttpServer httpServer = null ;
118120 try {
119121 httpServer = startHttpServer ();
120- File sourceFile = getFlinkClientsJar ();
122+ File sourceFile = Files . createTempFile ( pseudoJarDir , "testHttpFetch" , ".jar" ). toFile ();
121123 httpServer .createContext (
122124 "/download/" + sourceFile .getName (), new DummyHttpDownloadHandler (sourceFile ));
123125 String uriStr =
@@ -138,10 +140,11 @@ void testHttpFetch() throws Exception {
138140 }
139141
140142 @ Test
141- void testMixedArtifactFetch () throws Exception {
143+ void testMixedArtifactFetch (@ TempDir Path pseudoJarDir ) throws Exception {
142144 File sourceFile = TestingUtils .getClassFile (getClass ());
143145 String uriStr = "file://" + sourceFile .toURI ().getPath ();
144- File sourceFile2 = getFlinkClientsJar ();
146+ File sourceFile2 =
147+ Files .createTempFile (pseudoJarDir , "testMixedArtifactFetch" , ".jar" ).toFile ();
145148 String uriStr2 = "file://" + sourceFile2 .toURI ().getPath ();
146149
147150 ArtifactFetchManager fetchMgr = new ArtifactFetchManager (configuration );
@@ -230,15 +233,6 @@ private HttpServer startHttpServer() throws IOException {
230233 return httpServer ;
231234 }
232235
233- private File getFlinkClientsJar () throws IOException {
234- return TestingUtils .getFileFromTargetDir (
235- ArtifactFetchManager .class ,
236- p ->
237- org .apache .flink .util .FileUtils .isJarFile (p )
238- && p .toFile ().getName ().startsWith ("flink-clients" )
239- && !p .toFile ().getName ().contains ("test-utils" ));
240- }
241-
242236 private static class DummyHttpDownloadHandler implements HttpHandler {
243237
244238 final File file ;
0 commit comments