Upgrade to SpringBoot 3.4.1 and dependencies #147
@ -7,7 +7,7 @@ import lombok.NoArgsConstructor;
|
|||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import net.hostsharing.hsadminng.errors.DisplayAs;
|
import net.hostsharing.hsadminng.errors.DisplayAs;
|
||||||
import net.hostsharing.hsadminng.hs.office.bankaccount.HsOfficeBankAccountEntity;
|
import net.hostsharing.hsadminng.hs.office.bankaccount.HsOfficeBankAccountEntity;
|
||||||
import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerEntity;
|
import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerRbacEntity;
|
||||||
import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelation;
|
import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelation;
|
||||||
import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRealEntity;
|
import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRealEntity;
|
||||||
import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRbacEntity;
|
import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRbacEntity;
|
||||||
@ -96,7 +96,7 @@ public class HsOfficeDebitorEntity implements BaseEntity<HsOfficeDebitorEntity>,
|
|||||||
)
|
)
|
||||||
""")
|
""")
|
||||||
@NotFound(action = NotFoundAction.IGNORE) // TODO.impl: map a simplified raw-PartnerEntity, just for the partner-number
|
@NotFound(action = NotFoundAction.IGNORE) // TODO.impl: map a simplified raw-PartnerEntity, just for the partner-number
|
||||||
private HsOfficePartnerEntity partner;
|
private HsOfficePartnerRbacEntity partner;
|
||||||
|
|
||||||
@Column(name = "debitornumbersuffix", length = 2)
|
@Column(name = "debitornumbersuffix", length = 2)
|
||||||
@Pattern(regexp = TWO_DECIMAL_DIGITS)
|
@Pattern(regexp = TWO_DECIMAL_DIGITS)
|
||||||
@ -145,7 +145,7 @@ public class HsOfficeDebitorEntity implements BaseEntity<HsOfficeDebitorEntity>,
|
|||||||
public String getTaggedDebitorNumber() {
|
public String getTaggedDebitorNumber() {
|
||||||
return ofNullable(partner)
|
return ofNullable(partner)
|
||||||
.filter(partner -> debitorNumberSuffix != null)
|
.filter(partner -> debitorNumberSuffix != null)
|
||||||
.map(HsOfficePartnerEntity::getPartnerNumber)
|
.map(HsOfficePartnerRbacEntity::getPartnerNumber)
|
||||||
.map(partnerNumber -> DEBITOR_NUMBER_TAG + partnerNumber + debitorNumberSuffix)
|
.map(partnerNumber -> DEBITOR_NUMBER_TAG + partnerNumber + debitorNumberSuffix)
|
||||||
.orElse(null);
|
.orElse(null);
|
||||||
}
|
}
|
||||||
|
@ -6,8 +6,8 @@ import net.hostsharing.hsadminng.hs.office.generated.api.v1.api.HsOfficeMembersh
|
|||||||
import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficeMembershipInsertResource;
|
import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficeMembershipInsertResource;
|
||||||
import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficeMembershipPatchResource;
|
import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficeMembershipPatchResource;
|
||||||
import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficeMembershipResource;
|
import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficeMembershipResource;
|
||||||
import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerEntity;
|
import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerRbacEntity;
|
||||||
import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerRepository;
|
import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerRbacRepository;
|
||||||
import net.hostsharing.hsadminng.mapper.StrictMapper;
|
import net.hostsharing.hsadminng.mapper.StrictMapper;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
@ -33,7 +33,7 @@ public class HsOfficeMembershipController implements HsOfficeMembershipsApi {
|
|||||||
private StrictMapper mapper;
|
private StrictMapper mapper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private HsOfficePartnerRepository partnerRepo;
|
private HsOfficePartnerRbacRepository partnerRepo;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private HsOfficeMembershipRepository membershipRepo;
|
private HsOfficeMembershipRepository membershipRepo;
|
||||||
@ -52,7 +52,7 @@ public class HsOfficeMembershipController implements HsOfficeMembershipsApi {
|
|||||||
|
|
||||||
final var entities = partnerNumber != null
|
final var entities = partnerNumber != null
|
||||||
? membershipRepo.findMembershipsByPartnerNumber(
|
? membershipRepo.findMembershipsByPartnerNumber(
|
||||||
cropTag(HsOfficePartnerEntity.PARTNER_NUMBER_TAG, partnerNumber))
|
cropTag(HsOfficePartnerRbacEntity.PARTNER_NUMBER_TAG, partnerNumber))
|
||||||
: partnerUuid != null
|
: partnerUuid != null
|
||||||
? membershipRepo.findMembershipsByPartnerUuid(partnerUuid)
|
? membershipRepo.findMembershipsByPartnerUuid(partnerUuid)
|
||||||
: membershipRepo.findAll();
|
: membershipRepo.findAll();
|
||||||
|
@ -10,7 +10,7 @@ import lombok.Setter;
|
|||||||
import net.hostsharing.hsadminng.errors.DisplayAs;
|
import net.hostsharing.hsadminng.errors.DisplayAs;
|
||||||
import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRbacEntity;
|
import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRbacEntity;
|
||||||
import net.hostsharing.hsadminng.persistence.BaseEntity;
|
import net.hostsharing.hsadminng.persistence.BaseEntity;
|
||||||
import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerEntity;
|
import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerRbacEntity;
|
||||||
import net.hostsharing.hsadminng.rbac.generator.RbacSpec;
|
import net.hostsharing.hsadminng.rbac.generator.RbacSpec;
|
||||||
import net.hostsharing.hsadminng.rbac.generator.RbacSpec.SQL;
|
import net.hostsharing.hsadminng.rbac.generator.RbacSpec.SQL;
|
||||||
import net.hostsharing.hsadminng.rbac.role.WithRoleId;
|
import net.hostsharing.hsadminng.rbac.role.WithRoleId;
|
||||||
@ -85,7 +85,7 @@ public class HsOfficeMembershipEntity implements BaseEntity<HsOfficeMembershipEn
|
|||||||
|
|
||||||
@ManyToOne(fetch = FetchType.LAZY)
|
@ManyToOne(fetch = FetchType.LAZY)
|
||||||
@JoinColumn(name = "partneruuid")
|
@JoinColumn(name = "partneruuid")
|
||||||
private HsOfficePartnerEntity partner;
|
private HsOfficePartnerRbacEntity partner;
|
||||||
|
|
||||||
@Column(name = "membernumbersuffix", length = 2)
|
@Column(name = "membernumbersuffix", length = 2)
|
||||||
@Pattern(regexp = TWO_DECIMAL_DIGITS)
|
@Pattern(regexp = TWO_DECIMAL_DIGITS)
|
||||||
|
@ -42,7 +42,7 @@ public class HsOfficePartnerController implements HsOfficePartnersApi {
|
|||||||
private StrictMapper mapper;
|
private StrictMapper mapper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private HsOfficePartnerRepository partnerRepo;
|
private HsOfficePartnerRbacRepository partnerRepo;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private HsOfficeRelationRealRepository relationRepo;
|
private HsOfficeRelationRealRepository relationRepo;
|
||||||
@ -168,16 +168,16 @@ public class HsOfficePartnerController implements HsOfficePartnersApi {
|
|||||||
return ResponseEntity.ok(mapped);
|
return ResponseEntity.ok(mapped);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void optionallyCreateExPartnerRelation(final HsOfficePartnerEntity saved, final HsOfficeRelationRealEntity previousPartnerRel) {
|
private void optionallyCreateExPartnerRelation(final HsOfficePartnerRbacEntity saved, final HsOfficeRelationRealEntity previousPartnerRel) {
|
||||||
if (!saved.getPartnerRel().getUuid().equals(previousPartnerRel.getUuid())) {
|
if (!saved.getPartnerRel().getUuid().equals(previousPartnerRel.getUuid())) {
|
||||||
// TODO.impl: we also need to use the new partner-person as the anchor
|
// TODO.impl: we also need to use the new partner-person as the anchor
|
||||||
relationRepo.save(previousPartnerRel.toBuilder().uuid(null).type(EX_PARTNER).build());
|
relationRepo.save(previousPartnerRel.toBuilder().uuid(null).type(EX_PARTNER).build());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private HsOfficePartnerEntity createPartnerEntity(final HsOfficePartnerInsertResource body) {
|
private HsOfficePartnerRbacEntity createPartnerEntity(final HsOfficePartnerInsertResource body) {
|
||||||
final var entityToSave = new HsOfficePartnerEntity();
|
final var entityToSave = new HsOfficePartnerRbacEntity();
|
||||||
entityToSave.setPartnerNumber(cropTag(HsOfficePartnerEntity.PARTNER_NUMBER_TAG, body.getPartnerNumber()));
|
entityToSave.setPartnerNumber(cropTag(HsOfficePartnerRbacEntity.PARTNER_NUMBER_TAG, body.getPartnerNumber()));
|
||||||
entityToSave.setPartnerRel(persistPartnerRel(body.getPartnerRel()));
|
entityToSave.setPartnerRel(persistPartnerRel(body.getPartnerRel()));
|
||||||
entityToSave.setDetails(mapper.map(body.getDetails(), HsOfficePartnerDetailsEntity.class));
|
entityToSave.setDetails(mapper.map(body.getDetails(), HsOfficePartnerDetailsEntity.class));
|
||||||
return entityToSave;
|
return entityToSave;
|
||||||
@ -201,7 +201,7 @@ public class HsOfficePartnerController implements HsOfficePartnersApi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final BiConsumer<HsOfficePartnerEntity, HsOfficePartnerResource> ENTITY_TO_RESOURCE_POSTMAPPER = (entity, resource) -> {
|
final BiConsumer<HsOfficePartnerRbacEntity, HsOfficePartnerResource> ENTITY_TO_RESOURCE_POSTMAPPER = (entity, resource) -> {
|
||||||
resource.setPartnerNumber(entity.getTaggedPartnerNumber());
|
resource.setPartnerNumber(entity.getTaggedPartnerNumber());
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -9,10 +9,10 @@ import jakarta.persistence.EntityManager;
|
|||||||
|
|
||||||
class HsOfficePartnerEntityPatcher implements EntityPatcher<HsOfficePartnerPatchResource> {
|
class HsOfficePartnerEntityPatcher implements EntityPatcher<HsOfficePartnerPatchResource> {
|
||||||
private final EntityManager em;
|
private final EntityManager em;
|
||||||
private final HsOfficePartnerEntity entity;
|
private final HsOfficePartnerRbacEntity entity;
|
||||||
HsOfficePartnerEntityPatcher(
|
HsOfficePartnerEntityPatcher(
|
||||||
final EntityManager em,
|
final EntityManager em,
|
||||||
final HsOfficePartnerEntity entity) {
|
final HsOfficePartnerRbacEntity entity) {
|
||||||
this.em = em;
|
this.em = em;
|
||||||
this.entity = entity;
|
this.entity = entity;
|
||||||
}
|
}
|
||||||
|
@ -43,12 +43,12 @@ import static net.hostsharing.hsadminng.repr.Stringify.stringify;
|
|||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@DisplayAs("Partner")
|
@DisplayAs("Partner")
|
||||||
public class HsOfficePartnerEntity implements Stringifyable, BaseEntity<HsOfficePartnerEntity> {
|
public class HsOfficePartnerRbacEntity implements Stringifyable, BaseEntity<HsOfficePartnerRbacEntity> {
|
||||||
|
|
||||||
public static final String PARTNER_NUMBER_TAG = "P-";
|
public static final String PARTNER_NUMBER_TAG = "P-";
|
||||||
|
|
||||||
private static Stringify<HsOfficePartnerEntity> stringify = stringify(HsOfficePartnerEntity.class, "partner")
|
private static Stringify<HsOfficePartnerRbacEntity> stringify = stringify(HsOfficePartnerRbacEntity.class, "partner")
|
||||||
.withIdProp(HsOfficePartnerEntity::toShortString)
|
.withIdProp(HsOfficePartnerRbacEntity::toShortString)
|
||||||
.withProp(p -> ofNullable(p.getPartnerRel())
|
.withProp(p -> ofNullable(p.getPartnerRel())
|
||||||
.map(HsOfficeRelation::getHolder)
|
.map(HsOfficeRelation::getHolder)
|
||||||
.map(HsOfficePerson::toShortString)
|
.map(HsOfficePerson::toShortString)
|
||||||
@ -79,7 +79,7 @@ public class HsOfficePartnerEntity implements Stringifyable, BaseEntity<HsOffice
|
|||||||
private HsOfficePartnerDetailsEntity details;
|
private HsOfficePartnerDetailsEntity details;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HsOfficePartnerEntity load() {
|
public HsOfficePartnerRbacEntity load() {
|
||||||
BaseEntity.super.load();
|
BaseEntity.super.load();
|
||||||
partnerRel.load();
|
partnerRel.load();
|
||||||
if (details != null) {
|
if (details != null) {
|
||||||
@ -103,7 +103,7 @@ public class HsOfficePartnerEntity implements Stringifyable, BaseEntity<HsOffice
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static RbacSpec rbac() {
|
public static RbacSpec rbac() {
|
||||||
return rbacViewFor("partner", HsOfficePartnerEntity.class)
|
return rbacViewFor("partner", HsOfficePartnerRbacEntity.class)
|
||||||
.withIdentityView(SQL.projection("'P-' || partnerNumber"))
|
.withIdentityView(SQL.projection("'P-' || partnerNumber"))
|
||||||
.withUpdatableColumns("partnerRelUuid")
|
.withUpdatableColumns("partnerRelUuid")
|
||||||
.toRole(GLOBAL, ADMIN).grantPermission(INSERT)
|
.toRole(GLOBAL, ADMIN).grantPermission(INSERT)
|
@ -8,27 +8,14 @@ import java.util.List;
|
|||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public interface HsOfficePartnerRepository extends Repository<HsOfficePartnerEntity, UUID> {
|
public interface HsOfficePartnerRbacRepository extends Repository<HsOfficePartnerRbacEntity, UUID> {
|
||||||
|
|
||||||
@Timed("app.office.partners.repo.findByUuid")
|
@Timed("app.office.partners.repo.findByUuid")
|
||||||
Optional<HsOfficePartnerEntity> findByUuid(UUID id);
|
Optional<HsOfficePartnerRbacEntity> findByUuid(UUID id);
|
||||||
|
|
||||||
@Timed("app.office.partners.repo.findAll")
|
@Timed("app.office.partners.repo.findAll")
|
||||||
List<HsOfficePartnerEntity> findAll(); // TODO.refa: move to a repo in test sources
|
List<HsOfficePartnerRbacEntity> findAll(); // TODO.refa: move to a repo in test sources
|
||||||
|
|
||||||
// @Query("""
|
|
||||||
// SELECT partner FROM HsOfficePartnerEntity partner
|
|
||||||
// JOIN HsOfficeRelationRealEntity rel ON rel.uuid = partner.partnerRel.uuid
|
|
||||||
// JOIN HsOfficeContactRealEntity contact ON contact.uuid = rel.contact.uuid
|
|
||||||
// JOIN HsOfficePersonRealEntity person ON person.uuid = rel.holder.uuid
|
|
||||||
// LEFT JOIN HsOfficePartnerDetailsEntity details ON partner.details.uuid = details.uuid
|
|
||||||
// WHERE :name is null
|
|
||||||
// OR (details IS NOT NULL AND details.birthName like concat(cast(:name as text), '%'))
|
|
||||||
// OR contact.caption like concat(cast(:name as text), '%')
|
|
||||||
// OR person.tradeName like concat(cast(:name as text), '%')
|
|
||||||
// OR person.givenName like concat(cast(:name as text), '%')
|
|
||||||
// OR person.familyName like concat(cast(:name as text), '%')
|
|
||||||
// """)
|
|
||||||
@Query(value = """
|
@Query(value = """
|
||||||
select partner.uuid, partner.detailsuuid, partner.partnernumber, partner.partnerreluuid, partner.version
|
select partner.uuid, partner.detailsuuid, partner.partnernumber, partner.partnerreluuid, partner.version
|
||||||
from hs_office.partner_rv partner
|
from hs_office.partner_rv partner
|
||||||
@ -44,13 +31,13 @@ public interface HsOfficePartnerRepository extends Repository<HsOfficePartnerEnt
|
|||||||
or partnerPerson.familyname like (cast(:name as text) || '%') escape ''
|
or partnerPerson.familyname like (cast(:name as text) || '%') escape ''
|
||||||
""", nativeQuery = true)
|
""", nativeQuery = true)
|
||||||
@Timed("app.office.partners.repo.findPartnerByOptionalNameLike")
|
@Timed("app.office.partners.repo.findPartnerByOptionalNameLike")
|
||||||
List<HsOfficePartnerEntity> findPartnerByOptionalNameLike(String name);
|
List<HsOfficePartnerRbacEntity> findPartnerByOptionalNameLike(String name);
|
||||||
|
|
||||||
@Timed("app.office.partners.repo.findPartnerByPartnerNumber")
|
@Timed("app.office.partners.repo.findPartnerByPartnerNumber")
|
||||||
Optional<HsOfficePartnerEntity> findPartnerByPartnerNumber(Integer partnerNumber);
|
Optional<HsOfficePartnerRbacEntity> findPartnerByPartnerNumber(Integer partnerNumber);
|
||||||
|
|
||||||
@Timed("app.office.partners.repo.save")
|
@Timed("app.office.partners.repo.save")
|
||||||
HsOfficePartnerEntity save(final HsOfficePartnerEntity entity);
|
HsOfficePartnerRbacEntity save(final HsOfficePartnerRbacEntity entity);
|
||||||
|
|
||||||
@Timed("app.office.partners.repo.count")
|
@Timed("app.office.partners.repo.count")
|
||||||
long count();
|
long count();
|
@ -10,7 +10,7 @@ import net.hostsharing.hsadminng.hs.office.debitor.HsOfficeDebitorEntity;
|
|||||||
import net.hostsharing.hsadminng.hs.office.membership.HsOfficeMembershipEntity;
|
import net.hostsharing.hsadminng.hs.office.membership.HsOfficeMembershipEntity;
|
||||||
import net.hostsharing.hsadminng.hs.office.membership.HsOfficeMembershipStatus;
|
import net.hostsharing.hsadminng.hs.office.membership.HsOfficeMembershipStatus;
|
||||||
import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerDetailsEntity;
|
import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerDetailsEntity;
|
||||||
import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerEntity;
|
import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerRbacEntity;
|
||||||
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRealEntity;
|
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRealEntity;
|
||||||
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonType;
|
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonType;
|
||||||
import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelation;
|
import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelation;
|
||||||
@ -84,7 +84,7 @@ public abstract class BaseOfficeDataImport extends CsvDataImport {
|
|||||||
|
|
||||||
static Map<Integer, HsOfficeContactRealEntity> contacts = new WriteOnceMap<>();
|
static Map<Integer, HsOfficeContactRealEntity> contacts = new WriteOnceMap<>();
|
||||||
static Map<Integer, HsOfficePersonRealEntity> persons = new WriteOnceMap<>();
|
static Map<Integer, HsOfficePersonRealEntity> persons = new WriteOnceMap<>();
|
||||||
static Map<Integer, HsOfficePartnerEntity> partners = new WriteOnceMap<>();
|
static Map<Integer, HsOfficePartnerRbacEntity> partners = new WriteOnceMap<>();
|
||||||
static Map<Integer, HsOfficeDebitorEntity> debitors = new WriteOnceMap<>();
|
static Map<Integer, HsOfficeDebitorEntity> debitors = new WriteOnceMap<>();
|
||||||
static Map<Integer, HsOfficeMembershipEntity> memberships = new WriteOnceMap<>();
|
static Map<Integer, HsOfficeMembershipEntity> memberships = new WriteOnceMap<>();
|
||||||
|
|
||||||
@ -743,7 +743,7 @@ public abstract class BaseOfficeDataImport extends CsvDataImport {
|
|||||||
null // is set during contacts import depending on assigned roles
|
null // is set during contacts import depending on assigned roles
|
||||||
);
|
);
|
||||||
|
|
||||||
final var partner = HsOfficePartnerEntity.builder()
|
final var partner = HsOfficePartnerRbacEntity.builder()
|
||||||
.partnerNumber(rec.getInteger("member_id"))
|
.partnerNumber(rec.getInteger("member_id"))
|
||||||
.details(HsOfficePartnerDetailsEntity.builder().build())
|
.details(HsOfficePartnerDetailsEntity.builder().build())
|
||||||
.partnerRel(partnerRel)
|
.partnerRel(partnerRel)
|
||||||
|
@ -4,7 +4,7 @@ import net.hostsharing.hsadminng.config.JsonObjectMapperConfiguration;
|
|||||||
import net.hostsharing.hsadminng.context.Context;
|
import net.hostsharing.hsadminng.context.Context;
|
||||||
import net.hostsharing.hsadminng.hs.office.membership.HsOfficeMembershipEntity;
|
import net.hostsharing.hsadminng.hs.office.membership.HsOfficeMembershipEntity;
|
||||||
import net.hostsharing.hsadminng.hs.office.membership.HsOfficeMembershipRepository;
|
import net.hostsharing.hsadminng.hs.office.membership.HsOfficeMembershipRepository;
|
||||||
import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerEntity;
|
import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerRbacEntity;
|
||||||
import net.hostsharing.hsadminng.mapper.StrictMapper;
|
import net.hostsharing.hsadminng.mapper.StrictMapper;
|
||||||
import net.hostsharing.hsadminng.persistence.EntityManagerWrapper;
|
import net.hostsharing.hsadminng.persistence.EntityManagerWrapper;
|
||||||
import net.hostsharing.hsadminng.rbac.test.JsonBuilder;
|
import net.hostsharing.hsadminng.rbac.test.JsonBuilder;
|
||||||
@ -67,7 +67,7 @@ class HsOfficeCoopAssetsTransactionControllerRestTest {
|
|||||||
private static final String ORIGIN_MEMBER_NUMBER = "M-1111100";
|
private static final String ORIGIN_MEMBER_NUMBER = "M-1111100";
|
||||||
public final HsOfficeMembershipEntity ORIGIN_TARGET_MEMBER_ENTITY = HsOfficeMembershipEntity.builder()
|
public final HsOfficeMembershipEntity ORIGIN_TARGET_MEMBER_ENTITY = HsOfficeMembershipEntity.builder()
|
||||||
.uuid(ORIGIN_MEMBERSHIP_UUID)
|
.uuid(ORIGIN_MEMBERSHIP_UUID)
|
||||||
.partner(HsOfficePartnerEntity.builder()
|
.partner(HsOfficePartnerRbacEntity.builder()
|
||||||
.partnerNumber(partnerNumberOf(ORIGIN_MEMBER_NUMBER))
|
.partnerNumber(partnerNumberOf(ORIGIN_MEMBER_NUMBER))
|
||||||
.build())
|
.build())
|
||||||
.memberNumberSuffix(suffixOf(ORIGIN_MEMBER_NUMBER))
|
.memberNumberSuffix(suffixOf(ORIGIN_MEMBER_NUMBER))
|
||||||
@ -77,7 +77,7 @@ class HsOfficeCoopAssetsTransactionControllerRestTest {
|
|||||||
private static final String AVAILABLE_TARGET_MEMBER_NUMBER = "M-1234500";
|
private static final String AVAILABLE_TARGET_MEMBER_NUMBER = "M-1234500";
|
||||||
public final HsOfficeMembershipEntity AVAILABLE_MEMBER_ENTITY = HsOfficeMembershipEntity.builder()
|
public final HsOfficeMembershipEntity AVAILABLE_MEMBER_ENTITY = HsOfficeMembershipEntity.builder()
|
||||||
.uuid(AVAILABLE_TARGET_MEMBERSHIP_UUID)
|
.uuid(AVAILABLE_TARGET_MEMBERSHIP_UUID)
|
||||||
.partner(HsOfficePartnerEntity.builder()
|
.partner(HsOfficePartnerRbacEntity.builder()
|
||||||
.partnerNumber(partnerNumberOf(AVAILABLE_TARGET_MEMBER_NUMBER))
|
.partnerNumber(partnerNumberOf(AVAILABLE_TARGET_MEMBER_NUMBER))
|
||||||
.build())
|
.build())
|
||||||
.memberNumberSuffix(suffixOf(AVAILABLE_TARGET_MEMBER_NUMBER))
|
.memberNumberSuffix(suffixOf(AVAILABLE_TARGET_MEMBER_NUMBER))
|
||||||
|
@ -6,7 +6,7 @@ import net.hostsharing.hsadminng.HsadminNgApplication;
|
|||||||
import net.hostsharing.hsadminng.context.Context;
|
import net.hostsharing.hsadminng.context.Context;
|
||||||
import net.hostsharing.hsadminng.hs.office.bankaccount.HsOfficeBankAccountRepository;
|
import net.hostsharing.hsadminng.hs.office.bankaccount.HsOfficeBankAccountRepository;
|
||||||
import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRealRepository;
|
import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRealRepository;
|
||||||
import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerRepository;
|
import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerRbacRepository;
|
||||||
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRealRepository;
|
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRealRepository;
|
||||||
import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRealEntity;
|
import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRealEntity;
|
||||||
import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRealRepository;
|
import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRealRepository;
|
||||||
@ -58,7 +58,7 @@ class HsOfficeDebitorControllerAcceptanceTest extends ContextBasedTestWithCleanu
|
|||||||
HsOfficeDebitorRepository debitorRepo;
|
HsOfficeDebitorRepository debitorRepo;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
HsOfficePartnerRepository partnerRepo;
|
HsOfficePartnerRbacRepository partnerRepo;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
HsOfficeContactRealRepository contactRealRepo;
|
HsOfficeContactRealRepository contactRealRepo;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package net.hostsharing.hsadminng.hs.office.debitor;
|
package net.hostsharing.hsadminng.hs.office.debitor;
|
||||||
|
|
||||||
import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRealEntity;
|
import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRealEntity;
|
||||||
import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerEntity;
|
import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerRbacEntity;
|
||||||
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRealEntity;
|
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRealEntity;
|
||||||
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonType;
|
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonType;
|
||||||
import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRealEntity;
|
import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRealEntity;
|
||||||
@ -30,7 +30,7 @@ class HsOfficeDebitorEntityUnitTest {
|
|||||||
.debitorNumberSuffix("67")
|
.debitorNumberSuffix("67")
|
||||||
.debitorRel(givenDebitorRel)
|
.debitorRel(givenDebitorRel)
|
||||||
.defaultPrefix("som")
|
.defaultPrefix("som")
|
||||||
.partner(HsOfficePartnerEntity.builder()
|
.partner(HsOfficePartnerRbacEntity.builder()
|
||||||
.partnerNumber(12345)
|
.partnerNumber(12345)
|
||||||
.build())
|
.build())
|
||||||
.build();
|
.build();
|
||||||
@ -45,7 +45,7 @@ class HsOfficeDebitorEntityUnitTest {
|
|||||||
final var given = HsOfficeDebitorEntity.builder()
|
final var given = HsOfficeDebitorEntity.builder()
|
||||||
.debitorRel(givenDebitorRel)
|
.debitorRel(givenDebitorRel)
|
||||||
.debitorNumberSuffix("67")
|
.debitorNumberSuffix("67")
|
||||||
.partner(HsOfficePartnerEntity.builder()
|
.partner(HsOfficePartnerRbacEntity.builder()
|
||||||
.partnerNumber(12345)
|
.partnerNumber(12345)
|
||||||
.build())
|
.build())
|
||||||
.build();
|
.build();
|
||||||
@ -60,7 +60,7 @@ class HsOfficeDebitorEntityUnitTest {
|
|||||||
final var given = HsOfficeDebitorEntity.builder()
|
final var given = HsOfficeDebitorEntity.builder()
|
||||||
.debitorRel(givenDebitorRel)
|
.debitorRel(givenDebitorRel)
|
||||||
.debitorNumberSuffix("67")
|
.debitorNumberSuffix("67")
|
||||||
.partner(HsOfficePartnerEntity.builder()
|
.partner(HsOfficePartnerRbacEntity.builder()
|
||||||
.partnerNumber(12345)
|
.partnerNumber(12345)
|
||||||
.build())
|
.build())
|
||||||
.build();
|
.build();
|
||||||
@ -88,7 +88,7 @@ class HsOfficeDebitorEntityUnitTest {
|
|||||||
final var given = HsOfficeDebitorEntity.builder()
|
final var given = HsOfficeDebitorEntity.builder()
|
||||||
.debitorRel(givenDebitorRel)
|
.debitorRel(givenDebitorRel)
|
||||||
.debitorNumberSuffix("67")
|
.debitorNumberSuffix("67")
|
||||||
.partner(HsOfficePartnerEntity.builder().build())
|
.partner(HsOfficePartnerRbacEntity.builder().build())
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
final var result = given.getTaggedDebitorNumber();
|
final var result = given.getTaggedDebitorNumber();
|
||||||
@ -101,7 +101,7 @@ class HsOfficeDebitorEntityUnitTest {
|
|||||||
final var given = HsOfficeDebitorEntity.builder()
|
final var given = HsOfficeDebitorEntity.builder()
|
||||||
.debitorRel(givenDebitorRel)
|
.debitorRel(givenDebitorRel)
|
||||||
.debitorNumberSuffix(null)
|
.debitorNumberSuffix(null)
|
||||||
.partner(HsOfficePartnerEntity.builder()
|
.partner(HsOfficePartnerRbacEntity.builder()
|
||||||
.partnerNumber(12345)
|
.partnerNumber(12345)
|
||||||
.build())
|
.build())
|
||||||
.build();
|
.build();
|
||||||
|
@ -3,7 +3,7 @@ package net.hostsharing.hsadminng.hs.office.debitor;
|
|||||||
import net.hostsharing.hsadminng.context.Context;
|
import net.hostsharing.hsadminng.context.Context;
|
||||||
import net.hostsharing.hsadminng.hs.office.bankaccount.HsOfficeBankAccountRepository;
|
import net.hostsharing.hsadminng.hs.office.bankaccount.HsOfficeBankAccountRepository;
|
||||||
import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRealRepository;
|
import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRealRepository;
|
||||||
import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerRepository;
|
import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerRbacRepository;
|
||||||
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRealRepository;
|
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRealRepository;
|
||||||
import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelation;
|
import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelation;
|
||||||
import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRealEntity;
|
import net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationRealEntity;
|
||||||
@ -48,7 +48,7 @@ class HsOfficeDebitorRepositoryIntegrationTest extends ContextBasedTestWithClean
|
|||||||
HsOfficeDebitorRepository debitorRepo;
|
HsOfficeDebitorRepository debitorRepo;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
HsOfficePartnerRepository partnerRepo;
|
HsOfficePartnerRbacRepository partnerRepo;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
HsOfficeContactRealRepository contactRealRepo;
|
HsOfficeContactRealRepository contactRealRepo;
|
||||||
|
@ -5,7 +5,7 @@ import io.restassured.RestAssured;
|
|||||||
import io.restassured.http.ContentType;
|
import io.restassured.http.ContentType;
|
||||||
import net.hostsharing.hsadminng.HsadminNgApplication;
|
import net.hostsharing.hsadminng.HsadminNgApplication;
|
||||||
import net.hostsharing.hsadminng.context.Context;
|
import net.hostsharing.hsadminng.context.Context;
|
||||||
import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerRepository;
|
import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerRbacRepository;
|
||||||
import net.hostsharing.hsadminng.rbac.test.ContextBasedTestWithCleanup;
|
import net.hostsharing.hsadminng.rbac.test.ContextBasedTestWithCleanup;
|
||||||
import net.hostsharing.hsadminng.rbac.test.JpaAttempt;
|
import net.hostsharing.hsadminng.rbac.test.JpaAttempt;
|
||||||
import net.hostsharing.hsadminng.config.DisableSecurityConfig;
|
import net.hostsharing.hsadminng.config.DisableSecurityConfig;
|
||||||
@ -54,7 +54,7 @@ class HsOfficeMembershipControllerAcceptanceTest extends ContextBasedTestWithCle
|
|||||||
HsOfficeMembershipRepository membershipRepo;
|
HsOfficeMembershipRepository membershipRepo;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
HsOfficePartnerRepository partnerRepo;
|
HsOfficePartnerRbacRepository partnerRepo;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
JpaAttempt jpaAttempt;
|
JpaAttempt jpaAttempt;
|
||||||
|
@ -2,8 +2,8 @@ package net.hostsharing.hsadminng.hs.office.membership;
|
|||||||
|
|
||||||
import net.hostsharing.hsadminng.context.Context;
|
import net.hostsharing.hsadminng.context.Context;
|
||||||
import net.hostsharing.hsadminng.hs.office.coopassets.HsOfficeCoopAssetsTransactionRepository;
|
import net.hostsharing.hsadminng.hs.office.coopassets.HsOfficeCoopAssetsTransactionRepository;
|
||||||
import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerEntity;
|
import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerRbacEntity;
|
||||||
import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerRepository;
|
import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerRbacRepository;
|
||||||
import net.hostsharing.hsadminng.mapper.StrictMapper;
|
import net.hostsharing.hsadminng.mapper.StrictMapper;
|
||||||
import net.hostsharing.hsadminng.persistence.EntityManagerWrapper;
|
import net.hostsharing.hsadminng.persistence.EntityManagerWrapper;
|
||||||
import net.hostsharing.hsadminng.config.DisableSecurityConfig;
|
import net.hostsharing.hsadminng.config.DisableSecurityConfig;
|
||||||
@ -39,7 +39,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
|||||||
@ActiveProfiles("test")
|
@ActiveProfiles("test")
|
||||||
public class HsOfficeMembershipControllerRestTest {
|
public class HsOfficeMembershipControllerRestTest {
|
||||||
|
|
||||||
private static final HsOfficePartnerEntity PARTNER_12345 = HsOfficePartnerEntity.builder()
|
private static final HsOfficePartnerRbacEntity PARTNER_12345 = HsOfficePartnerRbacEntity.builder()
|
||||||
.partnerNumber(12345)
|
.partnerNumber(12345)
|
||||||
.build();
|
.build();
|
||||||
public static final HsOfficeMembershipEntity MEMBERSHIP_1234501 = HsOfficeMembershipEntity.builder()
|
public static final HsOfficeMembershipEntity MEMBERSHIP_1234501 = HsOfficeMembershipEntity.builder()
|
||||||
@ -77,7 +77,7 @@ public class HsOfficeMembershipControllerRestTest {
|
|||||||
HsOfficeCoopAssetsTransactionRepository coopAssetsTransactionRepo;
|
HsOfficeCoopAssetsTransactionRepository coopAssetsTransactionRepo;
|
||||||
|
|
||||||
@MockitoBean
|
@MockitoBean
|
||||||
HsOfficePartnerRepository partnerRepo;
|
HsOfficePartnerRbacRepository partnerRepo;
|
||||||
|
|
||||||
@MockitoBean
|
@MockitoBean
|
||||||
HsOfficeMembershipRepository membershipRepo;
|
HsOfficeMembershipRepository membershipRepo;
|
||||||
@ -256,7 +256,7 @@ public class HsOfficeMembershipControllerRestTest {
|
|||||||
|
|
||||||
// given
|
// given
|
||||||
final var givenPartnerUuid = UUID.randomUUID();
|
final var givenPartnerUuid = UUID.randomUUID();
|
||||||
when(em.find(HsOfficePartnerEntity.class, givenPartnerUuid)).thenReturn(null);
|
when(em.find(HsOfficePartnerRbacEntity.class, givenPartnerUuid)).thenReturn(null);
|
||||||
|
|
||||||
// when
|
// when
|
||||||
mockMvc.perform(MockMvcRequestBuilders
|
mockMvc.perform(MockMvcRequestBuilders
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package net.hostsharing.hsadminng.hs.office.membership;
|
package net.hostsharing.hsadminng.hs.office.membership;
|
||||||
|
|
||||||
import io.hypersistence.utils.hibernate.type.range.Range;
|
import io.hypersistence.utils.hibernate.type.range.Range;
|
||||||
import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerEntity;
|
import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerRbacEntity;
|
||||||
import net.hostsharing.hsadminng.rbac.generator.RbacViewMermaidFlowchartGenerator;
|
import net.hostsharing.hsadminng.rbac.generator.RbacViewMermaidFlowchartGenerator;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ class HsOfficeMembershipEntityUnitTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void getMemberNumberWithoutPartnerNumberButWithSuffix() {
|
void getMemberNumberWithoutPartnerNumberButWithSuffix() {
|
||||||
givenMembership.setPartner(HsOfficePartnerEntity.builder().build());
|
givenMembership.setPartner(HsOfficePartnerRbacEntity.builder().build());
|
||||||
final var result = givenMembership.getMemberNumber();
|
final var result = givenMembership.getMemberNumber();
|
||||||
assertThat(result).isEqualTo(null);
|
assertThat(result).isEqualTo(null);
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ package net.hostsharing.hsadminng.hs.office.membership;
|
|||||||
import io.hypersistence.utils.hibernate.type.range.Range;
|
import io.hypersistence.utils.hibernate.type.range.Range;
|
||||||
import net.hostsharing.hsadminng.context.Context;
|
import net.hostsharing.hsadminng.context.Context;
|
||||||
import net.hostsharing.hsadminng.hs.office.debitor.HsOfficeDebitorRepository;
|
import net.hostsharing.hsadminng.hs.office.debitor.HsOfficeDebitorRepository;
|
||||||
import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerRepository;
|
import net.hostsharing.hsadminng.hs.office.partner.HsOfficePartnerRbacRepository;
|
||||||
import net.hostsharing.hsadminng.rbac.test.ContextBasedTestWithCleanup;
|
import net.hostsharing.hsadminng.rbac.test.ContextBasedTestWithCleanup;
|
||||||
import net.hostsharing.hsadminng.rbac.grant.RawRbacGrantRepository;
|
import net.hostsharing.hsadminng.rbac.grant.RawRbacGrantRepository;
|
||||||
import net.hostsharing.hsadminng.rbac.role.RawRbacRoleRepository;
|
import net.hostsharing.hsadminng.rbac.role.RawRbacRoleRepository;
|
||||||
@ -37,7 +37,7 @@ class HsOfficeMembershipRepositoryIntegrationTest extends ContextBasedTestWithCl
|
|||||||
HsOfficeMembershipRepository membershipRepo;
|
HsOfficeMembershipRepository membershipRepo;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
HsOfficePartnerRepository partnerRepo;
|
HsOfficePartnerRbacRepository partnerRepo;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
HsOfficeDebitorRepository debitorRepo;
|
HsOfficeDebitorRepository debitorRepo;
|
||||||
|
@ -42,7 +42,7 @@ class HsOfficePartnerControllerAcceptanceTest extends ContextBasedTestWithCleanu
|
|||||||
private Integer port;
|
private Integer port;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
HsOfficePartnerRepository partnerRepo;
|
HsOfficePartnerRbacRepository partnerRepo;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
HsOfficeRelationRealRepository relationRepo;
|
HsOfficeRelationRealRepository relationRepo;
|
||||||
@ -541,12 +541,12 @@ class HsOfficePartnerControllerAcceptanceTest extends ContextBasedTestWithCleanu
|
|||||||
return partnerRel;
|
return partnerRel;
|
||||||
}).assertSuccessful().returnedValue();
|
}).assertSuccessful().returnedValue();
|
||||||
}
|
}
|
||||||
private HsOfficePartnerEntity givenSomeTemporaryPartnerBessler(final Integer partnerNumber) {
|
private HsOfficePartnerRbacEntity givenSomeTemporaryPartnerBessler(final Integer partnerNumber) {
|
||||||
return jpaAttempt.transacted(() -> {
|
return jpaAttempt.transacted(() -> {
|
||||||
context.define("superuser-alex@hostsharing.net");
|
context.define("superuser-alex@hostsharing.net");
|
||||||
final var partnerRel = em.merge(givenSomeTemporaryPartnerRel("Erben Bessler", "fourth contact"));
|
final var partnerRel = em.merge(givenSomeTemporaryPartnerRel("Erben Bessler", "fourth contact"));
|
||||||
|
|
||||||
final var newPartner = HsOfficePartnerEntity.builder()
|
final var newPartner = HsOfficePartnerRbacEntity.builder()
|
||||||
.partnerRel(partnerRel)
|
.partnerRel(partnerRel)
|
||||||
.partnerNumber(partnerNumber)
|
.partnerNumber(partnerNumber)
|
||||||
.details(HsOfficePartnerDetailsEntity.builder()
|
.details(HsOfficePartnerDetailsEntity.builder()
|
||||||
@ -561,7 +561,7 @@ class HsOfficePartnerControllerAcceptanceTest extends ContextBasedTestWithCleanu
|
|||||||
|
|
||||||
@AfterEach
|
@AfterEach
|
||||||
void cleanup() {
|
void cleanup() {
|
||||||
cleanupAllNew(HsOfficePartnerEntity.class);
|
cleanupAllNew(HsOfficePartnerRbacEntity.class);
|
||||||
|
|
||||||
// TODO: should not be necessary anymore, once it's deleted via after delete trigger
|
// TODO: should not be necessary anymore, once it's deleted via after delete trigger
|
||||||
cleanupAllNew(HsOfficeRelationRealEntity.class);
|
cleanupAllNew(HsOfficeRelationRealEntity.class);
|
||||||
|
@ -54,7 +54,7 @@ class HsOfficePartnerControllerRestTest {
|
|||||||
Context contextMock;
|
Context contextMock;
|
||||||
|
|
||||||
@MockitoBean
|
@MockitoBean
|
||||||
HsOfficePartnerRepository partnerRepo;
|
HsOfficePartnerRbacRepository partnerRepo;
|
||||||
|
|
||||||
@MockitoBean
|
@MockitoBean
|
||||||
HsOfficeRelationRealRepository relationRepo;
|
HsOfficeRelationRealRepository relationRepo;
|
||||||
@ -75,7 +75,7 @@ class HsOfficePartnerControllerRestTest {
|
|||||||
HsOfficeContactRbacEntity contactMock;
|
HsOfficeContactRbacEntity contactMock;
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
HsOfficePartnerEntity partnerMock;
|
HsOfficePartnerRbacEntity partnerMock;
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
void init() {
|
void init() {
|
||||||
@ -174,7 +174,7 @@ class HsOfficePartnerControllerRestTest {
|
|||||||
@Test
|
@Test
|
||||||
void respondWithPartner_ifPartnerNumberIsAvailable() throws Exception {
|
void respondWithPartner_ifPartnerNumberIsAvailable() throws Exception {
|
||||||
// given
|
// given
|
||||||
when(partnerRepo.findPartnerByPartnerNumber(12345)).thenReturn(Optional.of(HsOfficePartnerEntity.builder()
|
when(partnerRepo.findPartnerByPartnerNumber(12345)).thenReturn(Optional.of(HsOfficePartnerRbacEntity.builder()
|
||||||
.partnerNumber(12345)
|
.partnerNumber(12345)
|
||||||
.build()));
|
.build()));
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ import static org.mockito.Mockito.lenient;
|
|||||||
@ExtendWith(MockitoExtension.class)
|
@ExtendWith(MockitoExtension.class)
|
||||||
class HsOfficePartnerEntityPatcherUnitTest extends PatchUnitTestBase<
|
class HsOfficePartnerEntityPatcherUnitTest extends PatchUnitTestBase<
|
||||||
HsOfficePartnerPatchResource,
|
HsOfficePartnerPatchResource,
|
||||||
HsOfficePartnerEntity
|
HsOfficePartnerRbacEntity
|
||||||
> {
|
> {
|
||||||
|
|
||||||
private static final UUID INITIAL_PARTNER_UUID = UUID.randomUUID();
|
private static final UUID INITIAL_PARTNER_UUID = UUID.randomUUID();
|
||||||
@ -53,8 +53,8 @@ class HsOfficePartnerEntityPatcherUnitTest extends PatchUnitTestBase<
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected HsOfficePartnerEntity newInitialEntity() {
|
protected HsOfficePartnerRbacEntity newInitialEntity() {
|
||||||
final var entity = HsOfficePartnerEntity.builder()
|
final var entity = HsOfficePartnerRbacEntity.builder()
|
||||||
.uuid(INITIAL_PARTNER_UUID)
|
.uuid(INITIAL_PARTNER_UUID)
|
||||||
.partnerNumber(12345)
|
.partnerNumber(12345)
|
||||||
.partnerRel(HsOfficeRelationRealEntity.builder()
|
.partnerRel(HsOfficeRelationRealEntity.builder()
|
||||||
@ -72,7 +72,7 @@ class HsOfficePartnerEntityPatcherUnitTest extends PatchUnitTestBase<
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected HsOfficePartnerEntityPatcher createPatcher(final HsOfficePartnerEntity partner) {
|
protected HsOfficePartnerEntityPatcher createPatcher(final HsOfficePartnerRbacEntity partner) {
|
||||||
return new HsOfficePartnerEntityPatcher(em, partner);
|
return new HsOfficePartnerEntityPatcher(em, partner);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ class HsOfficePartnerEntityPatcherUnitTest extends PatchUnitTestBase<
|
|||||||
"partnerRel",
|
"partnerRel",
|
||||||
HsOfficePartnerPatchResource::setPartnerRelUuid,
|
HsOfficePartnerPatchResource::setPartnerRelUuid,
|
||||||
PATCHED_PARTNER_ROLE_UUID,
|
PATCHED_PARTNER_ROLE_UUID,
|
||||||
HsOfficePartnerEntity::setPartnerRel,
|
HsOfficePartnerRbacEntity::setPartnerRel,
|
||||||
newPartnerRel(PATCHED_PARTNER_ROLE_UUID))
|
newPartnerRel(PATCHED_PARTNER_ROLE_UUID))
|
||||||
.notNullable()
|
.notNullable()
|
||||||
);
|
);
|
||||||
|
@ -12,7 +12,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||||||
|
|
||||||
class HsOfficePartnerEntityUnitTest {
|
class HsOfficePartnerEntityUnitTest {
|
||||||
|
|
||||||
private final HsOfficePartnerEntity givenPartner = HsOfficePartnerEntity.builder()
|
private final HsOfficePartnerRbacEntity givenPartner = HsOfficePartnerRbacEntity.builder()
|
||||||
.partnerNumber(12345)
|
.partnerNumber(12345)
|
||||||
.partnerRel(HsOfficeRelationRealEntity.builder()
|
.partnerRel(HsOfficeRelationRealEntity.builder()
|
||||||
.anchor(HsOfficePersonRealEntity.builder()
|
.anchor(HsOfficePersonRealEntity.builder()
|
||||||
@ -42,7 +42,7 @@ class HsOfficePartnerEntityUnitTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void definesRbac() {
|
void definesRbac() {
|
||||||
final var rbacFlowchart = new RbacViewMermaidFlowchartGenerator(HsOfficePartnerEntity.rbac()).toString();
|
final var rbacFlowchart = new RbacViewMermaidFlowchartGenerator(HsOfficePartnerRbacEntity.rbac()).toString();
|
||||||
assertThat(rbacFlowchart).isEqualTo("""
|
assertThat(rbacFlowchart).isEqualTo("""
|
||||||
%%{init:{'flowchart':{'htmlLabels':false}}}%%
|
%%{init:{'flowchart':{'htmlLabels':false}}}%%
|
||||||
flowchart TB
|
flowchart TB
|
||||||
|
@ -41,7 +41,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||||||
class HsOfficePartnerRepositoryIntegrationTest extends ContextBasedTestWithCleanup {
|
class HsOfficePartnerRepositoryIntegrationTest extends ContextBasedTestWithCleanup {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
HsOfficePartnerRepository partnerRepo;
|
HsOfficePartnerRbacRepository partnerRepo;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
HsOfficeRelationRealRepository relationRepo;
|
HsOfficeRelationRealRepository relationRepo;
|
||||||
@ -82,7 +82,7 @@ class HsOfficePartnerRepositoryIntegrationTest extends ContextBasedTestWithClean
|
|||||||
|
|
||||||
// when
|
// when
|
||||||
final var result = attempt(em, () -> {
|
final var result = attempt(em, () -> {
|
||||||
final var newPartner = HsOfficePartnerEntity.builder()
|
final var newPartner = HsOfficePartnerRbacEntity.builder()
|
||||||
.partnerNumber(20031)
|
.partnerNumber(20031)
|
||||||
.partnerRel(partnerRel)
|
.partnerRel(partnerRel)
|
||||||
.details(HsOfficePartnerDetailsEntity.builder().build())
|
.details(HsOfficePartnerDetailsEntity.builder().build())
|
||||||
@ -92,7 +92,7 @@ class HsOfficePartnerRepositoryIntegrationTest extends ContextBasedTestWithClean
|
|||||||
|
|
||||||
// then
|
// then
|
||||||
result.assertSuccessful();
|
result.assertSuccessful();
|
||||||
assertThat(result.returnedValue()).isNotNull().extracting(HsOfficePartnerEntity::getUuid).isNotNull();
|
assertThat(result.returnedValue()).isNotNull().extracting(HsOfficePartnerRbacEntity::getUuid).isNotNull();
|
||||||
assertThatPartnerIsPersisted(result.returnedValue());
|
assertThatPartnerIsPersisted(result.returnedValue());
|
||||||
assertThat(partnerRepo.count()).isEqualTo(count + 1);
|
assertThat(partnerRepo.count()).isEqualTo(count + 1);
|
||||||
}
|
}
|
||||||
@ -122,7 +122,7 @@ class HsOfficePartnerRepositoryIntegrationTest extends ContextBasedTestWithClean
|
|||||||
.build();
|
.build();
|
||||||
relationRepo.save(newRelation);
|
relationRepo.save(newRelation);
|
||||||
|
|
||||||
final var newPartner = HsOfficePartnerEntity.builder()
|
final var newPartner = HsOfficePartnerRbacEntity.builder()
|
||||||
.partnerNumber(20032)
|
.partnerNumber(20032)
|
||||||
.partnerRel(newRelation)
|
.partnerRel(newRelation)
|
||||||
.details(HsOfficePartnerDetailsEntity.builder().build())
|
.details(HsOfficePartnerDetailsEntity.builder().build())
|
||||||
@ -180,7 +180,7 @@ class HsOfficePartnerRepositoryIntegrationTest extends ContextBasedTestWithClean
|
|||||||
null)));
|
null)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assertThatPartnerIsPersisted(final HsOfficePartnerEntity saved) {
|
private void assertThatPartnerIsPersisted(final HsOfficePartnerRbacEntity saved) {
|
||||||
final var found = partnerRepo.findByUuid(saved.getUuid());
|
final var found = partnerRepo.findByUuid(saved.getUuid());
|
||||||
assertThat(found).isNotEmpty().get().extracting(Object::toString).isEqualTo(saved.toString());
|
assertThat(found).isNotEmpty().get().extracting(Object::toString).isEqualTo(saved.toString());
|
||||||
}
|
}
|
||||||
@ -325,13 +325,13 @@ class HsOfficePartnerRepositoryIntegrationTest extends ContextBasedTestWithClean
|
|||||||
result.assertSuccessful();
|
result.assertSuccessful();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assertThatPartnerActuallyInDatabase(final HsOfficePartnerEntity saved) {
|
private void assertThatPartnerActuallyInDatabase(final HsOfficePartnerRbacEntity saved) {
|
||||||
final var found = partnerRepo.findByUuid(saved.getUuid());
|
final var found = partnerRepo.findByUuid(saved.getUuid());
|
||||||
assertThat(found).isNotEmpty().get().isNotSameAs(saved).extracting(HsOfficePartnerEntity::toString).isEqualTo(saved.toString());
|
assertThat(found).isNotEmpty().get().isNotSameAs(saved).extracting(HsOfficePartnerRbacEntity::toString).isEqualTo(saved.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assertThatPartnerIsVisibleForUserWithRole(
|
private void assertThatPartnerIsVisibleForUserWithRole(
|
||||||
final HsOfficePartnerEntity entity,
|
final HsOfficePartnerRbacEntity entity,
|
||||||
final String assumedRoles) {
|
final String assumedRoles) {
|
||||||
jpaAttempt.transacted(() -> {
|
jpaAttempt.transacted(() -> {
|
||||||
context("superuser-alex@hostsharing.net", assumedRoles);
|
context("superuser-alex@hostsharing.net", assumedRoles);
|
||||||
@ -340,7 +340,7 @@ class HsOfficePartnerRepositoryIntegrationTest extends ContextBasedTestWithClean
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void assertThatPartnerIsNotVisibleForUserWithRole(
|
private void assertThatPartnerIsNotVisibleForUserWithRole(
|
||||||
final HsOfficePartnerEntity entity,
|
final HsOfficePartnerRbacEntity entity,
|
||||||
final String assumedRoles) {
|
final String assumedRoles) {
|
||||||
jpaAttempt.transacted(() -> {
|
jpaAttempt.transacted(() -> {
|
||||||
context("superuser-alex@hostsharing.net", assumedRoles);
|
context("superuser-alex@hostsharing.net", assumedRoles);
|
||||||
@ -442,13 +442,13 @@ class HsOfficePartnerRepositoryIntegrationTest extends ContextBasedTestWithClean
|
|||||||
"[creating partner test-data , hs_office.partner, INSERT, 10010]");
|
"[creating partner test-data , hs_office.partner, INSERT, 10010]");
|
||||||
}
|
}
|
||||||
|
|
||||||
private HsOfficePartnerEntity givenSomeTemporaryHostsharingPartner(
|
private HsOfficePartnerRbacEntity givenSomeTemporaryHostsharingPartner(
|
||||||
final Integer partnerNumber, final String person, final String contact) {
|
final Integer partnerNumber, final String person, final String contact) {
|
||||||
return jpaAttempt.transacted(() -> {
|
return jpaAttempt.transacted(() -> {
|
||||||
context("superuser-alex@hostsharing.net");
|
context("superuser-alex@hostsharing.net");
|
||||||
final var partnerRel = givenSomeTemporaryHostsharingPartnerRel(person, contact);
|
final var partnerRel = givenSomeTemporaryHostsharingPartnerRel(person, contact);
|
||||||
|
|
||||||
final var newPartner = HsOfficePartnerEntity.builder()
|
final var newPartner = HsOfficePartnerRbacEntity.builder()
|
||||||
.partnerNumber(partnerNumber)
|
.partnerNumber(partnerNumber)
|
||||||
.partnerRel(partnerRel)
|
.partnerRel(partnerRel)
|
||||||
.details(HsOfficePartnerDetailsEntity.builder().build())
|
.details(HsOfficePartnerDetailsEntity.builder().build())
|
||||||
@ -476,21 +476,21 @@ class HsOfficePartnerRepositoryIntegrationTest extends ContextBasedTestWithClean
|
|||||||
return partnerRel;
|
return partnerRel;
|
||||||
}
|
}
|
||||||
|
|
||||||
void exactlyThesePartnersAreReturned(final List<HsOfficePartnerEntity> actualResult, final String... partnerNames) {
|
void exactlyThesePartnersAreReturned(final List<HsOfficePartnerRbacEntity> actualResult, final String... partnerNames) {
|
||||||
assertThat(actualResult)
|
assertThat(actualResult)
|
||||||
.extracting(HsOfficePartnerEntity::toString)
|
.extracting(HsOfficePartnerRbacEntity::toString)
|
||||||
.containsExactlyInAnyOrder(partnerNames);
|
.containsExactlyInAnyOrder(partnerNames);
|
||||||
}
|
}
|
||||||
|
|
||||||
void allThesePartnersAreReturned(final List<HsOfficePartnerEntity> actualResult, final String... partnerNames) {
|
void allThesePartnersAreReturned(final List<HsOfficePartnerRbacEntity> actualResult, final String... partnerNames) {
|
||||||
assertThat(actualResult)
|
assertThat(actualResult)
|
||||||
.extracting(HsOfficePartnerEntity::toString)
|
.extracting(HsOfficePartnerRbacEntity::toString)
|
||||||
.contains(partnerNames);
|
.contains(partnerNames);
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterEach
|
@AfterEach
|
||||||
void cleanup() {
|
void cleanup() {
|
||||||
cleanupAllNew(HsOfficePartnerEntity.class);
|
cleanupAllNew(HsOfficePartnerRbacEntity.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String[] distinct(final String[] strings) {
|
private String[] distinct(final String[] strings) {
|
||||||
|
@ -9,10 +9,10 @@ import static net.hostsharing.hsadminng.hs.office.person.HsOfficePersonType.LEGA
|
|||||||
|
|
||||||
public class TestHsOfficePartner {
|
public class TestHsOfficePartner {
|
||||||
|
|
||||||
public static final HsOfficePartnerEntity TEST_PARTNER = hsOfficePartnerWithLegalPerson("Test Ltd.");
|
public static final HsOfficePartnerRbacEntity TEST_PARTNER = hsOfficePartnerWithLegalPerson("Test Ltd.");
|
||||||
|
|
||||||
static public HsOfficePartnerEntity hsOfficePartnerWithLegalPerson(final String tradeName) {
|
static public HsOfficePartnerRbacEntity hsOfficePartnerWithLegalPerson(final String tradeName) {
|
||||||
return HsOfficePartnerEntity.builder()
|
return HsOfficePartnerRbacEntity.builder()
|
||||||
.partnerNumber(10001)
|
.partnerNumber(10001)
|
||||||
.partnerRel(
|
.partnerRel(
|
||||||
HsOfficeRelationRealEntity.builder()
|
HsOfficeRelationRealEntity.builder()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user