1
0
Fork 0
mirror of https://github.com/s-frick/effigenix.git synced 2026-03-28 12:09:35 +01:00

feat(loadtest): Gatling-Lasttests mit ~2500 Requests für komprimiertes Jahres-Volumen

Szenarien: Stammdaten-CRUD, Produktions-Workflow, Lagerverwaltung,
Read-Only-Zugriffe. Batch-Repository auf Summary-Projektion umgestellt,
Permissions-Changeset Merge-Konflikt aufgelöst, Unit-Enum im
JsonBodyBuilder korrigiert (KILOGRAM → KG).
This commit is contained in:
Sebastian Frick 2026-02-24 21:44:16 +01:00
parent 8a9bf849a9
commit 11fb62383b
21 changed files with 1856 additions and 38 deletions

View file

@ -81,7 +81,7 @@ class ListBatchesTest {
void should_ReturnAllBatches() {
var batches = List.of(sampleBatch("b1", BatchStatus.PLANNED), sampleBatch("b2", BatchStatus.PLANNED));
when(authPort.can(performedBy, ProductionAction.BATCH_READ)).thenReturn(true);
when(batchRepository.findAll()).thenReturn(Result.success(batches));
when(batchRepository.findAllSummary()).thenReturn(Result.success(batches));
var result = listBatches.execute(performedBy);
@ -93,7 +93,7 @@ class ListBatchesTest {
@DisplayName("should return empty list when no batches exist")
void should_ReturnEmptyList_When_NoBatchesExist() {
when(authPort.can(performedBy, ProductionAction.BATCH_READ)).thenReturn(true);
when(batchRepository.findAll()).thenReturn(Result.success(List.of()));
when(batchRepository.findAllSummary()).thenReturn(Result.success(List.of()));
var result = listBatches.execute(performedBy);
@ -105,7 +105,7 @@ class ListBatchesTest {
@DisplayName("should fail with RepositoryFailure when findAll fails")
void should_FailWithRepositoryFailure_When_FindAllFails() {
when(authPort.can(performedBy, ProductionAction.BATCH_READ)).thenReturn(true);
when(batchRepository.findAll()).thenReturn(Result.failure(DB_ERROR));
when(batchRepository.findAllSummary()).thenReturn(Result.failure(DB_ERROR));
var result = listBatches.execute(performedBy);
@ -135,7 +135,7 @@ class ListBatchesTest {
void should_ReturnBatches_FilteredByStatus() {
var batches = List.of(sampleBatch("b1", BatchStatus.PLANNED));
when(authPort.can(performedBy, ProductionAction.BATCH_READ)).thenReturn(true);
when(batchRepository.findByStatus(BatchStatus.PLANNED)).thenReturn(Result.success(batches));
when(batchRepository.findByStatusSummary(BatchStatus.PLANNED)).thenReturn(Result.success(batches));
var result = listBatches.executeByStatus(BatchStatus.PLANNED, performedBy);
@ -147,7 +147,7 @@ class ListBatchesTest {
@DisplayName("should return empty list when no batches match status")
void should_ReturnEmptyList_When_NoBatchesMatchStatus() {
when(authPort.can(performedBy, ProductionAction.BATCH_READ)).thenReturn(true);
when(batchRepository.findByStatus(BatchStatus.PLANNED)).thenReturn(Result.success(List.of()));
when(batchRepository.findByStatusSummary(BatchStatus.PLANNED)).thenReturn(Result.success(List.of()));
var result = listBatches.executeByStatus(BatchStatus.PLANNED, performedBy);
@ -159,7 +159,7 @@ class ListBatchesTest {
@DisplayName("should fail with RepositoryFailure when findByStatus fails")
void should_FailWithRepositoryFailure_When_FindByStatusFails() {
when(authPort.can(performedBy, ProductionAction.BATCH_READ)).thenReturn(true);
when(batchRepository.findByStatus(BatchStatus.PLANNED)).thenReturn(Result.failure(DB_ERROR));
when(batchRepository.findByStatusSummary(BatchStatus.PLANNED)).thenReturn(Result.failure(DB_ERROR));
var result = listBatches.executeByStatus(BatchStatus.PLANNED, performedBy);
@ -189,7 +189,7 @@ class ListBatchesTest {
void should_ReturnBatches_FilteredByProductionDate() {
var batches = List.of(sampleBatch("b1", BatchStatus.PLANNED));
when(authPort.can(performedBy, ProductionAction.BATCH_READ)).thenReturn(true);
when(batchRepository.findByProductionDate(PRODUCTION_DATE)).thenReturn(Result.success(batches));
when(batchRepository.findByProductionDateSummary(PRODUCTION_DATE)).thenReturn(Result.success(batches));
var result = listBatches.executeByProductionDate(PRODUCTION_DATE, performedBy);
@ -201,7 +201,7 @@ class ListBatchesTest {
@DisplayName("should return empty list when no batches match date")
void should_ReturnEmptyList_When_NoBatchesMatchDate() {
when(authPort.can(performedBy, ProductionAction.BATCH_READ)).thenReturn(true);
when(batchRepository.findByProductionDate(PRODUCTION_DATE)).thenReturn(Result.success(List.of()));
when(batchRepository.findByProductionDateSummary(PRODUCTION_DATE)).thenReturn(Result.success(List.of()));
var result = listBatches.executeByProductionDate(PRODUCTION_DATE, performedBy);
@ -213,7 +213,7 @@ class ListBatchesTest {
@DisplayName("should fail with RepositoryFailure when findByProductionDate fails")
void should_FailWithRepositoryFailure_When_FindByProductionDateFails() {
when(authPort.can(performedBy, ProductionAction.BATCH_READ)).thenReturn(true);
when(batchRepository.findByProductionDate(PRODUCTION_DATE)).thenReturn(Result.failure(DB_ERROR));
when(batchRepository.findByProductionDateSummary(PRODUCTION_DATE)).thenReturn(Result.failure(DB_ERROR));
var result = listBatches.executeByProductionDate(PRODUCTION_DATE, performedBy);
@ -245,7 +245,7 @@ class ListBatchesTest {
var batches = List.of(sampleBatch("b1", BatchStatus.PLANNED));
when(authPort.can(performedBy, ProductionAction.BATCH_READ)).thenReturn(true);
when(recipeRepository.findByArticleId("article-123")).thenReturn(Result.success(List.of(recipe)));
when(batchRepository.findByRecipeIds(List.of(RecipeId.of("recipe-1")))).thenReturn(Result.success(batches));
when(batchRepository.findByRecipeIdsSummary(List.of(RecipeId.of("recipe-1")))).thenReturn(Result.success(batches));
var result = listBatches.executeByArticleId("article-123", performedBy);
@ -272,7 +272,7 @@ class ListBatchesTest {
var recipe = sampleRecipe("recipe-1");
when(authPort.can(performedBy, ProductionAction.BATCH_READ)).thenReturn(true);
when(recipeRepository.findByArticleId("article-123")).thenReturn(Result.success(List.of(recipe)));
when(batchRepository.findByRecipeIds(List.of(RecipeId.of("recipe-1")))).thenReturn(Result.success(List.of()));
when(batchRepository.findByRecipeIdsSummary(List.of(RecipeId.of("recipe-1")))).thenReturn(Result.success(List.of()));
var result = listBatches.executeByArticleId("article-123", performedBy);
@ -299,7 +299,7 @@ class ListBatchesTest {
var recipe = sampleRecipe("recipe-1");
when(authPort.can(performedBy, ProductionAction.BATCH_READ)).thenReturn(true);
when(recipeRepository.findByArticleId("article-123")).thenReturn(Result.success(List.of(recipe)));
when(batchRepository.findByRecipeIds(List.of(RecipeId.of("recipe-1")))).thenReturn(Result.failure(DB_ERROR));
when(batchRepository.findByRecipeIdsSummary(List.of(RecipeId.of("recipe-1")))).thenReturn(Result.failure(DB_ERROR));
var result = listBatches.executeByArticleId("article-123", performedBy);