From beda3f3b7ebe4d8f1bb8ee34f3eccd1bb857a5b9 Mon Sep 17 00:00:00 2001 From: Jacek Milewski Date: Sat, 30 Dec 2023 15:17:02 +0100 Subject: [PATCH] task-repo-done --- .../java/com/bottega/sharedlib/infra/repo/InMemoryRepo.java | 6 ++---- .../bottega/promoter/concert/api/app/ConcertService.java | 2 +- .../bottega/promoter/concert/domain/ConcertFixtures.java | 3 +-- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/libs/SharedLib/src/test/java/com/bottega/sharedlib/infra/repo/InMemoryRepo.java b/libs/SharedLib/src/test/java/com/bottega/sharedlib/infra/repo/InMemoryRepo.java index 4799033f..7abed31b 100644 --- a/libs/SharedLib/src/test/java/com/bottega/sharedlib/infra/repo/InMemoryRepo.java +++ b/libs/SharedLib/src/test/java/com/bottega/sharedlib/infra/repo/InMemoryRepo.java @@ -27,8 +27,7 @@ public Iterable saveAll(Iterable entities) { @Override public Optional findById(ID id) { - //TODO implement - throw new RuntimeException("Not Implemented"); + return Optional.ofNullable(database.get(id)); } @Override @@ -38,8 +37,7 @@ public boolean existsById(ID id) { @Override public Iterable findAll() { - //TODO implement - throw new RuntimeException("Not Implemented"); + return database.values(); } @Override diff --git a/services/Promoter/src/main/java/com/bottega/promoter/concert/api/app/ConcertService.java b/services/Promoter/src/main/java/com/bottega/promoter/concert/api/app/ConcertService.java index 8c551155..8d65b4b4 100644 --- a/services/Promoter/src/main/java/com/bottega/promoter/concert/api/app/ConcertService.java +++ b/services/Promoter/src/main/java/com/bottega/promoter/concert/api/app/ConcertService.java @@ -36,7 +36,7 @@ public Either createConcert(String title, String dateTime, } return concertFactory.createConcert(title, dateTime, promoterAgreement.promoterId()) .peek(concert -> concert.initNewConcert(tagService, categoryService)) - //TODO: save in repo + .map(concertRepo::save) .peek(concert -> eventPublisher.publish(concertCreated(concert, promoterAgreement.profitMarginPercentage()))); } diff --git a/services/Promoter/src/test/java/com/bottega/promoter/concert/domain/ConcertFixtures.java b/services/Promoter/src/test/java/com/bottega/promoter/concert/domain/ConcertFixtures.java index 9cc9e78a..999627b0 100644 --- a/services/Promoter/src/test/java/com/bottega/promoter/concert/domain/ConcertFixtures.java +++ b/services/Promoter/src/test/java/com/bottega/promoter/concert/domain/ConcertFixtures.java @@ -55,8 +55,7 @@ public static ConcertFixtures init(SharedFixtures sharedFixtures) { } private static void initInfrastructure(ConcertFixtures concertFixtures) { - //TODO initialize repo - concertFixtures.concertRepo = null; + concertFixtures.concertRepo = new InMemoryConcertRepo(); concertFixtures.categoryRepo = new InMemoryCategoryRepo(); concertFixtures.tagRepo = new InMemoryTagRepo(); }