diff --git a/src/main/java/net/hostsharing/hsadminng/hs/booking/debitor/HsBookingDebitorRepository.java b/src/main/java/net/hostsharing/hsadminng/hs/booking/debitor/HsBookingDebitorRepository.java index f69dd72f..4fef88e2 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/booking/debitor/HsBookingDebitorRepository.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/booking/debitor/HsBookingDebitorRepository.java @@ -1,5 +1,6 @@ package net.hostsharing.hsadminng.hs.booking.debitor; +import io.micrometer.core.annotation.Timed; import org.springframework.data.repository.Repository; import java.util.List; @@ -8,7 +9,9 @@ import java.util.UUID; public interface HsBookingDebitorRepository extends Repository { + @Timed("app.bookingDebitor.repo.findByUuid") Optional findByUuid(UUID id); + @Timed("app.bookingDebitor.repo.findByDebitorNumber") List findByDebitorNumber(int debitorNumber); } diff --git a/src/main/java/net/hostsharing/hsadminng/hs/booking/item/BookingItemCreatedEventRepository.java b/src/main/java/net/hostsharing/hsadminng/hs/booking/item/BookingItemCreatedEventRepository.java index e36bda61..f94f1458 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/booking/item/BookingItemCreatedEventRepository.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/booking/item/BookingItemCreatedEventRepository.java @@ -1,12 +1,15 @@ package net.hostsharing.hsadminng.hs.booking.item; +import io.micrometer.core.annotation.Timed; import org.springframework.data.repository.Repository; import java.util.UUID; public interface BookingItemCreatedEventRepository extends Repository { + @Timed("app.booking.items.repo.save") BookingItemCreatedEventEntity save(HsBookingItemRealEntity current); + @Timed("app.booking.items.repo.findByBookingItem") BookingItemCreatedEventEntity findByBookingItem(HsBookingItemRealEntity newBookingItem); } diff --git a/src/main/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemController.java b/src/main/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemController.java index e8441b01..6facc03f 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemController.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemController.java @@ -2,6 +2,7 @@ package net.hostsharing.hsadminng.hs.booking.item; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; +import io.micrometer.core.annotation.Timed; import net.hostsharing.hsadminng.context.Context; import net.hostsharing.hsadminng.hs.booking.generated.api.v1.api.HsBookingItemsApi; import net.hostsharing.hsadminng.hs.booking.generated.api.v1.model.HsBookingItemInsertResource; @@ -51,7 +52,8 @@ public class HsBookingItemController implements HsBookingItemsApi { @Override @Transactional(readOnly = true) - public ResponseEntity> listBookingItemsByProjectUuid( + @Timed("app.bookingItems.api.getListOfBookingItemsByProjectUuid") + public ResponseEntity> getListOfBookingItemsByProjectUuid( final String currentSubject, final String assumedRoles, final UUID projectUuid) { @@ -65,7 +67,8 @@ public class HsBookingItemController implements HsBookingItemsApi { @Override @Transactional - public ResponseEntity addBookingItem( + @Timed("app.bookingItems.api.postNewBookingItem") + public ResponseEntity postNewBookingItem( final String currentSubject, final String assumedRoles, final HsBookingItemInsertResource body) { @@ -94,7 +97,8 @@ public class HsBookingItemController implements HsBookingItemsApi { @Override @Transactional(readOnly = true) - public ResponseEntity getBookingItemByUuid( + @Timed("app.bookingItems.api.getSingleBookingItemByUuid") + public ResponseEntity getSingleBookingItemByUuid( final String currentSubject, final String assumedRoles, final UUID bookingItemUuid) { @@ -111,6 +115,7 @@ public class HsBookingItemController implements HsBookingItemsApi { @Override @Transactional + @Timed("app.bookingItems.api.deleteBookingIemByUuid") public ResponseEntity deleteBookingIemByUuid( final String currentSubject, final String assumedRoles, @@ -125,6 +130,7 @@ public class HsBookingItemController implements HsBookingItemsApi { @Override @Transactional + @Timed("app.bookingItems.api.patchBookingItem") public ResponseEntity patchBookingItem( final String currentSubject, final String assumedRoles, diff --git a/src/main/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemRbacRepository.java b/src/main/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemRbacRepository.java index 8c230445..392b7077 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemRbacRepository.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemRbacRepository.java @@ -1,5 +1,6 @@ package net.hostsharing.hsadminng.hs.booking.item; +import io.micrometer.core.annotation.Timed; import org.springframework.data.repository.Repository; import java.util.List; @@ -9,15 +10,21 @@ import java.util.UUID; public interface HsBookingItemRbacRepository extends HsBookingItemRepository, Repository { + @Timed("app.bookingItems.repo.findByUuid.rbac") Optional findByUuid(final UUID bookingItemUuid); + @Timed("app.bookingItems.repo.findByCaption.rbac") List findByCaption(String bookingItemCaption); + @Timed("app.bookingItems.repo.findAllByProjectUuid.rbac") List findAllByProjectUuid(final UUID projectItemUuid); + @Timed("app.bookingItems.repo.save.rbac") HsBookingItemRbacEntity save(HsBookingItemRbacEntity current); + @Timed("app.bookingItems.repo.deleteByUuid.rbac") int deleteByUuid(final UUID uuid); + @Timed("app.bookingItems.repo.count.rbac") long count(); } diff --git a/src/main/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemRealRepository.java b/src/main/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemRealRepository.java index d9c509cc..706b1349 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemRealRepository.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemRealRepository.java @@ -1,5 +1,6 @@ package net.hostsharing.hsadminng.hs.booking.item; +import io.micrometer.core.annotation.Timed; import org.springframework.data.repository.Repository; import java.util.List; @@ -9,15 +10,21 @@ import java.util.UUID; public interface HsBookingItemRealRepository extends HsBookingItemRepository, Repository { + @Timed("app.bookingItems.repo.findByUuid.real") Optional findByUuid(final UUID bookingItemUuid); + @Timed("app.bookingItems.repo.findByCaption.real") List findByCaption(String bookingItemCaption); + @Timed("app.bookingItems.repo.findAllByProjectUuid.real") List findAllByProjectUuid(final UUID projectItemUuid); + @Timed("app.bookingItems.repo.save.real") HsBookingItemRealEntity save(HsBookingItemRealEntity current); + @Timed("app.bookingItems.repo.deleteByUuid.real") int deleteByUuid(final UUID uuid); + @Timed("app.bookingItems.repo.count.real") long count(); } diff --git a/src/main/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemRepository.java b/src/main/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemRepository.java index 98ba547c..67cb8efc 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemRepository.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemRepository.java @@ -1,5 +1,6 @@ package net.hostsharing.hsadminng.hs.booking.item; + import java.util.List; import java.util.Optional; import java.util.UUID; diff --git a/src/main/java/net/hostsharing/hsadminng/hs/booking/project/HsBookingProjectController.java b/src/main/java/net/hostsharing/hsadminng/hs/booking/project/HsBookingProjectController.java index f657d45e..ac21083a 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/booking/project/HsBookingProjectController.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/booking/project/HsBookingProjectController.java @@ -1,5 +1,6 @@ package net.hostsharing.hsadminng.hs.booking.project; +import io.micrometer.core.annotation.Timed; import net.hostsharing.hsadminng.context.Context; import net.hostsharing.hsadminng.hs.booking.debitor.HsBookingDebitorRepository; import net.hostsharing.hsadminng.hs.booking.generated.api.v1.api.HsBookingProjectsApi; @@ -35,7 +36,8 @@ public class HsBookingProjectController implements HsBookingProjectsApi { @Override @Transactional(readOnly = true) - public ResponseEntity> listBookingProjectsByDebitorUuid( + @Timed("app.bookingProjects.api.getListOfBookingProjectsByDebitorUuid") + public ResponseEntity> getListOfBookingProjectsByDebitorUuid( final String currentSubject, final String assumedRoles, final UUID debitorUuid) { @@ -49,7 +51,8 @@ public class HsBookingProjectController implements HsBookingProjectsApi { @Override @Transactional - public ResponseEntity addBookingProject( + @Timed("app.bookingProjects.api.postNewBookingProject") + public ResponseEntity postNewBookingProject( final String currentSubject, final String assumedRoles, final HsBookingProjectInsertResource body) { @@ -71,6 +74,7 @@ public class HsBookingProjectController implements HsBookingProjectsApi { @Override @Transactional(readOnly = true) + @Timed("app.bookingProjects.api.getBookingProjectByUuid") public ResponseEntity getBookingProjectByUuid( final String currentSubject, final String assumedRoles, @@ -87,6 +91,7 @@ public class HsBookingProjectController implements HsBookingProjectsApi { @Override @Transactional + @Timed("app.bookingProjects.api.deleteBookingIemByUuid") public ResponseEntity deleteBookingIemByUuid( final String currentSubject, final String assumedRoles, @@ -101,6 +106,7 @@ public class HsBookingProjectController implements HsBookingProjectsApi { @Override @Transactional + @Timed("app.bookingProjects.api.patchBookingProject") public ResponseEntity patchBookingProject( final String currentSubject, final String assumedRoles, diff --git a/src/main/java/net/hostsharing/hsadminng/hs/booking/project/HsBookingProjectRbacRepository.java b/src/main/java/net/hostsharing/hsadminng/hs/booking/project/HsBookingProjectRbacRepository.java index 8541e002..63065bb2 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/booking/project/HsBookingProjectRbacRepository.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/booking/project/HsBookingProjectRbacRepository.java @@ -1,5 +1,6 @@ package net.hostsharing.hsadminng.hs.booking.project; +import io.micrometer.core.annotation.Timed; import org.springframework.data.repository.Repository; import java.util.List; @@ -9,14 +10,21 @@ import java.util.UUID; public interface HsBookingProjectRbacRepository extends HsBookingProjectRepository, Repository { + @Timed("app.bookingProjects.repo.findByUuid.rbac") Optional findByUuid(final UUID bookingProjectUuid); + + @Timed("app.bookingProjects.repo.findByCaption.rbac") List findByCaption(final String projectCaption); + @Timed("app.bookingProjects.repo.findAllByDebitorUuid.rbac") List findAllByDebitorUuid(final UUID bookingProjectUuid); + @Timed("app.bookingProjects.repo.save.rbac") HsBookingProjectRbacEntity save(HsBookingProjectRbacEntity current); + @Timed("app.bookingProjects.repo.deleteByUuid.rbac") int deleteByUuid(final UUID uuid); + @Timed("app.bookingProjects.repo.count.rbac") long count(); } diff --git a/src/main/java/net/hostsharing/hsadminng/hs/booking/project/HsBookingProjectRealRepository.java b/src/main/java/net/hostsharing/hsadminng/hs/booking/project/HsBookingProjectRealRepository.java index b6e74d62..66b978b5 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/booking/project/HsBookingProjectRealRepository.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/booking/project/HsBookingProjectRealRepository.java @@ -1,5 +1,6 @@ package net.hostsharing.hsadminng.hs.booking.project; +import io.micrometer.core.annotation.Timed; import org.springframework.data.repository.Repository; import java.util.List; @@ -9,14 +10,21 @@ import java.util.UUID; public interface HsBookingProjectRealRepository extends HsBookingProjectRepository, Repository { + @Timed("app.bookingProjects.repo.findByUuid.real") Optional findByUuid(final UUID bookingProjectUuid); + + @Timed("app.bookingProjects.repo.findByCaption.real") List findByCaption(final String projectCaption); + @Timed("app.bookingProjects.repo.findAllByDebitorUuid.real") List findAllByDebitorUuid(final UUID bookingProjectUuid); + @Timed("app.bookingProjects.repo.save.real") HsBookingProjectRealEntity save(HsBookingProjectRealEntity current); + @Timed("app.bookingProjects.repo.deleteByUuid.real") int deleteByUuid(final UUID uuid); + @Timed("app.bookingProjects.repo.count.real") long count(); } diff --git a/src/main/java/net/hostsharing/hsadminng/hs/booking/project/HsBookingProjectRepository.java b/src/main/java/net/hostsharing/hsadminng/hs/booking/project/HsBookingProjectRepository.java index a609f625..0b9c7871 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/booking/project/HsBookingProjectRepository.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/booking/project/HsBookingProjectRepository.java @@ -1,19 +1,28 @@ package net.hostsharing.hsadminng.hs.booking.project; +import io.micrometer.core.annotation.Timed; + import java.util.List; import java.util.Optional; import java.util.UUID; public interface HsBookingProjectRepository { - Optional findByUuid(final UUID bookingProjectUuid); + @Timed("app.booking.projects.repo.findByUuid") + Optional findByUuid(final UUID findByUuid); + + @Timed("app.booking.projects.repo.findByCaption") List findByCaption(final String projectCaption); + @Timed("app.booking.projects.repo.findAllByDebitorUuid") List findAllByDebitorUuid(final UUID bookingProjectUuid); + @Timed("app.booking.projects.repo.save") E save(E current); + @Timed("app.booking.projects.repo.deleteByUuid") int deleteByUuid(final UUID uuid); + @Timed("app.booking.projects.repo.count") long count(); } diff --git a/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetController.java b/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetController.java index 56b59427..a8d4f7cf 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetController.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetController.java @@ -1,5 +1,6 @@ package net.hostsharing.hsadminng.hs.hosting.asset; +import io.micrometer.core.annotation.Timed; import net.hostsharing.hsadminng.hs.booking.item.HsBookingItemRealRepository; import net.hostsharing.hsadminng.hs.hosting.asset.validators.HostingAssetEntitySaveProcessor; import net.hostsharing.hsadminng.hs.hosting.asset.validators.HostingAssetEntityValidatorRegistry; @@ -48,7 +49,8 @@ public class HsHostingAssetController implements HsHostingAssetsApi { @Override @Transactional(readOnly = true) - public ResponseEntity> listAssets( + @Timed("app.hosting.assets.api.getListOfHostingAssets") + public ResponseEntity> getListOfHostingAssets( final String currentSubject, final String assumedRoles, final UUID debitorUuid, @@ -65,7 +67,8 @@ public class HsHostingAssetController implements HsHostingAssetsApi { @Override @Transactional - public ResponseEntity addAsset( + @Timed("app.hosting.assets.api.postNewHostingAsset") + public ResponseEntity postNewHostingAsset( final String currentSubject, final String assumedRoles, final HsHostingAssetInsertResource body) { @@ -93,7 +96,8 @@ public class HsHostingAssetController implements HsHostingAssetsApi { @Override @Transactional(readOnly = true) - public ResponseEntity getAssetByUuid( + @Timed("app.hosting.assets.api.getSingleHostingAssetByUuid") + public ResponseEntity getSingleHostingAssetByUuid( final String currentSubject, final String assumedRoles, final UUID assetUuid) { @@ -109,7 +113,8 @@ public class HsHostingAssetController implements HsHostingAssetsApi { @Override @Transactional - public ResponseEntity deleteAssetUuid( + @Timed("app.hosting.assets.api.deleteHostingAssetByUuid") + public ResponseEntity deleteHostingAssetByUuid( final String currentSubject, final String assumedRoles, final UUID assetUuid) { @@ -123,7 +128,8 @@ public class HsHostingAssetController implements HsHostingAssetsApi { @Override @Transactional - public ResponseEntity patchAsset( + @Timed("app.hosting.assets.api.patchHostingAsset") + public ResponseEntity patchHostingAsset( final String currentSubject, final String assumedRoles, final UUID assetUuid, diff --git a/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetPropsController.java b/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetPropsController.java index ca8bbb08..b4c56f4c 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetPropsController.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetPropsController.java @@ -1,5 +1,6 @@ package net.hostsharing.hsadminng.hs.hosting.asset; +import io.micrometer.core.annotation.Timed; import net.hostsharing.hsadminng.hs.hosting.asset.validators.HostingAssetEntityValidatorRegistry; import net.hostsharing.hsadminng.hs.hosting.generated.api.v1.api.HsHostingAssetPropsApi; import net.hostsharing.hsadminng.hs.hosting.generated.api.v1.model.HsHostingAssetTypeResource; @@ -14,7 +15,8 @@ import java.util.Map; public class HsHostingAssetPropsController implements HsHostingAssetPropsApi { @Override - public ResponseEntity> listAssetTypes() { + @Timed("app.hosting.assets.api.getListOfHostingAssetTypes") + public ResponseEntity> getListOfHostingAssetTypes() { final var resource = HostingAssetEntityValidatorRegistry.types().stream() .map(Enum::name) .toList(); @@ -22,7 +24,8 @@ public class HsHostingAssetPropsController implements HsHostingAssetPropsApi { } @Override - public ResponseEntity> listAssetTypeProps( + @Timed("app.hosting.assets.api.getListOfHostingAssetTypeProps") + public ResponseEntity> getListOfHostingAssetTypeProps( final HsHostingAssetTypeResource assetType) { final Enum type = HsHostingAssetType.of(assetType); diff --git a/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetRbacRepository.java b/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetRbacRepository.java index 73050383..75a9863f 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetRbacRepository.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetRbacRepository.java @@ -1,5 +1,6 @@ package net.hostsharing.hsadminng.hs.hosting.asset; +import io.micrometer.core.annotation.Timed; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.Repository; @@ -10,8 +11,10 @@ import java.util.UUID; public interface HsHostingAssetRbacRepository extends HsHostingAssetRepository, Repository { + @Timed("app.hostingAsset.repo.findByUuid.rbac") Optional findByUuid(final UUID serverUuid); + @Timed("app.hostingAsset.repo.findByIdentifier.rbac") List findByIdentifier(String assetIdentifier); @Query(value = """ @@ -32,16 +35,21 @@ public interface HsHostingAssetRbacRepository extends HsHostingAssetRepository findAllByCriteriaImpl(UUID projectUuid, UUID parentAssetUuid, String type); + default List findAllByCriteria(final UUID projectUuid, final UUID parentAssetUuid, final HsHostingAssetType type) { return findAllByCriteriaImpl(projectUuid, parentAssetUuid, HsHostingAssetType.asString(type)); } + @Timed("app.hostingAsset.repo.save.rbac") HsHostingAssetRbacEntity save(HsHostingAsset current); + @Timed("app.hostingAsset.repo.deleteByUuid.rbac") int deleteByUuid(final UUID uuid); + @Timed("app.hostingAsset.repo.count.rbac") long count(); } diff --git a/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetRealRepository.java b/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetRealRepository.java index c3709039..64fc44bd 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetRealRepository.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetRealRepository.java @@ -1,5 +1,6 @@ package net.hostsharing.hsadminng.hs.hosting.asset; +import io.micrometer.core.annotation.Timed; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.Repository; @@ -10,8 +11,10 @@ import java.util.UUID; public interface HsHostingAssetRealRepository extends HsHostingAssetRepository, Repository { + @Timed("app.hostingAsset.repo.findByUuid.real") Optional findByUuid(final UUID serverUuid); + @Timed("app.hostingAsset.repo.findByIdentifier.real") List findByIdentifier(String assetIdentifier); default List findByTypeAndIdentifier(@NotNull HsHostingAssetType type, @NotNull String identifier) { @@ -24,6 +27,7 @@ public interface HsHostingAssetRealRepository extends HsHostingAssetRepository findByTypeAndIdentifierImpl(@NotNull String type, @NotNull String identifier); @Query(value = """ @@ -46,14 +50,19 @@ public interface HsHostingAssetRealRepository extends HsHostingAssetRepository findAllByCriteriaImpl(UUID projectUuid, UUID parentAssetUuid, String type); + default List findAllByCriteria(final UUID projectUuid, final UUID parentAssetUuid, final HsHostingAssetType type) { return findAllByCriteriaImpl(projectUuid, parentAssetUuid, HsHostingAssetType.asString(type)); } + @Timed("app.hostingAsset.repo.save.real") HsHostingAssetRealEntity save(HsHostingAssetRealEntity current); + @Timed("app.hostingAsset.repo.deleteByUuid.real") int deleteByUuid(final UUID uuid); + @Timed("app.hostingAsset.repo.count.real") long count(); } diff --git a/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetRepository.java b/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetRepository.java index 8e062869..a473accc 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetRepository.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetRepository.java @@ -1,24 +1,32 @@ package net.hostsharing.hsadminng.hs.hosting.asset; +import io.micrometer.core.annotation.Timed; + import java.util.List; import java.util.Optional; import java.util.UUID; public interface HsHostingAssetRepository { + @Timed("app.hosting.assets.repo.findByUuid") Optional findByUuid(final UUID serverUuid); + @Timed("app.hosting.assets.repo.findByIdentifier") List findByIdentifier(String assetIdentifier); + @Timed("app.hosting.assets.repo.findAllByCriteriaImpl") List findAllByCriteriaImpl(UUID projectUuid, UUID parentAssetUuid, String type); default List findAllByCriteria(final UUID projectUuid, final UUID parentAssetUuid, final HsHostingAssetType type) { return findAllByCriteriaImpl(projectUuid, parentAssetUuid, HsHostingAssetType.asString(type)); } + @Timed("app.hosting.assets.repo.save") E save(HsHostingAsset current); + @Timed("app.hosting.assets.repo.deleteByUuid") int deleteByUuid(final UUID uuid); + @Timed("app.hosting.assets.repo.count") long count(); } diff --git a/src/main/java/net/hostsharing/hsadminng/hs/office/bankaccount/HsOfficeBankAccountRepository.java b/src/main/java/net/hostsharing/hsadminng/hs/office/bankaccount/HsOfficeBankAccountRepository.java index ecc1b2c0..862a6e7d 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/office/bankaccount/HsOfficeBankAccountRepository.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/office/bankaccount/HsOfficeBankAccountRepository.java @@ -20,6 +20,7 @@ public interface HsOfficeBankAccountRepository extends Repository findByOptionalHolderLikeImpl(String holder); + default List findByOptionalHolderLike(String holder) { return findByOptionalHolderLikeImpl(holder == null ? "" : holder); } diff --git a/src/main/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorRepository.java b/src/main/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorRepository.java index 3eb1835e..817eb202 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorRepository.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorRepository.java @@ -21,13 +21,13 @@ public interface HsOfficeDebitorRepository extends Repository findDebitorByDebitorNumber(int partnerNumber, String debitorNumberSuffix); + @Timed("app.debitors.repo.findDebitorByPartnerNumberAndDebitorNumberSuffix") + List findDebitorByPartnerNumberAndDebitorNumberSuffix(int partnerNumber, String debitorNumberSuffix); default List findDebitorByDebitorNumber(int debitorNumber) { final var partnerNumber = debitorNumber / 100; final String suffix = String.format("%02d", debitorNumber % 100); - final var result = findDebitorByDebitorNumber(partnerNumber, suffix); + final var result = findDebitorByPartnerNumberAndDebitorNumberSuffix(partnerNumber, suffix); return result; } diff --git a/src/main/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipController.java b/src/main/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipController.java index d2ee381b..3ba36f5c 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipController.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipController.java @@ -34,7 +34,7 @@ public class HsOfficeMembershipController implements HsOfficeMembershipsApi { @Override @Transactional(readOnly = true) - @Timed("app.membership.api.getListOfMemberships") + @Timed("app.office.membership.api.getListOfMemberships") public ResponseEntity> getListOfMemberships( final String currentSubject, final String assumedRoles, @@ -55,7 +55,7 @@ public class HsOfficeMembershipController implements HsOfficeMembershipsApi { @Override @Transactional - @Timed("app.membership.api.postNewMembership") + @Timed("app.office.membership.api.postNewMembership") public ResponseEntity postNewMembership( final String currentSubject, final String assumedRoles, @@ -79,7 +79,7 @@ public class HsOfficeMembershipController implements HsOfficeMembershipsApi { @Override @Transactional(readOnly = true) - @Timed("app.membership.api.getSingleMembershipByUuid") + @Timed("app.office.membership.api.getSingleMembershipByUuid") public ResponseEntity getSingleMembershipByUuid( final String currentSubject, final String assumedRoles, @@ -97,7 +97,7 @@ public class HsOfficeMembershipController implements HsOfficeMembershipsApi { @Override @Transactional - @Timed("app.membership.api.deleteMembershipByUuid") + @Timed("app.office.membership.api.deleteMembershipByUuid") public ResponseEntity deleteMembershipByUuid( final String currentSubject, final String assumedRoles, @@ -114,7 +114,7 @@ public class HsOfficeMembershipController implements HsOfficeMembershipsApi { @Override @Transactional - @Timed("app.membership.api.patchMembership") + @Timed("app.office.membership.api.patchMembership") public ResponseEntity patchMembership( final String currentSubject, final String assumedRoles, diff --git a/src/main/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipRepository.java b/src/main/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipRepository.java index e0fb0e1e..5a537b26 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipRepository.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipRepository.java @@ -11,13 +11,13 @@ import java.util.UUID; public interface HsOfficeMembershipRepository extends Repository { - @Timed("app.membership.repo.findByUuid") + @Timed("app.office.membership.repo.findByUuid") Optional findByUuid(UUID id); - @Timed("app.membership.repo.save") + @Timed("app.office.membership.repo.save") HsOfficeMembershipEntity save(final HsOfficeMembershipEntity entity); - @Timed("app.membership.repo.findAll") + @Timed("app.office.membership.repo.findAll") List findAll(); @Query(""" @@ -26,7 +26,7 @@ public interface HsOfficeMembershipRepository extends Repository findMembershipsByOptionalPartnerUuid(UUID partnerUuid); @Query(""" @@ -35,7 +35,7 @@ public interface HsOfficeMembershipRepository extends Repository { - List findAll(); + @Timed("app.rbac.grants.repo.findAll") + List findAll(); // TODO.refa: move to test repo + @Timed("app.rbac.grants.repo.findByAscendingUuid") List findByAscendingUuid(UUID ascendingUuid); + @Timed("app.rbac.grants.repo.findByDescendantUuid") List findByDescendantUuid(UUID refUuid); } diff --git a/src/main/java/net/hostsharing/hsadminng/rbac/grant/RbacGrantController.java b/src/main/java/net/hostsharing/hsadminng/rbac/grant/RbacGrantController.java index 6af53104..500c0ff3 100644 --- a/src/main/java/net/hostsharing/hsadminng/rbac/grant/RbacGrantController.java +++ b/src/main/java/net/hostsharing/hsadminng/rbac/grant/RbacGrantController.java @@ -1,5 +1,6 @@ package net.hostsharing.hsadminng.rbac.grant; +import io.micrometer.core.annotation.Timed; import net.hostsharing.hsadminng.context.Context; import net.hostsharing.hsadminng.mapper.StandardMapper; import net.hostsharing.hsadminng.rbac.generated.api.v1.api.RbacGrantsApi; @@ -32,7 +33,8 @@ public class RbacGrantController implements RbacGrantsApi { @Override @Transactional(readOnly = true) - public ResponseEntity getGrantById( + @Timed("app.rbac.grants.api.getListOfGrantsByUuid") + public ResponseEntity getListOfGrantsByUuid( final String currentSubject, final String assumedRoles, final UUID grantedRoleUuid, @@ -50,7 +52,8 @@ public class RbacGrantController implements RbacGrantsApi { @Override @Transactional(readOnly = true) - public ResponseEntity> listSubjectGrants( + @Timed("app.rbac.grants.api.getListOfSubjectGrants") + public ResponseEntity> getListOfSubjectGrants( final String currentSubject, final String assumedRoles) { @@ -61,7 +64,8 @@ public class RbacGrantController implements RbacGrantsApi { @Override @Transactional - public ResponseEntity grantRoleToSubject( + @Timed("app.rbac.grants.api.postNewRoleGrantToSubject") + public ResponseEntity postNewRoleGrantToSubject( final String currentSubject, final String assumedRoles, final RbacGrantResource body) { @@ -82,7 +86,8 @@ public class RbacGrantController implements RbacGrantsApi { @Override @Transactional - public ResponseEntity revokeRoleFromSubject( + @Timed("app.rbac.grants.api.deleteRoleGrantFromSubject") + public ResponseEntity deleteRoleGrantFromSubject( final String currentSubject, final String assumedRoles, final UUID grantedRoleUuid, diff --git a/src/main/java/net/hostsharing/hsadminng/rbac/grant/RbacGrantRepository.java b/src/main/java/net/hostsharing/hsadminng/rbac/grant/RbacGrantRepository.java index 9621e1f4..7aec28fa 100644 --- a/src/main/java/net/hostsharing/hsadminng/rbac/grant/RbacGrantRepository.java +++ b/src/main/java/net/hostsharing/hsadminng/rbac/grant/RbacGrantRepository.java @@ -1,5 +1,6 @@ package net.hostsharing.hsadminng.rbac.grant; +import io.micrometer.core.annotation.Timed; import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.Repository; @@ -13,12 +14,16 @@ public interface RbacGrantRepository extends Repository findAll(); + @Timed("app.rbac.grants.repo.save") RbacGrantEntity save(final RbacGrantEntity grant); @Modifying @@ -27,5 +32,6 @@ public interface RbacGrantRepository extends Repository> listRoles( + @Timed("app.rbac.roles.api.getListOfRoles") + public ResponseEntity> getListOfRoles( final String currentSubject, final String assumedRoles) { diff --git a/src/main/java/net/hostsharing/hsadminng/rbac/role/RbacRoleRepository.java b/src/main/java/net/hostsharing/hsadminng/rbac/role/RbacRoleRepository.java index 50a2e8b4..25348cd6 100644 --- a/src/main/java/net/hostsharing/hsadminng/rbac/role/RbacRoleRepository.java +++ b/src/main/java/net/hostsharing/hsadminng/rbac/role/RbacRoleRepository.java @@ -1,5 +1,6 @@ package net.hostsharing.hsadminng.rbac.role; +import io.micrometer.core.annotation.Timed; import org.springframework.data.repository.Repository; import java.util.List; @@ -10,12 +11,15 @@ public interface RbacRoleRepository extends Repository { /** * @return the number of persistent RbacRoleEntity instances, mostly for testing purposes. */ - long count(); // TODO: move to test sources + @Timed("app.rbac.roles.repo.findByUuid") + long count(); // TODO.refa: move to test sources /** * @return all persistent RbacRoleEntity instances, assigned to the current subject (user or assumed roles) */ - List findAll(); + @Timed("app.rbac.roles.repo.findAll") + List findAll(); // TODO.refa: move to test sources + @Timed("app.rbac.roles.repo.findByRoleName") RbacRoleEntity findByRoleName(String roleName); } diff --git a/src/main/java/net/hostsharing/hsadminng/rbac/subject/RbacSubjectController.java b/src/main/java/net/hostsharing/hsadminng/rbac/subject/RbacSubjectController.java index 1676cc7c..f2f7afab 100644 --- a/src/main/java/net/hostsharing/hsadminng/rbac/subject/RbacSubjectController.java +++ b/src/main/java/net/hostsharing/hsadminng/rbac/subject/RbacSubjectController.java @@ -1,5 +1,6 @@ package net.hostsharing.hsadminng.rbac.subject; +import io.micrometer.core.annotation.Timed; import net.hostsharing.hsadminng.context.Context; import net.hostsharing.hsadminng.mapper.StandardMapper; import net.hostsharing.hsadminng.rbac.generated.api.v1.api.RbacSubjectsApi; @@ -28,7 +29,8 @@ public class RbacSubjectController implements RbacSubjectsApi { @Override @Transactional - public ResponseEntity createSubject( + @Timed("app.rbac.subjects.api.postNewSubject") + public ResponseEntity postNewSubject( final RbacSubjectResource body ) { context.define(null); @@ -48,6 +50,7 @@ public class RbacSubjectController implements RbacSubjectsApi { @Override @Transactional + @Timed("app.rbac.subjects.api.deleteSubjectByUuid") public ResponseEntity deleteSubjectByUuid( final String currentSubject, final String assumedRoles, @@ -62,7 +65,8 @@ public class RbacSubjectController implements RbacSubjectsApi { @Override @Transactional(readOnly = true) - public ResponseEntity getSubjectById( + @Timed("app.rbac.subjects.api.getSingleSubjectByUuid") + public ResponseEntity getSingleSubjectByUuid( final String currentSubject, final String assumedRoles, final UUID subjectUuid) { @@ -78,7 +82,8 @@ public class RbacSubjectController implements RbacSubjectsApi { @Override @Transactional(readOnly = true) - public ResponseEntity> listSubjects( + @Timed("app.rbac.subjects.api.getListOfSubjects") + public ResponseEntity> getListOfSubjects( final String currentSubject, final String assumedRoles, final String userName @@ -90,7 +95,8 @@ public class RbacSubjectController implements RbacSubjectsApi { @Override @Transactional(readOnly = true) - public ResponseEntity> listSubjectPermissions( + @Timed("app.rbac.subjects.api.getListOfSubjectPermissions") + public ResponseEntity> getListOfSubjectPermissions( final String currentSubject, final String assumedRoles, final UUID subjectUuid diff --git a/src/main/java/net/hostsharing/hsadminng/rbac/subject/RbacSubjectRepository.java b/src/main/java/net/hostsharing/hsadminng/rbac/subject/RbacSubjectRepository.java index 16a13962..36dd2675 100644 --- a/src/main/java/net/hostsharing/hsadminng/rbac/subject/RbacSubjectRepository.java +++ b/src/main/java/net/hostsharing/hsadminng/rbac/subject/RbacSubjectRepository.java @@ -1,5 +1,6 @@ package net.hostsharing.hsadminng.rbac.subject; +import io.micrometer.core.annotation.Timed; import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.Repository; @@ -14,15 +15,19 @@ public interface RbacSubjectRepository extends Repository findByOptionalNameLike(String userName); // bypasses the restricted view, to be able to grant rights to arbitrary user @Query(value = "select * from rbac.subject where name=:userName", nativeQuery = true) + @Timed("app.rbac.subjects.repo.findByName") RbacSubjectEntity findByName(String userName); + @Timed("app.rbac.subjects.repo.findByUuid") RbacSubjectEntity findByUuid(UUID uuid); @Query(value = "select * from rbac.grantedPermissions(:subjectUuid)", nativeQuery = true) + @Timed("app.rbac.subjects.repo.findPermissionsOfUserByUuid") List findPermissionsOfUserByUuid(UUID subjectUuid); /* @@ -32,6 +37,7 @@ public interface RbacSubjectRepository extends Repository haveAllPublicMethodsAnnotatedWith(Class annotation) { + return new ArchCondition<>("have all public methods annotated with @" + annotation.getSimpleName()) { + @Override + public void check(final JavaClass item, final ConditionEvents events) { + for (JavaMethod method : item.getMethods()) { + if (method.isAnnotatedWith(annotation)) { + continue; + } + if (isGeneratedSpringRepositoryMethod(item, method)) { + continue; + } + if (item.isAnnotatedWith(RestController.class) && !method.getModifiers().contains(PUBLIC)) { + continue; + } + final var message = String.format( + "Method %s in class %s is not annotated with @%s", + method.getName(), + item.getName(), + annotation.getSimpleName() + ); + events.add(SimpleConditionEvent.violated(method, message)); + } + } + }; + } + + private static boolean isGeneratedSpringRepositoryMethod(final JavaClass item, final JavaMethod method) { + // this is a heuristic, ideally we can determine all methods with generated database calls + return item.isAssignableTo(Repository.class) && !method.getModifiers().contains(JavaModifier.ABSTRACT); + } } diff --git a/src/test/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemControllerAcceptanceTest.java b/src/test/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemControllerAcceptanceTest.java index ea433e71..120f62f5 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemControllerAcceptanceTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemControllerAcceptanceTest.java @@ -139,10 +139,10 @@ class HsBookingItemControllerAcceptanceTest extends ContextBasedTestWithCleanup @Nested @Order(3) - class AddBookingItem { + class PostNewBookingItem { @Test - void globalAdmin_canAddBookingItem() { + void globalAdmin_canPostNewBookingItem() { context.define("superuser-alex@hostsharing.net"); final var givenProject = findDefaultProjectOfDebitorNumber(1000111); @@ -349,7 +349,7 @@ class HsBookingItemControllerAcceptanceTest extends ContextBasedTestWithCleanup } @Test - void projectAgent_canAddBookingItemEvenIfHostingAssetCreationFails() { + void projectAgent_canPostNewBookingItemEvenIfHostingAssetCreationFails() { context.define("superuser-alex@hostsharing.net", "hs_booking.project#D-1000111-D-1000111defaultproject:AGENT"); final var givenProject = findDefaultProjectOfDebitorNumber(1000111); diff --git a/src/test/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemControllerRestTest.java b/src/test/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemControllerRestTest.java index 06e51a24..77e0abc8 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemControllerRestTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemControllerRestTest.java @@ -84,7 +84,7 @@ class HsBookingItemControllerRestTest { } @Nested - class AddBookingItem { + class PostNewBookingItem { @Test void globalAdmin_canAddValidBookingItem() throws Exception { diff --git a/src/test/java/net/hostsharing/hsadminng/hs/booking/project/HsBookingProjectControllerAcceptanceTest.java b/src/test/java/net/hostsharing/hsadminng/hs/booking/project/HsBookingProjectControllerAcceptanceTest.java index d2860219..737cc0a2 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/booking/project/HsBookingProjectControllerAcceptanceTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/booking/project/HsBookingProjectControllerAcceptanceTest.java @@ -79,10 +79,10 @@ class HsBookingProjectControllerAcceptanceTest extends ContextBasedTestWithClean } @Nested - class AddBookingProject { + class PostNewBookingProject { @Test - void globalAdmin_canAddBookingProject() { + void globalAdmin_canPostNewBookingProject() { context.define("superuser-alex@hostsharing.net"); final var givenDebitor = debitorRepo.findByDebitorNumber(1000111).stream() diff --git a/src/test/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetControllerAcceptanceTest.java b/src/test/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetControllerAcceptanceTest.java index 5b732b68..2d493fd0 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetControllerAcceptanceTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetControllerAcceptanceTest.java @@ -76,7 +76,7 @@ class HsHostingAssetControllerAcceptanceTest extends ContextBasedTestWithCleanup @Nested @Order(2) - class ListAssets { + class GetListOfHostingAssets { @Test void globalAdmin_canViewAllAssetsOfArbitraryDebitor() { @@ -146,7 +146,7 @@ class HsHostingAssetControllerAcceptanceTest extends ContextBasedTestWithCleanup @Nested @Order(3) - class AddAsset { + class PostNewHostingAsset { @Test void globalAdmin_canAddBookedAsset() { @@ -481,7 +481,7 @@ class HsHostingAssetControllerAcceptanceTest extends ContextBasedTestWithCleanup @Nested @Order(4) - class PatchAsset { + class PatchHostingAsset { @Test void globalAdmin_canPatchAllUpdatablePropertiesOfAsset() { diff --git a/src/test/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetControllerRestTest.java b/src/test/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetControllerRestTest.java index 45fd83c4..5aad9e2f 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetControllerRestTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetControllerRestTest.java @@ -583,7 +583,7 @@ public class HsHostingAssetControllerRestTest { @ParameterizedTest @EnumSource(HsHostingAssetControllerRestTest.ListTestCases.class) - void shouldListAssets(final HsHostingAssetControllerRestTest.ListTestCases testCase) throws Exception { + void shouldGetListOfHostingAssets(final HsHostingAssetControllerRestTest.ListTestCases testCase) throws Exception { // given when(rbacAssetRepo.findAllByCriteria(null, null, testCase.assetType)) .thenReturn(testCase.givenHostingAssetsOfType); @@ -607,7 +607,7 @@ public class HsHostingAssetControllerRestTest { } @Test - void shouldPatchAsset() throws Exception { + void shouldPatchHostingAsset() throws Exception { // given final var givenDomainSetup = HsHostingAssetRealEntity.builder() .type(HsHostingAssetType.DOMAIN_SETUP) diff --git a/src/test/java/net/hostsharing/hsadminng/rbac/grant/RbacGrantControllerAcceptanceTest.java b/src/test/java/net/hostsharing/hsadminng/rbac/grant/RbacGrantControllerAcceptanceTest.java index db13757e..e2460d05 100644 --- a/src/test/java/net/hostsharing/hsadminng/rbac/grant/RbacGrantControllerAcceptanceTest.java +++ b/src/test/java/net/hostsharing/hsadminng/rbac/grant/RbacGrantControllerAcceptanceTest.java @@ -161,7 +161,7 @@ class RbacGrantControllerAcceptanceTest extends ContextBasedTest { } @Nested - class GetGrantById { + class GetListOfGrantsByUuid { @Test void customerAdmin_withAssumedPacketAdminRole_canReadPacketAdminsGrantById() { @@ -171,7 +171,7 @@ class RbacGrantControllerAcceptanceTest extends ContextBasedTest { final var givenGrantedRole = getRbacRoleByName("rbactest.package#xxx00:ADMIN"); // when - final var grant = givencurrentSubjectAsPackageAdmin.getGrantById() + final var grant = givencurrentSubjectAsPackageAdmin.getListOfGrantsByUuid() .forGrantedRole(givenGrantedRole).toGranteeUser(givenGranteeUser); // then @@ -190,7 +190,7 @@ class RbacGrantControllerAcceptanceTest extends ContextBasedTest { final var givenGrantedRole = getRbacRoleByName("rbactest.package#xxx00:ADMIN"); // when - final var grant = givencurrentSubjectAsPackageAdmin.getGrantById() + final var grant = givencurrentSubjectAsPackageAdmin.getListOfGrantsByUuid() .forGrantedRole(givenGrantedRole).toGranteeUser(givenGranteeUser); // then @@ -211,7 +211,7 @@ class RbacGrantControllerAcceptanceTest extends ContextBasedTest { final var givenGrantedRole = getRbacRoleByName("rbactest.package#xxx00:ADMIN"); // when - final var grant = givencurrentSubjectAsPackageAdmin.getGrantById() + final var grant = givencurrentSubjectAsPackageAdmin.getListOfGrantsByUuid() .forGrantedRole(givenGrantedRole).toGranteeUser(givenGranteeUser); // then @@ -231,7 +231,7 @@ class RbacGrantControllerAcceptanceTest extends ContextBasedTest { "rbactest.package#xxx00:TENANT"); final var givenGranteeUser = findRbacSubjectByName("pac-admin-xxx00@xxx.example.com"); final var givenGrantedRole = getRbacRoleByName("rbactest.package#xxx00:ADMIN"); - final var grant = givencurrentSubjectAsPackageAdmin.getGrantById() + final var grant = givencurrentSubjectAsPackageAdmin.getListOfGrantsByUuid() .forGrantedRole(givenGrantedRole).toGranteeUser(givenGranteeUser); // then @@ -360,8 +360,8 @@ class RbacGrantControllerAcceptanceTest extends ContextBasedTest { return new RevokeFixture(givenOwnPackageAdminRole); } - GetGrantByIdFixture getGrantById() { - return new GetGrantByIdFixture(); + GetListOfGrantsByUuidFixture getListOfGrantsByUuid() { + return new GetListOfGrantsByUuidFixture(); } class GrantFixture { @@ -443,12 +443,12 @@ class RbacGrantControllerAcceptanceTest extends ContextBasedTest { } } - private class GetGrantByIdFixture { + private class GetListOfGrantsByUuidFixture { private Subject currentSubject = Subject.this; private RbacRoleEntity grantedRole; - GetGrantByIdFixture forGrantedRole(final RbacRoleEntity grantedRole) { + GetListOfGrantsByUuidFixture forGrantedRole(final RbacRoleEntity grantedRole) { this.grantedRole = grantedRole; return this; } diff --git a/src/test/java/net/hostsharing/hsadminng/rbac/role/RawRbacObjectRepository.java b/src/test/java/net/hostsharing/hsadminng/rbac/role/RawRbacObjectRepository.java index bda22795..dba24973 100644 --- a/src/test/java/net/hostsharing/hsadminng/rbac/role/RawRbacObjectRepository.java +++ b/src/test/java/net/hostsharing/hsadminng/rbac/role/RawRbacObjectRepository.java @@ -1,5 +1,6 @@ package net.hostsharing.hsadminng.rbac.role; +import io.micrometer.core.annotation.Timed; import org.springframework.data.repository.Repository; import java.util.List; @@ -7,5 +8,6 @@ import java.util.UUID; public interface RawRbacObjectRepository extends Repository { + @Timed("app.rbac.objects.repo.findAll.real") List findAll(); } diff --git a/src/test/java/net/hostsharing/hsadminng/rbac/role/RawRbacRoleRepository.java b/src/test/java/net/hostsharing/hsadminng/rbac/role/RawRbacRoleRepository.java index 029e1360..f9f629ce 100644 --- a/src/test/java/net/hostsharing/hsadminng/rbac/role/RawRbacRoleRepository.java +++ b/src/test/java/net/hostsharing/hsadminng/rbac/role/RawRbacRoleRepository.java @@ -1,5 +1,6 @@ package net.hostsharing.hsadminng.rbac.role; +import io.micrometer.core.annotation.Timed; import org.springframework.data.repository.Repository; import java.util.List; @@ -7,5 +8,6 @@ import java.util.UUID; public interface RawRbacRoleRepository extends Repository { + @Timed("app.rbac.roles.repo.findAll.real") List findAll(); } diff --git a/src/test/java/net/hostsharing/hsadminng/rbac/subject/RbacSubjectControllerRestTest.java b/src/test/java/net/hostsharing/hsadminng/rbac/subject/RbacSubjectControllerRestTest.java index 1b96029b..e788c34b 100644 --- a/src/test/java/net/hostsharing/hsadminng/rbac/subject/RbacSubjectControllerRestTest.java +++ b/src/test/java/net/hostsharing/hsadminng/rbac/subject/RbacSubjectControllerRestTest.java @@ -45,7 +45,7 @@ class RbacSubjectControllerRestTest { @Test - void createSubjectUsesGivenUuid() throws Exception { + void postNewSubjectUsesGivenUuid() throws Exception { // given final var givenUuid = UUID.randomUUID(); @@ -69,7 +69,7 @@ class RbacSubjectControllerRestTest { } @Test - void createSubjectGeneratesRandomUuidIfNotGiven() throws Exception { + void postNewSubjectGeneratesRandomUuidIfNotGiven() throws Exception { // when mockMvc.perform(MockMvcRequestBuilders .post("/api/rbac/subjects") diff --git a/src/test/java/net/hostsharing/hsadminng/rbac/subject/RbacSubjectRepositoryIntegrationTest.java b/src/test/java/net/hostsharing/hsadminng/rbac/subject/RbacSubjectRepositoryIntegrationTest.java index c60142d5..ea72ce14 100644 --- a/src/test/java/net/hostsharing/hsadminng/rbac/subject/RbacSubjectRepositoryIntegrationTest.java +++ b/src/test/java/net/hostsharing/hsadminng/rbac/subject/RbacSubjectRepositoryIntegrationTest.java @@ -41,7 +41,7 @@ class RbacSubjectRepositoryIntegrationTest extends ContextBasedTest { HttpServletRequest request; @Nested - class CreateSubject { + class PostNewSubject { @Test @Transactional(propagation = Propagation.NEVER) @@ -178,7 +178,7 @@ class RbacSubjectRepositoryIntegrationTest extends ContextBasedTest { } @Nested - class ListSubjectPermissions { + class GetListOfSubjectPermissions { private static final String[] ALL_USER_PERMISSIONS = Array.of( // @formatter:off