Skip to content

Commit efd000f

Browse files
authored
Remove lombok e2e (#2925)
1 parent 822c87c commit efd000f

7 files changed

Lines changed: 95 additions & 115 deletions

File tree

tika-e2e-tests/pom.xml

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,6 @@
103103
<artifactId>jackson-databind</artifactId>
104104
<version>${jackson.version}</version>
105105
</dependency>
106-
107-
<!-- Lombok -->
108-
<dependency>
109-
<groupId>org.projectlombok</groupId>
110-
<artifactId>lombok</artifactId>
111-
<version>${lombok.version}</version>
112-
<optional>true</optional>
113-
</dependency>
114106
</dependencies>
115107
</dependencyManagement>
116108

@@ -123,15 +115,6 @@
123115
<version>3.15.0</version>
124116
<configuration>
125117
<release>17</release>
126-
<!-- maven-compiler-plugin 3.15 no longer auto-discovers classpath
127-
annotation processors; declare Lombok explicitly so @Slf4j runs. -->
128-
<annotationProcessorPaths>
129-
<path>
130-
<groupId>org.projectlombok</groupId>
131-
<artifactId>lombok</artifactId>
132-
<version>${lombok.version}</version>
133-
</path>
134-
</annotationProcessorPaths>
135118
</configuration>
136119
</plugin>
137120
<plugin>

tika-e2e-tests/tika-grpc/pom.xml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,6 @@
7070
<artifactId>jackson-databind</artifactId>
7171
</dependency>
7272

73-
<!-- Lombok -->
74-
<dependency>
75-
<groupId>org.projectlombok</groupId>
76-
<artifactId>lombok</artifactId>
77-
<optional>true</optional>
78-
</dependency>
79-
8073
<!-- JUnit 5 -->
8174
<dependency>
8275
<groupId>org.junit.jupiter</groupId>

tika-e2e-tests/tika-grpc/src/test/java/org/apache/tika/pipes/ExternalTestBase.java

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,13 @@
4343
import com.fasterxml.jackson.databind.ObjectMapper;
4444
import io.grpc.ManagedChannel;
4545
import io.grpc.ManagedChannelBuilder;
46-
import lombok.extern.slf4j.Slf4j;
4746
import org.junit.jupiter.api.AfterAll;
4847
import org.junit.jupiter.api.Assertions;
4948
import org.junit.jupiter.api.BeforeAll;
5049
import org.junit.jupiter.api.Tag;
5150
import org.junit.jupiter.api.TestInstance;
51+
import org.slf4j.Logger;
52+
import org.slf4j.LoggerFactory;
5253
import org.testcontainers.containers.DockerComposeContainer;
5354
import org.testcontainers.containers.output.Slf4jLogConsumer;
5455
import org.testcontainers.containers.wait.strategy.Wait;
@@ -60,9 +61,9 @@
6061

6162
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
6263
@Testcontainers
63-
@Slf4j
6464
@Tag("E2ETest")
6565
public abstract class ExternalTestBase {
66+
private static final Logger LOG = LoggerFactory.getLogger(ExternalTestBase.class);
6667
public static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
6768
public static final int MAX_STARTUP_TIMEOUT = 120;
6869
public static final String GOV_DOCS_FOLDER = "/tika/govdocs1";
@@ -88,7 +89,7 @@ static void setup() throws Exception {
8889
}
8990

9091
private static void startLocalGrpcServer() throws Exception {
91-
log.info("Starting local tika-grpc server using Maven exec");
92+
LOG.info("Starting local tika-grpc server using Maven exec");
9293

9394
Path tikaGrpcDir = findTikaGrpcDirectory();
9495
Path configFile = Path.of("src/test/resources/tika-config.json").toAbsolutePath();
@@ -97,8 +98,8 @@ private static void startLocalGrpcServer() throws Exception {
9798
throw new IllegalStateException("Config file not found: " + configFile);
9899
}
99100

100-
log.info("Using tika-grpc from: {}", tikaGrpcDir);
101-
log.info("Using config file: {}", configFile);
101+
LOG.info("Using tika-grpc from: {}", tikaGrpcDir);
102+
LOG.info("Using config file: {}", configFile);
102103

103104
String javaHome = System.getProperty("java.home");
104105
boolean isWindows = System.getProperty("os.name").toLowerCase(Locale.ROOT).contains("win");
@@ -131,18 +132,18 @@ private static void startLocalGrpcServer() throws Exception {
131132
new InputStreamReader(localGrpcProcess.getInputStream(), StandardCharsets.UTF_8))) {
132133
String line;
133134
while ((line = reader.readLine()) != null) {
134-
log.info("tika-grpc: {}", line);
135+
LOG.info("tika-grpc: {}", line);
135136
}
136137
} catch (IOException e) {
137-
log.error("Error reading server output", e);
138+
LOG.error("Error reading server output", e);
138139
}
139140
});
140141
logThread.setDaemon(true);
141142
logThread.start();
142143

