1
0

Refactoring: Paketnamen und Klassennamen

This commit is contained in:
2026-04-02 14:40:14 +02:00
parent 1c53b65b86
commit 60498ab3c8
26 changed files with 111 additions and 105 deletions

View File

@@ -3,19 +3,19 @@ package de.gecheckt.pdf.umbenenner.bootstrap;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import de.gecheckt.pdf.umbenenner.adapter.inbound.cli.SchedulerBatchCommand;
import de.gecheckt.pdf.umbenenner.adapter.outbound.configuration.PropertiesConfigurationPortAdapter;
import de.gecheckt.pdf.umbenenner.adapter.outbound.lock.FilesystemRunLockPortAdapter;
import de.gecheckt.pdf.umbenenner.adapter.outbound.pdfextraction.PdfTextExtractionPortAdapter;
import de.gecheckt.pdf.umbenenner.adapter.outbound.sourcedocument.SourceDocumentCandidatesPortAdapter;
import de.gecheckt.pdf.umbenenner.adapter.in.cli.SchedulerBatchCommand;
import de.gecheckt.pdf.umbenenner.adapter.out.configuration.PropertiesConfigurationPortAdapter;
import de.gecheckt.pdf.umbenenner.adapter.out.lock.FilesystemRunLockPortAdapter;
import de.gecheckt.pdf.umbenenner.adapter.out.pdfextraction.PdfTextExtractionPortAdapter;
import de.gecheckt.pdf.umbenenner.adapter.out.sourcedocument.SourceDocumentCandidatesPortAdapter;
import de.gecheckt.pdf.umbenenner.application.config.InvalidStartConfigurationException;
import de.gecheckt.pdf.umbenenner.application.config.StartConfiguration;
import de.gecheckt.pdf.umbenenner.application.config.StartConfigurationValidator;
import de.gecheckt.pdf.umbenenner.application.port.in.BatchRunOutcome;
import de.gecheckt.pdf.umbenenner.application.port.in.RunBatchProcessingUseCase;
import de.gecheckt.pdf.umbenenner.application.port.in.BatchRunProcessingUseCase;
import de.gecheckt.pdf.umbenenner.application.port.out.ConfigurationPort;
import de.gecheckt.pdf.umbenenner.application.port.out.RunLockPort;
import de.gecheckt.pdf.umbenenner.application.usecase.BatchRunProcessingUseCase;
import de.gecheckt.pdf.umbenenner.application.usecase.DefaultBatchRunProcessingUseCase;
import de.gecheckt.pdf.umbenenner.domain.model.BatchRunContext;
import de.gecheckt.pdf.umbenenner.domain.model.RunId;
@@ -79,7 +79,7 @@ public class BootstrapRunner {
}
/**
* Functional interface for creating a RunBatchProcessingUseCase.
* Functional interface for creating a BatchRunProcessingUseCase.
* <p>
* Receives the already-loaded and validated {@link StartConfiguration} and run lock port.
* The factory is responsible for creating and wiring any additional outbound ports
@@ -87,7 +87,7 @@ public class BootstrapRunner {
*/
@FunctionalInterface
public interface UseCaseFactory {
RunBatchProcessingUseCase create(StartConfiguration config, RunLockPort runLockPort);
BatchRunProcessingUseCase create(StartConfiguration config, RunLockPort runLockPort);
}
/**
@@ -95,7 +95,7 @@ public class BootstrapRunner {
*/
@FunctionalInterface
public interface CommandFactory {
SchedulerBatchCommand create(RunBatchProcessingUseCase useCase);
SchedulerBatchCommand create(BatchRunProcessingUseCase useCase);
}
/**
@@ -113,7 +113,7 @@ public class BootstrapRunner {
this.configPortFactory = PropertiesConfigurationPortAdapter::new;
this.runLockPortFactory = FilesystemRunLockPortAdapter::new;
this.validatorFactory = StartConfigurationValidator::new;
this.useCaseFactory = (config, lock) -> new BatchRunProcessingUseCase(
this.useCaseFactory = (config, lock) -> new DefaultBatchRunProcessingUseCase(
config,
lock,
new SourceDocumentCandidatesPortAdapter(config.sourceFolder()),
@@ -127,7 +127,7 @@ public class BootstrapRunner {
* @param configPortFactory factory for creating ConfigurationPort instances
* @param runLockPortFactory factory for creating RunLockPort instances
* @param validatorFactory factory for creating StartConfigurationValidator instances
* @param useCaseFactory factory for creating RunBatchProcessingUseCase instances
* @param useCaseFactory factory for creating BatchRunProcessingUseCase instances
* @param commandFactory factory for creating SchedulerBatchCommand instances
*/
public BootstrapRunner(ConfigurationPortFactory configPortFactory,
@@ -181,7 +181,7 @@ public class BootstrapRunner {
// Step 6: Create the use case with the validated config and run lock (application layer).
// Config is passed directly; the use case does not re-read the properties file.
// Adapters (source document port, PDF extraction port) are wired by the factory.
RunBatchProcessingUseCase useCase = useCaseFactory.create(config, runLockPort);
BatchRunProcessingUseCase useCase = useCaseFactory.create(config, runLockPort);
// Step 7: Create the CLI command adapter with the use case
SchedulerBatchCommand command = commandFactory.create(useCase);

View File

@@ -1,11 +1,11 @@
package de.gecheckt.pdf.umbenenner.bootstrap;
import de.gecheckt.pdf.umbenenner.adapter.inbound.cli.SchedulerBatchCommand;
import de.gecheckt.pdf.umbenenner.adapter.in.cli.SchedulerBatchCommand;
import de.gecheckt.pdf.umbenenner.application.config.InvalidStartConfigurationException;
import de.gecheckt.pdf.umbenenner.application.config.StartConfiguration;
import de.gecheckt.pdf.umbenenner.application.config.StartConfigurationValidator;
import de.gecheckt.pdf.umbenenner.application.port.in.BatchRunOutcome;
import de.gecheckt.pdf.umbenenner.application.port.in.RunBatchProcessingUseCase;
import de.gecheckt.pdf.umbenenner.application.port.in.BatchRunProcessingUseCase;
import de.gecheckt.pdf.umbenenner.application.port.out.ConfigurationPort;
import de.gecheckt.pdf.umbenenner.application.port.out.RunLockPort;
import de.gecheckt.pdf.umbenenner.domain.model.BatchRunContext;
@@ -115,7 +115,7 @@ class BootstrapRunnerTest {
@Test
void run_returnsOneWhenBatchFails() throws Exception {
ConfigurationPort mockConfigPort = new MockConfigurationPort(tempDir, true);
RunBatchProcessingUseCase failingUseCase = (context) -> BatchRunOutcome.FAILURE;
BatchRunProcessingUseCase failingUseCase = (context) -> BatchRunOutcome.FAILURE;
BootstrapRunner runner = new BootstrapRunner(
() -> mockConfigPort,
@@ -134,7 +134,7 @@ class BootstrapRunnerTest {
void run_returnsOneWhenLockUnavailable() throws Exception {
// AP-007: controlled early termination because another instance is already running
ConfigurationPort mockConfigPort = new MockConfigurationPort(tempDir, true);
RunBatchProcessingUseCase lockUnavailableUseCase = (context) -> BatchRunOutcome.LOCK_UNAVAILABLE;
BatchRunProcessingUseCase lockUnavailableUseCase = (context) -> BatchRunOutcome.LOCK_UNAVAILABLE;
BootstrapRunner runner = new BootstrapRunner(
() -> mockConfigPort,
@@ -213,7 +213,7 @@ class BootstrapRunnerTest {
ConfigurationPort mockConfigPort = new MockConfigurationPort(tempDir, true);
// BatchRunOutcome.SUCCESS is what the M3 use case returns when the run completed,
// regardless of how many individual documents had content or technical errors.
RunBatchProcessingUseCase useCaseWithDocumentFailures = (context) -> BatchRunOutcome.SUCCESS;
BatchRunProcessingUseCase useCaseWithDocumentFailures = (context) -> BatchRunOutcome.SUCCESS;
BootstrapRunner runner = new BootstrapRunner(
() -> mockConfigPort,
@@ -286,7 +286,7 @@ class BootstrapRunnerTest {
}
}
private static class MockRunBatchProcessingUseCase implements RunBatchProcessingUseCase {
private static class MockRunBatchProcessingUseCase implements BatchRunProcessingUseCase {
private final boolean shouldSucceed;
MockRunBatchProcessingUseCase(boolean shouldSucceed) {