gabriel-farache commented on code in PR #4094:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/4094#discussion_r2581603152


##########
kogito-test-utils/src/main/java/org/kie/kogito/test/utils/ProcessInstanceLoggingTestBase.java:
##########
@@ -0,0 +1,244 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.kie.kogito.test.utils;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.time.Duration;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import io.restassured.http.ContentType;
+
+import static io.restassured.RestAssured.given;
+import static org.awaitility.Awaitility.await;
+
+/**
+ * Base class for process instance logging tests providing common 
functionality.
+ * This class eliminates code duplication between different logging test 
implementations.
+ */
+public abstract class ProcessInstanceLoggingTestBase {
+
+    private static final Logger LOGGER = 
LoggerFactory.getLogger(ProcessInstanceLoggingTestBase.class);
+
+    /**
+     * Get the configured log file path.
+     *
+     * @return Path to the Quarkus log file
+     */
+    protected Path getLogFilePath() {
+        String logPath = System.getProperty("quarkus.log.file.path", 
"target/quarkus.log");
+        return Paths.get(logPath);
+    }
+
+    /**
+     * Get all log files including rotated ones in chronological order (newest 
first).
+     * Handles Quarkus default rotation: quarkus.log, quarkus.log.1, 
quarkus.log.2, etc.
+     *
+     * @return List of log file paths sorted by modification time (newest 
first)
+     * @throws IOException if directory access fails
+     */
+    protected List<Path> getAllLogFiles() throws IOException {
+        Path logFile = getLogFilePath();
+        Path logDir = logFile.getParent();
+        String baseName = logFile.getFileName().toString();
+
+        List<Path> logFiles = new ArrayList<>();
+
+        // Add main log file if it exists
+        if (Files.exists(logFile)) {
+            logFiles.add(logFile);
+        }
+
+        // Look for rotated files: baseName.1, baseName.2, etc.
+        for (int i = 1; i <= 10; i++) { // Check up to 10 rotated files (more 
than default max-backup-index=5)

Review Comment:
   done



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to