This is an automated email from the ASF dual-hosted git repository. tballison pushed a commit to branch de-lombok-e2e in repository https://gitbox.apache.org/repos/asf/tika.git
commit 53bbcb9bb92ce668594083a3c7beeac4b99bf367 Author: tallison <[email protected]> AuthorDate: Thu Jul 2 09:29:15 2026 -0400 follow on to TIKA-4763 fix e2e --- tika-e2e-tests/pom.xml | 17 ----- tika-e2e-tests/tika-grpc/pom.xml | 7 -- .../org/apache/tika/pipes/ExternalTestBase.java | 43 ++++++------ .../pipes/filesystem/FileSystemFetcherTest.java | 24 +++---- .../tika/pipes/filesystem/HandlerTypeTest.java | 41 ++++++------ .../tika/pipes/ignite/IgniteConfigStoreTest.java | 77 +++++++++++----------- tika-parent/pom.xml | 1 - 7 files changed, 95 insertions(+), 115 deletions(-) diff --git a/tika-e2e-tests/pom.xml b/tika-e2e-tests/pom.xml index 06c3e5cb7f..5f60869446 100644 --- a/tika-e2e-tests/pom.xml +++ b/tika-e2e-tests/pom.xml @@ -103,14 +103,6 @@ <artifactId>jackson-databind</artifactId> <version>${jackson.version}</version> </dependency> - - <!-- Lombok --> - <dependency> - <groupId>org.projectlombok</groupId> - <artifactId>lombok</artifactId> - <version>${lombok.version}</version> - <optional>true</optional> - </dependency> </dependencies> </dependencyManagement> @@ -123,15 +115,6 @@ <version>3.15.0</version> <configuration> <release>17</release> - <!-- maven-compiler-plugin 3.15 no longer auto-discovers classpath - annotation processors; declare Lombok explicitly so @Slf4j runs. --> - <annotationProcessorPaths> - <path> - <groupId>org.projectlombok</groupId> - <artifactId>lombok</artifactId> - <version>${lombok.version}</version> - </path> - </annotationProcessorPaths> </configuration> </plugin> <plugin> diff --git a/tika-e2e-tests/tika-grpc/pom.xml b/tika-e2e-tests/tika-grpc/pom.xml index 4dd87ed12c..e4c91463e4 100644 --- a/tika-e2e-tests/tika-grpc/pom.xml +++ b/tika-e2e-tests/tika-grpc/pom.xml @@ -70,13 +70,6 @@ <artifactId>jackson-databind</artifactId> </dependency> - <!-- Lombok --> - <dependency> - <groupId>org.projectlombok</groupId> - <artifactId>lombok</artifactId> - <optional>true</optional> - </dependency> - <!-- JUnit 5 --> <dependency> <groupId>org.junit.jupiter</groupId> diff --git a/tika-e2e-tests/tika-grpc/src/test/java/org/apache/tika/pipes/ExternalTestBase.java b/tika-e2e-tests/tika-grpc/src/test/java/org/apache/tika/pipes/ExternalTestBase.java index d0d135309d..edcfd9a445 100644 --- a/tika-e2e-tests/tika-grpc/src/test/java/org/apache/tika/pipes/ExternalTestBase.java +++ b/tika-e2e-tests/tika-grpc/src/test/java/org/apache/tika/pipes/ExternalTestBase.java @@ -43,12 +43,13 @@ import java.util.zip.ZipInputStream; import com.fasterxml.jackson.databind.ObjectMapper; import io.grpc.ManagedChannel; import io.grpc.ManagedChannelBuilder; -import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.TestInstance; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.testcontainers.containers.DockerComposeContainer; import org.testcontainers.containers.output.Slf4jLogConsumer; import org.testcontainers.containers.wait.strategy.Wait; @@ -60,9 +61,9 @@ import org.apache.tika.TikaGrpc; @TestInstance(TestInstance.Lifecycle.PER_CLASS) @Testcontainers -@Slf4j @Tag("E2ETest") public abstract class ExternalTestBase { + private static final Logger LOG = LoggerFactory.getLogger(ExternalTestBase.class); public static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); public static final int MAX_STARTUP_TIMEOUT = 120; public static final String GOV_DOCS_FOLDER = "/tika/govdocs1"; @@ -88,7 +89,7 @@ public abstract class ExternalTestBase { } private static void startLocalGrpcServer() throws Exception { - log.info("Starting local tika-grpc server using Maven exec"); + LOG.info("Starting local tika-grpc server using Maven exec"); Path tikaGrpcDir = findTikaGrpcDirectory(); Path configFile = Path.of("src/test/resources/tika-config.json").toAbsolutePath(); @@ -97,8 +98,8 @@ public abstract class ExternalTestBase { throw new IllegalStateException("Config file not found: " + configFile); } - log.info("Using tika-grpc from: {}", tikaGrpcDir); - log.info("Using config file: {}", configFile); + LOG.info("Using tika-grpc from: {}", tikaGrpcDir); + LOG.info("Using config file: {}", configFile); String javaHome = System.getProperty("java.home"); boolean isWindows = System.getProperty("os.name").toLowerCase(Locale.ROOT).contains("win"); @@ -131,10 +132,10 @@ public abstract class ExternalTestBase { new InputStreamReader(localGrpcProcess.getInputStream(), StandardCharsets.UTF_8))) { String line; while ((line = reader.readLine()) != null) { - log.info("tika-grpc: {}", line); + LOG.info("tika-grpc: {}", line); } } catch (IOException e) { - log.error("Error reading server output", e); + LOG.error("Error reading server output", e); } }); logThread.setDaemon(true); @@ -142,7 +143,7 @@ public abstract class ExternalTestBase { waitForServerReady(); - log.info("Local tika-grpc server started successfully on port {}", GRPC_PORT); + LOG.info("Local tika-grpc server started successfully on port {}", GRPC_PORT); } private static Path findTikaGrpcDirectory() { @@ -173,10 +174,10 @@ public abstract class ExternalTestBase { try { TikaGrpc.TikaBlockingStub stub = TikaGrpc.newBlockingStub(testChannel); stub.listFetchers(ListFetchersRequest.newBuilder().build()); - log.info("gRPC server is ready"); + LOG.info("gRPC server is ready"); return; } catch (Exception e) { - log.trace("gRPC server not ready yet (attempt {}/{}): {}", i + 1, maxAttempts, e.getMessage()); + LOG.trace("gRPC server not ready yet (attempt {}/{}): {}", i + 1, maxAttempts, e.getMessage()); } finally { testChannel.shutdown(); testChannel.awaitTermination(1, TimeUnit.SECONDS); @@ -191,7 +192,7 @@ public abstract class ExternalTestBase { } private static void startDockerGrpcServer() { - log.info("Starting Docker Compose tika-grpc server"); + LOG.info("Starting Docker Compose tika-grpc server"); String composeFilePath = System.getProperty("tika.docker.compose.file"); if (composeFilePath == null || composeFilePath.isBlank()) { @@ -208,11 +209,11 @@ public abstract class ExternalTestBase { .withStartupTimeout(Duration.of(MAX_STARTUP_TIMEOUT, ChronoUnit.SECONDS)) .withExposedService("tika-grpc", 50052, Wait.forLogMessage(".*Server started.*\\n", 1)) - .withLogConsumer("tika-grpc", new Slf4jLogConsumer(log)); + .withLogConsumer("tika-grpc", new Slf4jLogConsumer(LOG)); composeContainer.start(); - log.info("Docker Compose containers started successfully"); + LOG.info("Docker Compose containers started successfully"); } private static void loadGovdocs1() throws IOException, InterruptedException { @@ -230,7 +231,7 @@ public abstract class ExternalTestBase { if (attempt >= retries) { throw e; } - log.warn("Download attempt {} failed, retrying in 10 seconds...", attempt, e); + LOG.warn("Download attempt {} failed, retrying in 10 seconds...", attempt, e); TimeUnit.SECONDS.sleep(10); } } @@ -253,13 +254,13 @@ public abstract class ExternalTestBase { Files.copy(in, targetDir.resolve(fixture), StandardCopyOption.REPLACE_EXISTING); } } - log.info("Copied {} test fixtures to {}", fixtures.length, targetDir); + LOG.info("Copied {} test fixtures to {}", fixtures.length, targetDir); } @AfterAll void close() { if (USE_LOCAL_SERVER && localGrpcProcess != null) { - log.info("Stopping local gRPC server"); + LOG.info("Stopping local gRPC server"); localGrpcProcess.destroy(); try { if (!localGrpcProcess.waitFor(10, TimeUnit.SECONDS)) { @@ -284,14 +285,14 @@ public abstract class ExternalTestBase { Path zipPath = targetDir.resolve(zipName); if (Files.exists(zipPath)) { - log.info("{} already exists, skipping download", zipName); + LOG.info("{} already exists, skipping download", zipName); } else { - log.info("Downloading {} from {}...", zipName, url); + LOG.info("Downloading {} from {}...", zipName, url); try (InputStream in = new URL(url).openStream()) { Files.copy(in, zipPath, StandardCopyOption.REPLACE_EXISTING); } } - log.info("Unzipping {}...", zipName); + LOG.info("Unzipping {}...", zipName); try (ZipInputStream zis = new ZipInputStream(new FileInputStream(zipPath.toFile()))) { ZipEntry entry; while ((entry = zis.getNextEntry()) != null) { @@ -309,7 +310,7 @@ public abstract class ExternalTestBase { } } - log.info("Finished downloading and extracting govdocs1 files"); + LOG.info("Finished downloading and extracting govdocs1 files"); } public static void assertAllFilesFetched(Path baseDir, List<FetchAndParseReply> successes, @@ -337,7 +338,7 @@ public abstract class ExternalTestBase { } Assertions.assertNotEquals(0, successes.size(), "Should have some successful fetches"); - log.info("Processed {} files: {} successes, {} errors", allFetchKeys.size(), successes.size(), errors.size()); + LOG.info("Processed {} files: {} successes, {} errors", allFetchKeys.size(), successes.size(), errors.size()); Assertions.assertEquals(keysFromGovdocs1, allFetchKeys, () -> { Set<String> missing = new HashSet<>(keysFromGovdocs1); missing.removeAll(allFetchKeys); diff --git a/tika-e2e-tests/tika-grpc/src/test/java/org/apache/tika/pipes/filesystem/FileSystemFetcherTest.java b/tika-e2e-tests/tika-grpc/src/test/java/org/apache/tika/pipes/filesystem/FileSystemFetcherTest.java index 92bfc72575..065aa7890a 100644 --- a/tika-e2e-tests/tika-grpc/src/test/java/org/apache/tika/pipes/filesystem/FileSystemFetcherTest.java +++ b/tika-e2e-tests/tika-grpc/src/test/java/org/apache/tika/pipes/filesystem/FileSystemFetcherTest.java @@ -27,11 +27,12 @@ import java.util.stream.Stream; import io.grpc.ManagedChannel; import io.grpc.stub.StreamObserver; -import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.condition.DisabledOnOs; import org.junit.jupiter.api.condition.OS; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.tika.FetchAndParseReply; import org.apache.tika.FetchAndParseRequest; @@ -41,9 +42,10 @@ import org.apache.tika.TikaGrpc; import org.apache.tika.pipes.ExternalTestBase; import org.apache.tika.pipes.fetcher.fs.FileSystemFetcherConfig; -@Slf4j @DisabledOnOs(value = OS.WINDOWS, disabledReason = "exec:exec classpath exceeds Windows CreateProcess command-line length limit") class FileSystemFetcherTest extends ExternalTestBase { + private static final Logger LOG = LoggerFactory.getLogger(FileSystemFetcherTest.class); + @Test void testFileSystemFetcher() throws Exception { @@ -59,7 +61,7 @@ class FileSystemFetcherTest extends ExternalTestBase { config.setBasePath(basePath); String configJson = OBJECT_MAPPER.writeValueAsString(config); - log.info("Creating fetcher with config (basePath={}): {}", basePath, configJson); + LOG.info("Creating fetcher with config (basePath={}): {}", basePath, configJson); SaveFetcherReply saveReply = blockingStub.saveFetcher(SaveFetcherRequest .newBuilder() @@ -68,7 +70,7 @@ class FileSystemFetcherTest extends ExternalTestBase { .setFetcherConfigJson(configJson) .build()); - log.info("Fetcher created: {}", saveReply.getFetcherId()); + LOG.info("Fetcher created: {}", saveReply.getFetcherId()); List<FetchAndParseReply> successes = Collections.synchronizedList(new ArrayList<>()); List<FetchAndParseReply> errors = Collections.synchronizedList(new ArrayList<>()); @@ -78,7 +80,7 @@ class FileSystemFetcherTest extends ExternalTestBase { requestStreamObserver = tikaStub.fetchAndParseBiDirectionalStreaming(new StreamObserver<>() { @Override public void onNext(FetchAndParseReply fetchAndParseReply) { - log.debug("Reply from fetch-and-parse - key={}, status={}", + LOG.debug("Reply from fetch-and-parse - key={}, status={}", fetchAndParseReply.getFetchKey(), fetchAndParseReply.getStatus()); if ("FETCH_AND_PARSE_EXCEPTION".equals(fetchAndParseReply.getStatus())) { errors.add(fetchAndParseReply); @@ -89,14 +91,14 @@ class FileSystemFetcherTest extends ExternalTestBase { @Override public void onError(Throwable throwable) { - log.error("Received an error", throwable); + LOG.error("Received an error", throwable); Assertions.fail(throwable); countDownLatch.countDown(); } @Override public void onCompleted() { - log.info("Finished streaming fetch and parse replies"); + LOG.info("Finished streaming fetch and parse replies"); countDownLatch.countDown(); } }); @@ -122,13 +124,13 @@ class FileSystemFetcherTest extends ExternalTestBase { } }); } - log.info("Done submitting files to fetcher {}", fetcherId); + LOG.info("Done submitting files to fetcher {}", fetcherId); requestStreamObserver.onCompleted(); try { if (!countDownLatch.await(3, TimeUnit.MINUTES)) { - log.error("Timed out waiting for parse to complete"); + LOG.error("Timed out waiting for parse to complete"); Assertions.fail("Timed out waiting for parsing to complete"); } } catch (InterruptedException e) { @@ -140,14 +142,14 @@ class FileSystemFetcherTest extends ExternalTestBase { assertAllFilesFetched(TEST_FOLDER.toPath(), successes, errors); } else { int totalProcessed = successes.size() + errors.size(); - log.info("Processed {} documents (limit was {})", totalProcessed, maxDocs); + LOG.info("Processed {} documents (limit was {})", totalProcessed, maxDocs); Assertions.assertTrue(totalProcessed <= maxDocs, "Should not process more than " + maxDocs + " documents"); Assertions.assertTrue(totalProcessed > 0, "Should have processed at least one document"); } - log.info("Test completed successfully - {} successes, {} errors", + LOG.info("Test completed successfully - {} successes, {} errors", successes.size(), errors.size()); } finally { channel.shutdown(); diff --git a/tika-e2e-tests/tika-grpc/src/test/java/org/apache/tika/pipes/filesystem/HandlerTypeTest.java b/tika-e2e-tests/tika-grpc/src/test/java/org/apache/tika/pipes/filesystem/HandlerTypeTest.java index f8e4799331..9cf6697389 100644 --- a/tika-e2e-tests/tika-grpc/src/test/java/org/apache/tika/pipes/filesystem/HandlerTypeTest.java +++ b/tika-e2e-tests/tika-grpc/src/test/java/org/apache/tika/pipes/filesystem/HandlerTypeTest.java @@ -28,7 +28,6 @@ import java.util.concurrent.TimeUnit; import io.grpc.ManagedChannel; import io.grpc.ManagedChannelBuilder; -import lombok.extern.slf4j.Slf4j; import org.awaitility.Awaitility; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assertions; @@ -38,6 +37,8 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInstance; import org.junit.jupiter.api.condition.DisabledOnOs; import org.junit.jupiter.api.condition.OS; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.tika.FetchAndParseReply; import org.apache.tika.FetchAndParseRequest; @@ -58,11 +59,11 @@ import org.apache.tika.pipes.fetcher.fs.FileSystemFetcherConfig; * Example: {"basic-content-handler-factory": {"type": "HTML"}} */ @TestInstance(TestInstance.Lifecycle.PER_CLASS) -@Slf4j @Tag("E2ETest") @DisabledOnOs(value = OS.WINDOWS, disabledReason = "exec:exec classpath exceeds Windows CreateProcess command-line length limit") class HandlerTypeTest { + private static final Logger LOG = LoggerFactory.getLogger(HandlerTypeTest.class); private static final File TEST_FOLDER = ExternalTestBase.TEST_FOLDER; private static final int GRPC_PORT = Integer.parseInt(System.getProperty("tika.e2e.grpcPort", "50052")); @@ -75,7 +76,7 @@ class HandlerTypeTest { killProcessOnPort(3344); killProcessOnPort(10800); } catch (Exception e) { - log.debug("No orphaned processes to clean up: {}", e.getMessage()); + LOG.debug("No orphaned processes to clean up: {}", e.getMessage()); } ExternalTestBase.copyTestFixtures(); @@ -85,7 +86,7 @@ class HandlerTypeTest { @AfterAll void teardown() { if (localGrpcProcess != null) { - log.info("Stopping local gRPC server and child processes"); + LOG.info("Stopping local gRPC server and child processes"); localGrpcProcess.destroy(); try { if (!localGrpcProcess.waitFor(10, TimeUnit.SECONDS)) { @@ -97,14 +98,14 @@ class HandlerTypeTest { killProcessOnPort(3344); killProcessOnPort(10800); } catch (Exception e) { - log.debug("Error during teardown: {}", e.getMessage()); + LOG.debug("Error during teardown: {}", e.getMessage()); } - log.info("Local gRPC server stopped"); + LOG.info("Local gRPC server stopped"); } } private static void startLocalGrpcServer() throws Exception { - log.info("Starting local tika-grpc server with Ignite config for HandlerType test"); + LOG.info("Starting local tika-grpc server with Ignite config for HandlerType test"); Path currentDir = Path.of("").toAbsolutePath(); Path tikaRootDir = currentDir; @@ -123,8 +124,8 @@ class HandlerTypeTest { throw new IllegalStateException("Config file not found: " + configFile); } - log.info("tika-grpc dir: {}", tikaGrpcDir); - log.info("Config file: {}", configFile); + LOG.info("tika-grpc dir: {}", tikaGrpcDir); + LOG.info("Config file: {}", configFile); String javaHome = System.getProperty("java.home"); boolean isWindows = System.getProperty("os.name").toLowerCase(Locale.ROOT).contains("win"); @@ -172,7 +173,7 @@ class HandlerTypeTest { new InputStreamReader(localGrpcProcess.getInputStream(), StandardCharsets.UTF_8))) { String line; while ((line = reader.readLine()) != null) { - log.info("tika-grpc: {}", line); + LOG.info("tika-grpc: {}", line); if (line.contains("Ignite server started") || (line.contains("Table") && line.contains("created successfully")) || line.contains("Server started, listening on")) { @@ -183,7 +184,7 @@ class HandlerTypeTest { } } } catch (IOException e) { - log.error("Error reading server output", e); + LOG.error("Error reading server output", e); } }); logThread.setDaemon(true); @@ -230,7 +231,7 @@ class HandlerTypeTest { throw new RuntimeException("tika-grpc server with Ignite failed to start within timeout", e); } - log.info("HandlerType test server ready on port {}", GRPC_PORT); + LOG.info("HandlerType test server ready on port {}", GRPC_PORT); } private ManagedChannel getManagedChannel() { @@ -258,10 +259,10 @@ class HandlerTypeTest { .flatMap(h -> h.info().commandLine()) .orElse(""); if (!cmdLine.contains("tika") && !cmdLine.contains("TikaGrpc") && !cmdLine.contains("ignite")) { - log.debug("Skipping kill of PID {} on port {} — not a tika/ignite process", pid, port); + LOG.debug("Skipping kill of PID {} on port {} — not a tika/ignite process", pid, port); return; } - log.info("Killing tika/ignite process {} on port {}", pid, port); + LOG.info("Killing tika/ignite process {} on port {}", pid, port); new ProcessBuilder("kill", String.valueOf(pid)).start().waitFor(2, TimeUnit.SECONDS); Thread.sleep(1000); new ProcessBuilder("kill", "-9", String.valueOf(pid)).start().waitFor(2, TimeUnit.SECONDS); @@ -280,7 +281,7 @@ class HandlerTypeTest { } } } catch (Exception e) { - log.debug("Error checking parent process", e); + LOG.debug("Error checking parent process", e); } return false; } @@ -300,7 +301,7 @@ class HandlerTypeTest { .setFetcherType("file-system-fetcher") .setFetcherConfigJson(ExternalTestBase.OBJECT_MAPPER.writeValueAsString(config)) .build()); - log.info("Fetcher created: {}", saveReply.getFetcherId()); + LOG.info("Fetcher created: {}", saveReply.getFetcherId()); // Parse sample.html requesting HTML output FetchAndParseReply htmlReply = blockingStub.fetchAndParse(FetchAndParseRequest.newBuilder() @@ -309,13 +310,13 @@ class HandlerTypeTest { .setParseContextJson("{\"basic-content-handler-factory\": {\"type\": \"HTML\"}}") .build()); - log.info("HTML parse status: {}", htmlReply.getStatus()); + LOG.info("HTML parse status: {}", htmlReply.getStatus()); Assertions.assertEquals("PARSE_SUCCESS", htmlReply.getStatus(), "Parse should succeed with HTML handler type"); String htmlContent = htmlReply.getFieldsMap().get("X-TIKA:content"); Assertions.assertNotNull(htmlContent, "Content should be present in HTML response"); - log.info("HTML content (first 200 chars): {}", htmlContent.substring(0, Math.min(200, htmlContent.length()))); + LOG.info("HTML content (first 200 chars): {}", htmlContent.substring(0, Math.min(200, htmlContent.length()))); Assertions.assertTrue( htmlContent.contains("<html") || htmlContent.contains("<body") || htmlContent.contains("<p"), "HTML handler should produce HTML markup, got: " + htmlContent); @@ -327,13 +328,13 @@ class HandlerTypeTest { .setParseContextJson("{\"basic-content-handler-factory\": {\"type\": \"TEXT\"}}") .build()); - log.info("Text parse status: {}", textReply.getStatus()); + LOG.info("Text parse status: {}", textReply.getStatus()); Assertions.assertEquals("PARSE_SUCCESS", textReply.getStatus(), "Parse should succeed with TEXT handler type"); String textContent = textReply.getFieldsMap().get("X-TIKA:content"); Assertions.assertNotNull(textContent, "Content should be present in text response"); - log.info("Text content (first 200 chars): {}", textContent.substring(0, Math.min(200, textContent.length()))); + LOG.info("Text content (first 200 chars): {}", textContent.substring(0, Math.min(200, textContent.length()))); Assertions.assertFalse( textContent.contains("<html") || textContent.contains("<body"), "TEXT handler should not produce HTML tags, got: " + textContent); diff --git a/tika-e2e-tests/tika-grpc/src/test/java/org/apache/tika/pipes/ignite/IgniteConfigStoreTest.java b/tika-e2e-tests/tika-grpc/src/test/java/org/apache/tika/pipes/ignite/IgniteConfigStoreTest.java index eecfe2a0a2..347d13f1d0 100644 --- a/tika-e2e-tests/tika-grpc/src/test/java/org/apache/tika/pipes/ignite/IgniteConfigStoreTest.java +++ b/tika-e2e-tests/tika-grpc/src/test/java/org/apache/tika/pipes/ignite/IgniteConfigStoreTest.java @@ -33,7 +33,6 @@ import java.util.stream.Stream; import io.grpc.ManagedChannel; import io.grpc.ManagedChannelBuilder; import io.grpc.stub.StreamObserver; -import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeAll; @@ -42,6 +41,8 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInstance; import org.junit.jupiter.api.condition.DisabledOnOs; import org.junit.jupiter.api.condition.OS; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.testcontainers.containers.DockerComposeContainer; import org.testcontainers.containers.output.Slf4jLogConsumer; import org.testcontainers.containers.wait.strategy.Wait; @@ -57,11 +58,11 @@ import org.apache.tika.pipes.fetcher.fs.FileSystemFetcherConfig; @TestInstance(TestInstance.Lifecycle.PER_CLASS) @Testcontainers -@Slf4j @Tag("E2ETest") @DisabledOnOs(value = OS.WINDOWS, disabledReason = "Windows classpath length limit (CreateProcess error=206) exceeded by exec:exec with full Tika classpath") class IgniteConfigStoreTest { - + + private static final Logger LOG = LoggerFactory.getLogger(IgniteConfigStoreTest.class); private static final int MAX_STARTUP_TIMEOUT = ExternalTestBase.MAX_STARTUP_TIMEOUT; private static final File TEST_FOLDER = ExternalTestBase.TEST_FOLDER; private static final boolean USE_LOCAL_SERVER = Boolean.parseBoolean(System.getProperty("tika.e2e.useLocalServer", "true")); @@ -78,7 +79,7 @@ class IgniteConfigStoreTest { killProcessOnPort(3344); killProcessOnPort(10800); } catch (Exception e) { - log.debug("No orphaned processes to clean up"); + LOG.debug("No orphaned processes to clean up"); } } @@ -107,7 +108,7 @@ class IgniteConfigStoreTest { } private static void startLocalGrpcServer() throws Exception { - log.info("Starting local tika-grpc server using Maven"); + LOG.info("Starting local tika-grpc server using Maven"); Path currentDir = Path.of("").toAbsolutePath(); Path tikaRootDir = currentDir; @@ -136,9 +137,9 @@ class IgniteConfigStoreTest { throw new IllegalStateException("Config file not found: " + configFile); } - log.info("Tika root: {}", tikaRootDir); - log.info("Using tika-grpc from: {}", tikaGrpcDir); - log.info("Using config file: {}", configFile); + LOG.info("Tika root: {}", tikaRootDir); + LOG.info("Using tika-grpc from: {}", tikaGrpcDir); + LOG.info("Using config file: {}", configFile); // Use mvn exec:exec to run as external process (not exec:java which breaks ServiceLoader) String javaHome = System.getProperty("java.home"); @@ -188,7 +189,7 @@ class IgniteConfigStoreTest { new java.io.InputStreamReader(localGrpcProcess.getInputStream(), java.nio.charset.StandardCharsets.UTF_8))) { String line; while ((line = reader.readLine()) != null) { - log.info("tika-grpc: {}", line); + LOG.info("tika-grpc: {}", line); if (line.contains("Ignite server started") || line.contains("Table") && line.contains("created successfully") || @@ -200,7 +201,7 @@ class IgniteConfigStoreTest { } } } catch (IOException e) { - log.error("Error reading server output", e); + LOG.error("Error reading server output", e); } }); logThread.setDaemon(true); @@ -217,7 +218,7 @@ class IgniteConfigStoreTest { } if (!igniteReady) { - log.debug("Waiting for Ignite to start..."); + LOG.debug("Waiting for Ignite to start..."); return false; } @@ -239,10 +240,10 @@ class IgniteConfigStoreTest { io.grpc.health.v1.HealthCheckResponse.ServingStatus.SERVING; if (serving) { - log.info("gRPC server is healthy and serving!"); + LOG.info("gRPC server is healthy and serving!"); return true; } else { - log.debug("gRPC server responding but not serving yet: {}", response.getStatus()); + LOG.debug("gRPC server responding but not serving yet: {}", response.getStatus()); return false; } } finally { @@ -252,18 +253,18 @@ class IgniteConfigStoreTest { } catch (io.grpc.StatusRuntimeException e) { if (e.getStatus().getCode() == io.grpc.Status.Code.UNIMPLEMENTED) { // Health check not implemented, just verify channel works - log.info("Health check not available, assuming server is ready"); + LOG.info("Health check not available, assuming server is ready"); return true; } - log.debug("gRPC server not ready yet: {}", e.getMessage()); + LOG.debug("gRPC server not ready yet: {}", e.getMessage()); return false; } catch (Exception e) { - log.debug("gRPC server not ready yet: {}", e.getMessage()); + LOG.debug("gRPC server not ready yet: {}", e.getMessage()); return false; } }); - log.info("Both gRPC server and Ignite are ready!"); + LOG.info("Both gRPC server and Ignite are ready!"); } catch (org.awaitility.core.ConditionTimeoutException e) { if (localGrpcProcess.isAlive()) { localGrpcProcess.destroyForcibly(); @@ -271,7 +272,7 @@ class IgniteConfigStoreTest { throw new RuntimeException("Local gRPC server or Ignite failed to start within timeout", e); } - log.info("Local tika-grpc server started successfully on port {}", GRPC_PORT); + LOG.info("Local tika-grpc server started successfully on port {}", GRPC_PORT); } @@ -291,7 +292,7 @@ class IgniteConfigStoreTest { .withStartupTimeout(Duration.of(MAX_STARTUP_TIMEOUT, ChronoUnit.SECONDS)) .withExposedService("tika-grpc", 50052, Wait.forLogMessage(".*Server started.*\\n", 1)) - .withLogConsumer("tika-grpc", new Slf4jLogConsumer(log)); + .withLogConsumer("tika-grpc", new Slf4jLogConsumer(LOG)); igniteComposeContainer.start(); } @@ -299,15 +300,15 @@ class IgniteConfigStoreTest { @AfterAll static void teardownIgnite() { if (USE_LOCAL_SERVER && localGrpcProcess != null) { - log.info("Stopping local gRPC server and all child processes"); + LOG.info("Stopping local gRPC server and all child processes"); try { long mvnPid = localGrpcProcess.pid(); - log.info("Maven process PID: {}", mvnPid); + LOG.info("Maven process PID: {}", mvnPid); localGrpcProcess.destroy(); if (!localGrpcProcess.waitFor(10, TimeUnit.SECONDS)) { - log.warn("Process didn't stop gracefully, forcing shutdown"); + LOG.warn("Process didn't stop gracefully, forcing shutdown"); localGrpcProcess.destroyForcibly(); localGrpcProcess.waitFor(5, TimeUnit.SECONDS); } @@ -319,10 +320,10 @@ class IgniteConfigStoreTest { killProcessOnPort(3344); killProcessOnPort(10800); } catch (Exception e) { - log.debug("Error killing processes on ports (may already be stopped): {}", e.getMessage()); + LOG.debug("Error killing processes on ports (may already be stopped): {}", e.getMessage()); } - log.info("Local gRPC server stopped"); + LOG.info("Local gRPC server stopped"); } catch (InterruptedException e) { Thread.currentThread().interrupt(); localGrpcProcess.destroyForcibly(); @@ -345,7 +346,7 @@ class IgniteConfigStoreTest { long myPid = ProcessHandle.current().pid(); if (pid == myPid || isParentProcess(pid)) { - log.debug("Skipping kill of PID {} on port {} (test process or parent)", pid, port); + LOG.debug("Skipping kill of PID {} on port {} (test process or parent)", pid, port); return; } @@ -355,11 +356,11 @@ class IgniteConfigStoreTest { .flatMap(h -> h.info().commandLine()) .orElse(""); if (!cmdLine.contains("tika") && !cmdLine.contains("TikaGrpc") && !cmdLine.contains("ignite")) { - log.debug("Skipping kill of PID {} on port {} — not a tika/ignite process: {}", pid, port, cmdLine); + LOG.debug("Skipping kill of PID {} on port {} — not a tika/ignite process: {}", pid, port, cmdLine); return; } - log.info("Found tika/ignite process {} on port {}, killing it", pid, port); + LOG.info("Found tika/ignite process {} on port {}, killing it", pid, port); ProcessBuilder killPb = new ProcessBuilder("kill", String.valueOf(pid)); Process killProcess = killPb.start(); @@ -385,7 +386,7 @@ class IgniteConfigStoreTest { } } } catch (Exception e) { - log.debug("Error checking parent process", e); + LOG.debug("Error checking parent process", e); } return false; } @@ -404,7 +405,7 @@ class IgniteConfigStoreTest { config.setBasePath(basePath); String configJson = ExternalTestBase.OBJECT_MAPPER.writeValueAsString(config); - log.info("Creating fetcher with Ignite ConfigStore (basePath={}): {}", basePath, configJson); + LOG.info("Creating fetcher with Ignite ConfigStore (basePath={}): {}", basePath, configJson); SaveFetcherReply saveReply = blockingStub.saveFetcher(SaveFetcherRequest .newBuilder() @@ -413,7 +414,7 @@ class IgniteConfigStoreTest { .setFetcherConfigJson(configJson) .build()); - log.info("Fetcher saved to Ignite: {}", saveReply.getFetcherId()); + LOG.info("Fetcher saved to Ignite: {}", saveReply.getFetcherId()); List<FetchAndParseReply> successes = Collections.synchronizedList(new ArrayList<>()); List<FetchAndParseReply> errors = Collections.synchronizedList(new ArrayList<>()); @@ -423,7 +424,7 @@ class IgniteConfigStoreTest { requestStreamObserver = tikaStub.fetchAndParseBiDirectionalStreaming(new StreamObserver<>() { @Override public void onNext(FetchAndParseReply fetchAndParseReply) { - log.debug("Reply from fetch-and-parse - key={}, status={}", + LOG.debug("Reply from fetch-and-parse - key={}, status={}", fetchAndParseReply.getFetchKey(), fetchAndParseReply.getStatus()); if ("FETCH_AND_PARSE_EXCEPTION".equals(fetchAndParseReply.getStatus())) { errors.add(fetchAndParseReply); @@ -434,20 +435,20 @@ class IgniteConfigStoreTest { @Override public void onError(Throwable throwable) { - log.error("Received an error", throwable); + LOG.error("Received an error", throwable); Assertions.fail(throwable); countDownLatch.countDown(); } @Override public void onCompleted() { - log.info("Finished streaming fetch and parse replies"); + LOG.info("Finished streaming fetch and parse replies"); countDownLatch.countDown(); } }); int maxDocs = Integer.parseInt(System.getProperty("corpus.numDocs", "-1")); - log.info("Document limit: {}", maxDocs == -1 ? "unlimited" : maxDocs); + LOG.info("Document limit: {}", maxDocs == -1 ? "unlimited" : maxDocs); try (Stream<Path> paths = Files.walk(TEST_FOLDER.toPath())) { Stream<Path> fileStream = paths @@ -473,13 +474,13 @@ class IgniteConfigStoreTest { } }); } - log.info("Done submitting files to Ignite-backed fetcher {}", fetcherId); + LOG.info("Done submitting files to Ignite-backed fetcher {}", fetcherId); requestStreamObserver.onCompleted(); try { if (!countDownLatch.await(3, TimeUnit.MINUTES)) { - log.error("Timed out waiting for parse to complete"); + LOG.error("Timed out waiting for parse to complete"); Assertions.fail("Timed out waiting for parsing to complete"); } } catch (InterruptedException e) { @@ -491,7 +492,7 @@ class IgniteConfigStoreTest { ExternalTestBase.assertAllFilesFetched(TEST_FOLDER.toPath(), successes, errors); } else { int totalProcessed = successes.size() + errors.size(); - log.info("Processed {} documents with Ignite ConfigStore (limit was {})", + LOG.info("Processed {} documents with Ignite ConfigStore (limit was {})", totalProcessed, maxDocs); Assertions.assertTrue(totalProcessed <= maxDocs, "Should not process more than " + maxDocs + " documents"); @@ -499,7 +500,7 @@ class IgniteConfigStoreTest { "Should have processed at least one document"); } - log.info("Ignite ConfigStore test completed successfully - {} successes, {} errors", + LOG.info("Ignite ConfigStore test completed successfully - {} successes, {} errors", successes.size(), errors.size()); } finally { channel.shutdown(); diff --git a/tika-parent/pom.xml b/tika-parent/pom.xml index bf1d0129af..fbc7ed8d3d 100644 --- a/tika-parent/pom.xml +++ b/tika-parent/pom.xml @@ -397,7 +397,6 @@ <kotlin-stdlib.version>2.4.0</kotlin-stdlib.version> <libpst.version>0.9.3</libpst.version> <log4j2.version>2.26.0</log4j2.version> - <lombok.version>1.18.46</lombok.version> <!-- can't update to 10, needs jdk21 --> <lucene.version>9.12.3</lucene.version> <maven.plugin.annotations.version>3.15.2</maven.plugin.annotations.version>
