This is an automated email from the ASF dual-hosted git repository.

ppalaga pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git


The following commit(s) were added to refs/heads/main by this push:
     new dcf2bc8ca2 NettyHttpJaasTestResource reads config.jaas from disk fix 
#5083
dcf2bc8ca2 is described below

commit dcf2bc8ca2a2a6693269b0505e187563bc7d71a9
Author: Peter Palaga <ppal...@redhat.com>
AuthorDate: Fri Jul 7 19:23:34 2023 +0200

    NettyHttpJaasTestResource reads config.jaas from disk fix #5083
---
 .../quarkus/component/netty/http/NettyHttpJaasTestResource.java  | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git 
a/integration-tests/netty-http/src/test/java/org/apache/camel/quarkus/component/netty/http/NettyHttpJaasTestResource.java
 
b/integration-tests/netty-http/src/test/java/org/apache/camel/quarkus/component/netty/http/NettyHttpJaasTestResource.java
index 0e103e9594..d2dea0476e 100644
--- 
a/integration-tests/netty-http/src/test/java/org/apache/camel/quarkus/component/netty/http/NettyHttpJaasTestResource.java
+++ 
b/integration-tests/netty-http/src/test/java/org/apache/camel/quarkus/component/netty/http/NettyHttpJaasTestResource.java
@@ -17,6 +17,7 @@
 package org.apache.camel.quarkus.component.netty.http;
 
 import java.io.IOException;
+import java.io.InputStream;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
@@ -24,16 +25,16 @@ import java.util.Map;
 
 public class NettyHttpJaasTestResource extends NettyHttpTestResource {
     private static final String JAAS_FILE_NAME = "config.jaas";
-    private static final Path SOURCE_FILE = 
Paths.get("src/test/resources/").resolve(JAAS_FILE_NAME);
     private static final Path TARGET_FILE = 
Paths.get("target/").resolve(JAAS_FILE_NAME);
 
     @Override
     public Map<String, String> start() {
         if (!Files.exists(TARGET_FILE)) {
-            try {
-                Files.copy(SOURCE_FILE, TARGET_FILE);
+            try (InputStream in = 
getClass().getClassLoader().getResourceAsStream(JAAS_FILE_NAME)) {
+                Files.createDirectories(TARGET_FILE.getParent());
+                Files.copy(in, TARGET_FILE);
             } catch (IOException e) {
-                throw new RuntimeException("Unable to copy " + JAAS_FILE_NAME, 
e);
+                throw new RuntimeException("Unable to copy " + JAAS_FILE_NAME 
+ " from class path to " + TARGET_FILE, e);
             }
         }
 

Reply via email to