143144
waitForServerReady();
144145

145-
log.info("Local tika-grpc server started successfully on port {}", GRPC_PORT);
146+
LOG.info("Local tika-grpc server started successfully on port {}", GRPC_PORT);
146147
}
147148

148149
private static Path findTikaGrpcDirectory() {
@@ -173,10 +174,10 @@ private static void waitForServerReady() throws Exception {
173174
try {
174175
TikaGrpc.TikaBlockingStub stub = TikaGrpc.newBlockingStub(testChannel);
175176
stub.listFetchers(ListFetchersRequest.newBuilder().build());
176-
log.info("gRPC server is ready");
177+
LOG.info("gRPC server is ready");
177178
return;
178179
} catch (Exception e) {
179-
log.trace("gRPC server not ready yet (attempt {}/{}): {}", i + 1, maxAttempts, e.getMessage());
180+
LOG.trace("gRPC server not ready yet (attempt {}/{}): {}", i + 1, maxAttempts, e.getMessage());
180181
} finally {
181182
testChannel.shutdown();
182183
testChannel.awaitTermination(1, TimeUnit.SECONDS);
@@ -191,7 +192,7 @@ private static void waitForServerReady() throws Exception {
191192
}
192193

193194
private static void startDockerGrpcServer() {
194-
log.info("Starting Docker Compose tika-grpc server");
195+
LOG.info("Starting Docker Compose tika-grpc server");
195196

196197
String composeFilePath = System.getProperty("tika.docker.compose.file");
197198
if (composeFilePath == null || composeFilePath.isBlank()) {
@@ -208,11 +209,11 @@ private static void startDockerGrpcServer() {
208209
.withStartupTimeout(Duration.of(MAX_STARTUP_TIMEOUT, ChronoUnit.SECONDS))
209210
.withExposedService("tika-grpc", 50052,
210211
Wait.forLogMessage(".*Server started.*\\n", 1))
211-
.withLogConsumer("tika-grpc", new Slf4jLogConsumer(log));
212+
.withLogConsumer("tika-grpc", new Slf4jLogConsumer(LOG));
212213

213214
composeContainer.start();
214215

215-
log.info("Docker Compose containers started successfully");
216+
LOG.info("Docker Compose containers started successfully");
216217
}
217218

218219
private static void loadGovdocs1() throws IOException, InterruptedException {
@@ -230,7 +231,7 @@ private static void loadGovdocs1() throws IOException, InterruptedException {
230231
if (attempt >= retries) {
231232
throw e;
232233
}
233-
log.warn("Download attempt {} failed, retrying in 10 seconds...", attempt, e);
234+
LOG.warn("Download attempt {} failed, retrying in 10 seconds...", attempt, e);
234235
TimeUnit.SECONDS.sleep(10);
235236
}
236237
}
@@ -253,13 +254,13 @@ public static void copyTestFixtures() throws IOException {
253254
Files.copy(in, targetDir.resolve(fixture), StandardCopyOption.REPLACE_EXISTING);
254255
}
255256
}
256-
log.info("Copied {} test fixtures to {}", fixtures.length, targetDir);
257+
LOG.info("Copied {} test fixtures to {}", fixtures.length, targetDir);
257258
}
258259

259260
@AfterAll
260261
void close() {
261262
if (USE_LOCAL_SERVER && localGrpcProcess != null) {
262-
log.info("Stopping local gRPC server");
263+
LOG.info("Stopping local gRPC server");
263264
localGrpcProcess.destroy();
264265
try {
265266
if (!localGrpcProcess.waitFor(10, TimeUnit.SECONDS)) {
@@ -284,14 +285,14 @@ public static void downloadAndUnzipGovdocs1(int fromIndex, int toIndex) throws I
284285
Path zipPath = targetDir.resolve(zipName);
285286

286287
if (Files.exists(zipPath)) {
287-
log.info("{} already exists, skipping download", zipName);
288+
LOG.info("{} already exists, skipping download", zipName);
288289
} else {
289-
log.info("Downloading {} from {}...", zipName, url);
290+
LOG.info("Downloading {} from {}...", zipName, url);
290291
try (InputStream in = new URL(url).openStream()) {
291292
Files.copy(in, zipPath, StandardCopyOption.REPLACE_EXISTING);
292293
}
293294
}
294-
log.info("Unzipping {}...", zipName);
295+
LOG.info("Unzipping {}...", zipName);
295296
try (ZipInputStream zis = new ZipInputStream(new FileInputStream(zipPath.toFile()))) {
296297
ZipEntry entry;
297298
while ((entry = zis.getNextEntry()) != null) {
@@ -309,7 +310,7 @@ public static void downloadAndUnzipGovdocs1(int fromIndex, int toIndex) throws I
309310
}
310311
}
311312

312-
log.info("Finished downloading and extracting govdocs1 files");
313+
LOG.info("Finished downloading and extracting govdocs1 files");
313314
}
314315

315316
public static void assertAllFilesFetched(Path baseDir, List<FetchAndParseReply> successes,
@@ -337,7 +338,7 @@ public static void assertAllFilesFetched(Path baseDir, List<FetchAndParseReply>
337338
}
338339

339340
Assertions.assertNotEquals(0, successes.size(), "Should have some successful fetches");
340-
log.info("Processed {} files: {} successes, {} errors", allFetchKeys.size(), successes.size(), errors.size());
341+
LOG.info("Processed {} files: {} successes, {} errors", allFetchKeys.size(), successes.size(), errors.size());
341342
Assertions.assertEquals(keysFromGovdocs1, allFetchKeys, () -> {
342343
Set<String> missing = new HashSet<>(keysFromGovdocs1);
343344
missing.removeAll(allFetchKeys);

tika-e2e-tests/tika-grpc/src/test/java/org/apache/tika/pipes/filesystem/FileSystemFetcherTest.java

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,12 @@
2727

2828
import io.grpc.ManagedChannel;
2929
import io.grpc.stub.StreamObserver;
30-
import lombok.extern.slf4j.Slf4j;
3130
import org.junit.jupiter.api.Assertions;
3231
import org.junit.jupiter.api.Test;
3332
import org.junit.jupiter.api.condition.DisabledOnOs;
3433
import org.junit.jupiter.api.condition.OS;
34+
import org.slf4j.Logger;
35+
import org.slf4j.LoggerFactory;
3536

3637
import org.apache.tika.FetchAndParseReply;
3738
import org.apache.tika.FetchAndParseRequest;
@@ -41,9 +42,10 @@
4142
import org.apache.tika.pipes.ExternalTestBase;
4243
import org.apache.tika.pipes.fetcher.fs.FileSystemFetcherConfig;
4344

44-
@Slf4j
4545
@DisabledOnOs(value = OS.WINDOWS, disabledReason = "exec:exec classpath exceeds Windows CreateProcess command-line length limit")
4646
class FileSystemFetcherTest extends ExternalTestBase {
47+
private static final Logger LOG = LoggerFactory.getLogger(FileSystemFetcherTest.class);
48+
4749

4850
@Test
4951
void testFileSystemFetcher() throws Exception {
@@ -59,7 +61,7 @@ void testFileSystemFetcher() throws Exception {
5961
config.setBasePath(basePath);
6062

6163
String configJson = OBJECT_MAPPER.writeValueAsString(config);
62-
log.info("Creating fetcher with config (basePath={}): {}", basePath, configJson);
64+
LOG.info("Creating fetcher with config (basePath={}): {}", basePath, configJson);
6365

6466
SaveFetcherReply saveReply = blockingStub.saveFetcher(SaveFetcherRequest
6567
.newBuilder()
@@ -68,7 +70,7 @@ void testFileSystemFetcher() throws Exception {
6870
.setFetcherConfigJson(configJson)
6971
.build());
7072

71-
log.info("Fetcher created: {}", saveReply.getFetcherId());
73+
LOG.info("Fetcher created: {}", saveReply.getFetcherId());
7274

7375
List<FetchAndParseReply> successes = Collections.synchronizedList(new ArrayList<>());
7476
List<FetchAndParseReply> errors = Collections.synchronizedList(new ArrayList<>());
@@ -78,7 +80,7 @@ void testFileSystemFetcher() throws Exception {
7880
requestStreamObserver = tikaStub.fetchAndParseBiDirectionalStreaming(new StreamObserver<>() {
7981
@Override
8082
public void onNext(FetchAndParseReply fetchAndParseReply) {
81-
log.debug("Reply from fetch-and-parse - key={}, status={}",
83+
LOG.debug("Reply from fetch-and-parse - key={}, status={}",
8284
fetchAndParseReply.getFetchKey(), fetchAndParseReply.getStatus());
8385
if ("FETCH_AND_PARSE_EXCEPTION".equals(fetchAndParseReply.getStatus())) {
8486
errors.add(fetchAndParseReply);
@@ -89,14 +91,14 @@ public void onNext(FetchAndParseReply fetchAndParseReply) {
8991

9092
@Override
9193
public void onError(Throwable throwable) {
92-
log.error("Received an error", throwable);
94+
LOG.error("Received an error", throwable);
9395
Assertions.fail(throwable);
9496
countDownLatch.countDown();
9597
}
9698

9799
@Override
98100
public void onCompleted() {
99-
log.info("Finished streaming fetch and parse replies");
101+
LOG.info("Finished streaming fetch and parse replies");
100102
countDownLatch.countDown();
101103
}
102104
});
@@ -122,13 +124,13 @@ public void onCompleted() {
122124
}
123125
});
124126
}
125-
log.info("Done submitting files to fetcher {}", fetcherId);
127+
LOG.info("Done submitting files to fetcher {}", fetcherId);
126128

127129
requestStreamObserver.onCompleted();
128130

129131
try {
130132
if (!countDownLatch.await(3, TimeUnit.MINUTES)) {
131-
log.error("Timed out waiting for parse to complete");
133+
LOG.error("Timed out waiting for parse to complete");
132134
Assertions.fail("Timed out waiting for parsing to complete");
133135
}
134136
} catch (InterruptedException e) {
@@ -140,14 +142,14 @@ public void onCompleted() {
140142
assertAllFilesFetched(TEST_FOLDER.toPath(), successes, errors);
141143
} else {
142144
int totalProcessed = successes.size() + errors.size();
143-
log.info("Processed {} documents (limit was {})", totalProcessed, maxDocs);
145+
LOG.info("Processed {} documents (limit was {})", totalProcessed, maxDocs);
144146
Assertions.assertTrue(totalProcessed <= maxDocs,
145147
"Should not process more than " + maxDocs + " documents");
146148
Assertions.assertTrue(totalProcessed > 0,
147149
"Should have processed at least one document");
148150
}
149151

150-
log.info("Test completed successfully - {} successes, {} errors",
152+
LOG.info("Test completed successfully - {} successes, {} errors",
151153
successes.size(), errors.size());
152154
} finally {
153155
channel.shutdown();

0 commit comments

Comments
 (0)