|
|
|
|
@@ -31,7 +31,7 @@ import java.util.Map;
|
|
|
|
|
import static org.junit.jupiter.api.Assertions.*;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Tests for {@link BatchRunProcessingUseCase}.
|
|
|
|
|
* Tests for {@link DefaultBatchRunProcessingUseCase}.
|
|
|
|
|
* <p>
|
|
|
|
|
* Covers:
|
|
|
|
|
* <ul>
|
|
|
|
|
@@ -57,7 +57,7 @@ class BatchRunProcessingUseCaseTest {
|
|
|
|
|
MockRunLockPort lockPort = new MockRunLockPort();
|
|
|
|
|
StartConfiguration config = buildConfig(tempDir);
|
|
|
|
|
|
|
|
|
|
BatchRunProcessingUseCase useCase = new BatchRunProcessingUseCase(
|
|
|
|
|
DefaultBatchRunProcessingUseCase useCase = new DefaultBatchRunProcessingUseCase(
|
|
|
|
|
config, lockPort, new EmptyCandidatesPort(), new NoOpExtractionPort());
|
|
|
|
|
BatchRunContext context = new BatchRunContext(new RunId("test-run-1"), Instant.now());
|
|
|
|
|
|
|
|
|
|
@@ -73,7 +73,7 @@ class BatchRunProcessingUseCaseTest {
|
|
|
|
|
CountingRunLockPort lockPort = new CountingRunLockPort(true);
|
|
|
|
|
StartConfiguration config = buildConfig(tempDir);
|
|
|
|
|
|
|
|
|
|
BatchRunProcessingUseCase useCase = new BatchRunProcessingUseCase(
|
|
|
|
|
DefaultBatchRunProcessingUseCase useCase = new DefaultBatchRunProcessingUseCase(
|
|
|
|
|
config, lockPort, new EmptyCandidatesPort(), new NoOpExtractionPort());
|
|
|
|
|
BatchRunContext context = new BatchRunContext(new RunId("test-run-2"), Instant.now());
|
|
|
|
|
|
|
|
|
|
@@ -92,7 +92,7 @@ class BatchRunProcessingUseCaseTest {
|
|
|
|
|
CountingRunLockPort lockPort = new CountingRunLockPort(true);
|
|
|
|
|
StartConfiguration config = buildConfig(tempDir);
|
|
|
|
|
|
|
|
|
|
BatchRunProcessingUseCase useCase = new BatchRunProcessingUseCase(
|
|
|
|
|
DefaultBatchRunProcessingUseCase useCase = new DefaultBatchRunProcessingUseCase(
|
|
|
|
|
config, lockPort, new EmptyCandidatesPort(), new NoOpExtractionPort());
|
|
|
|
|
BatchRunContext context = new BatchRunContext(new RunId("test-run-f1"), Instant.now());
|
|
|
|
|
|
|
|
|
|
@@ -108,7 +108,7 @@ class BatchRunProcessingUseCaseTest {
|
|
|
|
|
ErrorAfterAcquireLockPort lockPort = new ErrorAfterAcquireLockPort();
|
|
|
|
|
StartConfiguration config = buildConfig(tempDir);
|
|
|
|
|
|
|
|
|
|
BatchRunProcessingUseCase useCase = new BatchRunProcessingUseCase(
|
|
|
|
|
DefaultBatchRunProcessingUseCase useCase = new DefaultBatchRunProcessingUseCase(
|
|
|
|
|
config, lockPort, new EmptyCandidatesPort(), new NoOpExtractionPort());
|
|
|
|
|
BatchRunContext context = new BatchRunContext(new RunId("test-run-3"), Instant.now());
|
|
|
|
|
|
|
|
|
|
@@ -128,7 +128,7 @@ class BatchRunProcessingUseCaseTest {
|
|
|
|
|
MockRunLockPort lockPort = new MockRunLockPort();
|
|
|
|
|
StartConfiguration config = buildConfig(tempDir);
|
|
|
|
|
|
|
|
|
|
BatchRunProcessingUseCase useCase = new BatchRunProcessingUseCase(
|
|
|
|
|
DefaultBatchRunProcessingUseCase useCase = new DefaultBatchRunProcessingUseCase(
|
|
|
|
|
config, lockPort, new EmptyCandidatesPort(), new NoOpExtractionPort());
|
|
|
|
|
BatchRunContext context = new BatchRunContext(new RunId("empty"), Instant.now());
|
|
|
|
|
|
|
|
|
|
@@ -148,7 +148,7 @@ class BatchRunProcessingUseCaseTest {
|
|
|
|
|
FixedCandidatesPort candidatesPort = new FixedCandidatesPort(List.of(candidate));
|
|
|
|
|
FixedExtractionPort extractionPort = new FixedExtractionPort(success);
|
|
|
|
|
|
|
|
|
|
BatchRunProcessingUseCase useCase = new BatchRunProcessingUseCase(
|
|
|
|
|
DefaultBatchRunProcessingUseCase useCase = new DefaultBatchRunProcessingUseCase(
|
|
|
|
|
config, lockPort, candidatesPort, extractionPort);
|
|
|
|
|
BatchRunContext context = new BatchRunContext(new RunId("happy"), Instant.now());
|
|
|
|
|
|
|
|
|
|
@@ -170,7 +170,7 @@ class BatchRunProcessingUseCaseTest {
|
|
|
|
|
FixedCandidatesPort candidatesPort = new FixedCandidatesPort(List.of(candidate));
|
|
|
|
|
FixedExtractionPort extractionPort = new FixedExtractionPort(emptySuccess);
|
|
|
|
|
|
|
|
|
|
BatchRunProcessingUseCase useCase = new BatchRunProcessingUseCase(
|
|
|
|
|
DefaultBatchRunProcessingUseCase useCase = new DefaultBatchRunProcessingUseCase(
|
|
|
|
|
config, lockPort, candidatesPort, extractionPort);
|
|
|
|
|
BatchRunContext context = new BatchRunContext(new RunId("no-text"), Instant.now());
|
|
|
|
|
|
|
|
|
|
@@ -191,7 +191,7 @@ class BatchRunProcessingUseCaseTest {
|
|
|
|
|
FixedCandidatesPort candidatesPort = new FixedCandidatesPort(List.of(candidate));
|
|
|
|
|
FixedExtractionPort extractionPort = new FixedExtractionPort(manyPages);
|
|
|
|
|
|
|
|
|
|
BatchRunProcessingUseCase useCase = new BatchRunProcessingUseCase(
|
|
|
|
|
DefaultBatchRunProcessingUseCase useCase = new DefaultBatchRunProcessingUseCase(
|
|
|
|
|
config, lockPort, candidatesPort, extractionPort);
|
|
|
|
|
BatchRunContext context = new BatchRunContext(new RunId("page-limit"), Instant.now());
|
|
|
|
|
|
|
|
|
|
@@ -211,7 +211,7 @@ class BatchRunProcessingUseCaseTest {
|
|
|
|
|
FixedCandidatesPort candidatesPort = new FixedCandidatesPort(List.of(candidate));
|
|
|
|
|
FixedExtractionPort extractionPort = new FixedExtractionPort(contentError);
|
|
|
|
|
|
|
|
|
|
BatchRunProcessingUseCase useCase = new BatchRunProcessingUseCase(
|
|
|
|
|
DefaultBatchRunProcessingUseCase useCase = new DefaultBatchRunProcessingUseCase(
|
|
|
|
|
config, lockPort, candidatesPort, extractionPort);
|
|
|
|
|
BatchRunContext context = new BatchRunContext(new RunId("content-error"), Instant.now());
|
|
|
|
|
|
|
|
|
|
@@ -230,7 +230,7 @@ class BatchRunProcessingUseCaseTest {
|
|
|
|
|
FixedCandidatesPort candidatesPort = new FixedCandidatesPort(List.of(candidate));
|
|
|
|
|
FixedExtractionPort extractionPort = new FixedExtractionPort(technicalError);
|
|
|
|
|
|
|
|
|
|
BatchRunProcessingUseCase useCase = new BatchRunProcessingUseCase(
|
|
|
|
|
DefaultBatchRunProcessingUseCase useCase = new DefaultBatchRunProcessingUseCase(
|
|
|
|
|
config, lockPort, candidatesPort, extractionPort);
|
|
|
|
|
BatchRunContext context = new BatchRunContext(new RunId("tech-error"), Instant.now());
|
|
|
|
|
|
|
|
|
|
@@ -248,7 +248,7 @@ class BatchRunProcessingUseCaseTest {
|
|
|
|
|
throw new SourceDocumentAccessException("Source folder not readable");
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
BatchRunProcessingUseCase useCase = new BatchRunProcessingUseCase(
|
|
|
|
|
DefaultBatchRunProcessingUseCase useCase = new DefaultBatchRunProcessingUseCase(
|
|
|
|
|
config, lockPort, failingPort, new NoOpExtractionPort());
|
|
|
|
|
BatchRunContext context = new BatchRunContext(new RunId("access-fail"), Instant.now());
|
|
|
|
|
|
|
|
|
|
@@ -287,7 +287,7 @@ class BatchRunProcessingUseCaseTest {
|
|
|
|
|
.with(technicalErrorCandidate, new PdfExtractionTechnicalError("I/O error", null))
|
|
|
|
|
.with(contentErrorCandidate, new PdfExtractionContentError("PDF is encrypted"));
|
|
|
|
|
|
|
|
|
|
BatchRunProcessingUseCase useCase = new BatchRunProcessingUseCase(
|
|
|
|
|
DefaultBatchRunProcessingUseCase useCase = new DefaultBatchRunProcessingUseCase(
|
|
|
|
|
config, lockPort, candidatesPort, extractionPort);
|
|
|
|
|
BatchRunContext context = new BatchRunContext(new RunId("mixed"), Instant.now());
|
|
|
|
|
|
|
|
|
|
@@ -313,7 +313,7 @@ class BatchRunProcessingUseCaseTest {
|
|
|
|
|
FixedCandidatesPort candidatesPort = new FixedCandidatesPort(candidates);
|
|
|
|
|
FixedExtractionPort extractionPort = new FixedExtractionPort(success);
|
|
|
|
|
|
|
|
|
|
BatchRunProcessingUseCase useCase = new BatchRunProcessingUseCase(
|
|
|
|
|
DefaultBatchRunProcessingUseCase useCase = new DefaultBatchRunProcessingUseCase(
|
|
|
|
|
config, lockPort, candidatesPort, extractionPort);
|
|
|
|
|
BatchRunContext context = new BatchRunContext(new RunId("multi"), Instant.now());
|
|
|
|
|
|
|
|
|
|
|