From c5a9fa9ec668e2d073c8afb2c3c002aa848d4b8d Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Mon, 5 Aug 2024 11:47:16 +0200 Subject: [PATCH] Bare->Real --- .../hs/hosting/asset/HsHostingAsset.java | 4 +- .../hosting/asset/HsHostingAssetEntity.java | 4 +- .../asset/HsHostingAssetEntityPatcher.java | 4 +- .../HostingAssetEntityValidator.java | 4 +- ...ty.java => HsOfficeContactRealEntity.java} | 4 +- ...ava => HsOfficeContactRealRepository.java} | 10 +- .../debitor/HsOfficeDebitorController.java | 16 +- .../office/debitor/HsOfficeDebitorEntity.java | 4 +- .../debitor/HsOfficeDebitorEntityPatcher.java | 4 +- .../debitor/HsOfficeDebitorRepository.java | 2 +- .../partner/HsOfficePartnerController.java | 16 +- .../office/partner/HsOfficePartnerEntity.java | 4 +- .../partner/HsOfficePartnerEntityPatcher.java | 4 +- .../partner/HsOfficePartnerRepository.java | 4 +- .../hs/office/relation/HsOfficeRelation.java | 4 +- .../relation/HsOfficeRelationController.java | 6 +- .../HsOfficeRelationEntityPatcher.java | 4 +- ...y.java => HsOfficeRelationRealEntity.java} | 4 +- ...va => HsOfficeRelationRealRepository.java} | 12 +- .../changelog/1-rbac/1058-rbac-generators.sql | 2 + ...sHostingAssetControllerAcceptanceTest.java | 4 +- .../HsHostingAssetControllerRestTest.java | 6 +- .../HsHostingAssetEntityPatcherUnitTest.java | 12 +- ...ity.java => HsHostingAssetRealEntity.java} | 14 +- .../hs/migration/ImportHostingAssets.java | 208 +++++++++--------- .../hs/migration/ImportOfficeData.java | 16 +- ...HsOfficeBankAccountControllerRestTest.java | 4 +- ...ava => HsOfficeContactRealTestEntity.java} | 8 +- ...opAssetsTransactionControllerRestTest.java | 2 +- ...OfficeDebitorControllerAcceptanceTest.java | 26 +-- .../HsOfficeDebitorEntityPatcherUnitTest.java | 12 +- .../HsOfficeDebitorEntityUnitTest.java | 8 +- ...fficeDebitorRepositoryIntegrationTest.java | 27 ++- .../office/debitor/TestHsOfficeDebitor.java | 8 +- ...OfficePartnerControllerAcceptanceTest.java | 26 +-- .../HsOfficePartnerControllerRestTest.java | 10 +- .../HsOfficePartnerEntityPatcherUnitTest.java | 16 +- .../HsOfficePartnerEntityUnitTest.java | 8 +- ...fficePartnerRepositoryIntegrationTest.java | 20 +- .../office/partner/TestHsOfficePartner.java | 8 +- ...fficeRelationControllerAcceptanceTest.java | 30 +-- .../HsOfficeRelationPatcherUnitTest.java | 12 +- ...ficeRelationRepositoryIntegrationTest.java | 12 +- 43 files changed, 307 insertions(+), 306 deletions(-) rename src/main/java/net/hostsharing/hsadminng/hs/office/contact/{HsOfficeContactBareEntity.java => HsOfficeContactRealEntity.java} (81%) rename src/main/java/net/hostsharing/hsadminng/hs/office/contact/{HsOfficeContactBareRepository.java => HsOfficeContactRealRepository.java} (58%) rename src/main/java/net/hostsharing/hsadminng/hs/office/relation/{HsOfficeRelationBareEntity.java => HsOfficeRelationRealEntity.java} (81%) rename src/main/java/net/hostsharing/hsadminng/hs/office/relation/{HsOfficeRelationBareRepository.java => HsOfficeRelationRealRepository.java} (73%) rename src/test/java/net/hostsharing/hsadminng/hs/migration/{HsHostingAssetBareEntity.java => HsHostingAssetRealEntity.java} (89%) rename src/test/java/net/hostsharing/hsadminng/hs/office/contact/{HsOfficeContactBareTestEntity.java => HsOfficeContactRealTestEntity.java} (62%) diff --git a/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAsset.java b/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAsset.java index de2c1851..81b09512 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAsset.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAsset.java @@ -2,7 +2,7 @@ package net.hostsharing.hsadminng.hs.hosting.asset; import net.hostsharing.hsadminng.hs.booking.item.HsBookingItemEntity; import net.hostsharing.hsadminng.hs.booking.project.HsBookingProjectEntity; -import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactBareEntity; +import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRealEntity; import net.hostsharing.hsadminng.hs.validation.PropertiesProvider; import net.hostsharing.hsadminng.rbac.rbacobject.BaseEntity; import net.hostsharing.hsadminng.stringify.Stringify; @@ -36,7 +36,7 @@ public interface HsHostingAsset extends Stringifyable, BaseEntity getSubHostingAssets(); String getCaption(); Map getConfig(); diff --git a/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetEntity.java b/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetEntity.java index f6b905da..4083ab36 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetEntity.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetEntity.java @@ -8,7 +8,7 @@ import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import net.hostsharing.hsadminng.hs.booking.item.HsBookingItemEntity; -import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactBareEntity; +import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRealEntity; import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRbacEntity; import net.hostsharing.hsadminng.mapper.PatchableMapWrapper; import net.hostsharing.hsadminng.rbac.rbacdef.RbacView; @@ -90,7 +90,7 @@ public class HsHostingAssetEntity implements HsHostingAsset { @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "alarmcontactuuid") - private HsOfficeContactBareEntity alarmContact; + private HsOfficeContactRealEntity alarmContact; @OneToMany(cascade = CascadeType.REFRESH, orphanRemoval = true, fetch = FetchType.LAZY) @JoinColumn(name = "parentassetuuid", referencedColumnName = "uuid") diff --git a/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetEntityPatcher.java b/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetEntityPatcher.java index 585375d5..856b4243 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetEntityPatcher.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetEntityPatcher.java @@ -1,7 +1,7 @@ package net.hostsharing.hsadminng.hs.hosting.asset; import net.hostsharing.hsadminng.hs.hosting.generated.api.v1.model.HsHostingAssetPatchResource; -import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactBareEntity; +import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRealEntity; import net.hostsharing.hsadminng.mapper.EntityPatcher; import net.hostsharing.hsadminng.mapper.KeyValueMap; import net.hostsharing.hsadminng.mapper.OptionalFromJson; @@ -29,7 +29,7 @@ public class HsHostingAssetEntityPatcher implements EntityPatcher entity.setAlarmContact( Optional.ofNullable(newValue) - .map(uuid -> em.getReference(HsOfficeContactBareEntity.class, newValue)) + .map(uuid -> em.getReference(HsOfficeContactRealEntity.class, newValue)) .orElse(null))); } } diff --git a/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/validators/HostingAssetEntityValidator.java b/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/validators/HostingAssetEntityValidator.java index 6a95448d..472502f6 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/validators/HostingAssetEntityValidator.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/validators/HostingAssetEntityValidator.java @@ -5,7 +5,7 @@ import net.hostsharing.hsadminng.hs.booking.item.HsBookingItemType; import net.hostsharing.hsadminng.hs.booking.item.validators.HsBookingItemEntityValidatorRegistry; import net.hostsharing.hsadminng.hs.hosting.asset.HsHostingAsset; import net.hostsharing.hsadminng.hs.hosting.asset.HsHostingAssetType; -import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactBareEntity; +import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRealEntity; import net.hostsharing.hsadminng.hs.validation.HsEntityValidator; import net.hostsharing.hsadminng.hs.validation.ValidatableProperty; @@ -213,7 +213,7 @@ public abstract class HostingAssetEntityValidator extends HsEntityValidator> { + static class AlarmContact extends ReferenceValidator> { AlarmContact(final HsHostingAssetType.RelationPolicy policy) { super(policy, HsHostingAsset::getAlarmContact); diff --git a/src/main/java/net/hostsharing/hsadminng/hs/office/contact/HsOfficeContactBareEntity.java b/src/main/java/net/hostsharing/hsadminng/hs/office/contact/HsOfficeContactRealEntity.java similarity index 81% rename from src/main/java/net/hostsharing/hsadminng/hs/office/contact/HsOfficeContactBareEntity.java rename to src/main/java/net/hostsharing/hsadminng/hs/office/contact/HsOfficeContactRealEntity.java index 1a8e10a1..44f72d99 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/office/contact/HsOfficeContactBareEntity.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/office/contact/HsOfficeContactRealEntity.java @@ -15,7 +15,7 @@ import jakarta.persistence.Table; @Setter @NoArgsConstructor @SuperBuilder(toBuilder = true) -@DisplayAs("BareContact") -public class HsOfficeContactBareEntity extends HsOfficeContact { +@DisplayAs("RealContact") +public class HsOfficeContactRealEntity extends HsOfficeContact { } diff --git a/src/main/java/net/hostsharing/hsadminng/hs/office/contact/HsOfficeContactBareRepository.java b/src/main/java/net/hostsharing/hsadminng/hs/office/contact/HsOfficeContactRealRepository.java similarity index 58% rename from src/main/java/net/hostsharing/hsadminng/hs/office/contact/HsOfficeContactBareRepository.java rename to src/main/java/net/hostsharing/hsadminng/hs/office/contact/HsOfficeContactRealRepository.java index baa1e1e1..b4099422 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/office/contact/HsOfficeContactBareRepository.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/office/contact/HsOfficeContactRealRepository.java @@ -7,18 +7,18 @@ import java.util.List; import java.util.Optional; import java.util.UUID; -public interface HsOfficeContactBareRepository extends Repository { +public interface HsOfficeContactRealRepository extends Repository { - Optional findByUuid(UUID id); + Optional findByUuid(UUID id); @Query(""" - SELECT c FROM HsOfficeContactBareEntity c + SELECT c FROM HsOfficeContactRealEntity c WHERE :caption is null OR c.caption like concat(cast(:caption as text), '%') """) - List findContactByOptionalCaptionLike(String caption); + List findContactByOptionalCaptionLike(String caption); - HsOfficeContactBareEntity save(final HsOfficeContactBareEntity entity); + HsOfficeContactRealEntity save(final HsOfficeContactRealEntity entity); int deleteByUuid(final UUID uuid); diff --git a/src/main/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorController.java b/src/main/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorController.java index 6fada65c..73fe78af 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorController.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorController.java @@ -5,8 +5,8 @@ import net.hostsharing.hsadminng.hs.office.generated.api.v1.api.HsOfficeDebitors import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficeDebitorInsertResource; import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficeDebitorPatchResource; import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficeDebitorResource; -import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationBareEntity; -import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationBareRepository; +import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRealEntity; +import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRealRepository; import net.hostsharing.hsadminng.mapper.Mapper; import net.hostsharing.hsadminng.rbac.rbacobject.BaseEntity; import org.apache.commons.lang3.Validate; @@ -40,7 +40,7 @@ public class HsOfficeDebitorController implements HsOfficeDebitorsApi { private HsOfficeDebitorRepository debitorRepo; @Autowired - private HsOfficeRelationBareRepository relBareRepo; + private HsOfficeRelationRealRepository relrealRepo; @PersistenceContext private EntityManager em; @@ -84,16 +84,16 @@ public class HsOfficeDebitorController implements HsOfficeDebitorsApi { final var entityToSave = mapper.map(body, HsOfficeDebitorEntity.class); if ( body.getDebitorRel() != null ) { body.getDebitorRel().setType(DEBITOR.name()); - final var debitorRel = mapper.map(body.getDebitorRel(), HsOfficeRelationBareEntity.class); + final var debitorRel = mapper.map(body.getDebitorRel(), HsOfficeRelationRealEntity.class); validateEntityExists("debitorRel.anchorUuid", debitorRel.getAnchor()); validateEntityExists("debitorRel.holderUuid", debitorRel.getHolder()); validateEntityExists("debitorRel.contactUuid", debitorRel.getContact()); - entityToSave.setDebitorRel(relBareRepo.save(debitorRel)); + entityToSave.setDebitorRel(relrealRepo.save(debitorRel)); } else { - final var debitorRelOptional = relBareRepo.findByUuid(body.getDebitorRelUuid()); + final var debitorRelOptional = relrealRepo.findByUuid(body.getDebitorRelUuid()); debitorRelOptional.ifPresentOrElse( - debitorRel -> {entityToSave.setDebitorRel(relBareRepo.save(debitorRel));}, - () -> { throw new ValidationException("Unable to find BareRelation by debitorRelUuid: " + body.getDebitorRelUuid());}); + debitorRel -> {entityToSave.setDebitorRel(relrealRepo.save(debitorRel));}, + () -> { throw new ValidationException("Unable to find RealRelation by debitorRelUuid: " + body.getDebitorRelUuid());}); } final var savedEntity = debitorRepo.save(entityToSave); diff --git a/src/main/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorEntity.java b/src/main/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorEntity.java index 8cf1b0be..192f3f2e 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorEntity.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorEntity.java @@ -9,7 +9,7 @@ import net.hostsharing.hsadminng.errors.DisplayAs; import net.hostsharing.hsadminng.hs.office.bankaccount.HsOfficeBankAccountEntity; import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerEntity; import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelation; -import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationBareEntity; +import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRealEntity; import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRbacEntity; import net.hostsharing.hsadminng.rbac.rbacobject.BaseEntity; import net.hostsharing.hsadminng.rbac.rbacdef.RbacView; @@ -103,7 +103,7 @@ public class HsOfficeDebitorEntity implements BaseEntity, @ManyToOne(cascade = { PERSIST, MERGE, REFRESH, DETACH }, optional = false, fetch = FetchType.LAZY) @JoinColumn(name = "debitorreluuid", nullable = false) - private HsOfficeRelationBareEntity debitorRel; + private HsOfficeRelationRealEntity debitorRel; @Column(name = "billable", nullable = false) private Boolean billable; // not a primitive because otherwise the default would be false diff --git a/src/main/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorEntityPatcher.java b/src/main/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorEntityPatcher.java index 2acaf1eb..d8d67943 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorEntityPatcher.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorEntityPatcher.java @@ -2,7 +2,7 @@ package net.hostsharing.hsadminng.hs.office.debitor; import net.hostsharing.hsadminng.hs.office.bankaccount.HsOfficeBankAccountEntity; import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficeDebitorPatchResource; -import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationBareEntity; +import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRealEntity; import net.hostsharing.hsadminng.mapper.EntityPatcher; import net.hostsharing.hsadminng.mapper.OptionalFromJson; @@ -25,7 +25,7 @@ class HsOfficeDebitorEntityPatcher implements EntityPatcher { verifyNotNull(newValue, "debitorRel"); - entity.setDebitorRel(em.getReference(HsOfficeRelationBareEntity.class, newValue)); + entity.setDebitorRel(em.getReference(HsOfficeRelationRealEntity.class, newValue)); }); Optional.ofNullable(resource.getBillable()).ifPresent(entity::setBillable); OptionalFromJson.of(resource.getVatId()).ifPresent(entity::setVatId); 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 bc794f6c..bb6cd0f2 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 @@ -33,7 +33,7 @@ public interface HsOfficeDebitorRepository extends Repository { verifyNotNull(newValue, "partnerRel"); - entity.setPartnerRel(em.getReference(HsOfficeRelationBareEntity.class, newValue)); + entity.setPartnerRel(em.getReference(HsOfficeRelationRealEntity.class, newValue)); }); new HsOfficePartnerDetailsEntityPatcher(em, entity.getDetails()).apply(resource.getDetails()); diff --git a/src/main/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerRepository.java b/src/main/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerRepository.java index be9463bd..2c5913a5 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerRepository.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerRepository.java @@ -15,8 +15,8 @@ public interface HsOfficePartnerRepository extends Repository, Stringify @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "contactuuid") - private HsOfficeContactBareEntity contact; + private HsOfficeContactRealEntity contact; @Column(name = "type") @Enumerated(EnumType.STRING) diff --git a/src/main/java/net/hostsharing/hsadminng/hs/office/relation/HsOfficeRelationController.java b/src/main/java/net/hostsharing/hsadminng/hs/office/relation/HsOfficeRelationController.java index da2e11a0..a3f4d136 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/office/relation/HsOfficeRelationController.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/office/relation/HsOfficeRelationController.java @@ -1,7 +1,7 @@ package net.hostsharing.hsadminng.hs.office.relation; import net.hostsharing.hsadminng.context.Context; -import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactBareRepository; +import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRealRepository; import net.hostsharing.hsadminng.hs.office.generated.api.v1.api.HsOfficeRelationsApi; import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.*; import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRepository; @@ -37,7 +37,7 @@ public class HsOfficeRelationController implements HsOfficeRelationsApi { private HsOfficePersonRepository holderRepo; @Autowired - private HsOfficeContactBareRepository contactBareRepo; + private HsOfficeContactRealRepository contactrealRepo; @PersistenceContext private EntityManager em; @@ -77,7 +77,7 @@ public class HsOfficeRelationController implements HsOfficeRelationsApi { entityToSave.setHolder(holderRepo.findByUuid(body.getHolderUuid()).orElseThrow( () -> new NoSuchElementException("cannot find Person by holderUuid: " + body.getHolderUuid()) )); - entityToSave.setContact(contactBareRepo.findByUuid(body.getContactUuid()).orElseThrow( + entityToSave.setContact(contactrealRepo.findByUuid(body.getContactUuid()).orElseThrow( () -> new NoSuchElementException("cannot find Contact by contactUuid: " + body.getContactUuid()) )); diff --git a/src/main/java/net/hostsharing/hsadminng/hs/office/relation/HsOfficeRelationEntityPatcher.java b/src/main/java/net/hostsharing/hsadminng/hs/office/relation/HsOfficeRelationEntityPatcher.java index 2888e3c0..d9e6244a 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/office/relation/HsOfficeRelationEntityPatcher.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/office/relation/HsOfficeRelationEntityPatcher.java @@ -1,6 +1,6 @@ package net.hostsharing.hsadminng.hs.office.relation; -import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactBareEntity; +import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRealEntity; import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficeRelationPatchResource; import net.hostsharing.hsadminng.mapper.EntityPatcher; import net.hostsharing.hsadminng.mapper.OptionalFromJson; @@ -22,7 +22,7 @@ class HsOfficeRelationEntityPatcher implements EntityPatcher { verifyNotNull(newValue, "contact"); - entity.setContact(em.getReference(HsOfficeContactBareEntity.class, newValue)); + entity.setContact(em.getReference(HsOfficeContactRealEntity.class, newValue)); }); } diff --git a/src/main/java/net/hostsharing/hsadminng/hs/office/relation/HsOfficeRelationBareEntity.java b/src/main/java/net/hostsharing/hsadminng/hs/office/relation/HsOfficeRelationRealEntity.java similarity index 81% rename from src/main/java/net/hostsharing/hsadminng/hs/office/relation/HsOfficeRelationBareEntity.java rename to src/main/java/net/hostsharing/hsadminng/hs/office/relation/HsOfficeRelationRealEntity.java index 5c85e8ae..3c6c71a9 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/office/relation/HsOfficeRelationBareEntity.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/office/relation/HsOfficeRelationRealEntity.java @@ -16,6 +16,6 @@ import jakarta.persistence.Table; @Getter @Setter @SuperBuilder(toBuilder = true) -@DisplayAs("BareRelation") -public class HsOfficeRelationBareEntity extends HsOfficeRelation { +@DisplayAs("RealRelation") +public class HsOfficeRelationRealEntity extends HsOfficeRelation { } diff --git a/src/main/java/net/hostsharing/hsadminng/hs/office/relation/HsOfficeRelationBareRepository.java b/src/main/java/net/hostsharing/hsadminng/hs/office/relation/HsOfficeRelationRealRepository.java similarity index 73% rename from src/main/java/net/hostsharing/hsadminng/hs/office/relation/HsOfficeRelationBareRepository.java rename to src/main/java/net/hostsharing/hsadminng/hs/office/relation/HsOfficeRelationRealRepository.java index e3cdba3d..6a24ad02 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/office/relation/HsOfficeRelationBareRepository.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/office/relation/HsOfficeRelationRealRepository.java @@ -8,11 +8,11 @@ import java.util.List; import java.util.Optional; import java.util.UUID; -public interface HsOfficeRelationBareRepository extends Repository { +public interface HsOfficeRelationRealRepository extends Repository { - Optional findByUuid(UUID id); + Optional findByUuid(UUID id); - default List findRelationRelatedToPersonUuidAndRelationType(@NotNull UUID personUuid, HsOfficeRelationType relationType) { + default List findRelationRelatedToPersonUuidAndRelationType(@NotNull UUID personUuid, HsOfficeRelationType relationType) { return findRelationRelatedToPersonUuidAndRelationTypeString(personUuid, relationType.toString()); } @@ -20,16 +20,16 @@ public interface HsOfficeRelationBareRepository extends Repository findRelationRelatedToPersonUuid(@NotNull UUID personUuid); + List findRelationRelatedToPersonUuid(@NotNull UUID personUuid); @Query(value = """ SELECT p.* FROM hs_office_relation AS p WHERE (:relationType IS NULL OR p.type = cast(:relationType AS HsOfficeRelationType)) AND ( p.anchorUuid = :personUuid OR p.holderUuid = :personUuid) """, nativeQuery = true) - List findRelationRelatedToPersonUuidAndRelationTypeString(@NotNull UUID personUuid, String relationType); + List findRelationRelatedToPersonUuidAndRelationTypeString(@NotNull UUID personUuid, String relationType); - HsOfficeRelationBareEntity save(final HsOfficeRelationBareEntity entity); + HsOfficeRelationRealEntity save(final HsOfficeRelationRealEntity entity); long count(); diff --git a/src/main/resources/db/changelog/1-rbac/1058-rbac-generators.sql b/src/main/resources/db/changelog/1-rbac/1058-rbac-generators.sql index ecea52d1..4bfc83b2 100644 --- a/src/main/resources/db/changelog/1-rbac/1058-rbac-generators.sql +++ b/src/main/resources/db/changelog/1-rbac/1058-rbac-generators.sql @@ -178,6 +178,8 @@ begin create or replace view %1$s_rv as with accessible_%1$s_uuids as ( + -- TODO.perf: this CTE query makes RBAC-SELECT-permission-queries so slow (~500ms), any idea how to optimize? + -- My guess is, that the depth of role-grants causes the problem. with recursive grants as ( select descendantUuid, ascendantUuid, 1 as level from RbacGrants 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 b6a6d263..1e822604 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 @@ -307,7 +307,7 @@ class HsHostingAssetControllerAcceptanceTest extends ContextBasedTestWithCleanup .body("", lenientlyEquals(""" { "statusPhrase": "Bad Request", - "message": "[ + "message": "ERROR: [400] [ <<<'MANAGED_SERVER:vm1400.config.extra' is not expected but is set to '42', <<<'MANAGED_SERVER:vm1400.config.monit_max_cpu_usage' is expected to be at most 100 but is 101, <<<'MANAGED_SERVER:vm1400.config.monit_max_ssd_usage' is expected to be at least 10 but is 0 @@ -360,7 +360,7 @@ class HsHostingAssetControllerAcceptanceTest extends ContextBasedTestWithCleanup .body("", lenientlyEquals(""" { "statusPhrase": "Bad Request", - "message": "['D-1000111:D-1000111 default project:separate ManagedWebspace.resources.Multi=1 allows at maximum 25 unix users, but 26 found]" + "message": "ERROR: [400] ['D-1000111:D-1000111 default project:separate ManagedWebspace.resources.Multi=1 allows at maximum 25 unix users, but 26 found]" } """.replaceAll(" +<<<", ""))); // @formatter:on } 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 62d319ea..7a382edb 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 @@ -32,7 +32,7 @@ import static net.hostsharing.hsadminng.hs.booking.item.TestHsBookingItem.TEST_C import static net.hostsharing.hsadminng.hs.booking.item.TestHsBookingItem.TEST_MANAGED_SERVER_BOOKING_ITEM; import static net.hostsharing.hsadminng.hs.hosting.asset.TestHsHostingAssetEntities.TEST_MANAGED_SERVER_HOSTING_ASSET; import static net.hostsharing.hsadminng.hs.hosting.asset.TestHsHostingAssetEntities.TEST_MANAGED_WEBSPACE_HOSTING_ASSET; -import static net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactBareTestEntity.TEST_BARE_CONTACT; +import static net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRealTestEntity.TEST_REAL_CONTACT; import static net.hostsharing.hsadminng.rbac.test.JsonMatcher.lenientlyEquals; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.any; @@ -75,7 +75,7 @@ public class HsHostingAssetControllerRestTest { .bookingItem(TEST_CLOUD_SERVER_BOOKING_ITEM) .identifier("vm1234") .caption("some fake cloud-server") - .alarmContact(TEST_BARE_CONTACT) + .alarmContact(TEST_REAL_CONTACT) .build()), """ [ @@ -101,7 +101,7 @@ public class HsHostingAssetControllerRestTest { .bookingItem(TEST_MANAGED_SERVER_BOOKING_ITEM) .identifier("vm1234") .caption("some fake managed-server") - .alarmContact(TEST_BARE_CONTACT) + .alarmContact(TEST_REAL_CONTACT) .config(Map.ofEntries( entry("monit_max_ssd_usage", 70), entry("monit_max_cpu_usage", 80), diff --git a/src/test/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetEntityPatcherUnitTest.java b/src/test/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetEntityPatcherUnitTest.java index 272c31e8..f9e4c568 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetEntityPatcherUnitTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetEntityPatcherUnitTest.java @@ -1,7 +1,7 @@ package net.hostsharing.hsadminng.hs.hosting.asset; import net.hostsharing.hsadminng.hs.hosting.generated.api.v1.model.HsHostingAssetPatchResource; -import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactBareEntity; +import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRealEntity; import net.hostsharing.hsadminng.mapper.KeyValueMap; import net.hostsharing.hsadminng.rbac.test.PatchUnitTestBase; import org.junit.jupiter.api.BeforeEach; @@ -48,7 +48,7 @@ class HsHostingAssetEntityPatcherUnitTest extends PatchUnitTestBase< entry("SSD", 256), entry("MEM", 64) ); - final HsOfficeContactBareEntity givenInitialContact = HsOfficeContactBareEntity.builder() + final HsOfficeContactRealEntity givenInitialContact = HsOfficeContactRealEntity.builder() .uuid(UUID.randomUUID()) .build(); @@ -62,8 +62,8 @@ class HsHostingAssetEntityPatcherUnitTest extends PatchUnitTestBase< void initMocks() { lenient().when(em.getReference(eq(HsHostingAssetEntity.class), any())).thenAnswer(invocation -> HsHostingAssetEntity.builder().uuid(invocation.getArgument(1)).build()); - lenient().when(em.getReference(eq(HsOfficeContactBareEntity.class), any())).thenAnswer(invocation -> - HsOfficeContactBareEntity.builder().uuid(invocation.getArgument(1)).build()); + lenient().when(em.getReference(eq(HsOfficeContactRealEntity.class), any())).thenAnswer(invocation -> + HsOfficeContactRealEntity.builder().uuid(invocation.getArgument(1)).build()); } @Override @@ -111,7 +111,7 @@ class HsHostingAssetEntityPatcherUnitTest extends PatchUnitTestBase< ); } - static HsOfficeContactBareEntity newContact(final UUID uuid) { - return HsOfficeContactBareEntity.builder().uuid(uuid).build(); + static HsOfficeContactRealEntity newContact(final UUID uuid) { + return HsOfficeContactRealEntity.builder().uuid(uuid).build(); } } diff --git a/src/test/java/net/hostsharing/hsadminng/hs/migration/HsHostingAssetBareEntity.java b/src/test/java/net/hostsharing/hsadminng/hs/migration/HsHostingAssetRealEntity.java similarity index 89% rename from src/test/java/net/hostsharing/hsadminng/hs/migration/HsHostingAssetBareEntity.java rename to src/test/java/net/hostsharing/hsadminng/hs/migration/HsHostingAssetRealEntity.java index 34e6721f..51665b9c 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/migration/HsHostingAssetBareEntity.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/migration/HsHostingAssetRealEntity.java @@ -10,7 +10,7 @@ import lombok.Setter; import net.hostsharing.hsadminng.hs.booking.item.HsBookingItemEntity; import net.hostsharing.hsadminng.hs.hosting.asset.HsHostingAsset; import net.hostsharing.hsadminng.hs.hosting.asset.HsHostingAssetType; -import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactBareEntity; +import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRealEntity; import net.hostsharing.hsadminng.mapper.PatchableMapWrapper; import org.hibernate.annotations.Type; @@ -42,7 +42,7 @@ import java.util.UUID; @Setter @NoArgsConstructor @AllArgsConstructor -public class HsHostingAssetBareEntity implements HsHostingAsset { +public class HsHostingAssetRealEntity implements HsHostingAsset { @Id @GeneratedValue @@ -57,11 +57,11 @@ public class HsHostingAssetBareEntity implements HsHostingAsset { @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "parentassetuuid") - private HsHostingAssetBareEntity parentAsset; + private HsHostingAssetRealEntity parentAsset; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "assignedtoassetuuid") - private HsHostingAssetBareEntity assignedToAsset; + private HsHostingAssetRealEntity assignedToAsset; @Column(name = "type") @Enumerated(EnumType.STRING) @@ -69,11 +69,11 @@ public class HsHostingAssetBareEntity implements HsHostingAsset { @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "alarmcontactuuid") - private HsOfficeContactBareEntity alarmContact; + private HsOfficeContactRealEntity alarmContact; @OneToMany(cascade = CascadeType.REFRESH, orphanRemoval = true, fetch = FetchType.LAZY) @JoinColumn(name = "parentassetuuid", referencedColumnName = "uuid") - private List subHostingAssets; + private List subHostingAssets; @Column(name = "identifier") private String identifier; // e.g. vm1234, xyz00, example.org, xyz00_abc @@ -109,6 +109,6 @@ public class HsHostingAssetBareEntity implements HsHostingAsset { @Override public String toString() { - return stringify.using(HsHostingAssetBareEntity.class).apply(this); + return stringify.using(HsHostingAssetRealEntity.class).apply(this); } } diff --git a/src/test/java/net/hostsharing/hsadminng/hs/migration/ImportHostingAssets.java b/src/test/java/net/hostsharing/hsadminng/hs/migration/ImportHostingAssets.java index cb07b688..ae1b5e44 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/migration/ImportHostingAssets.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/migration/ImportHostingAssets.java @@ -113,13 +113,13 @@ public class ImportHostingAssets extends ImportOfficeData { static final Integer DBUSER_ID_OFFSET = 7000000; static final Integer DB_ID_OFFSET = 8000000; - record Hive(int hive_id, String hive_name, int inet_addr_id, AtomicReference serverRef) {} + record Hive(int hive_id, String hive_name, int inet_addr_id, AtomicReference serverRef) {} static Map bookingProjects = new WriteOnceMap<>(); static Map bookingItems = new WriteOnceMap<>(); static Map hives = new WriteOnceMap<>(); - static Map hostingAssets = new WriteOnceMap<>(); // TODO.impl: separate maps for each type? - static Map dbUsersByEngineAndName = new WriteOnceMap<>(); + static Map hostingAssets = new WriteOnceMap<>(); // TODO.impl: separate maps for each type? + static Map dbUsersByEngineAndName = new WriteOnceMap<>(); @Test @Order(11010) @@ -150,11 +150,11 @@ public class ImportHostingAssets extends ImportOfficeData { assertThat(firstOfEachType(5, IPV4_NUMBER)).isEqualToIgnoringWhitespace(""" { - 1000363=HsHostingAssetBareEntity(IPV4_NUMBER, 83.223.95.34), - 1000381=HsHostingAssetBareEntity(IPV4_NUMBER, 83.223.95.52), - 1000402=HsHostingAssetBareEntity(IPV4_NUMBER, 83.223.95.73), - 1000433=HsHostingAssetBareEntity(IPV4_NUMBER, 83.223.95.104), - 1000457=HsHostingAssetBareEntity(IPV4_NUMBER, 83.223.95.128) + 1000363=HsHostingAssetRealEntity(IPV4_NUMBER, 83.223.95.34), + 1000381=HsHostingAssetRealEntity(IPV4_NUMBER, 83.223.95.52), + 1000402=HsHostingAssetRealEntity(IPV4_NUMBER, 83.223.95.73), + 1000433=HsHostingAssetRealEntity(IPV4_NUMBER, 83.223.95.104), + 1000457=HsHostingAssetRealEntity(IPV4_NUMBER, 83.223.95.128) } """); } @@ -204,13 +204,13 @@ public class ImportHostingAssets extends ImportOfficeData { assertThat(firstOfEachType(3, CLOUD_SERVER, MANAGED_SERVER, MANAGED_WEBSPACE)).isEqualToIgnoringWhitespace(""" { - 3000630=HsHostingAssetBareEntity(MANAGED_WEBSPACE, hsh00, HA hsh00, MANAGED_SERVER:vm1050, D-1000000:hsh default project:BI hsh00), - 3000968=HsHostingAssetBareEntity(MANAGED_SERVER, vm1061, HA vm1061, D-1015200:rar default project:BI vm1061), - 3000978=HsHostingAssetBareEntity(MANAGED_SERVER, vm1050, HA vm1050, D-1000000:hsh default project:BI vm1050), - 3001061=HsHostingAssetBareEntity(MANAGED_SERVER, vm1068, HA vm1068, D-1000300:mim default project:BI vm1068), - 3001094=HsHostingAssetBareEntity(MANAGED_WEBSPACE, lug00, HA lug00, MANAGED_SERVER:vm1068, D-1000300:mim default project:BI lug00), - 3001112=HsHostingAssetBareEntity(MANAGED_WEBSPACE, mim00, HA mim00, MANAGED_SERVER:vm1068, D-1000300:mim default project:BI mim00), - 3023611=HsHostingAssetBareEntity(CLOUD_SERVER, vm2097, HA vm2097, D-1101800:wws default project:BI vm2097) + 3000630=HsHostingAssetRealEntity(MANAGED_WEBSPACE, hsh00, HA hsh00, MANAGED_SERVER:vm1050, D-1000000:hsh default project:BI hsh00), + 3000968=HsHostingAssetRealEntity(MANAGED_SERVER, vm1061, HA vm1061, D-1015200:rar default project:BI vm1061), + 3000978=HsHostingAssetRealEntity(MANAGED_SERVER, vm1050, HA vm1050, D-1000000:hsh default project:BI vm1050), + 3001061=HsHostingAssetRealEntity(MANAGED_SERVER, vm1068, HA vm1068, D-1000300:mim default project:BI vm1068), + 3001094=HsHostingAssetRealEntity(MANAGED_WEBSPACE, lug00, HA lug00, MANAGED_SERVER:vm1068, D-1000300:mim default project:BI lug00), + 3001112=HsHostingAssetRealEntity(MANAGED_WEBSPACE, mim00, HA mim00, MANAGED_SERVER:vm1068, D-1000300:mim default project:BI mim00), + 3023611=HsHostingAssetRealEntity(CLOUD_SERVER, vm2097, HA vm2097, D-1101800:wws default project:BI vm2097) } """); assertThat(firstOfEachType( @@ -249,15 +249,15 @@ public class ImportHostingAssets extends ImportOfficeData { assertThat(firstOfEachType(5, CLOUD_SERVER, MANAGED_SERVER, MANAGED_WEBSPACE)) .isEqualToIgnoringWhitespace(""" { - 3000630=HsHostingAssetBareEntity(MANAGED_WEBSPACE, hsh00, HA hsh00, MANAGED_SERVER:vm1050, D-1000000:hsh default project:BI hsh00), - 3000968=HsHostingAssetBareEntity(MANAGED_SERVER, vm1061, HA vm1061, D-1015200:rar default project:BI vm1061), - 3000978=HsHostingAssetBareEntity(MANAGED_SERVER, vm1050, HA vm1050, D-1000000:hsh default project:BI vm1050), - 3001061=HsHostingAssetBareEntity(MANAGED_SERVER, vm1068, HA vm1068, D-1000300:mim default project:BI vm1068), - 3001094=HsHostingAssetBareEntity(MANAGED_WEBSPACE, lug00, HA lug00, MANAGED_SERVER:vm1068, D-1000300:mim default project:BI lug00), - 3001112=HsHostingAssetBareEntity(MANAGED_WEBSPACE, mim00, HA mim00, MANAGED_SERVER:vm1068, D-1000300:mim default project:BI mim00), - 3001447=HsHostingAssetBareEntity(MANAGED_SERVER, vm1093, HA vm1093, D-1000000:hsh default project:BI vm1093), - 3019959=HsHostingAssetBareEntity(MANAGED_WEBSPACE, dph00, HA dph00, MANAGED_SERVER:vm1093, D-1101900:dph default project:BI dph00), - 3023611=HsHostingAssetBareEntity(CLOUD_SERVER, vm2097, HA vm2097, D-1101800:wws default project:BI vm2097) + 3000630=HsHostingAssetRealEntity(MANAGED_WEBSPACE, hsh00, HA hsh00, MANAGED_SERVER:vm1050, D-1000000:hsh default project:BI hsh00), + 3000968=HsHostingAssetRealEntity(MANAGED_SERVER, vm1061, HA vm1061, D-1015200:rar default project:BI vm1061), + 3000978=HsHostingAssetRealEntity(MANAGED_SERVER, vm1050, HA vm1050, D-1000000:hsh default project:BI vm1050), + 3001061=HsHostingAssetRealEntity(MANAGED_SERVER, vm1068, HA vm1068, D-1000300:mim default project:BI vm1068), + 3001094=HsHostingAssetRealEntity(MANAGED_WEBSPACE, lug00, HA lug00, MANAGED_SERVER:vm1068, D-1000300:mim default project:BI lug00), + 3001112=HsHostingAssetRealEntity(MANAGED_WEBSPACE, mim00, HA mim00, MANAGED_SERVER:vm1068, D-1000300:mim default project:BI mim00), + 3001447=HsHostingAssetRealEntity(MANAGED_SERVER, vm1093, HA vm1093, D-1000000:hsh default project:BI vm1093), + 3019959=HsHostingAssetRealEntity(MANAGED_WEBSPACE, dph00, HA dph00, MANAGED_SERVER:vm1093, D-1101900:dph default project:BI dph00), + 3023611=HsHostingAssetRealEntity(CLOUD_SERVER, vm2097, HA vm2097, D-1101800:wws default project:BI vm2097) } """); assertThat(firstOfEachType( @@ -298,20 +298,20 @@ public class ImportHostingAssets extends ImportOfficeData { assertThat(firstOfEachType(15, UNIX_USER)).isEqualToIgnoringWhitespace(""" { - 4005803=HsHostingAssetBareEntity(UNIX_USER, lug00, LUGs, MANAGED_WEBSPACE:lug00, { "SSD hard quota": 0, "SSD soft quota": 0, "locked": false, "shell": "/bin/bash", "userid": 102090}), - 4005805=HsHostingAssetBareEntity(UNIX_USER, lug00-wla.1, Paul Klemm, MANAGED_WEBSPACE:lug00, { "SSD hard quota": 0, "SSD soft quota": 0, "locked": false, "shell": "/bin/bash", "userid": 102091}), - 4005809=HsHostingAssetBareEntity(UNIX_USER, lug00-wla.2, Walter Müller, MANAGED_WEBSPACE:lug00, { "SSD hard quota": 8, "SSD soft quota": 4, "locked": false, "shell": "/bin/bash", "userid": 102093}), - 4005811=HsHostingAssetBareEntity(UNIX_USER, lug00-ola.a, LUG OLA - POP a, MANAGED_WEBSPACE:lug00, { "SSD hard quota": 0, "SSD soft quota": 0, "locked": false, "shell": "/usr/bin/passwd", "userid": 102094}), - 4005813=HsHostingAssetBareEntity(UNIX_USER, lug00-ola.b, LUG OLA - POP b, MANAGED_WEBSPACE:lug00, { "SSD hard quota": 0, "SSD soft quota": 0, "locked": false, "shell": "/usr/bin/passwd", "userid": 102095}), - 4005835=HsHostingAssetBareEntity(UNIX_USER, lug00-test, Test, MANAGED_WEBSPACE:lug00, { "SSD hard quota": 1024, "SSD soft quota": 1024, "locked": false, "shell": "/usr/bin/passwd", "userid": 102106}), - 4005964=HsHostingAssetBareEntity(UNIX_USER, mim00, Michael Mellis, MANAGED_WEBSPACE:mim00, { "SSD hard quota": 0, "SSD soft quota": 0, "locked": false, "shell": "/bin/bash", "userid": 102147}), - 4005966=HsHostingAssetBareEntity(UNIX_USER, mim00-1981, Jahrgangstreffen 1981, MANAGED_WEBSPACE:mim00, { "SSD hard quota": 256, "SSD soft quota": 128, "locked": false, "shell": "/bin/bash", "userid": 102148}), - 4005990=HsHostingAssetBareEntity(UNIX_USER, mim00-mail, Mailbox, MANAGED_WEBSPACE:mim00, { "SSD hard quota": 0, "SSD soft quota": 0, "locked": false, "shell": "/bin/bash", "userid": 102160}), - 4100705=HsHostingAssetBareEntity(UNIX_USER, hsh00-mim, Michael Mellis, MANAGED_WEBSPACE:hsh00, { "HDD hard quota": 0, "HDD soft quota": 0, "SSD hard quota": 0, "SSD soft quota": 0, "locked": false, "shell": "/bin/false", "userid": 10003}), - 4100824=HsHostingAssetBareEntity(UNIX_USER, hsh00, Hostsharing Paket, MANAGED_WEBSPACE:hsh00, { "HDD hard quota": 0, "HDD soft quota": 0, "SSD hard quota": 0, "SSD soft quota": 0, "locked": false, "shell": "/bin/bash", "userid": 10000}), - 4167846=HsHostingAssetBareEntity(UNIX_USER, hsh00-dph, hsh00-uph, MANAGED_WEBSPACE:hsh00, { "HDD hard quota": 0, "HDD soft quota": 0, "SSD hard quota": 0, "SSD soft quota": 0, "locked": false, "shell": "/bin/false", "userid": 110568}), - 4169546=HsHostingAssetBareEntity(UNIX_USER, dph00, Reinhard Wiese, MANAGED_WEBSPACE:dph00, { "SSD hard quota": 0, "SSD soft quota": 0, "locked": false, "shell": "/bin/bash", "userid": 110593}), - 4169596=HsHostingAssetBareEntity(UNIX_USER, dph00-uph, Domain admin, MANAGED_WEBSPACE:dph00, { "SSD hard quota": 0, "SSD soft quota": 0, "locked": false, "shell": "/bin/bash", "userid": 110594}) + 4005803=HsHostingAssetRealEntity(UNIX_USER, lug00, LUGs, MANAGED_WEBSPACE:lug00, { "SSD hard quota": 0, "SSD soft quota": 0, "locked": false, "shell": "/bin/bash", "userid": 102090}), + 4005805=HsHostingAssetRealEntity(UNIX_USER, lug00-wla.1, Paul Klemm, MANAGED_WEBSPACE:lug00, { "SSD hard quota": 0, "SSD soft quota": 0, "locked": false, "shell": "/bin/bash", "userid": 102091}), + 4005809=HsHostingAssetRealEntity(UNIX_USER, lug00-wla.2, Walter Müller, MANAGED_WEBSPACE:lug00, { "SSD hard quota": 8, "SSD soft quota": 4, "locked": false, "shell": "/bin/bash", "userid": 102093}), + 4005811=HsHostingAssetRealEntity(UNIX_USER, lug00-ola.a, LUG OLA - POP a, MANAGED_WEBSPACE:lug00, { "SSD hard quota": 0, "SSD soft quota": 0, "locked": false, "shell": "/usr/bin/passwd", "userid": 102094}), + 4005813=HsHostingAssetRealEntity(UNIX_USER, lug00-ola.b, LUG OLA - POP b, MANAGED_WEBSPACE:lug00, { "SSD hard quota": 0, "SSD soft quota": 0, "locked": false, "shell": "/usr/bin/passwd", "userid": 102095}), + 4005835=HsHostingAssetRealEntity(UNIX_USER, lug00-test, Test, MANAGED_WEBSPACE:lug00, { "SSD hard quota": 1024, "SSD soft quota": 1024, "locked": false, "shell": "/usr/bin/passwd", "userid": 102106}), + 4005964=HsHostingAssetRealEntity(UNIX_USER, mim00, Michael Mellis, MANAGED_WEBSPACE:mim00, { "SSD hard quota": 0, "SSD soft quota": 0, "locked": false, "shell": "/bin/bash", "userid": 102147}), + 4005966=HsHostingAssetRealEntity(UNIX_USER, mim00-1981, Jahrgangstreffen 1981, MANAGED_WEBSPACE:mim00, { "SSD hard quota": 256, "SSD soft quota": 128, "locked": false, "shell": "/bin/bash", "userid": 102148}), + 4005990=HsHostingAssetRealEntity(UNIX_USER, mim00-mail, Mailbox, MANAGED_WEBSPACE:mim00, { "SSD hard quota": 0, "SSD soft quota": 0, "locked": false, "shell": "/bin/bash", "userid": 102160}), + 4100705=HsHostingAssetRealEntity(UNIX_USER, hsh00-mim, Michael Mellis, MANAGED_WEBSPACE:hsh00, { "HDD hard quota": 0, "HDD soft quota": 0, "SSD hard quota": 0, "SSD soft quota": 0, "locked": false, "shell": "/bin/false", "userid": 10003}), + 4100824=HsHostingAssetRealEntity(UNIX_USER, hsh00, Hostsharing Paket, MANAGED_WEBSPACE:hsh00, { "HDD hard quota": 0, "HDD soft quota": 0, "SSD hard quota": 0, "SSD soft quota": 0, "locked": false, "shell": "/bin/bash", "userid": 10000}), + 4167846=HsHostingAssetRealEntity(UNIX_USER, hsh00-dph, hsh00-uph, MANAGED_WEBSPACE:hsh00, { "HDD hard quota": 0, "HDD soft quota": 0, "SSD hard quota": 0, "SSD soft quota": 0, "locked": false, "shell": "/bin/false", "userid": 110568}), + 4169546=HsHostingAssetRealEntity(UNIX_USER, dph00, Reinhard Wiese, MANAGED_WEBSPACE:dph00, { "SSD hard quota": 0, "SSD soft quota": 0, "locked": false, "shell": "/bin/bash", "userid": 110593}), + 4169596=HsHostingAssetRealEntity(UNIX_USER, dph00-uph, Domain admin, MANAGED_WEBSPACE:dph00, { "SSD hard quota": 0, "SSD soft quota": 0, "locked": false, "shell": "/bin/bash", "userid": 110594}) } """); } @@ -334,17 +334,17 @@ public class ImportHostingAssets extends ImportOfficeData { assertThat(firstOfEachType(15, EMAIL_ALIAS)).isEqualToIgnoringWhitespace(""" { - 5002403=HsHostingAssetBareEntity(EMAIL_ALIAS, lug00, lug00, MANAGED_WEBSPACE:lug00, { "target": "[michael.mellis@example.com]"}), - 5002405=HsHostingAssetBareEntity(EMAIL_ALIAS, lug00-wla-listar, lug00-wla-listar, MANAGED_WEBSPACE:lug00, { "target": "[|/home/pacs/lug00/users/in/mailinglist/listar]"}), - 5002429=HsHostingAssetBareEntity(EMAIL_ALIAS, mim00, mim00, MANAGED_WEBSPACE:mim00, { "target": "[mim12-mi@mim12.hostsharing.net]"}), - 5002431=HsHostingAssetBareEntity(EMAIL_ALIAS, mim00-abruf, mim00-abruf, MANAGED_WEBSPACE:mim00, { "target": "[michael.mellis@hostsharing.net]"}), - 5002449=HsHostingAssetBareEntity(EMAIL_ALIAS, mim00-hhfx, mim00-hhfx, MANAGED_WEBSPACE:mim00, { "target": "[mim00-hhfx, |/usr/bin/formail -I 'Reply-To: hamburger-fx@example.net' | /usr/lib/sendmail mim00-hhfx-l]"}), - 5002451=HsHostingAssetBareEntity(EMAIL_ALIAS, mim00-hhfx-l, mim00-hhfx-l, MANAGED_WEBSPACE:mim00, { "target": "[:include:/home/pacs/mim00/etc/hhfx.list]"}), - 5002452=HsHostingAssetBareEntity(EMAIL_ALIAS, mim00-empty, mim00-empty, MANAGED_WEBSPACE:mim00, { "target": "[]"}), - 5002453=HsHostingAssetBareEntity(EMAIL_ALIAS, mim00-0_entries, mim00-0_entries, MANAGED_WEBSPACE:mim00, { "target": "[]"}), - 5002454=HsHostingAssetBareEntity(EMAIL_ALIAS, mim00-dev.null, mim00-dev.null, MANAGED_WEBSPACE:mim00, { "target": "[/dev/null]"}), - 5002455=HsHostingAssetBareEntity(EMAIL_ALIAS, mim00-1_with_space, mim00-1_with_space, MANAGED_WEBSPACE:mim00, { "target": "[|/home/pacs/mim00/install/corpslistar/listar]"}), - 5002456=HsHostingAssetBareEntity(EMAIL_ALIAS, mim00-1_with_single_quotes, mim00-1_with_single_quotes, MANAGED_WEBSPACE:mim00, { "target": "[|/home/pacs/rir00/mailinglist/ecartis -r kybs06-intern]"}) + 5002403=HsHostingAssetRealEntity(EMAIL_ALIAS, lug00, lug00, MANAGED_WEBSPACE:lug00, { "target": "[michael.mellis@example.com]"}), + 5002405=HsHostingAssetRealEntity(EMAIL_ALIAS, lug00-wla-listar, lug00-wla-listar, MANAGED_WEBSPACE:lug00, { "target": "[|/home/pacs/lug00/users/in/mailinglist/listar]"}), + 5002429=HsHostingAssetRealEntity(EMAIL_ALIAS, mim00, mim00, MANAGED_WEBSPACE:mim00, { "target": "[mim12-mi@mim12.hostsharing.net]"}), + 5002431=HsHostingAssetRealEntity(EMAIL_ALIAS, mim00-abruf, mim00-abruf, MANAGED_WEBSPACE:mim00, { "target": "[michael.mellis@hostsharing.net]"}), + 5002449=HsHostingAssetRealEntity(EMAIL_ALIAS, mim00-hhfx, mim00-hhfx, MANAGED_WEBSPACE:mim00, { "target": "[mim00-hhfx, |/usr/bin/formail -I 'Reply-To: hamburger-fx@example.net' | /usr/lib/sendmail mim00-hhfx-l]"}), + 5002451=HsHostingAssetRealEntity(EMAIL_ALIAS, mim00-hhfx-l, mim00-hhfx-l, MANAGED_WEBSPACE:mim00, { "target": "[:include:/home/pacs/mim00/etc/hhfx.list]"}), + 5002452=HsHostingAssetRealEntity(EMAIL_ALIAS, mim00-empty, mim00-empty, MANAGED_WEBSPACE:mim00, { "target": "[]"}), + 5002453=HsHostingAssetRealEntity(EMAIL_ALIAS, mim00-0_entries, mim00-0_entries, MANAGED_WEBSPACE:mim00, { "target": "[]"}), + 5002454=HsHostingAssetRealEntity(EMAIL_ALIAS, mim00-dev.null, mim00-dev.null, MANAGED_WEBSPACE:mim00, { "target": "[/dev/null]"}), + 5002455=HsHostingAssetRealEntity(EMAIL_ALIAS, mim00-1_with_space, mim00-1_with_space, MANAGED_WEBSPACE:mim00, { "target": "[|/home/pacs/mim00/install/corpslistar/listar]"}), + 5002456=HsHostingAssetRealEntity(EMAIL_ALIAS, mim00-1_with_single_quotes, mim00-1_with_single_quotes, MANAGED_WEBSPACE:mim00, { "target": "[|/home/pacs/rir00/mailinglist/ecartis -r kybs06-intern]"}) } """); } @@ -362,14 +362,14 @@ public class ImportHostingAssets extends ImportOfficeData { assertThat(firstOfEachType(5, PGSQL_INSTANCE, MARIADB_INSTANCE)).isEqualToIgnoringWhitespace(""" { - 6000000=HsHostingAssetBareEntity(PGSQL_INSTANCE, vm1061|PgSql.default, vm1061-PostgreSQL default instance, MANAGED_SERVER:vm1061), - 6000001=HsHostingAssetBareEntity(MARIADB_INSTANCE, vm1061|MariaDB.default, vm1061-MariaDB default instance, MANAGED_SERVER:vm1061), - 6000002=HsHostingAssetBareEntity(PGSQL_INSTANCE, vm1050|PgSql.default, vm1050-PostgreSQL default instance, MANAGED_SERVER:vm1050), - 6000003=HsHostingAssetBareEntity(MARIADB_INSTANCE, vm1050|MariaDB.default, vm1050-MariaDB default instance, MANAGED_SERVER:vm1050), - 6000004=HsHostingAssetBareEntity(PGSQL_INSTANCE, vm1068|PgSql.default, vm1068-PostgreSQL default instance, MANAGED_SERVER:vm1068), - 6000005=HsHostingAssetBareEntity(MARIADB_INSTANCE, vm1068|MariaDB.default, vm1068-MariaDB default instance, MANAGED_SERVER:vm1068), - 6000006=HsHostingAssetBareEntity(PGSQL_INSTANCE, vm1093|PgSql.default, vm1093-PostgreSQL default instance, MANAGED_SERVER:vm1093), - 6000007=HsHostingAssetBareEntity(MARIADB_INSTANCE, vm1093|MariaDB.default, vm1093-MariaDB default instance, MANAGED_SERVER:vm1093) + 6000000=HsHostingAssetRealEntity(PGSQL_INSTANCE, vm1061|PgSql.default, vm1061-PostgreSQL default instance, MANAGED_SERVER:vm1061), + 6000001=HsHostingAssetRealEntity(MARIADB_INSTANCE, vm1061|MariaDB.default, vm1061-MariaDB default instance, MANAGED_SERVER:vm1061), + 6000002=HsHostingAssetRealEntity(PGSQL_INSTANCE, vm1050|PgSql.default, vm1050-PostgreSQL default instance, MANAGED_SERVER:vm1050), + 6000003=HsHostingAssetRealEntity(MARIADB_INSTANCE, vm1050|MariaDB.default, vm1050-MariaDB default instance, MANAGED_SERVER:vm1050), + 6000004=HsHostingAssetRealEntity(PGSQL_INSTANCE, vm1068|PgSql.default, vm1068-PostgreSQL default instance, MANAGED_SERVER:vm1068), + 6000005=HsHostingAssetRealEntity(MARIADB_INSTANCE, vm1068|MariaDB.default, vm1068-MariaDB default instance, MANAGED_SERVER:vm1068), + 6000006=HsHostingAssetRealEntity(PGSQL_INSTANCE, vm1093|PgSql.default, vm1093-PostgreSQL default instance, MANAGED_SERVER:vm1093), + 6000007=HsHostingAssetRealEntity(MARIADB_INSTANCE, vm1093|MariaDB.default, vm1093-MariaDB default instance, MANAGED_SERVER:vm1093) } """); } @@ -392,16 +392,16 @@ public class ImportHostingAssets extends ImportOfficeData { assertThat(firstOfEachType(5, PGSQL_USER, MARIADB_USER)).isEqualToIgnoringWhitespace(""" { - 7001857=HsHostingAssetBareEntity(PGSQL_USER, PGU|hsh00, hsh00, MANAGED_WEBSPACE:hsh00, PGSQL_INSTANCE:vm1050|PgSql.default, { "password": "SCRAM-SHA-256$4096:Zml4ZWQgc2FsdA==$JDiZmaxU+O+ByArLY/CkYZ8HbOk0r/I8LyABnno5gQs=:NI3T500/63dzI1B07Jh3UtQGlukS6JxuS0XoxM/QgAc="}), - 7001858=HsHostingAssetBareEntity(MARIADB_USER, MAU|hsh00, hsh00, MANAGED_WEBSPACE:hsh00, MARIADB_INSTANCE:vm1050|MariaDB.default, { "password": "*59067A36BA197AD0A47D74909296C5B002A0FB9F"}), - 7001859=HsHostingAssetBareEntity(PGSQL_USER, PGU|hsh00_vorstand, hsh00_vorstand, MANAGED_WEBSPACE:hsh00, PGSQL_INSTANCE:vm1050|PgSql.default, { "password": "SCRAM-SHA-256$4096:Zml4ZWQgc2FsdA==$54Wh+OGx/GaIvAia+I3k78jHGhqmYwe4+iLssmH5zhk=:D4Gq1z2Li2BVSaZrz1azDrs6pwsIzhq4+suK1Hh6ZIg="}), - 7001860=HsHostingAssetBareEntity(PGSQL_USER, PGU|hsh00_hsadmin, hsh00_hsadmin, MANAGED_WEBSPACE:hsh00, PGSQL_INSTANCE:vm1050|PgSql.default, { "password": "SCRAM-SHA-256$4096:Zml4ZWQgc2FsdA==$54Wh+OGx/GaIvAia+I3k78jHGhqmYwe4+iLssmH5zhk=:D4Gq1z2Li2BVSaZrz1azDrs6pwsIzhq4+suK1Hh6ZIg="}), - 7001861=HsHostingAssetBareEntity(PGSQL_USER, PGU|hsh00_hsadmin_ro, hsh00_hsadmin_ro, MANAGED_WEBSPACE:hsh00, PGSQL_INSTANCE:vm1050|PgSql.default, { "password": "SCRAM-SHA-256$4096:Zml4ZWQgc2FsdA==$UhJnJJhmKANbcaG+izWK3rz5bmhhluSuiCJFlUmDVI8=:6AC4mbLfJGiGlEOWhpz9BivvMODhLLHOnRnnktJPgn8="}), - 7004908=HsHostingAssetBareEntity(MARIADB_USER, MAU|hsh00_mantis, hsh00_mantis, MANAGED_WEBSPACE:hsh00, MARIADB_INSTANCE:vm1050|MariaDB.default, { "password": "*EA4C0889A22AAE66BBEBC88161E8CF862D73B44F"}), - 7004909=HsHostingAssetBareEntity(MARIADB_USER, MAU|hsh00_mantis_ro, hsh00_mantis_ro, MANAGED_WEBSPACE:hsh00, MARIADB_INSTANCE:vm1050|MariaDB.default, { "password": "*B3BB6D0DA2EC01958616E9B3BCD2926FE8C38383"}), - 7004931=HsHostingAssetBareEntity(PGSQL_USER, PGU|hsh00_phpPgSqlAdmin, hsh00_phpPgSqlAdmin, MANAGED_WEBSPACE:hsh00, PGSQL_INSTANCE:vm1050|PgSql.default, { "password": "SCRAM-SHA-256$4096:Zml4ZWQgc2FsdA==$UhJnJJhmKANbcaG+izWK3rz5bmhhluSuiCJFlUmDVI8=:6AC4mbLfJGiGlEOWhpz9BivvMODhLLHOnRnnktJPgn8="}), - 7004932=HsHostingAssetBareEntity(MARIADB_USER, MAU|hsh00_phpMyAdmin, hsh00_phpMyAdmin, MANAGED_WEBSPACE:hsh00, MARIADB_INSTANCE:vm1050|MariaDB.default, { "password": "*3188720B1889EF5447C722629765F296F40257C2"}), - 7007520=HsHostingAssetBareEntity(MARIADB_USER, MAU|lug00_wla, lug00_wla, MANAGED_WEBSPACE:lug00, MARIADB_INSTANCE:vm1068|MariaDB.default, { "password": "*11667C0EAC42BF8B0295ABEDC7D2868A835E4DB5"}) + 7001857=HsHostingAssetRealEntity(PGSQL_USER, PGU|hsh00, hsh00, MANAGED_WEBSPACE:hsh00, PGSQL_INSTANCE:vm1050|PgSql.default, { "password": "SCRAM-SHA-256$4096:Zml4ZWQgc2FsdA==$JDiZmaxU+O+ByArLY/CkYZ8HbOk0r/I8LyABnno5gQs=:NI3T500/63dzI1B07Jh3UtQGlukS6JxuS0XoxM/QgAc="}), + 7001858=HsHostingAssetRealEntity(MARIADB_USER, MAU|hsh00, hsh00, MANAGED_WEBSPACE:hsh00, MARIADB_INSTANCE:vm1050|MariaDB.default, { "password": "*59067A36BA197AD0A47D74909296C5B002A0FB9F"}), + 7001859=HsHostingAssetRealEntity(PGSQL_USER, PGU|hsh00_vorstand, hsh00_vorstand, MANAGED_WEBSPACE:hsh00, PGSQL_INSTANCE:vm1050|PgSql.default, { "password": "SCRAM-SHA-256$4096:Zml4ZWQgc2FsdA==$54Wh+OGx/GaIvAia+I3k78jHGhqmYwe4+iLssmH5zhk=:D4Gq1z2Li2BVSaZrz1azDrs6pwsIzhq4+suK1Hh6ZIg="}), + 7001860=HsHostingAssetRealEntity(PGSQL_USER, PGU|hsh00_hsadmin, hsh00_hsadmin, MANAGED_WEBSPACE:hsh00, PGSQL_INSTANCE:vm1050|PgSql.default, { "password": "SCRAM-SHA-256$4096:Zml4ZWQgc2FsdA==$54Wh+OGx/GaIvAia+I3k78jHGhqmYwe4+iLssmH5zhk=:D4Gq1z2Li2BVSaZrz1azDrs6pwsIzhq4+suK1Hh6ZIg="}), + 7001861=HsHostingAssetRealEntity(PGSQL_USER, PGU|hsh00_hsadmin_ro, hsh00_hsadmin_ro, MANAGED_WEBSPACE:hsh00, PGSQL_INSTANCE:vm1050|PgSql.default, { "password": "SCRAM-SHA-256$4096:Zml4ZWQgc2FsdA==$UhJnJJhmKANbcaG+izWK3rz5bmhhluSuiCJFlUmDVI8=:6AC4mbLfJGiGlEOWhpz9BivvMODhLLHOnRnnktJPgn8="}), + 7004908=HsHostingAssetRealEntity(MARIADB_USER, MAU|hsh00_mantis, hsh00_mantis, MANAGED_WEBSPACE:hsh00, MARIADB_INSTANCE:vm1050|MariaDB.default, { "password": "*EA4C0889A22AAE66BBEBC88161E8CF862D73B44F"}), + 7004909=HsHostingAssetRealEntity(MARIADB_USER, MAU|hsh00_mantis_ro, hsh00_mantis_ro, MANAGED_WEBSPACE:hsh00, MARIADB_INSTANCE:vm1050|MariaDB.default, { "password": "*B3BB6D0DA2EC01958616E9B3BCD2926FE8C38383"}), + 7004931=HsHostingAssetRealEntity(PGSQL_USER, PGU|hsh00_phpPgSqlAdmin, hsh00_phpPgSqlAdmin, MANAGED_WEBSPACE:hsh00, PGSQL_INSTANCE:vm1050|PgSql.default, { "password": "SCRAM-SHA-256$4096:Zml4ZWQgc2FsdA==$UhJnJJhmKANbcaG+izWK3rz5bmhhluSuiCJFlUmDVI8=:6AC4mbLfJGiGlEOWhpz9BivvMODhLLHOnRnnktJPgn8="}), + 7004932=HsHostingAssetRealEntity(MARIADB_USER, MAU|hsh00_phpMyAdmin, hsh00_phpMyAdmin, MANAGED_WEBSPACE:hsh00, MARIADB_INSTANCE:vm1050|MariaDB.default, { "password": "*3188720B1889EF5447C722629765F296F40257C2"}), + 7007520=HsHostingAssetRealEntity(MARIADB_USER, MAU|lug00_wla, lug00_wla, MANAGED_WEBSPACE:lug00, MARIADB_INSTANCE:vm1068|MariaDB.default, { "password": "*11667C0EAC42BF8B0295ABEDC7D2868A835E4DB5"}) } """); } @@ -424,16 +424,16 @@ public class ImportHostingAssets extends ImportOfficeData { assertThat(firstOfEachType(5, PGSQL_DATABASE, MARIADB_DATABASE)).isEqualToIgnoringWhitespace(""" { - 8000077=HsHostingAssetBareEntity(PGSQL_DATABASE, PGD|hsh00_vorstand, hsh00_vorstand, PGSQL_USER:PGU|hsh00_vorstand, { "encoding": "LATIN1"}), - 8000786=HsHostingAssetBareEntity(MARIADB_DATABASE, MAD|hsh00_addr, hsh00_addr, MARIADB_USER:MAU|hsh00, { "encoding": "latin1"}), - 8000805=HsHostingAssetBareEntity(MARIADB_DATABASE, MAD|hsh00_db2, hsh00_db2, MARIADB_USER:MAU|hsh00, { "encoding": "latin1"}), - 8001858=HsHostingAssetBareEntity(PGSQL_DATABASE, PGD|hsh00, hsh00, PGSQL_USER:PGU|hsh00, { "encoding": "LATIN1"}), - 8001860=HsHostingAssetBareEntity(PGSQL_DATABASE, PGD|hsh00_hsadmin, hsh00_hsadmin, PGSQL_USER:PGU|hsh00_hsadmin, { "encoding": "UTF8"}), - 8004908=HsHostingAssetBareEntity(MARIADB_DATABASE, MAD|hsh00_mantis, hsh00_mantis, MARIADB_USER:MAU|hsh00_mantis, { "encoding": "utf8"}), - 8004931=HsHostingAssetBareEntity(PGSQL_DATABASE, PGD|hsh00_phpPgSqlAdmin, hsh00_phpPgSqlAdmin, PGSQL_USER:PGU|hsh00_phpPgSqlAdmin, { "encoding": "UTF8"}), - 8004932=HsHostingAssetBareEntity(PGSQL_DATABASE, PGD|hsh00_phpPgSqlAdmin_new, hsh00_phpPgSqlAdmin_new, PGSQL_USER:PGU|hsh00_phpPgSqlAdmin, { "encoding": "UTF8"}), - 8004941=HsHostingAssetBareEntity(MARIADB_DATABASE, MAD|hsh00_phpMyAdmin, hsh00_phpMyAdmin, MARIADB_USER:MAU|hsh00_phpMyAdmin, { "encoding": "utf8"}), - 8004942=HsHostingAssetBareEntity(MARIADB_DATABASE, MAD|hsh00_phpMyAdmin_old, hsh00_phpMyAdmin_old, MARIADB_USER:MAU|hsh00_phpMyAdmin, { "encoding": "utf8"}) + 8000077=HsHostingAssetRealEntity(PGSQL_DATABASE, PGD|hsh00_vorstand, hsh00_vorstand, PGSQL_USER:PGU|hsh00_vorstand, { "encoding": "LATIN1"}), + 8000786=HsHostingAssetRealEntity(MARIADB_DATABASE, MAD|hsh00_addr, hsh00_addr, MARIADB_USER:MAU|hsh00, { "encoding": "latin1"}), + 8000805=HsHostingAssetRealEntity(MARIADB_DATABASE, MAD|hsh00_db2, hsh00_db2, MARIADB_USER:MAU|hsh00, { "encoding": "latin1"}), + 8001858=HsHostingAssetRealEntity(PGSQL_DATABASE, PGD|hsh00, hsh00, PGSQL_USER:PGU|hsh00, { "encoding": "LATIN1"}), + 8001860=HsHostingAssetRealEntity(PGSQL_DATABASE, PGD|hsh00_hsadmin, hsh00_hsadmin, PGSQL_USER:PGU|hsh00_hsadmin, { "encoding": "UTF8"}), + 8004908=HsHostingAssetRealEntity(MARIADB_DATABASE, MAD|hsh00_mantis, hsh00_mantis, MARIADB_USER:MAU|hsh00_mantis, { "encoding": "utf8"}), + 8004931=HsHostingAssetRealEntity(PGSQL_DATABASE, PGD|hsh00_phpPgSqlAdmin, hsh00_phpPgSqlAdmin, PGSQL_USER:PGU|hsh00_phpPgSqlAdmin, { "encoding": "UTF8"}), + 8004932=HsHostingAssetRealEntity(PGSQL_DATABASE, PGD|hsh00_phpPgSqlAdmin_new, hsh00_phpPgSqlAdmin_new, PGSQL_USER:PGU|hsh00_phpPgSqlAdmin, { "encoding": "UTF8"}), + 8004941=HsHostingAssetRealEntity(MARIADB_DATABASE, MAD|hsh00_phpMyAdmin, hsh00_phpMyAdmin, MARIADB_USER:MAU|hsh00_phpMyAdmin, { "encoding": "utf8"}), + 8004942=HsHostingAssetRealEntity(MARIADB_DATABASE, MAD|hsh00_phpMyAdmin_old, hsh00_phpMyAdmin_old, MARIADB_USER:MAU|hsh00_phpMyAdmin, { "encoding": "utf8"}) } """); } @@ -583,20 +583,20 @@ public class ImportHostingAssets extends ImportOfficeData { assertThat(firstOfEachType(15, UNIX_USER)).isEqualToIgnoringWhitespace(""" { - 4005803=HsHostingAssetBareEntity(UNIX_USER, lug00, LUGs, MANAGED_WEBSPACE:lug00, { "SSD hard quota": 0, "SSD soft quota": 0, "locked": false, "password": null, "shell": "/bin/bash", "userid": 102090}), - 4005805=HsHostingAssetBareEntity(UNIX_USER, lug00-wla.1, Paul Klemm, MANAGED_WEBSPACE:lug00, { "SSD hard quota": 0, "SSD soft quota": 0, "locked": false, "password": null, "shell": "/bin/bash", "userid": 102091}), - 4005809=HsHostingAssetBareEntity(UNIX_USER, lug00-wla.2, Walter Müller, MANAGED_WEBSPACE:lug00, { "SSD hard quota": 8, "SSD soft quota": 4, "locked": false, "password": null, "shell": "/bin/bash", "userid": 102093}), - 4005811=HsHostingAssetBareEntity(UNIX_USER, lug00-ola.a, LUG OLA - POP a, MANAGED_WEBSPACE:lug00, { "SSD hard quota": 0, "SSD soft quota": 0, "locked": false, "password": null, "shell": "/usr/bin/passwd", "userid": 102094}), - 4005813=HsHostingAssetBareEntity(UNIX_USER, lug00-ola.b, LUG OLA - POP b, MANAGED_WEBSPACE:lug00, { "SSD hard quota": 0, "SSD soft quota": 0, "locked": false, "password": null, "shell": "/usr/bin/passwd", "userid": 102095}), - 4005835=HsHostingAssetBareEntity(UNIX_USER, lug00-test, Test, MANAGED_WEBSPACE:lug00, { "SSD hard quota": 1024, "SSD soft quota": 1024, "locked": false, "password": null, "shell": "/usr/bin/passwd", "userid": 102106}), - 4005964=HsHostingAssetBareEntity(UNIX_USER, mim00, Michael Mellis, MANAGED_WEBSPACE:mim00, { "SSD hard quota": 0, "SSD soft quota": 0, "locked": false, "password": null, "shell": "/bin/bash", "userid": 102147}), - 4005966=HsHostingAssetBareEntity(UNIX_USER, mim00-1981, Jahrgangstreffen 1981, MANAGED_WEBSPACE:mim00, { "SSD hard quota": 256, "SSD soft quota": 128, "locked": false, "password": null, "shell": "/bin/bash", "userid": 102148}), - 4005990=HsHostingAssetBareEntity(UNIX_USER, mim00-mail, Mailbox, MANAGED_WEBSPACE:mim00, { "SSD hard quota": 0, "SSD soft quota": 0, "locked": false, "password": null, "shell": "/bin/bash", "userid": 102160}), - 4100705=HsHostingAssetBareEntity(UNIX_USER, hsh00-mim, Michael Mellis, MANAGED_WEBSPACE:hsh00, { "HDD hard quota": 0, "HDD soft quota": 0, "SSD hard quota": 0, "SSD soft quota": 0, "locked": false, "password": null, "shell": "/bin/false", "userid": 10003}), - 4100824=HsHostingAssetBareEntity(UNIX_USER, hsh00, Hostsharing Paket, MANAGED_WEBSPACE:hsh00, { "HDD hard quota": 0, "HDD soft quota": 0, "SSD hard quota": 0, "SSD soft quota": 0, "locked": false, "password": null, "shell": "/bin/bash", "userid": 10000}), - 4167846=HsHostingAssetBareEntity(UNIX_USER, hsh00-dph, hsh00-uph, MANAGED_WEBSPACE:hsh00, { "HDD hard quota": 0, "HDD soft quota": 0, "SSD hard quota": 0, "SSD soft quota": 0, "locked": false, "password": null, "shell": "/bin/false", "userid": 110568}), - 4169546=HsHostingAssetBareEntity(UNIX_USER, dph00, Reinhard Wiese, MANAGED_WEBSPACE:dph00, { "SSD hard quota": 0, "SSD soft quota": 0, "locked": false, "password": null, "shell": "/bin/bash", "userid": 110593}), - 4169596=HsHostingAssetBareEntity(UNIX_USER, dph00-uph, Domain admin, MANAGED_WEBSPACE:dph00, { "SSD hard quota": 0, "SSD soft quota": 0, "locked": false, "password": null, "shell": "/bin/bash", "userid": 110594}) + 4005803=HsHostingAssetRealEntity(UNIX_USER, lug00, LUGs, MANAGED_WEBSPACE:lug00, { "SSD hard quota": 0, "SSD soft quota": 0, "locked": false, "password": null, "shell": "/bin/bash", "userid": 102090}), + 4005805=HsHostingAssetRealEntity(UNIX_USER, lug00-wla.1, Paul Klemm, MANAGED_WEBSPACE:lug00, { "SSD hard quota": 0, "SSD soft quota": 0, "locked": false, "password": null, "shell": "/bin/bash", "userid": 102091}), + 4005809=HsHostingAssetRealEntity(UNIX_USER, lug00-wla.2, Walter Müller, MANAGED_WEBSPACE:lug00, { "SSD hard quota": 8, "SSD soft quota": 4, "locked": false, "password": null, "shell": "/bin/bash", "userid": 102093}), + 4005811=HsHostingAssetRealEntity(UNIX_USER, lug00-ola.a, LUG OLA - POP a, MANAGED_WEBSPACE:lug00, { "SSD hard quota": 0, "SSD soft quota": 0, "locked": false, "password": null, "shell": "/usr/bin/passwd", "userid": 102094}), + 4005813=HsHostingAssetRealEntity(UNIX_USER, lug00-ola.b, LUG OLA - POP b, MANAGED_WEBSPACE:lug00, { "SSD hard quota": 0, "SSD soft quota": 0, "locked": false, "password": null, "shell": "/usr/bin/passwd", "userid": 102095}), + 4005835=HsHostingAssetRealEntity(UNIX_USER, lug00-test, Test, MANAGED_WEBSPACE:lug00, { "SSD hard quota": 1024, "SSD soft quota": 1024, "locked": false, "password": null, "shell": "/usr/bin/passwd", "userid": 102106}), + 4005964=HsHostingAssetRealEntity(UNIX_USER, mim00, Michael Mellis, MANAGED_WEBSPACE:mim00, { "SSD hard quota": 0, "SSD soft quota": 0, "locked": false, "password": null, "shell": "/bin/bash", "userid": 102147}), + 4005966=HsHostingAssetRealEntity(UNIX_USER, mim00-1981, Jahrgangstreffen 1981, MANAGED_WEBSPACE:mim00, { "SSD hard quota": 256, "SSD soft quota": 128, "locked": false, "password": null, "shell": "/bin/bash", "userid": 102148}), + 4005990=HsHostingAssetRealEntity(UNIX_USER, mim00-mail, Mailbox, MANAGED_WEBSPACE:mim00, { "SSD hard quota": 0, "SSD soft quota": 0, "locked": false, "password": null, "shell": "/bin/bash", "userid": 102160}), + 4100705=HsHostingAssetRealEntity(UNIX_USER, hsh00-mim, Michael Mellis, MANAGED_WEBSPACE:hsh00, { "HDD hard quota": 0, "HDD soft quota": 0, "SSD hard quota": 0, "SSD soft quota": 0, "locked": false, "password": null, "shell": "/bin/false", "userid": 10003}), + 4100824=HsHostingAssetRealEntity(UNIX_USER, hsh00, Hostsharing Paket, MANAGED_WEBSPACE:hsh00, { "HDD hard quota": 0, "HDD soft quota": 0, "SSD hard quota": 0, "SSD soft quota": 0, "locked": false, "password": null, "shell": "/bin/bash", "userid": 10000}), + 4167846=HsHostingAssetRealEntity(UNIX_USER, hsh00-dph, hsh00-uph, MANAGED_WEBSPACE:hsh00, { "HDD hard quota": 0, "HDD soft quota": 0, "SSD hard quota": 0, "SSD soft quota": 0, "locked": false, "password": null, "shell": "/bin/false", "userid": 110568}), + 4169546=HsHostingAssetRealEntity(UNIX_USER, dph00, Reinhard Wiese, MANAGED_WEBSPACE:dph00, { "SSD hard quota": 0, "SSD soft quota": 0, "locked": false, "password": null, "shell": "/bin/bash", "userid": 110593}), + 4169596=HsHostingAssetRealEntity(UNIX_USER, dph00-uph, Domain admin, MANAGED_WEBSPACE:dph00, { "SSD hard quota": 0, "SSD soft quota": 0, "locked": false, "password": null, "shell": "/bin/bash", "userid": 110594}) } """); } @@ -622,12 +622,12 @@ public class ImportHostingAssets extends ImportOfficeData { void logErrors() { if (isImportingControlledTestData()) { super.expectErrors(""" - validation failed for id:5002452( HsHostingAssetBareEntity(EMAIL_ALIAS, mim00-empty, mim00-empty, MANAGED_WEBSPACE:mim00, { + validation failed for id:5002452( HsHostingAssetRealEntity(EMAIL_ALIAS, mim00-empty, mim00-empty, MANAGED_WEBSPACE:mim00, { "target": "[]" } )): ['EMAIL_ALIAS:mim00-empty.config.target' length is expected to be at min 1 but length of [[]] is 0]""", """ - validation failed for id:5002453( HsHostingAssetBareEntity(EMAIL_ALIAS, mim00-0_entries, mim00-0_entries, MANAGED_WEBSPACE:mim00, { + validation failed for id:5002453( HsHostingAssetRealEntity(EMAIL_ALIAS, mim00-0_entries, mim00-0_entries, MANAGED_WEBSPACE:mim00, { "target": "[]" } )): ['EMAIL_ALIAS:mim00-0_entries.config.target' length is expected to be at min 1 but length of [[]] is 0]""" @@ -670,7 +670,7 @@ public class ImportHostingAssets extends ImportOfficeData { .map(this::trimAll) .map(row -> new Record(columns, row)) .forEach(rec -> { - final var ipNumber = HsHostingAssetBareEntity.builder() + final var ipNumber = HsHostingAssetRealEntity.builder() .type(IPV4_NUMBER) .identifier(rec.getString("inet_addr")) .caption(rec.getString("description")) @@ -734,7 +734,7 @@ public class ImportHostingAssets extends ImportOfficeData { + packet_name) .isTrue()); - final var asset = HsHostingAssetBareEntity.builder() + final var asset = HsHostingAssetRealEntity.builder() // this turns off identifier validation to accept former default prefixes .isLoaded(haType == MANAGED_WEBSPACE) .type(haType) @@ -874,7 +874,7 @@ public class ImportHostingAssets extends ImportOfficeData { .forEach(rec -> { final var unixuser_id = rec.getInteger("unixuser_id"); final var packet_id = rec.getInteger("packet_id"); - final var unixUserAsset = HsHostingAssetBareEntity.builder() + final var unixUserAsset = HsHostingAssetRealEntity.builder() .type(UNIX_USER) .parentAsset(hostingAssets.get(PACKET_ID_OFFSET + packet_id)) .identifier(rec.getString("name")) @@ -931,7 +931,7 @@ public class ImportHostingAssets extends ImportOfficeData { final var unixuser_id = rec.getInteger("emailalias_id"); final var packet_id = rec.getInteger("pac_id"); final var targets = parseCsvLine(rec.getString("target")); - final var unixUserAsset = HsHostingAssetBareEntity.builder() + final var unixUserAsset = HsHostingAssetRealEntity.builder() .type(EMAIL_ALIAS) .parentAsset(hostingAssets.get(PACKET_ID_OFFSET + packet_id)) .identifier(rec.getString("name")) @@ -944,14 +944,14 @@ public class ImportHostingAssets extends ImportOfficeData { }); } - private void createDatabaseInstances(final List parentAssets) { + private void createDatabaseInstances(final List parentAssets) { final var idRef = new AtomicInteger(0); parentAssets.forEach(pa -> { if (pa.getSubHostingAssets() == null) { pa.setSubHostingAssets(new ArrayList<>()); } - final var pgSqlInstanceAsset = HsHostingAssetBareEntity.builder() + final var pgSqlInstanceAsset = HsHostingAssetRealEntity.builder() .type(PGSQL_INSTANCE) .parentAsset(pa) .identifier(pa.getIdentifier() + "|PgSql.default") @@ -960,7 +960,7 @@ public class ImportHostingAssets extends ImportOfficeData { pa.getSubHostingAssets().add(pgSqlInstanceAsset); hostingAssets.put(DBINSTANCE_ID_OFFSET + idRef.getAndIncrement(), pgSqlInstanceAsset); - final var mariaDbInstanceAsset = HsHostingAssetBareEntity.builder() + final var mariaDbInstanceAsset = HsHostingAssetRealEntity.builder() .type(MARIADB_INSTANCE) .parentAsset(pa) .identifier(pa.getIdentifier() + "|MariaDB.default") @@ -996,7 +996,7 @@ public class ImportHostingAssets extends ImportOfficeData { .filter(ha -> ha.getType() == dbInstanceAssetType) .findAny().orElseThrow(); // there is exactly one: the default instance for the given type - final var dbUserAsset = HsHostingAssetBareEntity.builder() + final var dbUserAsset = HsHostingAssetRealEntity.builder() .type(dbUserAssetType) .parentAsset(hostingAssets.get(PACKET_ID_OFFSET + packet_id)) .assignedToAsset(dbInstanceAsset) @@ -1027,7 +1027,7 @@ public class ImportHostingAssets extends ImportOfficeData { : failWith("unknown DB engine " + engine); final var name = rec.getString("name"); final var encoding = rec.getString("encoding").replaceAll("[-_]+", ""); - final var dbAsset = HsHostingAssetBareEntity.builder() + final var dbAsset = HsHostingAssetRealEntity.builder() .type(type) .parentAsset(owningDbUserHA) .identifier(type.name().substring(0, 2) + "D|" + name) @@ -1069,7 +1069,7 @@ public class ImportHostingAssets extends ImportOfficeData { }; } - private static HsHostingAssetBareEntity ipNumber(final Integer inet_addr_id) { + private static HsHostingAssetRealEntity ipNumber(final Integer inet_addr_id) { return inet_addr_id != null ? hostingAssets.get(IP_NUMBER_ID_OFFSET + inet_addr_id) : null; } @@ -1077,7 +1077,7 @@ public class ImportHostingAssets extends ImportOfficeData { return hive_id != null ? hives.get(HIVE_ID_OFFSET + hive_id) : null; } - private static HsHostingAssetBareEntity pac(final Integer packet_id) { + private static HsHostingAssetRealEntity pac(final Integer packet_id) { return packet_id != null ? hostingAssets.get(PACKET_ID_OFFSET + packet_id) : null; } diff --git a/src/test/java/net/hostsharing/hsadminng/hs/migration/ImportOfficeData.java b/src/test/java/net/hostsharing/hsadminng/hs/migration/ImportOfficeData.java index 78a2ab0a..4e3e9e01 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/migration/ImportOfficeData.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/migration/ImportOfficeData.java @@ -2,7 +2,7 @@ package net.hostsharing.hsadminng.hs.migration; import net.hostsharing.hsadminng.context.Context; import net.hostsharing.hsadminng.hs.office.bankaccount.HsOfficeBankAccountEntity; -import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactBareEntity; +import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRealEntity; import net.hostsharing.hsadminng.hs.office.coopassets.HsOfficeCoopAssetsTransactionEntity; import net.hostsharing.hsadminng.hs.office.coopassets.HsOfficeCoopAssetsTransactionType; import net.hostsharing.hsadminng.hs.office.coopshares.HsOfficeCoopSharesTransactionEntity; @@ -15,7 +15,7 @@ import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerEntity; import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonEntity; import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonType; import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelation; -import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationBareEntity; +import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRealEntity; import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationType; import net.hostsharing.hsadminng.hs.office.sepamandate.HsOfficeSepaMandateEntity; import net.hostsharing.hsadminng.rbac.rbacobject.BaseEntity; @@ -121,7 +121,7 @@ public class ImportOfficeData extends CsvDataImport { -1 ); - static Map contacts = new WriteOnceMap<>(); + static Map contacts = new WriteOnceMap<>(); static Map persons = new WriteOnceMap<>(); static Map partners = new WriteOnceMap<>(); static Map debitors = new WriteOnceMap<>(); @@ -972,7 +972,7 @@ public class ImportOfficeData extends CsvDataImport { contactPerson = addPerson(HsOfficePersonEntity.builder().build(), rec); } - final var contact = HsOfficeContactBareEntity.builder().build(); + final var contact = HsOfficeContactRealEntity.builder().build(); initContact(contact, rec); if (containsPartnerRel(rec)) { @@ -1046,12 +1046,12 @@ public class ImportOfficeData extends CsvDataImport { return containsRole(rec, "partner"); } - private static HsOfficeRelationBareEntity addRelation( + private static HsOfficeRelationRealEntity addRelation( final HsOfficeRelationType type, final HsOfficePersonEntity anchor, final HsOfficePersonEntity holder, - final HsOfficeContactBareEntity contact) { - final var rel = HsOfficeRelationBareEntity.builder() + final HsOfficeContactRealEntity contact) { + final var rel = HsOfficeRelationRealEntity.builder() .anchor(anchor) .holder(holder) .contact(contact) @@ -1111,7 +1111,7 @@ public class ImportOfficeData extends CsvDataImport { assertThat(unexpectedRolesSet).isEmpty(); } - private HsOfficeContactBareEntity initContact(final HsOfficeContactBareEntity contact, final Record contactRecord) { + private HsOfficeContactRealEntity initContact(final HsOfficeContactRealEntity contact, final Record contactRecord) { contact.setCaption(toCaption( contactRecord.getString("salut"), diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/bankaccount/HsOfficeBankAccountControllerRestTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/bankaccount/HsOfficeBankAccountControllerRestTest.java index d870ca1a..37f85f83 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/bankaccount/HsOfficeBankAccountControllerRestTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/bankaccount/HsOfficeBankAccountControllerRestTest.java @@ -77,7 +77,7 @@ class HsOfficeBankAccountControllerRestTest { .andExpect(status().is4xxClientError()) .andExpect(jsonPath("statusCode", is(400))) .andExpect(jsonPath("statusPhrase", is("Bad Request"))) - .andExpect(jsonPath("message", is(testCase.expectedErrorMessage()))); + .andExpect(jsonPath("message", is("ERROR: [400] " + testCase.expectedErrorMessage()))); } enum InvalidBicTestCase { @@ -124,6 +124,6 @@ class HsOfficeBankAccountControllerRestTest { .andExpect(status().is4xxClientError()) .andExpect(jsonPath("statusCode", is(400))) .andExpect(jsonPath("statusPhrase", is("Bad Request"))) - .andExpect(jsonPath("message", is(testCase.expectedErrorMessage()))); + .andExpect(jsonPath("message", is("ERROR: [400] " + testCase.expectedErrorMessage()))); } } diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/contact/HsOfficeContactBareTestEntity.java b/src/test/java/net/hostsharing/hsadminng/hs/office/contact/HsOfficeContactRealTestEntity.java similarity index 62% rename from src/test/java/net/hostsharing/hsadminng/hs/office/contact/HsOfficeContactBareTestEntity.java rename to src/test/java/net/hostsharing/hsadminng/hs/office/contact/HsOfficeContactRealTestEntity.java index bb50a609..d8cdfe1b 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/contact/HsOfficeContactBareTestEntity.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/contact/HsOfficeContactRealTestEntity.java @@ -2,12 +2,12 @@ package net.hostsharing.hsadminng.hs.office.contact; import java.util.Map; -public class HsOfficeContactBareTestEntity { +public class HsOfficeContactRealTestEntity { - public static final HsOfficeContactBareEntity TEST_BARE_CONTACT = hsOfficeContact("some contact", "some-contact@example.com"); + public static final HsOfficeContactRealEntity TEST_REAL_CONTACT = hsOfficeContact("some contact", "some-contact@example.com"); - static public HsOfficeContactBareEntity hsOfficeContact(final String caption, final String emailAddr) { - return HsOfficeContactBareEntity.builder() + static public HsOfficeContactRealEntity hsOfficeContact(final String caption, final String emailAddr) { + return HsOfficeContactRealEntity.builder() .caption(caption) .postalAddress("address of " + caption) .emailAddresses(Map.of("main", emailAddr)) diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionControllerRestTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionControllerRestTest.java index 0d33bf85..8176df09 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionControllerRestTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionControllerRestTest.java @@ -124,7 +124,7 @@ class HsOfficeCoopAssetsTransactionControllerRestTest { .andExpect(status().is4xxClientError()) .andExpect(jsonPath("statusCode", is(400))) .andExpect(jsonPath("statusPhrase", is("Bad Request"))) - .andExpect(jsonPath("message", is(testCase.expectedErrorMessage))); + .andExpect(jsonPath("message", is("ERROR: [400] " + testCase.expectedErrorMessage))); } } diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorControllerAcceptanceTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorControllerAcceptanceTest.java index 45db50d3..68545a78 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorControllerAcceptanceTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorControllerAcceptanceTest.java @@ -5,11 +5,11 @@ import io.restassured.http.ContentType; import net.hostsharing.hsadminng.HsadminNgApplication; import net.hostsharing.hsadminng.context.Context; import net.hostsharing.hsadminng.hs.office.bankaccount.HsOfficeBankAccountRepository; -import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactBareRepository; +import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRealRepository; import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerRepository; import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRepository; -import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationBareEntity; -import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationBareRepository; +import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRealEntity; +import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRealRepository; import net.hostsharing.hsadminng.rbac.test.ContextBasedTestWithCleanup; import net.hostsharing.hsadminng.rbac.test.JpaAttempt; import org.json.JSONException; @@ -55,7 +55,7 @@ class HsOfficeDebitorControllerAcceptanceTest extends ContextBasedTestWithCleanu HsOfficePartnerRepository partnerRepo; @Autowired - HsOfficeContactBareRepository contactBareRepo; + HsOfficeContactRealRepository contactrealRepo; @Autowired HsOfficeBankAccountRepository bankAccountRepo; @@ -64,7 +64,7 @@ class HsOfficeDebitorControllerAcceptanceTest extends ContextBasedTestWithCleanu HsOfficePersonRepository personRepo; @Autowired - HsOfficeRelationBareRepository relBareRepo; + HsOfficeRelationRealRepository relrealRepo; @Autowired JpaAttempt jpaAttempt; @@ -268,13 +268,13 @@ class HsOfficeDebitorControllerAcceptanceTest extends ContextBasedTestWithCleanu context.define("superuser-alex@hostsharing.net"); final var givenPartner = partnerRepo.findPartnerByOptionalNameLike("Third").get(0); - final var givenContact = contactBareRepo.findContactByOptionalCaptionLike("fourth").get(0); + final var givenContact = contactrealRepo.findContactByOptionalCaptionLike("fourth").get(0); final var givenBankAccount = bankAccountRepo.findByOptionalHolderLike("Fourth").get(0); final var givenBillingPerson = personRepo.findPersonByOptionalNameLike("Fourth").get(0); final var givenDebitorRelUUid = jpaAttempt.transacted(() -> { context.define("superuser-alex@hostsharing.net"); - return relBareRepo.save(HsOfficeRelationBareEntity.builder() + return relrealRepo.save(HsOfficeRelationRealEntity.builder() .type(DEBITOR) .anchor(givenPartner.getPartnerRel().getHolder()) .holder(givenBillingPerson) @@ -325,7 +325,7 @@ class HsOfficeDebitorControllerAcceptanceTest extends ContextBasedTestWithCleanu context.define("superuser-alex@hostsharing.net"); final var givenPartner = partnerRepo.findPartnerByOptionalNameLike("Third").get(0); - final var givenContact = contactBareRepo.findContactByOptionalCaptionLike("fourth").get(0); + final var givenContact = contactrealRepo.findContactByOptionalCaptionLike("fourth").get(0); final var location = RestAssured // @formatter:off .given() @@ -405,7 +405,7 @@ class HsOfficeDebitorControllerAcceptanceTest extends ContextBasedTestWithCleanu .post("http://localhost/api/hs/office/debitors") .then().log().all().assertThat() .statusCode(400) - .body("message", is("ERROR: [400] Unable to find BareContact by debitorRel.contactUuid: 00000000-0000-0000-0000-000000000000")); + .body("message", is("ERROR: [400] Unable to find RealContact by debitorRel.contactUuid: 00000000-0000-0000-0000-000000000000")); // @formatter:on } @@ -433,7 +433,7 @@ class HsOfficeDebitorControllerAcceptanceTest extends ContextBasedTestWithCleanu .post("http://localhost/api/hs/office/debitors") .then().log().all().assertThat() .statusCode(400) - .body("message", is("ERROR: [400] Unable to find BareRelation by uuid: 00000000-0000-0000-0000-000000000000")); + .body("message", is("ERROR: [400] Unable to find RealRelation by uuid: 00000000-0000-0000-0000-000000000000")); // @formatter:on } } @@ -550,7 +550,7 @@ class HsOfficeDebitorControllerAcceptanceTest extends ContextBasedTestWithCleanu context.define("superuser-alex@hostsharing.net"); final var givenDebitor = givenSomeTemporaryDebitor(); - final var givenContact = contactBareRepo.findContactByOptionalCaptionLike("fourth").get(0); + final var givenContact = contactrealRepo.findContactByOptionalCaptionLike("fourth").get(0); final var location = RestAssured // @formatter:off .given() @@ -720,12 +720,12 @@ class HsOfficeDebitorControllerAcceptanceTest extends ContextBasedTestWithCleanu return jpaAttempt.transacted(() -> { context.define("superuser-alex@hostsharing.net"); final var givenPartner = partnerRepo.findPartnerByOptionalNameLike("Fourth").get(0).load(); - final var givenContact = contactBareRepo.findContactByOptionalCaptionLike("fourth contact").get(0); + final var givenContact = contactrealRepo.findContactByOptionalCaptionLike("fourth contact").get(0); final var newDebitor = HsOfficeDebitorEntity.builder() .debitorNumberSuffix(nextDebitorSuffix()) .billable(true) .debitorRel( - HsOfficeRelationBareEntity.builder() + HsOfficeRelationRealEntity.builder() .type(DEBITOR) .anchor(givenPartner.getPartnerRel().getHolder()) .holder(givenPartner.getPartnerRel().getHolder()) diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorEntityPatcherUnitTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorEntityPatcherUnitTest.java index e46fedf9..52ddb318 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorEntityPatcherUnitTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorEntityPatcherUnitTest.java @@ -2,7 +2,7 @@ package net.hostsharing.hsadminng.hs.office.debitor; import net.hostsharing.hsadminng.hs.office.bankaccount.HsOfficeBankAccountEntity; import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficeDebitorPatchResource; -import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationBareEntity; +import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRealEntity; import net.hostsharing.hsadminng.rbac.test.PatchUnitTestBase; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.TestInstance; @@ -41,7 +41,7 @@ class HsOfficeDebitorEntityPatcherUnitTest extends PatchUnitTestBase - HsOfficeRelationBareEntity.builder().uuid(invocation.getArgument(1)).build()); + lenient().when(em.getReference(eq(HsOfficeRelationRealEntity.class), any())).thenAnswer(invocation -> + HsOfficeRelationRealEntity.builder().uuid(invocation.getArgument(1)).build()); lenient().when(em.getReference(eq(HsOfficeBankAccountEntity.class), any())).thenAnswer(invocation -> HsOfficeBankAccountEntity.builder().uuid(invocation.getArgument(1)).build()); } @@ -139,8 +139,8 @@ class HsOfficeDebitorEntityPatcherUnitTest extends PatchUnitTestBase { final var newDebitor = HsOfficeDebitorEntity.builder() .partner(givenPartner) .debitorNumberSuffix("21") - .debitorRel(HsOfficeRelationBareEntity.builder() + .debitorRel(HsOfficeRelationRealEntity.builder() .type(HsOfficeRelationType.DEBITOR) .anchor(givenPartnerPerson) .holder(givenPartnerPerson) @@ -120,13 +119,13 @@ class HsOfficeDebitorRepositoryIntegrationTest extends ContextBasedTestWithClean // given context("superuser-alex@hostsharing.net"); final var givenPartnerPerson = one(personRepo.findPersonByOptionalNameLike("First GmbH")); - final var givenContact = one(contactBareRepo.findContactByOptionalCaptionLike("first contact")); + final var givenContact = one(contactrealRepo.findContactByOptionalCaptionLike("first contact")); // when final var result = attempt(em, () -> { final var newDebitor = HsOfficeDebitorEntity.builder() .debitorNumberSuffix("21") - .debitorRel(HsOfficeRelationBareEntity.builder() + .debitorRel(HsOfficeRelationRealEntity.builder() .type(HsOfficeRelationType.DEBITOR) .anchor(givenPartnerPerson) .holder(givenPartnerPerson) @@ -158,10 +157,10 @@ class HsOfficeDebitorRepositoryIntegrationTest extends ContextBasedTestWithClean attempt(em, () -> { final var givenPartnerPerson = one(personRepo.findPersonByOptionalNameLike("First GmbH")); final var givenDebitorPerson = one(personRepo.findPersonByOptionalNameLike("Fourth eG")); - final var givenContact = one(contactBareRepo.findContactByOptionalCaptionLike("fourth contact")); + final var givenContact = one(contactrealRepo.findContactByOptionalCaptionLike("fourth contact")); final var newDebitor = HsOfficeDebitorEntity.builder() .debitorNumberSuffix("22") - .debitorRel(HsOfficeRelationBareEntity.builder() + .debitorRel(HsOfficeRelationRealEntity.builder() .type(HsOfficeRelationType.DEBITOR) .anchor(givenPartnerPerson) .holder(givenDebitorPerson) @@ -324,7 +323,7 @@ class HsOfficeDebitorRepositoryIntegrationTest extends ContextBasedTestWithClean "hs_office_relation#FourtheG-with-DEBITOR-FourtheG:ADMIN", true); final var givenNewPartnerPerson = one(personRepo.findPersonByOptionalNameLike("First")); final var givenNewBillingPerson = one(personRepo.findPersonByOptionalNameLike("Firby")); - final var givenNewContact = one(contactBareRepo.findContactByOptionalCaptionLike("sixth contact")); + final var givenNewContact = one(contactrealRepo.findContactByOptionalCaptionLike("sixth contact")); final var givenNewBankAccount = one(bankAccountRepo.findByOptionalHolderLike("first")); final String givenNewVatId = "NEW-VAT-ID"; final String givenNewVatCountryCode = "NC"; @@ -333,7 +332,7 @@ class HsOfficeDebitorRepositoryIntegrationTest extends ContextBasedTestWithClean // when final var result = jpaAttempt.transacted(() -> { context("superuser-alex@hostsharing.net"); - givenDebitor.setDebitorRel(HsOfficeRelationBareEntity.builder() + givenDebitor.setDebitorRel(HsOfficeRelationRealEntity.builder() .type(HsOfficeRelationType.DEBITOR) .anchor(givenNewPartnerPerson) .holder(givenNewBillingPerson) @@ -612,13 +611,13 @@ class HsOfficeDebitorRepositoryIntegrationTest extends ContextBasedTestWithClean context("superuser-alex@hostsharing.net"); final var givenPartner = one(partnerRepo.findPartnerByOptionalNameLike(partnerName)); final var givenPartnerPerson = givenPartner.getPartnerRel().getHolder(); - final var givenContact = one(contactBareRepo.findContactByOptionalCaptionLike(contactCaption)); + final var givenContact = one(contactrealRepo.findContactByOptionalCaptionLike(contactCaption)); final var givenBankAccount = bankAccountHolder != null ? one(bankAccountRepo.findByOptionalHolderLike(bankAccountHolder)) : null; final var newDebitor = HsOfficeDebitorEntity.builder() .partner(givenPartner) .debitorNumberSuffix("20") - .debitorRel(HsOfficeRelationBareEntity.builder() + .debitorRel(HsOfficeRelationRealEntity.builder() .type(HsOfficeRelationType.DEBITOR) .anchor(givenPartnerPerson) .holder(givenPartnerPerson) diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/debitor/TestHsOfficeDebitor.java b/src/test/java/net/hostsharing/hsadminng/hs/office/debitor/TestHsOfficeDebitor.java index 3d03a856..a3df1026 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/debitor/TestHsOfficeDebitor.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/debitor/TestHsOfficeDebitor.java @@ -2,9 +2,9 @@ package net.hostsharing.hsadminng.hs.office.debitor; import lombok.experimental.UtilityClass; import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonEntity; -import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationBareEntity; +import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRealEntity; -import static net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactBareTestEntity.TEST_BARE_CONTACT; +import static net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRealTestEntity.TEST_REAL_CONTACT; import static net.hostsharing.hsadminng.hs.office.partner.TestHsOfficePartner.TEST_PARTNER; @UtilityClass @@ -14,10 +14,10 @@ public class TestHsOfficeDebitor { public static final HsOfficeDebitorEntity TEST_DEBITOR = HsOfficeDebitorEntity.builder() .debitorNumberSuffix(DEFAULT_DEBITOR_SUFFIX) - .debitorRel(HsOfficeRelationBareEntity.builder() + .debitorRel(HsOfficeRelationRealEntity.builder() .holder(HsOfficePersonEntity.builder().build()) .anchor(HsOfficePersonEntity.builder().build()) - .contact(TEST_BARE_CONTACT) + .contact(TEST_REAL_CONTACT) .build()) .partner(TEST_PARTNER) .defaultPrefix("abc") diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerControllerAcceptanceTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerControllerAcceptanceTest.java index bd03876b..fc7287e4 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerControllerAcceptanceTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerControllerAcceptanceTest.java @@ -3,13 +3,13 @@ package net.hostsharing.hsadminng.hs.office.partner; import io.restassured.RestAssured; import io.restassured.http.ContentType; import net.hostsharing.hsadminng.HsadminNgApplication; -import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactBareEntity; -import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactBareRepository; +import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRealEntity; +import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRealRepository; import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonEntity; import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRepository; import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelation; -import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationBareEntity; -import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationBareRepository; +import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRealEntity; +import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRealRepository; import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationType; import net.hostsharing.hsadminng.rbac.test.ContextBasedTestWithCleanup; import net.hostsharing.hsadminng.rbac.test.JpaAttempt; @@ -42,13 +42,13 @@ class HsOfficePartnerControllerAcceptanceTest extends ContextBasedTestWithCleanu HsOfficePartnerRepository partnerRepo; @Autowired - HsOfficeRelationBareRepository relationRepo; + HsOfficeRelationRealRepository relationRepo; @Autowired HsOfficePersonRepository personRepo; @Autowired - HsOfficeContactBareRepository contactBareRepo; + HsOfficeContactRealRepository contactrealRepo; @Autowired JpaAttempt jpaAttempt; @@ -92,7 +92,7 @@ class HsOfficePartnerControllerAcceptanceTest extends ContextBasedTestWithCleanu context.define("superuser-alex@hostsharing.net"); final var givenMandantPerson = personRepo.findPersonByOptionalNameLike("Hostsharing eG").stream().findFirst().orElseThrow(); final var givenPerson = personRepo.findPersonByOptionalNameLike("Third").stream().findFirst().orElseThrow(); - final var givenContact = contactBareRepo.findContactByOptionalCaptionLike("fourth").stream().findFirst().orElseThrow(); + final var givenContact = contactrealRepo.findContactByOptionalCaptionLike("fourth").stream().findFirst().orElseThrow(); final var location = RestAssured // @formatter:off .given() @@ -180,7 +180,7 @@ class HsOfficePartnerControllerAcceptanceTest extends ContextBasedTestWithCleanu .post("http://localhost/api/hs/office/partners") .then().log().all().assertThat() .statusCode(400) - .body("message", is("ERROR: [400] Unable to find " + HsOfficeContactBareEntity.class.getName() + " with id " + GIVEN_NON_EXISTING_UUID)); + .body("message", is("ERROR: [400] Unable to find " + HsOfficeContactRealEntity.class.getName() + " with id " + GIVEN_NON_EXISTING_UUID)); // @formatter:on } @@ -189,7 +189,7 @@ class HsOfficePartnerControllerAcceptanceTest extends ContextBasedTestWithCleanu context.define("superuser-alex@hostsharing.net"); final var mandantPerson = personRepo.findPersonByOptionalNameLike("Hostsharing eG").get(0); - final var givenContact = contactBareRepo.findContactByOptionalCaptionLike("fourth").get(0); + final var givenContact = contactrealRepo.findContactByOptionalCaptionLike("fourth").get(0); final var location = RestAssured // @formatter:off .given() @@ -520,16 +520,16 @@ class HsOfficePartnerControllerAcceptanceTest extends ContextBasedTestWithCleanu } } - private HsOfficeRelationBareEntity givenSomeTemporaryPartnerRel( + private HsOfficeRelationRealEntity givenSomeTemporaryPartnerRel( final String partnerHolderName, final String contactName) { return jpaAttempt.transacted(() -> { context.define("superuser-alex@hostsharing.net"); final var givenMandantPerson = personRepo.findPersonByOptionalNameLike("Hostsharing eG").stream().findFirst().orElseThrow(); final var givenPerson = personRepo.findPersonByOptionalNameLike(partnerHolderName).stream().findFirst().orElseThrow(); - final var givenContact = contactBareRepo.findContactByOptionalCaptionLike(contactName).stream().findFirst().orElseThrow(); + final var givenContact = contactrealRepo.findContactByOptionalCaptionLike(contactName).stream().findFirst().orElseThrow(); - final var partnerRel = new HsOfficeRelationBareEntity(); + final var partnerRel = new HsOfficeRelationRealEntity(); partnerRel.setType(HsOfficeRelationType.PARTNER); partnerRel.setAnchor(givenMandantPerson); partnerRel.setHolder(givenPerson); @@ -561,6 +561,6 @@ class HsOfficePartnerControllerAcceptanceTest extends ContextBasedTestWithCleanu cleanupAllNew(HsOfficePartnerEntity.class); // TODO: should not be necessary anymore, once it's deleted via after delete trigger - cleanupAllNew(HsOfficeRelationBareEntity.class); + cleanupAllNew(HsOfficeRelationRealEntity.class); } } diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerControllerRestTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerControllerRestTest.java index e8ce3dfb..97b56052 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerControllerRestTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerControllerRestTest.java @@ -3,8 +3,8 @@ package net.hostsharing.hsadminng.hs.office.partner; import net.hostsharing.hsadminng.context.Context; import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRbacEntity; import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonEntity; -import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationBareEntity; -import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationBareRepository; +import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRealEntity; +import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRealRepository; import net.hostsharing.hsadminng.mapper.Mapper; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Nested; @@ -54,7 +54,7 @@ class HsOfficePartnerControllerRestTest { HsOfficePartnerRepository partnerRepo; @MockBean - HsOfficeRelationBareRepository relationRepo; + HsOfficeRelationRealRepository relationRepo; @MockBean EntityManager em; @@ -161,7 +161,7 @@ class HsOfficePartnerControllerRestTest { .andExpect(status().is4xxClientError()) .andExpect(jsonPath("statusCode", is(400))) .andExpect(jsonPath("statusPhrase", is("Bad Request"))) - .andExpect(jsonPath("message", startsWith("ERROR: [400] Cannot resolve HsOfficeContactBareEntity with uuid "))); + .andExpect(jsonPath("message", startsWith("ERROR: [400] Cannot resolve HsOfficeContactRealEntity with uuid "))); } } @@ -176,7 +176,7 @@ class HsOfficePartnerControllerRestTest { when(partnerRepo.deleteByUuid(givenPartnerUuid)).thenReturn(0); final UUID givenRelationUuid = UUID.randomUUID(); - when(partnerMock.getPartnerRel()).thenReturn(HsOfficeRelationBareEntity.builder() + when(partnerMock.getPartnerRel()).thenReturn(HsOfficeRelationRealEntity.builder() .uuid(givenRelationUuid) .build()); when(relationRepo.deleteByUuid(givenRelationUuid)).thenReturn(0); diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerEntityPatcherUnitTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerEntityPatcherUnitTest.java index 9392d60a..a2ed7ca5 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerEntityPatcherUnitTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerEntityPatcherUnitTest.java @@ -1,9 +1,9 @@ package net.hostsharing.hsadminng.hs.office.partner; -import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactBareEntity; +import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRealEntity; import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficePartnerPatchResource; import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonEntity; -import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationBareEntity; +import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRealEntity; import net.hostsharing.hsadminng.rbac.test.PatchUnitTestBase; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.TestInstance; @@ -36,7 +36,7 @@ class HsOfficePartnerEntityPatcherUnitTest extends PatchUnitTestBase< private final HsOfficePersonEntity givenInitialPerson = HsOfficePersonEntity.builder() .uuid(INITIAL_PERSON_UUID) .build(); - private final HsOfficeContactBareEntity givenInitialContact = HsOfficeContactBareEntity.builder() + private final HsOfficeContactRealEntity givenInitialContact = HsOfficeContactRealEntity.builder() .uuid(INITIAL_CONTACT_UUID) .build(); @@ -48,8 +48,8 @@ class HsOfficePartnerEntityPatcherUnitTest extends PatchUnitTestBase< @BeforeEach void initMocks() { - lenient().when(em.getReference(eq(HsOfficeRelationBareEntity.class), any())).thenAnswer(invocation -> - HsOfficeRelationBareEntity.builder().uuid(invocation.getArgument(1)).build()); + lenient().when(em.getReference(eq(HsOfficeRelationRealEntity.class), any())).thenAnswer(invocation -> + HsOfficeRelationRealEntity.builder().uuid(invocation.getArgument(1)).build()); } @Override @@ -57,7 +57,7 @@ class HsOfficePartnerEntityPatcherUnitTest extends PatchUnitTestBase< final var entity = HsOfficePartnerEntity.builder() .uuid(INITIAL_PARTNER_UUID) .partnerNumber(12345) - .partnerRel(HsOfficeRelationBareEntity.builder() + .partnerRel(HsOfficeRelationRealEntity.builder() .holder(givenInitialPerson) .contact(givenInitialContact) .build()) @@ -89,8 +89,8 @@ class HsOfficePartnerEntityPatcherUnitTest extends PatchUnitTestBase< ); } - private static HsOfficeRelationBareEntity newPartnerRel(final UUID uuid) { - return HsOfficeRelationBareEntity.builder() + private static HsOfficeRelationRealEntity newPartnerRel(final UUID uuid) { + return HsOfficeRelationRealEntity.builder() .uuid(uuid) .build(); } diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerEntityUnitTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerEntityUnitTest.java index ac644186..3cf07cab 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerEntityUnitTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerEntityUnitTest.java @@ -1,9 +1,9 @@ package net.hostsharing.hsadminng.hs.office.partner; -import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactBareEntity; +import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRealEntity; import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonEntity; import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonType; -import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationBareEntity; +import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRealEntity; import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationType; import org.junit.jupiter.api.Test; @@ -13,7 +13,7 @@ class HsOfficePartnerEntityUnitTest { private final HsOfficePartnerEntity givenPartner = HsOfficePartnerEntity.builder() .partnerNumber(12345) - .partnerRel(HsOfficeRelationBareEntity.builder() + .partnerRel(HsOfficeRelationRealEntity.builder() .anchor(HsOfficePersonEntity.builder() .personType(HsOfficePersonType.LEGAL_PERSON) .tradeName("Hostsharing eG") @@ -23,7 +23,7 @@ class HsOfficePartnerEntityUnitTest { .personType(HsOfficePersonType.LEGAL_PERSON) .tradeName("some trade name") .build()) - .contact(HsOfficeContactBareEntity.builder().caption("some caption").build()) + .contact(HsOfficeContactRealEntity.builder().caption("some caption").build()) .build()) .build(); diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerRepositoryIntegrationTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerRepositoryIntegrationTest.java index 5d325698..e365d183 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerRepositoryIntegrationTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/partner/HsOfficePartnerRepositoryIntegrationTest.java @@ -1,10 +1,10 @@ package net.hostsharing.hsadminng.hs.office.partner; import net.hostsharing.hsadminng.context.Context; -import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactBareRepository; +import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRealRepository; import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRepository; -import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationBareEntity; -import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationBareRepository; +import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRealEntity; +import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRealRepository; import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationType; import net.hostsharing.hsadminng.rbac.test.ContextBasedTestWithCleanup; import net.hostsharing.hsadminng.rbac.rbacgrant.RawRbacGrantRepository; @@ -42,13 +42,13 @@ class HsOfficePartnerRepositoryIntegrationTest extends ContextBasedTestWithClean HsOfficePartnerRepository partnerRepo; @Autowired - HsOfficeRelationBareRepository relationRepo; + HsOfficeRelationRealRepository relationRepo; @Autowired HsOfficePersonRepository personRepo; @Autowired - HsOfficeContactBareRepository contactBareRepo; + HsOfficeContactRealRepository contactrealRepo; @Autowired RawRbacObjectRepository rawObjectRepo; @@ -109,10 +109,10 @@ class HsOfficePartnerRepositoryIntegrationTest extends ContextBasedTestWithClean // when attempt(em, () -> { final var givenPartnerPerson = personRepo.findPersonByOptionalNameLike("Erben Bessler").get(0); - final var givenContact = contactBareRepo.findContactByOptionalCaptionLike("fourth contact").get(0); + final var givenContact = contactrealRepo.findContactByOptionalCaptionLike("fourth contact").get(0); final var givenMandantPerson = personRepo.findPersonByOptionalNameLike("Hostsharing eG").get(0); - final var newRelation = HsOfficeRelationBareEntity.builder() + final var newRelation = HsOfficeRelationRealEntity.builder() .holder(givenPartnerPerson) .type(HsOfficeRelationType.PARTNER) .anchor(givenMandantPerson) @@ -463,12 +463,12 @@ class HsOfficePartnerRepositoryIntegrationTest extends ContextBasedTestWithClean }).assertSuccessful().returnedValue(); } - private HsOfficeRelationBareEntity givenSomeTemporaryHostsharingPartnerRel(final String person, final String contact) { + private HsOfficeRelationRealEntity givenSomeTemporaryHostsharingPartnerRel(final String person, final String contact) { final var givenMandantorPerson = personRepo.findPersonByOptionalNameLike("Hostsharing eG").get(0); final var givenPartnerPerson = personRepo.findPersonByOptionalNameLike(person).get(0); - final var givenContact = contactBareRepo.findContactByOptionalCaptionLike(contact).get(0); + final var givenContact = contactrealRepo.findContactByOptionalCaptionLike(contact).get(0); - final var partnerRel = HsOfficeRelationBareEntity.builder() + final var partnerRel = HsOfficeRelationRealEntity.builder() .holder(givenPartnerPerson) .type(HsOfficeRelationType.PARTNER) .anchor(givenMandantorPerson) diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/partner/TestHsOfficePartner.java b/src/test/java/net/hostsharing/hsadminng/hs/office/partner/TestHsOfficePartner.java index 6deb7be4..1d3b8164 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/partner/TestHsOfficePartner.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/partner/TestHsOfficePartner.java @@ -1,8 +1,8 @@ package net.hostsharing.hsadminng.hs.office.partner; -import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactBareEntity; +import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRealEntity; import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonEntity; -import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationBareEntity; +import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRealEntity; import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationType; import static net.hostsharing.hsadminng.hs.office.person.HsOfficePersonType.LEGAL_PERSON; @@ -15,7 +15,7 @@ public class TestHsOfficePartner { return HsOfficePartnerEntity.builder() .partnerNumber(10001) .partnerRel( - HsOfficeRelationBareEntity.builder() + HsOfficeRelationRealEntity.builder() .holder(HsOfficePersonEntity.builder() .personType(LEGAL_PERSON) .tradeName("Hostsharing eG") @@ -25,7 +25,7 @@ public class TestHsOfficePartner { .personType(LEGAL_PERSON) .tradeName(tradeName) .build()) - .contact(HsOfficeContactBareEntity.builder() + .contact(HsOfficeContactRealEntity.builder() .caption(tradeName) .build()) .build() diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/relation/HsOfficeRelationControllerAcceptanceTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/relation/HsOfficeRelationControllerAcceptanceTest.java index 54989f0e..4f397199 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/relation/HsOfficeRelationControllerAcceptanceTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/relation/HsOfficeRelationControllerAcceptanceTest.java @@ -2,7 +2,7 @@ package net.hostsharing.hsadminng.hs.office.relation; import io.restassured.RestAssured; import io.restassured.http.ContentType; -import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactBareRepository; +import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRealRepository; import net.hostsharing.hsadminng.rbac.test.ContextBasedTestWithCleanup; import net.hostsharing.hsadminng.HsadminNgApplication; import net.hostsharing.hsadminng.context.Context; @@ -43,13 +43,13 @@ class HsOfficeRelationControllerAcceptanceTest extends ContextBasedTestWithClean Context contextMock; @Autowired - HsOfficeRelationBareRepository relationBareRepo; + HsOfficeRelationRealRepository relationrealRepo; @Autowired HsOfficePersonRepository personRepo; @Autowired - HsOfficeContactBareRepository contactBareRepo; + HsOfficeContactRealRepository contactrealRepo; @Autowired JpaAttempt jpaAttempt; @@ -125,7 +125,7 @@ class HsOfficeRelationControllerAcceptanceTest extends ContextBasedTestWithClean context.define("superuser-alex@hostsharing.net"); final var givenAnchorPerson = personRepo.findPersonByOptionalNameLike("Third").get(0); final var givenHolderPerson = personRepo.findPersonByOptionalNameLike("Paul").get(0); - final var givenContact = contactBareRepo.findContactByOptionalCaptionLike("second").get(0); + final var givenContact = contactrealRepo.findContactByOptionalCaptionLike("second").get(0); final var location = RestAssured // @formatter:off .given() @@ -172,7 +172,7 @@ class HsOfficeRelationControllerAcceptanceTest extends ContextBasedTestWithClean context.define("superuser-alex@hostsharing.net"); final var givenAnchorPersonUuid = GIVEN_NON_EXISTING_HOLDER_PERSON_UUID; final var givenHolderPerson = personRepo.findPersonByOptionalNameLike("Smith").get(0); - final var givenContact = contactBareRepo.findContactByOptionalCaptionLike("fourth").get(0); + final var givenContact = contactrealRepo.findContactByOptionalCaptionLike("fourth").get(0); final var location = RestAssured // @formatter:off .given() @@ -204,7 +204,7 @@ class HsOfficeRelationControllerAcceptanceTest extends ContextBasedTestWithClean context.define("superuser-alex@hostsharing.net"); final var givenAnchorPerson = personRepo.findPersonByOptionalNameLike("Third").get(0); - final var givenContact = contactBareRepo.findContactByOptionalCaptionLike("fourth").get(0); + final var givenContact = contactrealRepo.findContactByOptionalCaptionLike("fourth").get(0); final var location = RestAssured // @formatter:off .given() @@ -336,7 +336,7 @@ class HsOfficeRelationControllerAcceptanceTest extends ContextBasedTestWithClean final String holderPersoneName) { final var anchorPersonUuid = personRepo.findPersonByOptionalNameLike(anchorPersonName).get(0).getUuid(); final var holderPersonUuid = personRepo.findPersonByOptionalNameLike(holderPersoneName).get(0).getUuid(); - final var givenRelation = relationBareRepo + final var givenRelation = relationrealRepo .findRelationRelatedToPersonUuid(anchorPersonUuid) .stream() .filter(r -> r.getHolder().getUuid().equals(holderPersonUuid)) @@ -353,7 +353,7 @@ class HsOfficeRelationControllerAcceptanceTest extends ContextBasedTestWithClean context.define("superuser-alex@hostsharing.net"); final var givenRelation = givenSomeTemporaryRelationBessler(); assertThat(givenRelation.getContact().getCaption()).isEqualTo("seventh contact"); - final var givenContact = contactBareRepo.findContactByOptionalCaptionLike("fourth").get(0); + final var givenContact = contactrealRepo.findContactByOptionalCaptionLike("fourth").get(0); RestAssured // @formatter:off .given() @@ -379,7 +379,7 @@ class HsOfficeRelationControllerAcceptanceTest extends ContextBasedTestWithClean // finally, the relation is actually updated context.define("superuser-alex@hostsharing.net"); - assertThat(relationBareRepo.findByUuid(givenRelation.getUuid())).isPresent().get() + assertThat(relationrealRepo.findByUuid(givenRelation.getUuid())).isPresent().get() .matches(rel -> { assertThat(rel.getAnchor().getTradeName()).contains("Bessler"); assertThat(rel.getHolder().getFamilyName()).contains("Winkler"); @@ -408,7 +408,7 @@ class HsOfficeRelationControllerAcceptanceTest extends ContextBasedTestWithClean .statusCode(204); // @formatter:on // then the given relation is gone - assertThat(relationBareRepo.findByUuid(givenRelation.getUuid())).isEmpty(); + assertThat(relationrealRepo.findByUuid(givenRelation.getUuid())).isEmpty(); } @Test @@ -427,7 +427,7 @@ class HsOfficeRelationControllerAcceptanceTest extends ContextBasedTestWithClean .statusCode(403); // @formatter:on // then the given relation is still there - assertThat(relationBareRepo.findByUuid(givenRelation.getUuid())).isNotEmpty(); + assertThat(relationrealRepo.findByUuid(givenRelation.getUuid())).isNotEmpty(); } @Test @@ -446,7 +446,7 @@ class HsOfficeRelationControllerAcceptanceTest extends ContextBasedTestWithClean .statusCode(404); // @formatter:on // then the given relation is still there - assertThat(relationBareRepo.findByUuid(givenRelation.getUuid())).isNotEmpty(); + assertThat(relationrealRepo.findByUuid(givenRelation.getUuid())).isNotEmpty(); } } @@ -455,15 +455,15 @@ class HsOfficeRelationControllerAcceptanceTest extends ContextBasedTestWithClean context.define("superuser-alex@hostsharing.net"); final var givenAnchorPerson = personRepo.findPersonByOptionalNameLike("Erben Bessler").get(0); final var givenHolderPerson = personRepo.findPersonByOptionalNameLike("Winkler").get(0); - final var givenContact = contactBareRepo.findContactByOptionalCaptionLike("seventh contact").get(0); - final var newRelation = HsOfficeRelationBareEntity.builder() + final var givenContact = contactrealRepo.findContactByOptionalCaptionLike("seventh contact").get(0); + final var newRelation = HsOfficeRelationRealEntity.builder() .type(HsOfficeRelationType.REPRESENTATIVE) .anchor(givenAnchorPerson) .holder(givenHolderPerson) .contact(givenContact) .build(); - assertThat(toCleanup(relationBareRepo.save(newRelation))).isEqualTo(newRelation); + assertThat(toCleanup(relationrealRepo.save(newRelation))).isEqualTo(newRelation); return newRelation; }).assertSuccessful().returnedValue(); diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/relation/HsOfficeRelationPatcherUnitTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/relation/HsOfficeRelationPatcherUnitTest.java index 05ff2b07..2fc9b95e 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/relation/HsOfficeRelationPatcherUnitTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/relation/HsOfficeRelationPatcherUnitTest.java @@ -1,6 +1,6 @@ package net.hostsharing.hsadminng.hs.office.relation; -import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactBareEntity; +import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRealEntity; import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficeRelationPatchResource; import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonEntity; import net.hostsharing.hsadminng.rbac.test.PatchUnitTestBase; @@ -34,8 +34,8 @@ class HsOfficeRelationPatcherUnitTest extends PatchUnitTestBase< @BeforeEach void initMocks() { - lenient().when(em.getReference(eq(HsOfficeContactBareEntity.class), any())).thenAnswer(invocation -> - HsOfficeContactBareEntity.builder().uuid(invocation.getArgument(1)).build()); + lenient().when(em.getReference(eq(HsOfficeContactRealEntity.class), any())).thenAnswer(invocation -> + HsOfficeContactRealEntity.builder().uuid(invocation.getArgument(1)).build()); } final HsOfficePersonEntity givenInitialAnchorPerson = HsOfficePersonEntity.builder() @@ -44,7 +44,7 @@ class HsOfficeRelationPatcherUnitTest extends PatchUnitTestBase< final HsOfficePersonEntity givenInitialHolderPerson = HsOfficePersonEntity.builder() .uuid(UUID.randomUUID()) .build(); - final HsOfficeContactBareEntity givenInitialContact = HsOfficeContactBareEntity.builder() + final HsOfficeContactRealEntity givenInitialContact = HsOfficeContactRealEntity.builder() .uuid(UUID.randomUUID()) .build(); @@ -82,7 +82,7 @@ class HsOfficeRelationPatcherUnitTest extends PatchUnitTestBase< ); } - static HsOfficeContactBareEntity newContact(final UUID uuid) { - return HsOfficeContactBareEntity.builder().uuid(uuid).build(); + static HsOfficeContactRealEntity newContact(final UUID uuid) { + return HsOfficeContactRealEntity.builder().uuid(uuid).build(); } } diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/relation/HsOfficeRelationRepositoryIntegrationTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/relation/HsOfficeRelationRepositoryIntegrationTest.java index 2b99d1b2..151d9967 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/relation/HsOfficeRelationRepositoryIntegrationTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/relation/HsOfficeRelationRepositoryIntegrationTest.java @@ -1,7 +1,7 @@ package net.hostsharing.hsadminng.hs.office.relation; import net.hostsharing.hsadminng.context.Context; -import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactBareRepository; +import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRealRepository; import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRepository; import net.hostsharing.hsadminng.rbac.test.ContextBasedTestWithCleanup; import net.hostsharing.hsadminng.rbac.rbacgrant.RawRbacGrantRepository; @@ -40,7 +40,7 @@ class HsOfficeRelationRepositoryIntegrationTest extends ContextBasedTestWithClea HsOfficePersonRepository personRepo; @Autowired - HsOfficeContactBareRepository contactBareRepo; + HsOfficeContactRealRepository contactrealRepo; @Autowired RawRbacRoleRepository rawRoleRepo; @@ -71,7 +71,7 @@ class HsOfficeRelationRepositoryIntegrationTest extends ContextBasedTestWithClea final var givenHolderPerson = personRepo.findPersonByOptionalNameLike("Paul").stream() .filter(p -> p.getPersonType() == NATURAL_PERSON) .findFirst().orElseThrow(); - final var givenContact = contactBareRepo.findContactByOptionalCaptionLike("fourth contact").stream() + final var givenContact = contactrealRepo.findContactByOptionalCaptionLike("fourth contact").stream() .findFirst().orElseThrow(); // when @@ -111,7 +111,7 @@ class HsOfficeRelationRepositoryIntegrationTest extends ContextBasedTestWithClea final var givenHolderPerson = personRepo.findPersonByOptionalNameLike("Bert").stream() .filter(p -> p.getPersonType() == NATURAL_PERSON) .findFirst().orElseThrow(); - final var givenContact = contactBareRepo.findContactByOptionalCaptionLike("fourth contact").stream() + final var givenContact = contactrealRepo.findContactByOptionalCaptionLike("fourth contact").stream() .findFirst().orElseThrow(); final var newRelation = HsOfficeRelationRbacEntity.builder() .anchor(givenAnchorPerson) @@ -219,7 +219,7 @@ class HsOfficeRelationRepositoryIntegrationTest extends ContextBasedTestWithClea givenRelation, "hs_office_person#ErbenBesslerMelBessler:ADMIN"); context("superuser-alex@hostsharing.net"); - final var givenContact = contactBareRepo.findContactByOptionalCaptionLike("sixth contact").stream().findFirst().orElseThrow(); + final var givenContact = contactrealRepo.findContactByOptionalCaptionLike("sixth contact").stream().findFirst().orElseThrow(); // when final var result = jpaAttempt.transacted(() -> { @@ -413,7 +413,7 @@ class HsOfficeRelationRepositoryIntegrationTest extends ContextBasedTestWithClea context("superuser-alex@hostsharing.net"); final var givenAnchorPerson = personRepo.findPersonByOptionalNameLike("Erben Bessler").get(0); final var givenHolderPerson = personRepo.findPersonByOptionalNameLike(holderPerson).get(0); - final var givenContact = contactBareRepo.findContactByOptionalCaptionLike(contact).get(0); + final var givenContact = contactrealRepo.findContactByOptionalCaptionLike(contact).get(0); final var newRelation = HsOfficeRelationRbacEntity.builder() .type(HsOfficeRelationType.REPRESENTATIVE) .anchor(givenAnchorPerson)