diff --git a/java-packages-inventory.txt b/java-packages-inventory.txt new file mode 100644 index 0000000..d5faaa8 --- /dev/null +++ b/java-packages-inventory.txt @@ -0,0 +1,68 @@ +pdf-umbenenner-adapter-in-cli/src/main/java/de/gecheckt/pdf/umbenenner/adapter/inbound/cli/package-info.java | de.gecheckt.pdf.umbenenner.adapter.inbound.cli | | +pdf-umbenenner-adapter-in-cli/src/main/java/de/gecheckt/pdf/umbenenner/adapter/inbound/cli/SchedulerBatchCommand.java | de.gecheckt.pdf.umbenenner.adapter.inbound.cli | class | SchedulerBatchCommand +pdf-umbenenner-adapter-in-cli/src/test/java/de/gecheckt/pdf/umbenenner/adapter/inbound/cli/SchedulerBatchCommandTest.java | de.gecheckt.pdf.umbenenner.adapter.inbound.cli | class | SchedulerBatchCommandTest +pdf-umbenenner-adapter-out/src/main/java/de/gecheckt/pdf/umbenenner/adapter/outbound/configuration/package-info.java | de.gecheckt.pdf.umbenenner.adapter.outbound.configuration | | +pdf-umbenenner-adapter-out/src/main/java/de/gecheckt/pdf/umbenenner/adapter/outbound/configuration/PropertiesConfigurationPortAdapter.java | de.gecheckt.pdf.umbenenner.adapter.outbound.configuration | class | PropertiesConfigurationPortAdapter +pdf-umbenenner-adapter-out/src/main/java/de/gecheckt/pdf/umbenenner/adapter/outbound/lock/FilesystemRunLockPortAdapter.java | de.gecheckt.pdf.umbenenner.adapter.outbound.lock | class | FilesystemRunLockPortAdapter +pdf-umbenenner-adapter-out/src/main/java/de/gecheckt/pdf/umbenenner/adapter/outbound/lock/package-info.java | de.gecheckt.pdf.umbenenner.adapter.outbound.lock | | +pdf-umbenenner-adapter-out/src/main/java/de/gecheckt/pdf/umbenenner/adapter/outbound/package-info.java | de.gecheckt.pdf.umbenenner.adapter.outbound | | +pdf-umbenenner-adapter-out/src/main/java/de/gecheckt/pdf/umbenenner/adapter/outbound/pdfextraction/package-info.java | de.gecheckt.pdf.umbenenner.adapter.outbound.pdfextraction | | +pdf-umbenenner-adapter-out/src/main/java/de/gecheckt/pdf/umbenenner/adapter/outbound/pdfextraction/PdfTextExtractionPortAdapter.java | de.gecheckt.pdf.umbenenner.adapter.outbound.pdfextraction | class | PdfTextExtractionPortAdapter +pdf-umbenenner-adapter-out/src/main/java/de/gecheckt/pdf/umbenenner/adapter/outbound/sourcedocument/package-info.java | de.gecheckt.pdf.umbenenner.adapter.outbound.sourcedocument | | +pdf-umbenenner-adapter-out/src/main/java/de/gecheckt/pdf/umbenenner/adapter/outbound/sourcedocument/SourceDocumentCandidatesPortAdapter.java | de.gecheckt.pdf.umbenenner.adapter.outbound.sourcedocument | class | SourceDocumentCandidatesPortAdapter +pdf-umbenenner-adapter-out/src/test/java/de/gecheckt/pdf/umbenenner/adapter/outbound/configuration/PropertiesConfigurationPortAdapterTest.java | de.gecheckt.pdf.umbenenner.adapter.outbound.configuration | class | PropertiesConfigurationPortAdapterTest +pdf-umbenenner-adapter-out/src/test/java/de/gecheckt/pdf/umbenenner/adapter/outbound/lock/FilesystemRunLockPortAdapterTest.java | de.gecheckt.pdf.umbenenner.adapter.outbound.lock | class | FilesystemRunLockPortAdapterTest +pdf-umbenenner-adapter-out/src/test/java/de/gecheckt/pdf/umbenenner/adapter/outbound/pdfextraction/PdfTextExtractionPortAdapterTest.java | de.gecheckt.pdf.umbenenner.adapter.outbound.pdfextraction | class | PdfTextExtractionPortAdapterTest +pdf-umbenenner-adapter-out/src/test/java/de/gecheckt/pdf/umbenenner/adapter/outbound/sourcedocument/SourceDocumentCandidatesPortAdapterTest.java | de.gecheckt.pdf.umbenenner.adapter.outbound.sourcedocument | class | SourceDocumentCandidatesPortAdapterTest +pdf-umbenenner-application/src/main/java/de/gecheckt/pdf/umbenenner/application/config/InvalidStartConfigurationException.java | de.gecheckt.pdf.umbenenner.application.config | class | InvalidStartConfigurationException +pdf-umbenenner-application/src/main/java/de/gecheckt/pdf/umbenenner/application/config/package-info.java | de.gecheckt.pdf.umbenenner.application.config | | +pdf-umbenenner-application/src/main/java/de/gecheckt/pdf/umbenenner/application/config/StartConfiguration.java | de.gecheckt.pdf.umbenenner.application.config | record | StartConfiguration +pdf-umbenenner-application/src/main/java/de/gecheckt/pdf/umbenenner/application/config/StartConfigurationValidator.java | de.gecheckt.pdf.umbenenner.application.config | class | StartConfigurationValidator +pdf-umbenenner-application/src/main/java/de/gecheckt/pdf/umbenenner/application/package-info.java | de.gecheckt.pdf.umbenenner.application | | +pdf-umbenenner-application/src/main/java/de/gecheckt/pdf/umbenenner/application/port/in/BatchRunOutcome.java | de.gecheckt.pdf.umbenenner.application.port.in | enum | BatchRunOutcome +pdf-umbenenner-application/src/main/java/de/gecheckt/pdf/umbenenner/application/port/in/package-info.java | de.gecheckt.pdf.umbenenner.application.port.in | | +pdf-umbenenner-application/src/main/java/de/gecheckt/pdf/umbenenner/application/port/in/RunBatchProcessingUseCase.java | de.gecheckt.pdf.umbenenner.application.port.in | interface | RunBatchProcessingUseCase +pdf-umbenenner-application/src/main/java/de/gecheckt/pdf/umbenenner/application/port/out/ClockPort.java | de.gecheckt.pdf.umbenenner.application.port.out | interface | ClockPort +pdf-umbenenner-application/src/main/java/de/gecheckt/pdf/umbenenner/application/port/out/ConfigurationPort.java | de.gecheckt.pdf.umbenenner.application.port.out | interface | ConfigurationPort +pdf-umbenenner-application/src/main/java/de/gecheckt/pdf/umbenenner/application/port/out/package-info.java | de.gecheckt.pdf.umbenenner.application.port.out | | +pdf-umbenenner-application/src/main/java/de/gecheckt/pdf/umbenenner/application/port/out/PdfTextExtractionPort.java | de.gecheckt.pdf.umbenenner.application.port.out | interface | PdfTextExtractionPort +pdf-umbenenner-application/src/main/java/de/gecheckt/pdf/umbenenner/application/port/out/RunLockPort.java | de.gecheckt.pdf.umbenenner.application.port.out | interface | RunLockPort +pdf-umbenenner-application/src/main/java/de/gecheckt/pdf/umbenenner/application/port/out/RunLockUnavailableException.java | de.gecheckt.pdf.umbenenner.application.port.out | class | RunLockUnavailableException +pdf-umbenenner-application/src/main/java/de/gecheckt/pdf/umbenenner/application/port/out/SourceDocumentAccessException.java | de.gecheckt.pdf.umbenenner.application.port.out | | +pdf-umbenenner-application/src/main/java/de/gecheckt/pdf/umbenenner/application/port/out/SourceDocumentCandidatesPort.java | de.gecheckt.pdf.umbenenner.application.port.out | interface | SourceDocumentCandidatesPort +pdf-umbenenner-application/src/main/java/de/gecheckt/pdf/umbenenner/application/service/M3DocumentProcessingService.java | de.gecheckt.pdf.umbenenner.application.service | class | M3DocumentProcessingService +pdf-umbenenner-application/src/main/java/de/gecheckt/pdf/umbenenner/application/service/M3PreCheckEvaluator.java | de.gecheckt.pdf.umbenenner.application.service | class | M3PreCheckEvaluator +pdf-umbenenner-application/src/main/java/de/gecheckt/pdf/umbenenner/application/service/package-info.java | de.gecheckt.pdf.umbenenner.application.service | | +pdf-umbenenner-application/src/main/java/de/gecheckt/pdf/umbenenner/application/usecase/M2BatchRunProcessingUseCase.java | de.gecheckt.pdf.umbenenner.application.usecase | class | M2BatchRunProcessingUseCase +pdf-umbenenner-application/src/main/java/de/gecheckt/pdf/umbenenner/application/usecase/package-info.java | de.gecheckt.pdf.umbenenner.application.usecase | | +pdf-umbenenner-application/src/test/java/de/gecheckt/pdf/umbenenner/application/config/StartConfigurationValidatorTest.java | de.gecheckt.pdf.umbenenner.application.config | class | StartConfigurationValidatorTest +pdf-umbenenner-application/src/test/java/de/gecheckt/pdf/umbenenner/application/service/M3DocumentProcessingServiceTest.java | de.gecheckt.pdf.umbenenner.application.service | class | M3DocumentProcessingServiceTest +pdf-umbenenner-application/src/test/java/de/gecheckt/pdf/umbenenner/application/service/M3PreCheckEvaluatorTest.java | de.gecheckt.pdf.umbenenner.application.service | class | M3PreCheckEvaluatorTest +pdf-umbenenner-application/src/test/java/de/gecheckt/pdf/umbenenner/application/usecase/M2BatchRunProcessingUseCaseTest.java | de.gecheckt.pdf.umbenenner.application.usecase | class | M2BatchRunProcessingUseCaseTest +pdf-umbenenner-bootstrap/src/main/java/de/gecheckt/pdf/umbenenner/bootstrap/BootstrapRunner.java | de.gecheckt.pdf.umbenenner.bootstrap | class | BootstrapRunner +pdf-umbenenner-bootstrap/src/main/java/de/gecheckt/pdf/umbenenner/bootstrap/package-info.java | de.gecheckt.pdf.umbenenner.bootstrap | | +pdf-umbenenner-bootstrap/src/main/java/de/gecheckt/pdf/umbenenner/bootstrap/PdfUmbenennerApplication.java | de.gecheckt.pdf.umbenenner.bootstrap | class | PdfUmbenennerApplication +pdf-umbenenner-bootstrap/src/test/java/de/gecheckt/pdf/umbenenner/bootstrap/BootstrapRunnerTest.java | de.gecheckt.pdf.umbenenner.bootstrap | class | BootstrapRunnerTest +pdf-umbenenner-bootstrap/src/test/java/de/gecheckt/pdf/umbenenner/bootstrap/ExecutableJarSmokeTestIT.java | de.gecheckt.pdf.umbenenner.bootstrap | class | ExecutableJarSmokeTestIT +pdf-umbenenner-domain/src/main/java/de/gecheckt/pdf/umbenenner/domain/model/BatchRunContext.java | de.gecheckt.pdf.umbenenner.domain.model | | +pdf-umbenenner-domain/src/main/java/de/gecheckt/pdf/umbenenner/domain/model/M3DocumentProcessingOutcome.java | de.gecheckt.pdf.umbenenner.domain.model | | +pdf-umbenenner-domain/src/main/java/de/gecheckt/pdf/umbenenner/domain/model/M3PreCheckFailed.java | de.gecheckt.pdf.umbenenner.domain.model | record | M3PreCheckFailed +pdf-umbenenner-domain/src/main/java/de/gecheckt/pdf/umbenenner/domain/model/M3PreCheckFailureReason.java | de.gecheckt.pdf.umbenenner.domain.model | enum | M3PreCheckFailureReason +pdf-umbenenner-domain/src/main/java/de/gecheckt/pdf/umbenenner/domain/model/M3PreCheckPassed.java | de.gecheckt.pdf.umbenenner.domain.model | record | M3PreCheckPassed +pdf-umbenenner-domain/src/main/java/de/gecheckt/pdf/umbenenner/domain/model/M3ProcessingDecision.java | de.gecheckt.pdf.umbenenner.domain.model | | +pdf-umbenenner-domain/src/main/java/de/gecheckt/pdf/umbenenner/domain/model/M3TechnicalDocumentError.java | de.gecheckt.pdf.umbenenner.domain.model | record | M3TechnicalDocumentError +pdf-umbenenner-domain/src/main/java/de/gecheckt/pdf/umbenenner/domain/model/package-info.java | de.gecheckt.pdf.umbenenner.domain.model | | +pdf-umbenenner-domain/src/main/java/de/gecheckt/pdf/umbenenner/domain/model/PdfExtractionContentError.java | de.gecheckt.pdf.umbenenner.domain.model | record | PdfExtractionContentError +pdf-umbenenner-domain/src/main/java/de/gecheckt/pdf/umbenenner/domain/model/PdfExtractionResult.java | de.gecheckt.pdf.umbenenner.domain.model | | +pdf-umbenenner-domain/src/main/java/de/gecheckt/pdf/umbenenner/domain/model/PdfExtractionSuccess.java | de.gecheckt.pdf.umbenenner.domain.model | record | PdfExtractionSuccess +pdf-umbenenner-domain/src/main/java/de/gecheckt/pdf/umbenenner/domain/model/PdfExtractionTechnicalError.java | de.gecheckt.pdf.umbenenner.domain.model | record | PdfExtractionTechnicalError +pdf-umbenenner-domain/src/main/java/de/gecheckt/pdf/umbenenner/domain/model/PdfPageCount.java | de.gecheckt.pdf.umbenenner.domain.model | record | PdfPageCount +pdf-umbenenner-domain/src/main/java/de/gecheckt/pdf/umbenenner/domain/model/ProcessingStatus.java | de.gecheckt.pdf.umbenenner.domain.model | enum | ProcessingStatus +pdf-umbenenner-domain/src/main/java/de/gecheckt/pdf/umbenenner/domain/model/RunId.java | de.gecheckt.pdf.umbenenner.domain.model | | +pdf-umbenenner-domain/src/main/java/de/gecheckt/pdf/umbenenner/domain/model/SourceDocumentCandidate.java | de.gecheckt.pdf.umbenenner.domain.model | record | SourceDocumentCandidate +pdf-umbenenner-domain/src/main/java/de/gecheckt/pdf/umbenenner/domain/model/SourceDocumentLocator.java | de.gecheckt.pdf.umbenenner.domain.model | record | SourceDocumentLocator +pdf-umbenenner-domain/src/main/java/de/gecheckt/pdf/umbenenner/domain/package-info.java | de.gecheckt.pdf.umbenenner.domain | | +pdf-umbenenner-domain/src/test/java/de/gecheckt/pdf/umbenenner/domain/model/BatchRunContextTest.java | de.gecheckt.pdf.umbenenner.domain.model | class | BatchRunContextTest +pdf-umbenenner-domain/src/test/java/de/gecheckt/pdf/umbenenner/domain/model/M3DocumentProcessingOutcomeTest.java | de.gecheckt.pdf.umbenenner.domain.model | class | M3DocumentProcessingOutcomeTest +pdf-umbenenner-domain/src/test/java/de/gecheckt/pdf/umbenenner/domain/model/ProcessingStatusTest.java | de.gecheckt.pdf.umbenenner.domain.model | class | ProcessingStatusTest +pdf-umbenenner-domain/src/test/java/de/gecheckt/pdf/umbenenner/domain/model/RunIdTest.java | de.gecheckt.pdf.umbenenner.domain.model | class | RunIdTest diff --git a/pdf-umbenenner-application/src/main/java/de/gecheckt/pdf/umbenenner/application/service/M3DocumentProcessingService.java b/pdf-umbenenner-application/src/main/java/de/gecheckt/pdf/umbenenner/application/service/DocumentProcessingService.java similarity index 59% rename from pdf-umbenenner-application/src/main/java/de/gecheckt/pdf/umbenenner/application/service/M3DocumentProcessingService.java rename to pdf-umbenenner-application/src/main/java/de/gecheckt/pdf/umbenenner/application/service/DocumentProcessingService.java index 0734d3f..7144b0a 100644 --- a/pdf-umbenenner-application/src/main/java/de/gecheckt/pdf/umbenenner/application/service/M3DocumentProcessingService.java +++ b/pdf-umbenenner-application/src/main/java/de/gecheckt/pdf/umbenenner/application/service/DocumentProcessingService.java @@ -1,8 +1,8 @@ package de.gecheckt.pdf.umbenenner.application.service; import de.gecheckt.pdf.umbenenner.application.config.StartConfiguration; -import de.gecheckt.pdf.umbenenner.domain.model.M3DocumentProcessingOutcome; -import de.gecheckt.pdf.umbenenner.domain.model.M3TechnicalDocumentError; +import de.gecheckt.pdf.umbenenner.domain.model.DocumentProcessingOutcome; +import de.gecheckt.pdf.umbenenner.domain.model.TechnicalDocumentError; import de.gecheckt.pdf.umbenenner.domain.model.PdfExtractionContentError; import de.gecheckt.pdf.umbenenner.domain.model.PdfExtractionResult; import de.gecheckt.pdf.umbenenner.domain.model.PdfExtractionSuccess; @@ -12,45 +12,43 @@ import de.gecheckt.pdf.umbenenner.domain.model.SourceDocumentCandidate; import java.util.Objects; /** - * Orchestrates M3 document processing pipeline: extraction → pre-checks → outcome classification. + * Orchestrates document processing pipeline: extraction → pre-checks → outcome classification. *
- * Converts technical extraction results into M3 processing outcomes through this pipeline: + * Converts technical extraction results into processing outcomes through this pipeline: *
- * This service produces {@link M3DocumentProcessingOutcome}, a sealed interface that covers - * all four M3 document processing outcomes: + * This service produces {@link DocumentProcessingOutcome}, a sealed interface that covers + * all document processing outcomes: *
* This service is stateless and thread-safe. - * - * @since M3-AP-006 */ -public class M3DocumentProcessingService { +public class DocumentProcessingService { /** - * Processes a document candidate through the complete M3 pipeline. + * Processes a document candidate through the complete pipeline. *
* Pipeline: *
- * M3 Pre-checks verify that: + * Pre-checks verify that: *
- * A document that passes both pre-checks is ready to proceed to M4 and later milestones. + * A document that passes both pre-checks is ready to proceed to further processing steps. * A document that fails a pre-check is classified with a specific deterministic failure reason * and will not proceed further in the current batch run. *
* This service is stateless and thread-safe. - * - * @since M3-AP-004 */ -public class M3PreCheckEvaluator { +public class PreCheckEvaluator { /** - * Evaluates M3 pre-checks for a successfully extracted PDF document. + * Evaluates pre-checks for a successfully extracted PDF document. *
* Pre-check logic: *
- * Returns {@link M3PreCheckPassed} if both checks pass, or {@link M3PreCheckFailed} + * Returns {@link PreCheckPassed} if both checks pass, or {@link PreCheckFailed} * with a specific reason if any check fails. *
- * Note: Returns {@link M3DocumentProcessingOutcome} to integrate cleanly with the complete - * M3 document processing pipeline. + * Note: Returns {@link DocumentProcessingOutcome} to integrate cleanly with the complete + * document processing pipeline. * * @param candidate the source document metadata * @param extraction the successfully extracted PDF content * @param configuration the startup configuration (used for maxPages limit) - * @return the pre-check outcome: passed or failed with reason (both implement {@link M3DocumentProcessingOutcome}) + * @return the pre-check outcome: passed or failed with reason (both implement {@link DocumentProcessingOutcome}) * @throws NullPointerException if any parameter is null */ - public static M3DocumentProcessingOutcome evaluate( + public static DocumentProcessingOutcome evaluate( SourceDocumentCandidate candidate, PdfExtractionSuccess extraction, StartConfiguration configuration) { @@ -61,28 +59,28 @@ public class M3PreCheckEvaluator { // Pre-check 1: Verify document has usable text if (!hasUsableText(extraction.extractedText())) { - return new M3PreCheckFailed( + return new PreCheckFailed( candidate, - M3PreCheckFailureReason.NO_USABLE_TEXT.getDescription() + PreCheckFailureReason.NO_USABLE_TEXT.getDescription() ); } // Pre-check 2: Verify document page count does not exceed configured limit if (extraction.pageCount().exceedsLimit(configuration.maxPages())) { - return new M3PreCheckFailed( + return new PreCheckFailed( candidate, - M3PreCheckFailureReason.PAGE_LIMIT_EXCEEDED.getDescription() + PreCheckFailureReason.PAGE_LIMIT_EXCEEDED.getDescription() ); } // All pre-checks passed - return new M3PreCheckPassed(candidate, extraction); + return new PreCheckPassed(candidate, extraction); } /** * Determines whether the extracted text contains at least one meaningful character. *
- * Definition of "usable text" for M3: + * Definition of "usable text": *
- * Orchestrates the complete M3 batch processing workflow: + * Orchestrates the complete batch processing workflow: *
- * M3 processing boundary: + * Processing boundary: *
- * M3 Non-Goals (not implemented): + * Non-Goals (not implemented): *
- * M3 processing steps per document: + * Processing steps per document: *
* Per-document errors (extraction failure, technical error, pre-check failure) do not abort the overall * batch run. Each candidate ends controlled regardless of its outcome. *
- * M3 processing boundary: no KI call, no persistence, no filename generation, + * Processing boundary: no KI call, no persistence, no filename generation, * no target file copy is initiated here, even for candidates that pass all pre-checks. * * @param candidate the candidate to process @@ -179,20 +177,20 @@ public class M2BatchRunProcessingUseCase implements RunBatchProcessingUseCase { candidate.uniqueIdentifier(), technicalError.errorMessage()); } - // Process through complete M3 pipeline - var m3Outcome = M3DocumentProcessingService.processDocument(candidate, extractionResult, configuration); + // Process through complete pipeline + var outcome = DocumentProcessingService.processDocument(candidate, extractionResult, configuration); - // Log M3 processing outcome - switch (m3Outcome) { - case M3PreCheckPassed passed -> - LOG.info("M3 pre-checks PASSED for '{}'. Candidate ready for further processing (M4+).", + // Log processing outcome + switch (outcome) { + case PreCheckPassed passed -> + LOG.info("Pre-checks PASSED for '{}'. Candidate ready for further processing.", candidate.uniqueIdentifier()); - case M3PreCheckFailed failed -> - LOG.info("M3 pre-checks FAILED for '{}': {} (Deterministic content error – may retry in later run).", + case PreCheckFailed failed -> + LOG.info("Pre-checks FAILED for '{}': {} (Deterministic content error – may retry in later run).", candidate.uniqueIdentifier(), failed.failureReason()); - case M3TechnicalDocumentError technicalError -> - LOG.warn("M3 processing FAILED for '{}': {} (Technical error – may retry in later run).", + case TechnicalDocumentError technicalError -> + LOG.warn("Processing FAILED for '{}': {} (Technical error – may retry in later run).", candidate.uniqueIdentifier(), technicalError.errorMessage()); } } -} +} \ No newline at end of file diff --git a/pdf-umbenenner-application/src/main/java/de/gecheckt/pdf/umbenenner/application/usecase/package-info.java b/pdf-umbenenner-application/src/main/java/de/gecheckt/pdf/umbenenner/application/usecase/package-info.java index ce885f0..bae7f68 100644 --- a/pdf-umbenenner-application/src/main/java/de/gecheckt/pdf/umbenenner/application/usecase/package-info.java +++ b/pdf-umbenenner-application/src/main/java/de/gecheckt/pdf/umbenenner/application/usecase/package-info.java @@ -5,8 +5,8 @@ *
* All implementations are infrastructure-agnostic and interact only through ports. diff --git a/pdf-umbenenner-application/src/test/java/de/gecheckt/pdf/umbenenner/application/service/M3DocumentProcessingServiceTest.java b/pdf-umbenenner-application/src/test/java/de/gecheckt/pdf/umbenenner/application/service/DocumentProcessingServiceTest.java similarity index 69% rename from pdf-umbenenner-application/src/test/java/de/gecheckt/pdf/umbenenner/application/service/M3DocumentProcessingServiceTest.java rename to pdf-umbenenner-application/src/test/java/de/gecheckt/pdf/umbenenner/application/service/DocumentProcessingServiceTest.java index 881287f..8fc1bc4 100644 --- a/pdf-umbenenner-application/src/test/java/de/gecheckt/pdf/umbenenner/application/service/M3DocumentProcessingServiceTest.java +++ b/pdf-umbenenner-application/src/test/java/de/gecheckt/pdf/umbenenner/application/service/DocumentProcessingServiceTest.java @@ -1,10 +1,10 @@ package de.gecheckt.pdf.umbenenner.application.service; import de.gecheckt.pdf.umbenenner.application.config.StartConfiguration; -import de.gecheckt.pdf.umbenenner.domain.model.M3DocumentProcessingOutcome; -import de.gecheckt.pdf.umbenenner.domain.model.M3PreCheckFailed; -import de.gecheckt.pdf.umbenenner.domain.model.M3PreCheckPassed; -import de.gecheckt.pdf.umbenenner.domain.model.M3TechnicalDocumentError; +import de.gecheckt.pdf.umbenenner.domain.model.DocumentProcessingOutcome; +import de.gecheckt.pdf.umbenenner.domain.model.PreCheckFailed; +import de.gecheckt.pdf.umbenenner.domain.model.PreCheckPassed; +import de.gecheckt.pdf.umbenenner.domain.model.TechnicalDocumentError; import de.gecheckt.pdf.umbenenner.domain.model.PdfExtractionContentError; import de.gecheckt.pdf.umbenenner.domain.model.PdfExtractionSuccess; import de.gecheckt.pdf.umbenenner.domain.model.PdfExtractionTechnicalError; @@ -23,11 +23,11 @@ import java.nio.file.Path; import static org.junit.jupiter.api.Assertions.*; /** - * Tests for {@link M3DocumentProcessingService}. + * Tests for {@link DocumentProcessingService}. *
- * Verifies that all four M3 document processing outcomes are correctly classified. + * Verifies that all document processing outcomes are correctly classified. */ -class M3DocumentProcessingServiceTest { +class DocumentProcessingServiceTest { @TempDir Path tempDir; @@ -75,12 +75,12 @@ class M3DocumentProcessingServiceTest { var extraction = new PdfExtractionSuccess("This is valid PDF text", new PdfPageCount(5)); // Act - M3DocumentProcessingOutcome outcome = M3DocumentProcessingService.processDocument( + DocumentProcessingOutcome outcome = DocumentProcessingService.processDocument( candidate, extraction, configuration); - // Assert: Should produce M3PreCheckPassed - assertInstanceOf(M3PreCheckPassed.class, outcome); - M3PreCheckPassed passed = (M3PreCheckPassed) outcome; + // Assert: Should produce PreCheckPassed + assertInstanceOf(PreCheckPassed.class, outcome); + PreCheckPassed passed = (PreCheckPassed) outcome; assertEquals(candidate, passed.candidate()); assertEquals(extraction, passed.extraction()); } @@ -91,12 +91,12 @@ class M3DocumentProcessingServiceTest { var extraction = new PdfExtractionSuccess(" \n \t ", new PdfPageCount(1)); // Act - M3DocumentProcessingOutcome outcome = M3DocumentProcessingService.processDocument( + DocumentProcessingOutcome outcome = DocumentProcessingService.processDocument( candidate, extraction, configuration); - // Assert: Should produce M3PreCheckFailed with appropriate reason - assertInstanceOf(M3PreCheckFailed.class, outcome); - M3PreCheckFailed failed = (M3PreCheckFailed) outcome; + // Assert: Should produce PreCheckFailed with appropriate reason + assertInstanceOf(PreCheckFailed.class, outcome); + PreCheckFailed failed = (PreCheckFailed) outcome; assertEquals(candidate, failed.candidate()); assertTrue(failed.failureReason().toLowerCase().contains("usable")); } @@ -107,28 +107,28 @@ class M3DocumentProcessingServiceTest { var extraction = new PdfExtractionSuccess("Valid text content", new PdfPageCount(50)); // Act - M3DocumentProcessingOutcome outcome = M3DocumentProcessingService.processDocument( + DocumentProcessingOutcome outcome = DocumentProcessingService.processDocument( candidate, extraction, configuration); - // Assert: Should produce M3PreCheckFailed with page limit reason - assertInstanceOf(M3PreCheckFailed.class, outcome); - M3PreCheckFailed failed = (M3PreCheckFailed) outcome; + // Assert: Should produce PreCheckFailed with page limit reason + assertInstanceOf(PreCheckFailed.class, outcome); + PreCheckFailed failed = (PreCheckFailed) outcome; assertEquals(candidate, failed.candidate()); assertTrue(failed.failureReason().toLowerCase().contains("page")); } @Test void testProcessDocument_WithContentError() { - // Arrange: PDF content not extractable (classified as technical document error in M3) + // Arrange: PDF content not extractable (classified as technical document error) var contentError = new PdfExtractionContentError("PDF is corrupted"); // Act - M3DocumentProcessingOutcome outcome = M3DocumentProcessingService.processDocument( + DocumentProcessingOutcome outcome = DocumentProcessingService.processDocument( candidate, contentError, configuration); - // Assert: Should produce M3TechnicalDocumentError - assertInstanceOf(M3TechnicalDocumentError.class, outcome); - M3TechnicalDocumentError result = (M3TechnicalDocumentError) outcome; + // Assert: Should produce TechnicalDocumentError + assertInstanceOf(TechnicalDocumentError.class, outcome); + TechnicalDocumentError result = (TechnicalDocumentError) outcome; assertEquals(candidate, result.candidate()); assertTrue(result.errorMessage().contains("PDF is corrupted")); } @@ -140,12 +140,12 @@ class M3DocumentProcessingServiceTest { new RuntimeException("File not found")); // Act - M3DocumentProcessingOutcome outcome = M3DocumentProcessingService.processDocument( + DocumentProcessingOutcome outcome = DocumentProcessingService.processDocument( candidate, technicalError, configuration); - // Assert: Should produce M3TechnicalDocumentError - assertInstanceOf(M3TechnicalDocumentError.class, outcome); - M3TechnicalDocumentError result = (M3TechnicalDocumentError) outcome; + // Assert: Should produce TechnicalDocumentError + assertInstanceOf(TechnicalDocumentError.class, outcome); + TechnicalDocumentError result = (TechnicalDocumentError) outcome; assertEquals(candidate, result.candidate()); assertEquals("I/O error reading file", result.errorMessage()); assertNotNull(result.cause()); @@ -157,12 +157,12 @@ class M3DocumentProcessingServiceTest { var technicalError = new PdfExtractionTechnicalError("Unknown error", null); // Act - M3DocumentProcessingOutcome outcome = M3DocumentProcessingService.processDocument( + DocumentProcessingOutcome outcome = DocumentProcessingService.processDocument( candidate, technicalError, configuration); // Assert - assertInstanceOf(M3TechnicalDocumentError.class, outcome); - M3TechnicalDocumentError result = (M3TechnicalDocumentError) outcome; + assertInstanceOf(TechnicalDocumentError.class, outcome); + TechnicalDocumentError result = (TechnicalDocumentError) outcome; assertNull(result.cause()); } @@ -173,14 +173,14 @@ class M3DocumentProcessingServiceTest { // Act & Assert assertThrows(NullPointerException.class, - () -> M3DocumentProcessingService.processDocument(null, extraction, configuration)); + () -> DocumentProcessingService.processDocument(null, extraction, configuration)); } @Test void testProcessDocument_WithNullExtractionResult_ThrowsException() { // Act & Assert assertThrows(NullPointerException.class, - () -> M3DocumentProcessingService.processDocument(candidate, null, configuration)); + () -> DocumentProcessingService.processDocument(candidate, null, configuration)); } @Test @@ -190,6 +190,6 @@ class M3DocumentProcessingServiceTest { // Act & Assert assertThrows(NullPointerException.class, - () -> M3DocumentProcessingService.processDocument(candidate, extraction, null)); + () -> DocumentProcessingService.processDocument(candidate, extraction, null)); } -} +} \ No newline at end of file diff --git a/pdf-umbenenner-application/src/test/java/de/gecheckt/pdf/umbenenner/application/service/M3PreCheckEvaluatorTest.java b/pdf-umbenenner-application/src/test/java/de/gecheckt/pdf/umbenenner/application/service/PreCheckEvaluatorTest.java similarity index 64% rename from pdf-umbenenner-application/src/test/java/de/gecheckt/pdf/umbenenner/application/service/M3PreCheckEvaluatorTest.java rename to pdf-umbenenner-application/src/test/java/de/gecheckt/pdf/umbenenner/application/service/PreCheckEvaluatorTest.java index 794f358..35bc3f0 100644 --- a/pdf-umbenenner-application/src/test/java/de/gecheckt/pdf/umbenenner/application/service/M3PreCheckEvaluatorTest.java +++ b/pdf-umbenenner-application/src/test/java/de/gecheckt/pdf/umbenenner/application/service/PreCheckEvaluatorTest.java @@ -1,10 +1,10 @@ package de.gecheckt.pdf.umbenenner.application.service; import de.gecheckt.pdf.umbenenner.application.config.StartConfiguration; -import de.gecheckt.pdf.umbenenner.domain.model.M3DocumentProcessingOutcome; -import de.gecheckt.pdf.umbenenner.domain.model.M3PreCheckFailed; -import de.gecheckt.pdf.umbenenner.domain.model.M3PreCheckFailureReason; -import de.gecheckt.pdf.umbenenner.domain.model.M3PreCheckPassed; +import de.gecheckt.pdf.umbenenner.domain.model.DocumentProcessingOutcome; +import de.gecheckt.pdf.umbenenner.domain.model.PreCheckFailed; +import de.gecheckt.pdf.umbenenner.domain.model.PreCheckFailureReason; +import de.gecheckt.pdf.umbenenner.domain.model.PreCheckPassed; import de.gecheckt.pdf.umbenenner.domain.model.PdfExtractionSuccess; import de.gecheckt.pdf.umbenenner.domain.model.PdfPageCount; import de.gecheckt.pdf.umbenenner.domain.model.SourceDocumentCandidate; @@ -20,11 +20,11 @@ import java.nio.file.Path; import static org.junit.jupiter.api.Assertions.*; /** - * Tests for {@link M3PreCheckEvaluator}. + * Tests for {@link PreCheckEvaluator}. *
- * Verifies correct M3 pre-check logic for usable text and page limit validation. + * Verifies correct pre-check logic for usable text and page limit validation. */ -class M3PreCheckEvaluatorTest { +class PreCheckEvaluatorTest { @TempDir Path tempDir; @@ -35,10 +35,10 @@ class M3PreCheckEvaluatorTest { SourceDocumentCandidate candidate = buildCandidate(); PdfExtractionSuccess extraction = new PdfExtractionSuccess("Some meaningful text", new PdfPageCount(5)); - M3DocumentProcessingOutcome result = M3PreCheckEvaluator.evaluate(candidate, extraction, config); + DocumentProcessingOutcome result = PreCheckEvaluator.evaluate(candidate, extraction, config); - assertTrue(result instanceof M3PreCheckPassed, "Should pass when text is usable and page count is valid"); - M3PreCheckPassed passed = (M3PreCheckPassed) result; + assertTrue(result instanceof PreCheckPassed, "Should pass when text is usable and page count is valid"); + PreCheckPassed passed = (PreCheckPassed) result; assertSame(passed.candidate(), candidate, "Candidate should be preserved"); assertSame(passed.extraction(), extraction, "Extraction should be preserved"); } @@ -49,11 +49,11 @@ class M3PreCheckEvaluatorTest { SourceDocumentCandidate candidate = buildCandidate(); PdfExtractionSuccess extraction = new PdfExtractionSuccess("", new PdfPageCount(1)); - M3DocumentProcessingOutcome result = M3PreCheckEvaluator.evaluate(candidate, extraction, config); + DocumentProcessingOutcome result = PreCheckEvaluator.evaluate(candidate, extraction, config); - assertTrue(result instanceof M3PreCheckFailed, "Should fail with empty text"); - M3PreCheckFailed failed = (M3PreCheckFailed) result; - assertEquals(M3PreCheckFailureReason.NO_USABLE_TEXT.getDescription(), failed.failureReason()); + assertTrue(result instanceof PreCheckFailed, "Should fail with empty text"); + PreCheckFailed failed = (PreCheckFailed) result; + assertEquals(PreCheckFailureReason.NO_USABLE_TEXT.getDescription(), failed.failureReason()); } @Test @@ -62,11 +62,11 @@ class M3PreCheckEvaluatorTest { SourceDocumentCandidate candidate = buildCandidate(); PdfExtractionSuccess extraction = new PdfExtractionSuccess(" \n\t \r\n ", new PdfPageCount(1)); - M3DocumentProcessingOutcome result = M3PreCheckEvaluator.evaluate(candidate, extraction, config); + DocumentProcessingOutcome result = PreCheckEvaluator.evaluate(candidate, extraction, config); - assertTrue(result instanceof M3PreCheckFailed, "Should fail with whitespace-only text"); - M3PreCheckFailed failed = (M3PreCheckFailed) result; - assertEquals(M3PreCheckFailureReason.NO_USABLE_TEXT.getDescription(), failed.failureReason()); + assertTrue(result instanceof PreCheckFailed, "Should fail with whitespace-only text"); + PreCheckFailed failed = (PreCheckFailed) result; + assertEquals(PreCheckFailureReason.NO_USABLE_TEXT.getDescription(), failed.failureReason()); } @Test @@ -75,11 +75,11 @@ class M3PreCheckEvaluatorTest { SourceDocumentCandidate candidate = buildCandidate(); PdfExtractionSuccess extraction = new PdfExtractionSuccess("!@#$%^&*()_+-=[]{}|;:',.<>?/", new PdfPageCount(1)); - M3DocumentProcessingOutcome result = M3PreCheckEvaluator.evaluate(candidate, extraction, config); + DocumentProcessingOutcome result = PreCheckEvaluator.evaluate(candidate, extraction, config); - assertTrue(result instanceof M3PreCheckFailed, "Should fail with special characters only"); - M3PreCheckFailed failed = (M3PreCheckFailed) result; - assertEquals(M3PreCheckFailureReason.NO_USABLE_TEXT.getDescription(), failed.failureReason()); + assertTrue(result instanceof PreCheckFailed, "Should fail with special characters only"); + PreCheckFailed failed = (PreCheckFailed) result; + assertEquals(PreCheckFailureReason.NO_USABLE_TEXT.getDescription(), failed.failureReason()); } @Test @@ -88,9 +88,9 @@ class M3PreCheckEvaluatorTest { SourceDocumentCandidate candidate = buildCandidate(); PdfExtractionSuccess extraction = new PdfExtractionSuccess("a", new PdfPageCount(1)); - M3DocumentProcessingOutcome result = M3PreCheckEvaluator.evaluate(candidate, extraction, config); + DocumentProcessingOutcome result = PreCheckEvaluator.evaluate(candidate, extraction, config); - assertTrue(result instanceof M3PreCheckPassed, "Should pass with single letter"); + assertTrue(result instanceof PreCheckPassed, "Should pass with single letter"); } @Test @@ -99,9 +99,9 @@ class M3PreCheckEvaluatorTest { SourceDocumentCandidate candidate = buildCandidate(); PdfExtractionSuccess extraction = new PdfExtractionSuccess("5", new PdfPageCount(1)); - M3DocumentProcessingOutcome result = M3PreCheckEvaluator.evaluate(candidate, extraction, config); + DocumentProcessingOutcome result = PreCheckEvaluator.evaluate(candidate, extraction, config); - assertTrue(result instanceof M3PreCheckPassed, "Should pass with single digit"); + assertTrue(result instanceof PreCheckPassed, "Should pass with single digit"); } @Test @@ -110,9 +110,9 @@ class M3PreCheckEvaluatorTest { SourceDocumentCandidate candidate = buildCandidate(); PdfExtractionSuccess extraction = new PdfExtractionSuccess("!@#a$%^&*", new PdfPageCount(1)); - M3DocumentProcessingOutcome result = M3PreCheckEvaluator.evaluate(candidate, extraction, config); + DocumentProcessingOutcome result = PreCheckEvaluator.evaluate(candidate, extraction, config); - assertTrue(result instanceof M3PreCheckPassed, "Should pass when letters/digits are present among special chars"); + assertTrue(result instanceof PreCheckPassed, "Should pass when letters/digits are present among special chars"); } @Test @@ -121,9 +121,9 @@ class M3PreCheckEvaluatorTest { SourceDocumentCandidate candidate = buildCandidate(); PdfExtractionSuccess extraction = new PdfExtractionSuccess(" meaningful text ", new PdfPageCount(1)); - M3DocumentProcessingOutcome result = M3PreCheckEvaluator.evaluate(candidate, extraction, config); + DocumentProcessingOutcome result = PreCheckEvaluator.evaluate(candidate, extraction, config); - assertTrue(result instanceof M3PreCheckPassed, "Should pass when text has meaningful content despite whitespace"); + assertTrue(result instanceof PreCheckPassed, "Should pass when text has meaningful content despite whitespace"); } @Test @@ -132,9 +132,9 @@ class M3PreCheckEvaluatorTest { SourceDocumentCandidate candidate = buildCandidate(); PdfExtractionSuccess extraction = new PdfExtractionSuccess("Valid text", new PdfPageCount(5)); - M3DocumentProcessingOutcome result = M3PreCheckEvaluator.evaluate(candidate, extraction, config); + DocumentProcessingOutcome result = PreCheckEvaluator.evaluate(candidate, extraction, config); - assertTrue(result instanceof M3PreCheckPassed, "Should pass when page count equals limit (not exceeded)"); + assertTrue(result instanceof PreCheckPassed, "Should pass when page count equals limit (not exceeded)"); } @Test @@ -143,11 +143,11 @@ class M3PreCheckEvaluatorTest { SourceDocumentCandidate candidate = buildCandidate(); PdfExtractionSuccess extraction = new PdfExtractionSuccess("Valid text", new PdfPageCount(6)); - M3DocumentProcessingOutcome result = M3PreCheckEvaluator.evaluate(candidate, extraction, config); + DocumentProcessingOutcome result = PreCheckEvaluator.evaluate(candidate, extraction, config); - assertTrue(result instanceof M3PreCheckFailed, "Should fail when page count exceeds limit"); - M3PreCheckFailed failed = (M3PreCheckFailed) result; - assertEquals(M3PreCheckFailureReason.PAGE_LIMIT_EXCEEDED.getDescription(), failed.failureReason()); + assertTrue(result instanceof PreCheckFailed, "Should fail when page count exceeds limit"); + PreCheckFailed failed = (PreCheckFailed) result; + assertEquals(PreCheckFailureReason.PAGE_LIMIT_EXCEEDED.getDescription(), failed.failureReason()); } @Test @@ -156,11 +156,11 @@ class M3PreCheckEvaluatorTest { SourceDocumentCandidate candidate = buildCandidate(); PdfExtractionSuccess extraction = new PdfExtractionSuccess("Excellent meaningful text with lots of content", new PdfPageCount(100)); - M3DocumentProcessingOutcome result = M3PreCheckEvaluator.evaluate(candidate, extraction, config); + DocumentProcessingOutcome result = PreCheckEvaluator.evaluate(candidate, extraction, config); - assertTrue(result instanceof M3PreCheckFailed, "Should fail with page limit exceeded even if text is good"); - M3PreCheckFailed failed = (M3PreCheckFailed) result; - assertEquals(M3PreCheckFailureReason.PAGE_LIMIT_EXCEEDED.getDescription(), failed.failureReason()); + assertTrue(result instanceof PreCheckFailed, "Should fail with page limit exceeded even if text is good"); + PreCheckFailed failed = (PreCheckFailed) result; + assertEquals(PreCheckFailureReason.PAGE_LIMIT_EXCEEDED.getDescription(), failed.failureReason()); } @Test @@ -171,11 +171,11 @@ class M3PreCheckEvaluatorTest { SourceDocumentCandidate candidate = buildCandidate(); PdfExtractionSuccess extraction = new PdfExtractionSuccess("", new PdfPageCount(10)); - M3DocumentProcessingOutcome result = M3PreCheckEvaluator.evaluate(candidate, extraction, config); + DocumentProcessingOutcome result = PreCheckEvaluator.evaluate(candidate, extraction, config); - assertTrue(result instanceof M3PreCheckFailed, "Should fail when both checks fail"); - // The specific order of checks doesn't matter for M3; just verify one reason is returned - M3PreCheckFailed failed = (M3PreCheckFailed) result; + assertTrue(result instanceof PreCheckFailed, "Should fail when both checks fail"); + // The specific order of checks doesn't matter; just verify one reason is returned + PreCheckFailed failed = (PreCheckFailed) result; assertNotNull(failed.failureReason()); assertFalse(failed.failureReason().isEmpty()); } @@ -186,7 +186,7 @@ class M3PreCheckEvaluatorTest { PdfExtractionSuccess extraction = new PdfExtractionSuccess("Valid text", new PdfPageCount(1)); assertThrows(NullPointerException.class, () -> - M3PreCheckEvaluator.evaluate(null, extraction, config) + PreCheckEvaluator.evaluate(null, extraction, config) ); } @@ -196,7 +196,7 @@ class M3PreCheckEvaluatorTest { SourceDocumentCandidate candidate = buildCandidate(); assertThrows(NullPointerException.class, () -> - M3PreCheckEvaluator.evaluate(candidate, null, config) + PreCheckEvaluator.evaluate(candidate, null, config) ); } @@ -206,7 +206,7 @@ class M3PreCheckEvaluatorTest { PdfExtractionSuccess extraction = new PdfExtractionSuccess("Valid text", new PdfPageCount(1)); assertThrows(NullPointerException.class, () -> - M3PreCheckEvaluator.evaluate(candidate, extraction, null) + PreCheckEvaluator.evaluate(candidate, extraction, null) ); } @@ -216,9 +216,9 @@ class M3PreCheckEvaluatorTest { SourceDocumentCandidate candidate = buildCandidate(); PdfExtractionSuccess extraction = new PdfExtractionSuccess("Äußerst äöüß Großes", new PdfPageCount(1)); - M3DocumentProcessingOutcome result = M3PreCheckEvaluator.evaluate(candidate, extraction, config); + DocumentProcessingOutcome result = PreCheckEvaluator.evaluate(candidate, extraction, config); - assertTrue(result instanceof M3PreCheckPassed, "Should pass with German umlauts (ÄÖÜß)"); + assertTrue(result instanceof PreCheckPassed, "Should pass with German umlauts (ÄÖÜß)"); } @Test @@ -227,9 +227,9 @@ class M3PreCheckEvaluatorTest { SourceDocumentCandidate candidate = buildCandidate(); PdfExtractionSuccess extraction = new PdfExtractionSuccess("Αβγδ 中文 καλημέρα", new PdfPageCount(1)); - M3DocumentProcessingOutcome result = M3PreCheckEvaluator.evaluate(candidate, extraction, config); + DocumentProcessingOutcome result = PreCheckEvaluator.evaluate(candidate, extraction, config); - assertTrue(result instanceof M3PreCheckPassed, "Should pass with Greek, Chinese, and other Unicode letters"); + assertTrue(result instanceof PreCheckPassed, "Should pass with Greek, Chinese, and other Unicode letters"); } // ========================================================================= @@ -273,4 +273,4 @@ class M3PreCheckEvaluatorTest { SourceDocumentLocator locator = new SourceDocumentLocator(pdfFile.toString()); return new SourceDocumentCandidate(pdfFile.getFileName().toString(), 0L, locator); } -} +} \ No newline at end of file diff --git a/pdf-umbenenner-application/src/test/java/de/gecheckt/pdf/umbenenner/application/usecase/M2BatchRunProcessingUseCaseTest.java b/pdf-umbenenner-application/src/test/java/de/gecheckt/pdf/umbenenner/application/usecase/BatchRunProcessingUseCaseTest.java similarity index 86% rename from pdf-umbenenner-application/src/test/java/de/gecheckt/pdf/umbenenner/application/usecase/M2BatchRunProcessingUseCaseTest.java rename to pdf-umbenenner-application/src/test/java/de/gecheckt/pdf/umbenenner/application/usecase/BatchRunProcessingUseCaseTest.java index 8f344ed..2ae28b9 100644 --- a/pdf-umbenenner-application/src/test/java/de/gecheckt/pdf/umbenenner/application/usecase/M2BatchRunProcessingUseCaseTest.java +++ b/pdf-umbenenner-application/src/test/java/de/gecheckt/pdf/umbenenner/application/usecase/BatchRunProcessingUseCaseTest.java @@ -31,25 +31,25 @@ import java.util.Map; import static org.junit.jupiter.api.Assertions.*; /** - * Tests for {@link M2BatchRunProcessingUseCase}. + * Tests for {@link BatchRunProcessingUseCase}. *
* Covers: *
- * Exit code semantics (M3): + * Exit code semantics: *
- * Wires the full M3 processing pipeline: + * Wires the full processing pipeline: *
+ * This interface models all possible document outcomes: + *
+ * Design principles: + *
+ * Error classification: + *
- * This interface models all four possible M3 document outcomes: - *
- * Design principles: - *
- * Error classification: - *
- * This interface introduced in AP-001 establishes the architectural - * pattern for M3 pre-check results. The actual pre-check logic (fachlich validation - * such as "brauchbarer Text" and "Seitenlimit") is implemented in AP-004 via - * {@link de.gecheckt.pdf.umbenenner.application.service.M3PreCheckEvaluator}. - *
- * There are two allowed implementations: - *
- * Design principles: - *
* This result encapsulates: *
- * These are the deterministic content errors that can occur during M3 pre-check evaluation. + * These are the deterministic content errors that can occur during pre-check evaluation. * They distinguish between failures in the document content versus technical extraction failures. *
* Deterministic content errors: @@ -12,19 +12,17 @@ package de.gecheckt.pdf.umbenenner.domain.model; *
- * Note: Technical extraction failures (I/O errors, PDFBox failures) are not M3 pre-check reasons; + * Note: Technical extraction failures (I/O errors, PDFBox failures) are not pre-check reasons; * they are represented as {@link PdfExtractionTechnicalError} in the extraction result. - * - * @since M3-AP-004 */ -public enum M3PreCheckFailureReason { +public enum PreCheckFailureReason { /** * The extracted PDF text, after normalization, contains no letters or digits. *
* This is a deterministic content error: reprocessing the same file in a later run * will have the same outcome unless the source file is changed. *
- * In M3, retry logic: exactly 1 retry in a later batch run. + * Retry logic: exactly 1 retry in a later batch run. */ NO_USABLE_TEXT("No usable text in extracted PDF content"), @@ -33,13 +31,13 @@ public enum M3PreCheckFailureReason { *
* This is a deterministic content error: the page count will not change unless the source file is modified. *
- * In M3, retry logic: exactly 1 retry in a later batch run. + * Retry logic: exactly 1 retry in a later batch run. */ PAGE_LIMIT_EXCEEDED("Document page count exceeds configured limit"); private final String description; - M3PreCheckFailureReason(String description) { + PreCheckFailureReason(String description) { this.description = description; } @@ -51,4 +49,4 @@ public enum M3PreCheckFailureReason { public String getDescription() { return description; } -} +} \ No newline at end of file diff --git a/pdf-umbenenner-domain/src/main/java/de/gecheckt/pdf/umbenenner/domain/model/M3PreCheckPassed.java b/pdf-umbenenner-domain/src/main/java/de/gecheckt/pdf/umbenenner/domain/model/PreCheckPassed.java similarity index 75% rename from pdf-umbenenner-domain/src/main/java/de/gecheckt/pdf/umbenenner/domain/model/M3PreCheckPassed.java rename to pdf-umbenenner-domain/src/main/java/de/gecheckt/pdf/umbenenner/domain/model/PreCheckPassed.java index 1a2b7af..a92c17a 100644 --- a/pdf-umbenenner-domain/src/main/java/de/gecheckt/pdf/umbenenner/domain/model/M3PreCheckPassed.java +++ b/pdf-umbenenner-domain/src/main/java/de/gecheckt/pdf/umbenenner/domain/model/PreCheckPassed.java @@ -3,7 +3,7 @@ package de.gecheckt.pdf.umbenenner.domain.model; import java.util.Objects; /** - * Represents a document that passed all M3 pre-checks. + * Represents a document that passed all pre-checks. *
* This result encapsulates: *
- * A document with this decision is ready to proceed to M4 and later milestones + * A document with this decision is ready to proceed to further processing steps * (fingerprinting, persistence, KI integration, filename generation, target copy). * * @param candidate the source document metadata * @param extraction the successful text extraction result - * @since M3-AP-001 */ -public record M3PreCheckPassed( +public record PreCheckPassed( SourceDocumentCandidate candidate, PdfExtractionSuccess extraction -) implements M3ProcessingDecision, M3DocumentProcessingOutcome { +) implements ProcessingDecision, DocumentProcessingOutcome { /** * Constructor with validation. * @@ -29,8 +28,8 @@ public record M3PreCheckPassed( * @param extraction must be non-null * @throws NullPointerException if either parameter is null */ - public M3PreCheckPassed { + public PreCheckPassed { Objects.requireNonNull(candidate, "candidate must not be null"); Objects.requireNonNull(extraction, "extraction must not be null"); } -} +} \ No newline at end of file diff --git a/pdf-umbenenner-domain/src/main/java/de/gecheckt/pdf/umbenenner/domain/model/ProcessingDecision.java b/pdf-umbenenner-domain/src/main/java/de/gecheckt/pdf/umbenenner/domain/model/ProcessingDecision.java new file mode 100644 index 0000000..05fdcf6 --- /dev/null +++ b/pdf-umbenenner-domain/src/main/java/de/gecheckt/pdf/umbenenner/domain/model/ProcessingDecision.java @@ -0,0 +1,27 @@ +package de.gecheckt.pdf.umbenenner.domain.model; + +/** + * Sealed interface representing the outcome of document pre-checks. + *
+ * This interface establishes the architectural pattern for pre-check results. + * The actual pre-check logic (fachlich validation such as "brauchbarer Text" and "Seitenlimit") + * is implemented via {@link de.gecheckt.pdf.umbenenner.application.service.PreCheckEvaluator}. + *
+ * There are two allowed implementations: + *
+ * Design principles: + *
- * This is distinct from {@link M3ExtractedContentError}, which represents problems with the document + * This is distinct from content errors, which represent problems with the document * content itself rather than infrastructure failures. * * @param candidate the source document metadata * @param errorMessage a description of the technical failure * @param cause the underlying exception, if any (may be null) - * @since M3-AP-006 */ -public record M3TechnicalDocumentError( +public record TechnicalDocumentError( SourceDocumentCandidate candidate, String errorMessage, Throwable cause -) implements M3DocumentProcessingOutcome { +) implements DocumentProcessingOutcome { /** * Constructor with validation. * @@ -42,11 +41,11 @@ public record M3TechnicalDocumentError( * @throws NullPointerException if candidate or errorMessage is null * @throws IllegalArgumentException if errorMessage is empty */ - public M3TechnicalDocumentError { + public TechnicalDocumentError { Objects.requireNonNull(candidate, "candidate must not be null"); Objects.requireNonNull(errorMessage, "errorMessage must not be null"); if (errorMessage.isEmpty()) { throw new IllegalArgumentException("errorMessage must not be empty"); } } -} +} \ No newline at end of file diff --git a/pdf-umbenenner-domain/src/main/java/de/gecheckt/pdf/umbenenner/domain/model/package-info.java b/pdf-umbenenner-domain/src/main/java/de/gecheckt/pdf/umbenenner/domain/model/package-info.java index b02e82f..f0c785f 100644 --- a/pdf-umbenenner-domain/src/main/java/de/gecheckt/pdf/umbenenner/domain/model/package-info.java +++ b/pdf-umbenenner-domain/src/main/java/de/gecheckt/pdf/umbenenner/domain/model/package-info.java @@ -3,34 +3,34 @@ *
* This package contains the fundamental domain entities and status models required for document processing: *
- * Additional classes introduced in M3: + * Additional classes: *
+ * Verifies that all outcome types are properly created and validated. + */ +class DocumentProcessingOutcomeTest { + + @TempDir + Path tempDir; + + private SourceDocumentCandidate candidate; + + @BeforeEach + void setUp() throws Exception { + Path pdfFile = tempDir.resolve("doc.pdf"); + Files.createFile(pdfFile); + SourceDocumentLocator locator = new SourceDocumentLocator(pdfFile.toString()); + candidate = new SourceDocumentCandidate("doc.pdf", 1024L, locator); + } + + + @Test + void testTechnicalDocumentError_ValidConstruction() { + // Act + var error = new TechnicalDocumentError(candidate, "I/O error", null); + + // Assert + assertEquals(candidate, error.candidate()); + assertEquals("I/O error", error.errorMessage()); + assertNull(error.cause()); + } + + @Test + void testTechnicalDocumentError_WithCause() { + // Arrange + var cause = new RuntimeException("File not found"); + + // Act + var error = new TechnicalDocumentError(candidate, "I/O error", cause); + + // Assert + assertEquals(cause, error.cause()); + } + + @Test + void testTechnicalDocumentError_WithNullCandidate_ThrowsException() { + assertThrows(NullPointerException.class, + () -> new TechnicalDocumentError(null, "Error", null)); + } + + @Test + void testTechnicalDocumentError_WithNullErrorMessage_ThrowsException() { + assertThrows(NullPointerException.class, + () -> new TechnicalDocumentError(candidate, null, null)); + } + + @Test + void testTechnicalDocumentError_WithEmptyErrorMessage_ThrowsException() { + assertThrows(IllegalArgumentException.class, + () -> new TechnicalDocumentError(candidate, "", null)); + } + + @Test + void testTechnicalDocumentError_IsDocumentProcessingOutcome() { + // Verify type relationship + var error = new TechnicalDocumentError(candidate, "Error", null); + assertInstanceOf(DocumentProcessingOutcome.class, error); + } + + @Test + void testPreCheckPassed_IsDocumentProcessingOutcome() { + // Verify type relationship + var extraction = new PdfExtractionSuccess("text", new PdfPageCount(1)); + var passed = new PreCheckPassed(candidate, extraction); + assertInstanceOf(DocumentProcessingOutcome.class, passed); + } + + @Test + void testPreCheckFailed_IsDocumentProcessingOutcome() { + // Verify type relationship + var failed = new PreCheckFailed(candidate, "Test failure reason"); + assertInstanceOf(DocumentProcessingOutcome.class, failed); + } + + @Test + void testAllOutcomesAreExhaustive() { + // This test verifies that the outcome types are the only implementations + var extraction = new PdfExtractionSuccess("text", new PdfPageCount(1)); + + DocumentProcessingOutcome[] outcomes = { + new PreCheckPassed(candidate, extraction), + new PreCheckFailed(candidate, "Deterministic content failure"), + new TechnicalDocumentError(candidate, "Technical extraction error", null) + }; + + for (DocumentProcessingOutcome outcome : outcomes) { + assertInstanceOf(DocumentProcessingOutcome.class, outcome); + } + } +} \ No newline at end of file diff --git a/pdf-umbenenner-domain/src/test/java/de/gecheckt/pdf/umbenenner/domain/model/M3DocumentProcessingOutcomeTest.java b/pdf-umbenenner-domain/src/test/java/de/gecheckt/pdf/umbenenner/domain/model/M3DocumentProcessingOutcomeTest.java deleted file mode 100644 index 0edbee6..0000000 --- a/pdf-umbenenner-domain/src/test/java/de/gecheckt/pdf/umbenenner/domain/model/M3DocumentProcessingOutcomeTest.java +++ /dev/null @@ -1,113 +0,0 @@ -package de.gecheckt.pdf.umbenenner.domain.model; - -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.io.TempDir; - -import java.nio.file.Files; -import java.nio.file.Path; - -import static org.junit.jupiter.api.Assertions.*; - -/** - * Tests for M3 document processing outcome types. - *
- * Verifies that all four outcome types are properly created and validated. - */ -class M3DocumentProcessingOutcomeTest { - - @TempDir - Path tempDir; - - private SourceDocumentCandidate candidate; - - @BeforeEach - void setUp() throws Exception { - Path pdfFile = tempDir.resolve("doc.pdf"); - Files.createFile(pdfFile); - SourceDocumentLocator locator = new SourceDocumentLocator(pdfFile.toString()); - candidate = new SourceDocumentCandidate("doc.pdf", 1024L, locator); - } - - - @Test - void testM3TechnicalDocumentError_ValidConstruction() { - // Act - var error = new M3TechnicalDocumentError(candidate, "I/O error", null); - - // Assert - assertEquals(candidate, error.candidate()); - assertEquals("I/O error", error.errorMessage()); - assertNull(error.cause()); - } - - @Test - void testM3TechnicalDocumentError_WithCause() { - // Arrange - var cause = new RuntimeException("File not found"); - - // Act - var error = new M3TechnicalDocumentError(candidate, "I/O error", cause); - - // Assert - assertEquals(cause, error.cause()); - } - - @Test - void testM3TechnicalDocumentError_WithNullCandidate_ThrowsException() { - assertThrows(NullPointerException.class, - () -> new M3TechnicalDocumentError(null, "Error", null)); - } - - @Test - void testM3TechnicalDocumentError_WithNullErrorMessage_ThrowsException() { - assertThrows(NullPointerException.class, - () -> new M3TechnicalDocumentError(candidate, null, null)); - } - - @Test - void testM3TechnicalDocumentError_WithEmptyErrorMessage_ThrowsException() { - assertThrows(IllegalArgumentException.class, - () -> new M3TechnicalDocumentError(candidate, "", null)); - } - - @Test - void testM3TechnicalDocumentError_IsM3DocumentProcessingOutcome() { - // Verify type relationship - var error = new M3TechnicalDocumentError(candidate, "Error", null); - assertInstanceOf(M3DocumentProcessingOutcome.class, error); - } - - @Test - void testM3PreCheckPassed_IsM3DocumentProcessingOutcome() { - // Verify type relationship - var extraction = new PdfExtractionSuccess("text", new PdfPageCount(1)); - var passed = new M3PreCheckPassed(candidate, extraction); - assertInstanceOf(M3DocumentProcessingOutcome.class, passed); - } - - @Test - void testM3PreCheckFailed_IsM3DocumentProcessingOutcome() { - // Verify type relationship - var failed = new M3PreCheckFailed(candidate, "Test failure reason"); - assertInstanceOf(M3DocumentProcessingOutcome.class, failed); - } - - @Test - void testAllThreeOutcomesAreExhaustive() { - // This test verifies that the three outcome types are the only implementations - // M3 has exactly three outcome types: passed, failed (deterministic), and technical error - - var extraction = new PdfExtractionSuccess("text", new PdfPageCount(1)); - - M3DocumentProcessingOutcome[] outcomes = { - new M3PreCheckPassed(candidate, extraction), - new M3PreCheckFailed(candidate, "Deterministic content failure"), - new M3TechnicalDocumentError(candidate, "Technical extraction error", null) - }; - - for (M3DocumentProcessingOutcome outcome : outcomes) { - assertInstanceOf(M3DocumentProcessingOutcome.class, outcome); - } - } -}