Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NettyHttpJaasTestResource reads config.jaas from disk #5084

Merged
merged 1 commit into from
Jul 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,24 @@
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;
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);
}
}

Expand Down
Loading