jamesnetherton commented on code in PR #5404:
URL: https://github.com/apache/camel-quarkus/pull/5404#discussion_r1348381558
##########
integration-tests/camel-k-runtime/src/test/java/org/apache/camel/quarkus/k/it/RuntimeTest.java:
##########
@@ -48,6 +61,51 @@ public void inspect() {
.isEqualTo(Application.NoRoutesCollector.class.getName());
}
+ public static class Resources implements
QuarkusTestResourceLifecycleManager {
+ private static final Path TEMP_DIR =
Paths.get("target/test-classes/camel-k-runtime"); // Specify your temporary
directory here
+
+ @Override
+ public Map<String, String> start() {
+ Path confd = TEMP_DIR.resolve("conf.d");
+
+ for (int i = 1; i <= 3; i++) {
+ String path = String.format("00%d", i);
+ Path confdSubDir = confd.resolve(path);
+ confdSubDir.toFile().mkdirs();
+
+ String file = i < 3 ? "conf.properties" : "flat-property";
+ copyResourceToTemp("conf.d/" + path + "/" + file,
confdSubDir.resolve(file).toAbsolutePath());
+ }
+
+ Path confProperties = TEMP_DIR.resolve("conf.properties");
+ copyResourceToTemp("conf.properties",
confProperties.toAbsolutePath());
+
+ return Map.of(
+ "CAMEL_K_CONF", confProperties.toAbsolutePath().toString(),
+ "CAMEL_K_CONF_D", confd.toAbsolutePath().toString());
+ }
+
+ private void copyResourceToTemp(String resourceName, Path destination)
{
+ try (InputStream stream =
getClass().getClassLoader().getResourceAsStream(resourceName)) {
+ Files.copy(stream, destination,
StandardCopyOption.REPLACE_EXISTING);
+ } catch (Exception e) {
+ throw new RuntimeException("Failed to copy resource " +
resourceName + " to temporary directory", e);
+ }
+ }
+
+ @Override
+ public void stop() {
+ try {
+ Files.walk(TEMP_DIR)
Review Comment:
Let's follow up with another PR for this if needed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]