add partnerRole to partner and amend ImportOfficeData (WIP)
This commit is contained in:
parent
1eaef1e18c
commit
90e626eac0
4
.aliases
4
.aliases
@ -79,5 +79,5 @@ alias pg-sql-restore='gunzip --stdout | docker exec -i hsadmin-ng-postgres psql
|
|||||||
alias fp='grep -r '@Accepts' src | sed -e 's/^.*@/@/g' | sort -u | wc -l'
|
alias fp='grep -r '@Accepts' src | sed -e 's/^.*@/@/g' | sort -u | wc -l'
|
||||||
|
|
||||||
alias gw-spotless='./gradlew spotlessApply -x pitest -x test -x :processResources'
|
alias gw-spotless='./gradlew spotlessApply -x pitest -x test -x :processResources'
|
||||||
alias gw-test='. .aliases; ./gradlew test'
|
alias gw-test='. .aliases; ./gradlew test importOfficeData'
|
||||||
alias gw-check='. .aliases; gw check -x pitest -x :dependencyCheckAnalyze'
|
alias gw-check='. .aliases; gw test importOfficeData check -x pitest -x :dependencyCheckAnalyze'
|
||||||
|
@ -25,7 +25,7 @@ import static net.hostsharing.hsadminng.stringify.Stringify.stringify;
|
|||||||
public class HsOfficeCoopSharesTransactionEntity implements Stringifyable, HasUuid {
|
public class HsOfficeCoopSharesTransactionEntity implements Stringifyable, HasUuid {
|
||||||
|
|
||||||
private static Stringify<HsOfficeCoopSharesTransactionEntity> stringify = stringify(HsOfficeCoopSharesTransactionEntity.class)
|
private static Stringify<HsOfficeCoopSharesTransactionEntity> stringify = stringify(HsOfficeCoopSharesTransactionEntity.class)
|
||||||
.withProp(HsOfficeCoopSharesTransactionEntity::getMemberNumber)
|
.withProp(HsOfficeCoopSharesTransactionEntity::getMemberNumberTagged)
|
||||||
.withProp(HsOfficeCoopSharesTransactionEntity::getValueDate)
|
.withProp(HsOfficeCoopSharesTransactionEntity::getValueDate)
|
||||||
.withProp(HsOfficeCoopSharesTransactionEntity::getTransactionType)
|
.withProp(HsOfficeCoopSharesTransactionEntity::getTransactionType)
|
||||||
.withProp(HsOfficeCoopSharesTransactionEntity::getShareCount)
|
.withProp(HsOfficeCoopSharesTransactionEntity::getShareCount)
|
||||||
@ -76,12 +76,12 @@ public class HsOfficeCoopSharesTransactionEntity implements Stringifyable, HasUu
|
|||||||
return stringify.apply(this);
|
return stringify.apply(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getMemberNumber() {
|
private String getMemberNumberTagged() {
|
||||||
return ofNullable(membership).map(HsOfficeMembershipEntity::getMemberNumber).orElse(null);
|
return ofNullable(membership).map(HsOfficeMembershipEntity::toShortString).orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toShortString() {
|
public String toShortString() {
|
||||||
return "M-%s%+d".formatted(getMemberNumber(), shareCount);
|
return "%s%+d".formatted(getMemberNumberTagged(), shareCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ import net.hostsharing.hsadminng.errors.DisplayName;
|
|||||||
import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactEntity;
|
import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactEntity;
|
||||||
import net.hostsharing.hsadminng.hs.office.migration.HasUuid;
|
import net.hostsharing.hsadminng.hs.office.migration.HasUuid;
|
||||||
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonEntity;
|
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonEntity;
|
||||||
|
import net.hostsharing.hsadminng.hs.office.relationship.HsOfficeRelationshipEntity;
|
||||||
import net.hostsharing.hsadminng.stringify.Stringify;
|
import net.hostsharing.hsadminng.stringify.Stringify;
|
||||||
import net.hostsharing.hsadminng.stringify.Stringifyable;
|
import net.hostsharing.hsadminng.stringify.Stringifyable;
|
||||||
import org.hibernate.annotations.NotFound;
|
import org.hibernate.annotations.NotFound;
|
||||||
@ -39,10 +40,16 @@ public class HsOfficePartnerEntity implements Stringifyable, HasUuid {
|
|||||||
@Column(name = "partnernumber", columnDefinition = "numeric(5) not null")
|
@Column(name = "partnernumber", columnDefinition = "numeric(5) not null")
|
||||||
private Integer partnerNumber;
|
private Integer partnerNumber;
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "partnerroleuuid", nullable = false)
|
||||||
|
private HsOfficeRelationshipEntity partnerRole;
|
||||||
|
|
||||||
|
// TODO: remove, is replaced by partnerRole
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "personuuid", nullable = false)
|
@JoinColumn(name = "personuuid", nullable = false)
|
||||||
private HsOfficePersonEntity person;
|
private HsOfficePersonEntity person;
|
||||||
|
|
||||||
|
// TODO: remove, is replaced by partnerRole
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "contactuuid", nullable = false)
|
@JoinColumn(name = "contactuuid", nullable = false)
|
||||||
private HsOfficeContactEntity contact;
|
private HsOfficeContactEntity contact;
|
||||||
|
@ -2,6 +2,7 @@ package net.hostsharing.hsadminng.hs.office.relationship;
|
|||||||
|
|
||||||
public enum HsOfficeRelationshipType {
|
public enum HsOfficeRelationshipType {
|
||||||
UNKNOWN,
|
UNKNOWN,
|
||||||
|
PARTNER,
|
||||||
EX_PARTNER,
|
EX_PARTNER,
|
||||||
REPRESENTATIVE,
|
REPRESENTATIVE,
|
||||||
VIP_CONTACT,
|
VIP_CONTACT,
|
||||||
|
@ -61,7 +61,7 @@ do language plpgsql $$
|
|||||||
call createHsOfficeContactTestData('first contact');
|
call createHsOfficeContactTestData('first contact');
|
||||||
call createHsOfficeContactTestData('second contact');
|
call createHsOfficeContactTestData('second contact');
|
||||||
call createHsOfficeContactTestData('third contact');
|
call createHsOfficeContactTestData('third contact');
|
||||||
call createHsOfficeContactTestData('forth contact');
|
call createHsOfficeContactTestData('fourth contact');
|
||||||
call createHsOfficeContactTestData('fifth contact');
|
call createHsOfficeContactTestData('fifth contact');
|
||||||
call createHsOfficeContactTestData('sixth contact');
|
call createHsOfficeContactTestData('sixth contact');
|
||||||
call createHsOfficeContactTestData('seventh contact');
|
call createHsOfficeContactTestData('seventh contact');
|
||||||
|
@ -46,7 +46,7 @@ create or replace procedure createTestPersonTestData(
|
|||||||
begin
|
begin
|
||||||
for t in startCount..endCount
|
for t in startCount..endCount
|
||||||
loop
|
loop
|
||||||
call createHsOfficePersonTestData('LEGAL', intToVarChar(t, 4));
|
call createHsOfficePersonTestData('LP', intToVarChar(t, 4));
|
||||||
commit;
|
commit;
|
||||||
end loop;
|
end loop;
|
||||||
end; $$;
|
end; $$;
|
||||||
@ -59,11 +59,15 @@ end; $$;
|
|||||||
|
|
||||||
do language plpgsql $$
|
do language plpgsql $$
|
||||||
begin
|
begin
|
||||||
|
call createHsOfficePersonTestData('LP', 'Hostsharing eG');
|
||||||
call createHsOfficePersonTestData('LP', 'First GmbH');
|
call createHsOfficePersonTestData('LP', 'First GmbH');
|
||||||
|
call createHsOfficePersonTestData('NP', null, 'Firby', 'Susan');
|
||||||
call createHsOfficePersonTestData('NP', null, 'Smith', 'Peter');
|
call createHsOfficePersonTestData('NP', null, 'Smith', 'Peter');
|
||||||
|
call createHsOfficePersonTestData('NP', null, 'Tucker', 'Jack');
|
||||||
|
call createHsOfficePersonTestData('NP', null, 'Fouler', 'Ellie');
|
||||||
call createHsOfficePersonTestData('LP', 'Second e.K.', 'Sandra', 'Miller');
|
call createHsOfficePersonTestData('LP', 'Second e.K.', 'Sandra', 'Miller');
|
||||||
call createHsOfficePersonTestData('IF', 'Third OHG');
|
call createHsOfficePersonTestData('IF', 'Third OHG');
|
||||||
call createHsOfficePersonTestData('IF', 'Fourth e.G.');
|
call createHsOfficePersonTestData('IF', 'Fourth eG');
|
||||||
call createHsOfficePersonTestData('UF', 'Erben Bessler', 'Mel', 'Bessler');
|
call createHsOfficePersonTestData('UF', 'Erben Bessler', 'Mel', 'Bessler');
|
||||||
call createHsOfficePersonTestData('NP', null, 'Bessler', 'Anita');
|
call createHsOfficePersonTestData('NP', null, 'Bessler', 'Anita');
|
||||||
call createHsOfficePersonTestData('NP', null, 'Winkler', 'Paul');
|
call createHsOfficePersonTestData('NP', null, 'Winkler', 'Paul');
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
CREATE TYPE HsOfficeRelationshipType AS ENUM (
|
CREATE TYPE HsOfficeRelationshipType AS ENUM (
|
||||||
'UNKNOWN',
|
'UNKNOWN',
|
||||||
|
'PARTNER',
|
||||||
'EX_PARTNER',
|
'EX_PARTNER',
|
||||||
'REPRESENTATIVE',
|
'REPRESENTATIVE',
|
||||||
'VIP_CONTACT',
|
'VIP_CONTACT',
|
||||||
|
@ -9,9 +9,9 @@
|
|||||||
Creates a single relationship test record.
|
Creates a single relationship test record.
|
||||||
*/
|
*/
|
||||||
create or replace procedure createHsOfficeRelationshipTestData(
|
create or replace procedure createHsOfficeRelationshipTestData(
|
||||||
anchorPersonTradeName varchar,
|
holderPersonName varchar,
|
||||||
holderPersonFamilyName varchar,
|
|
||||||
relationshipType HsOfficeRelationshipType,
|
relationshipType HsOfficeRelationshipType,
|
||||||
|
anchorPersonTradeName varchar,
|
||||||
contactLabel varchar)
|
contactLabel varchar)
|
||||||
language plpgsql as $$
|
language plpgsql as $$
|
||||||
declare
|
declare
|
||||||
@ -22,14 +22,27 @@ declare
|
|||||||
contact hs_office_contact;
|
contact hs_office_contact;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
idName := cleanIdentifier( anchorPersonTradeName || '-' || holderPersonFamilyName);
|
idName := cleanIdentifier( anchorPersonTradeName || '-' || holderPersonName);
|
||||||
currentTask := 'creating relationship test-data ' || idName;
|
currentTask := 'creating relationship test-data ' || idName;
|
||||||
call defineContext(currentTask, null, 'superuser-alex@hostsharing.net', 'global#global.admin');
|
call defineContext(currentTask, null, 'superuser-alex@hostsharing.net', 'global#global.admin');
|
||||||
execute format('set local hsadminng.currentTask to %L', currentTask);
|
execute format('set local hsadminng.currentTask to %L', currentTask);
|
||||||
|
|
||||||
select p.* from hs_office_person p where p.tradeName = anchorPersonTradeName into anchorPerson;
|
select p.* from hs_office_person p where p.tradeName = anchorPersonTradeName into anchorPerson;
|
||||||
select p.* from hs_office_person p where p.familyName = holderPersonFamilyName into holderPerson;
|
if anchorPerson is null then
|
||||||
|
raise exception 'anchorPerson "%" not found', anchorPersonTradeName;
|
||||||
|
end if;
|
||||||
|
|
||||||
|
select p.* from hs_office_person p
|
||||||
|
where p.tradeName = holderPersonName or p.familyName = holderPersonName
|
||||||
|
into holderPerson;
|
||||||
|
if holderPerson is null then
|
||||||
|
raise exception 'holderPerson "%" not found', holderPersonName;
|
||||||
|
end if;
|
||||||
|
|
||||||
select c.* from hs_office_contact c where c.label = contactLabel into contact;
|
select c.* from hs_office_contact c where c.label = contactLabel into contact;
|
||||||
|
if contact is null then
|
||||||
|
raise exception 'contact "%" not found', contactLabel;
|
||||||
|
end if;
|
||||||
|
|
||||||
raise notice 'creating test relationship: %', idName;
|
raise notice 'creating test relationship: %', idName;
|
||||||
raise notice '- using anchor person (%): %', anchorPerson.uuid, anchorPerson;
|
raise notice '- using anchor person (%): %', anchorPerson.uuid, anchorPerson;
|
||||||
@ -71,11 +84,20 @@ end; $$;
|
|||||||
|
|
||||||
do language plpgsql $$
|
do language plpgsql $$
|
||||||
begin
|
begin
|
||||||
call createHsOfficeRelationshipTestData('First GmbH', 'Smith', 'REPRESENTATIVE', 'first contact');
|
call createHsOfficeRelationshipTestData('First GmbH', 'PARTNER', 'Hostsharing eG', 'first contact');
|
||||||
|
call createHsOfficeRelationshipTestData('Firby', 'REPRESENTATIVE', 'First GmbH', 'first contact');
|
||||||
|
|
||||||
call createHsOfficeRelationshipTestData('Second e.K.', 'Smith', 'REPRESENTATIVE', 'second contact');
|
call createHsOfficeRelationshipTestData('Second e.K.', 'PARTNER', 'Hostsharing eG', 'second contact');
|
||||||
|
call createHsOfficeRelationshipTestData('Smith', 'REPRESENTATIVE', 'Second e.K.', 'second contact');
|
||||||
|
|
||||||
|
call createHsOfficeRelationshipTestData('Third OHG', 'PARTNER', 'Hostsharing eG', 'third contact');
|
||||||
|
call createHsOfficeRelationshipTestData('Tucker', 'REPRESENTATIVE', 'Third OHG', 'third contact');
|
||||||
|
|
||||||
|
call createHsOfficeRelationshipTestData('Fourth eG', 'PARTNER', 'Hostsharing eG', 'fourth contact');
|
||||||
|
call createHsOfficeRelationshipTestData('Fouler', 'REPRESENTATIVE', 'Third OHG', 'third contact');
|
||||||
|
|
||||||
|
call createHsOfficeRelationshipTestData('Smith', 'PARTNER', 'Hostsharing eG', 'sixth contact');
|
||||||
|
|
||||||
call createHsOfficeRelationshipTestData('Third OHG', 'Smith', 'REPRESENTATIVE', 'third contact');
|
|
||||||
end;
|
end;
|
||||||
$$;
|
$$;
|
||||||
--//
|
--//
|
||||||
|
@ -33,7 +33,7 @@ create table hs_office_partner
|
|||||||
(
|
(
|
||||||
uuid uuid unique references RbacObject (uuid) initially deferred,
|
uuid uuid unique references RbacObject (uuid) initially deferred,
|
||||||
partnerNumber numeric(5),
|
partnerNumber numeric(5),
|
||||||
-- partnerRoleUuid uuid not null references hs_office_relationship(uuid),
|
partnerRoleUuid uuid not null references hs_office_relationship(uuid),
|
||||||
personUuid uuid not null references hs_office_person(uuid), -- TODO: remove, replaced by partnerRoleUuid
|
personUuid uuid not null references hs_office_person(uuid), -- TODO: remove, replaced by partnerRoleUuid
|
||||||
contactUuid uuid not null references hs_office_contact(uuid), -- TODO: remove, replaced by partnerRoleUuid
|
contactUuid uuid not null references hs_office_contact(uuid), -- TODO: remove, replaced by partnerRoleUuid
|
||||||
detailsUuid uuid not null references hs_office_partner_details(uuid) on delete cascade
|
detailsUuid uuid not null references hs_office_partner_details(uuid) on delete cascade
|
||||||
|
@ -179,6 +179,7 @@ call generateRbacIdentityView('hs_office_partner', $idName$
|
|||||||
call generateRbacRestrictedView('hs_office_partner',
|
call generateRbacRestrictedView('hs_office_partner',
|
||||||
'(select idName from hs_office_person_iv p where p.uuid = target.personUuid)',
|
'(select idName from hs_office_person_iv p where p.uuid = target.personUuid)',
|
||||||
$updates$
|
$updates$
|
||||||
|
partherRoleUuid = new.partnerRoleUuid,
|
||||||
personUuid = new.personUuid,
|
personUuid = new.personUuid,
|
||||||
contactUuid = new.contactUuid
|
contactUuid = new.contactUuid
|
||||||
$updates$);
|
$updates$);
|
||||||
|
@ -9,30 +9,49 @@
|
|||||||
Creates a single partner test record.
|
Creates a single partner test record.
|
||||||
*/
|
*/
|
||||||
create or replace procedure createHsOfficePartnerTestData(
|
create or replace procedure createHsOfficePartnerTestData(
|
||||||
|
mandantTradeName varchar,
|
||||||
partnerNumber numeric(5),
|
partnerNumber numeric(5),
|
||||||
personTradeOrFamilyName varchar,
|
partnerPersonName varchar,
|
||||||
contactLabel varchar )
|
contactLabel varchar )
|
||||||
language plpgsql as $$
|
language plpgsql as $$
|
||||||
declare
|
declare
|
||||||
currentTask varchar;
|
currentTask varchar;
|
||||||
idName varchar;
|
idName varchar;
|
||||||
|
mandantPerson hs_office_person;
|
||||||
|
partnerRole hs_office_relationship;
|
||||||
relatedPerson hs_office_person;
|
relatedPerson hs_office_person;
|
||||||
relatedContact hs_office_contact;
|
relatedContact hs_office_contact;
|
||||||
relatedDetailsUuid uuid;
|
relatedDetailsUuid uuid;
|
||||||
begin
|
begin
|
||||||
idName := cleanIdentifier( personTradeOrFamilyName|| '-' || contactLabel);
|
idName := cleanIdentifier( partnerPersonName|| '-' || contactLabel);
|
||||||
currentTask := 'creating partner test-data ' || idName;
|
currentTask := 'creating partner test-data ' || idName;
|
||||||
call defineContext(currentTask, null, 'superuser-alex@hostsharing.net', 'global#global.admin');
|
call defineContext(currentTask, null, 'superuser-alex@hostsharing.net', 'global#global.admin');
|
||||||
execute format('set local hsadminng.currentTask to %L', currentTask);
|
execute format('set local hsadminng.currentTask to %L', currentTask);
|
||||||
|
|
||||||
select p.* from hs_office_person p
|
select p.* from hs_office_person p
|
||||||
where p.tradeName = personTradeOrFamilyName or p.familyName = personTradeOrFamilyName
|
where p.tradeName = mandantTradeName
|
||||||
|
into mandantPerson;
|
||||||
|
if mandantPerson is null then
|
||||||
|
raise exception 'mandant "%" not found', mandantTradeName;
|
||||||
|
end if;
|
||||||
|
|
||||||
|
select p.* from hs_office_person p
|
||||||
|
where p.tradeName = partnerPersonName or p.familyName = partnerPersonName
|
||||||
into relatedPerson;
|
into relatedPerson;
|
||||||
select c.* from hs_office_contact c
|
select c.* from hs_office_contact c
|
||||||
where c.label = contactLabel
|
where c.label = contactLabel
|
||||||
into relatedContact;
|
into relatedContact;
|
||||||
|
|
||||||
|
select r.* from hs_office_relationship r
|
||||||
|
where r.reltype = 'PARTNER'
|
||||||
|
and r.relanchoruuid = mandantPerson.uuid and r.relholderuuid = relatedPerson.uuid
|
||||||
|
into partnerRole;
|
||||||
|
if partnerRole is null then
|
||||||
|
raise exception 'partnerRole "%"-"%" not found', mandantPerson.tradename, partnerPersonName;
|
||||||
|
end if;
|
||||||
|
|
||||||
raise notice 'creating test partner: %', idName;
|
raise notice 'creating test partner: %', idName;
|
||||||
|
raise notice '- using partnerRole (%): %', partnerRole.uuid, partnerRole;
|
||||||
raise notice '- using person (%): %', relatedPerson.uuid, relatedPerson;
|
raise notice '- using person (%): %', relatedPerson.uuid, relatedPerson;
|
||||||
raise notice '- using contact (%): %', relatedContact.uuid, relatedContact;
|
raise notice '- using contact (%): %', relatedContact.uuid, relatedContact;
|
||||||
|
|
||||||
@ -49,8 +68,8 @@ begin
|
|||||||
end if;
|
end if;
|
||||||
|
|
||||||
insert
|
insert
|
||||||
into hs_office_partner (uuid, partnerNumber, personuuid, contactuuid, detailsUuid)
|
into hs_office_partner (uuid, partnerNumber, partnerRoleUuid, personuuid, contactuuid, detailsUuid)
|
||||||
values (uuid_generate_v4(), partnerNumber, relatedPerson.uuid, relatedContact.uuid, relatedDetailsUuid);
|
values (uuid_generate_v4(), partnerNumber, partnerRole.uuid, relatedPerson.uuid, relatedContact.uuid, relatedDetailsUuid);
|
||||||
end; $$;
|
end; $$;
|
||||||
--//
|
--//
|
||||||
|
|
||||||
@ -62,11 +81,11 @@ end; $$;
|
|||||||
|
|
||||||
do language plpgsql $$
|
do language plpgsql $$
|
||||||
begin
|
begin
|
||||||
call createHsOfficePartnerTestData(10001, 'First GmbH', 'first contact');
|
call createHsOfficePartnerTestData('Hostsharing eG', 10001, 'First GmbH', 'first contact');
|
||||||
call createHsOfficePartnerTestData(10002, 'Second e.K.', 'second contact');
|
call createHsOfficePartnerTestData('Hostsharing eG', 10002, 'Second e.K.', 'second contact');
|
||||||
call createHsOfficePartnerTestData(10003, 'Third OHG', 'third contact');
|
call createHsOfficePartnerTestData('Hostsharing eG', 10003, 'Third OHG', 'third contact');
|
||||||
call createHsOfficePartnerTestData(10004, 'Fourth e.G.', 'forth contact');
|
call createHsOfficePartnerTestData('Hostsharing eG', 10004, 'Fourth eG', 'fourth contact');
|
||||||
call createHsOfficePartnerTestData(10010, 'Smith', 'fifth contact');
|
call createHsOfficePartnerTestData('Hostsharing eG', 10010, 'Smith', 'fifth contact');
|
||||||
end;
|
end;
|
||||||
$$;
|
$$;
|
||||||
--//
|
--//
|
||||||
|
@ -41,7 +41,7 @@ do language plpgsql $$
|
|||||||
call createHsOfficeBankAccountTestData('Peter Smith', 'DE02500105170137075030', 'INGDDEFF');
|
call createHsOfficeBankAccountTestData('Peter Smith', 'DE02500105170137075030', 'INGDDEFF');
|
||||||
call createHsOfficeBankAccountTestData('Second e.K.', 'DE02100500000054540402', 'BELADEBE');
|
call createHsOfficeBankAccountTestData('Second e.K.', 'DE02100500000054540402', 'BELADEBE');
|
||||||
call createHsOfficeBankAccountTestData('Third OHG', 'DE02300209000106531065', 'CMCIDEDD');
|
call createHsOfficeBankAccountTestData('Third OHG', 'DE02300209000106531065', 'CMCIDEDD');
|
||||||
call createHsOfficeBankAccountTestData('Fourth e.G.', 'DE02200505501015871393', 'HASPDEHH');
|
call createHsOfficeBankAccountTestData('Fourth eG', 'DE02200505501015871393', 'HASPDEHH');
|
||||||
call createHsOfficeBankAccountTestData('Mel Bessler', 'DE02100100100006820101', 'PBNKDEFF');
|
call createHsOfficeBankAccountTestData('Mel Bessler', 'DE02100100100006820101', 'PBNKDEFF');
|
||||||
call createHsOfficeBankAccountTestData('Anita Bessler', 'DE02300606010002474689', 'DAAEDEDD');
|
call createHsOfficeBankAccountTestData('Anita Bessler', 'DE02300606010002474689', 'DAAEDEDD');
|
||||||
call createHsOfficeBankAccountTestData('Paul Winkler', 'DE02600501010002034304', 'SOLADEST600');
|
call createHsOfficeBankAccountTestData('Paul Winkler', 'DE02600501010002034304', 'SOLADEST600');
|
||||||
|
@ -75,7 +75,7 @@ class HsOfficeBankAccountControllerAcceptanceTest {
|
|||||||
"bic": "BYLADEM1001"
|
"bic": "BYLADEM1001"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"holder": "Fourth e.G.",
|
"holder": "Fourth eG",
|
||||||
"iban": "DE02200505501015871393",
|
"iban": "DE02200505501015871393",
|
||||||
"bic": "HASPDEHH"
|
"bic": "HASPDEHH"
|
||||||
},
|
},
|
||||||
|
@ -147,7 +147,7 @@ class HsOfficeBankAccountRepositoryIntegrationTest extends ContextBasedTest {
|
|||||||
result,
|
result,
|
||||||
"Anita Bessler",
|
"Anita Bessler",
|
||||||
"First GmbH",
|
"First GmbH",
|
||||||
"Fourth e.G.",
|
"Fourth eG",
|
||||||
"Mel Bessler",
|
"Mel Bessler",
|
||||||
"Paul Winkler",
|
"Paul Winkler",
|
||||||
"Peter Smith",
|
"Peter Smith",
|
||||||
|
@ -73,7 +73,7 @@ class HsOfficeContactControllerAcceptanceTest {
|
|||||||
{ "label": "first contact" },
|
{ "label": "first contact" },
|
||||||
{ "label": "second contact" },
|
{ "label": "second contact" },
|
||||||
{ "label": "third contact" },
|
{ "label": "third contact" },
|
||||||
{ "label": "forth contact" },
|
{ "label": "fourth contact" },
|
||||||
{ "label": "fifth contact" },
|
{ "label": "fifth contact" },
|
||||||
{ "label": "sixth contact" },
|
{ "label": "sixth contact" },
|
||||||
{ "label": "seventh contact" },
|
{ "label": "seventh contact" },
|
||||||
|
@ -22,7 +22,7 @@ class HsOfficeCoopSharesTransactionEntityUnitTest {
|
|||||||
void toStringContainsAlmostAllPropertiesAccount() {
|
void toStringContainsAlmostAllPropertiesAccount() {
|
||||||
final var result = givenCoopSharesTransaction.toString();
|
final var result = givenCoopSharesTransaction.toString();
|
||||||
|
|
||||||
assertThat(result).isEqualTo("CoopShareTransaction(1000101, 2020-01-01, SUBSCRIPTION, 4, some-ref)");
|
assertThat(result).isEqualTo("CoopShareTransaction(M-1000101, 2020-01-01, SUBSCRIPTION, 4, some-ref)");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -36,7 +36,7 @@ class HsOfficeCoopSharesTransactionEntityUnitTest {
|
|||||||
void toStringEmptyTransactionDoesNotThrowException() {
|
void toStringEmptyTransactionDoesNotThrowException() {
|
||||||
final var result = givenEmptyCoopSharesTransaction.toString();
|
final var result = givenEmptyCoopSharesTransaction.toString();
|
||||||
|
|
||||||
assertThat(result).isEqualTo("CoopShareTransaction(0)");
|
assertThat(result).isEqualTo("CoopShareTransaction(M-0)");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -419,7 +419,7 @@ class HsOfficeDebitorControllerAcceptanceTest {
|
|||||||
assertThat(partner.getPartner().getPerson().getTradeName()).isEqualTo(givenDebitor.getPartner()
|
assertThat(partner.getPartner().getPerson().getTradeName()).isEqualTo(givenDebitor.getPartner()
|
||||||
.getPerson()
|
.getPerson()
|
||||||
.getTradeName());
|
.getTradeName());
|
||||||
assertThat(partner.getBillingContact().getLabel()).isEqualTo("forth contact");
|
assertThat(partner.getBillingContact().getLabel()).isEqualTo("fourth contact");
|
||||||
assertThat(partner.getVatId()).isEqualTo("VAT222222");
|
assertThat(partner.getVatId()).isEqualTo("VAT222222");
|
||||||
assertThat(partner.getVatCountryCode()).isEqualTo("AA");
|
assertThat(partner.getVatCountryCode()).isEqualTo("AA");
|
||||||
assertThat(partner.isVatBusiness()).isEqualTo(true);
|
assertThat(partner.isVatBusiness()).isEqualTo(true);
|
||||||
@ -500,11 +500,11 @@ class HsOfficeDebitorControllerAcceptanceTest {
|
|||||||
void contactAdminUser_canNotDeleteRelatedDebitor() {
|
void contactAdminUser_canNotDeleteRelatedDebitor() {
|
||||||
context.define("superuser-alex@hostsharing.net");
|
context.define("superuser-alex@hostsharing.net");
|
||||||
final var givenDebitor = givenSomeTemporaryDebitor();
|
final var givenDebitor = givenSomeTemporaryDebitor();
|
||||||
assertThat(givenDebitor.getBillingContact().getLabel()).isEqualTo("forth contact");
|
assertThat(givenDebitor.getBillingContact().getLabel()).isEqualTo("fourth contact");
|
||||||
|
|
||||||
RestAssured // @formatter:off
|
RestAssured // @formatter:off
|
||||||
.given()
|
.given()
|
||||||
.header("current-user", "contact-admin@forthcontact.example.com")
|
.header("current-user", "contact-admin@fourthcontact.example.com")
|
||||||
.port(port)
|
.port(port)
|
||||||
.when()
|
.when()
|
||||||
.delete("http://localhost/api/hs/office/debitors/" + givenDebitor.getUuid())
|
.delete("http://localhost/api/hs/office/debitors/" + givenDebitor.getUuid())
|
||||||
@ -520,7 +520,7 @@ class HsOfficeDebitorControllerAcceptanceTest {
|
|||||||
void normalUser_canNotDeleteUnrelatedDebitor() {
|
void normalUser_canNotDeleteUnrelatedDebitor() {
|
||||||
context.define("superuser-alex@hostsharing.net");
|
context.define("superuser-alex@hostsharing.net");
|
||||||
final var givenDebitor = givenSomeTemporaryDebitor();
|
final var givenDebitor = givenSomeTemporaryDebitor();
|
||||||
assertThat(givenDebitor.getBillingContact().getLabel()).isEqualTo("forth contact");
|
assertThat(givenDebitor.getBillingContact().getLabel()).isEqualTo("fourth contact");
|
||||||
|
|
||||||
RestAssured // @formatter:off
|
RestAssured // @formatter:off
|
||||||
.given()
|
.given()
|
||||||
@ -540,7 +540,7 @@ class HsOfficeDebitorControllerAcceptanceTest {
|
|||||||
return jpaAttempt.transacted(() -> {
|
return jpaAttempt.transacted(() -> {
|
||||||
context.define("superuser-alex@hostsharing.net");
|
context.define("superuser-alex@hostsharing.net");
|
||||||
final var givenPartner = partnerRepo.findPartnerByOptionalNameLike("Fourth").get(0);
|
final var givenPartner = partnerRepo.findPartnerByOptionalNameLike("Fourth").get(0);
|
||||||
final var givenContact = contactRepo.findContactByOptionalLabelLike("forth contact").get(0);
|
final var givenContact = contactRepo.findContactByOptionalLabelLike("fourth contact").get(0);
|
||||||
final var newDebitor = HsOfficeDebitorEntity.builder()
|
final var newDebitor = HsOfficeDebitorEntity.builder()
|
||||||
.debitorNumberSuffix(++nextDebitorSuffix)
|
.debitorNumberSuffix(++nextDebitorSuffix)
|
||||||
.billable(true)
|
.billable(true)
|
||||||
|
@ -128,16 +128,16 @@ class HsOfficeDebitorRepositoryIntegrationTest extends ContextBasedTest {
|
|||||||
final var initialGrantNames = grantDisplaysOf(rawGrantRepo.findAll()).stream()
|
final var initialGrantNames = grantDisplaysOf(rawGrantRepo.findAll()).stream()
|
||||||
// some search+replace to make the output fit into the screen width
|
// some search+replace to make the output fit into the screen width
|
||||||
.map(s -> s.replace("superuser-alex@hostsharing.net", "superuser-alex"))
|
.map(s -> s.replace("superuser-alex@hostsharing.net", "superuser-alex"))
|
||||||
.map(s -> s.replace("22Fourthe.G.-forthcontact", "FeG"))
|
.map(s -> s.replace("22Fourthe.G.-fourthcontact", "FeG"))
|
||||||
.map(s -> s.replace("Fourthe.G.-forthcontact", "FeG"))
|
.map(s -> s.replace("Fourthe.G.-fourthcontact", "FeG"))
|
||||||
.map(s -> s.replace("forthcontact", "4th"))
|
.map(s -> s.replace("fourthcontact", "4th"))
|
||||||
.map(s -> s.replace("hs_office_", ""))
|
.map(s -> s.replace("hs_office_", ""))
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
// when
|
// when
|
||||||
attempt(em, () -> {
|
attempt(em, () -> {
|
||||||
final var givenPartner = partnerRepo.findPartnerByOptionalNameLike("Fourth").get(0);
|
final var givenPartner = partnerRepo.findPartnerByOptionalNameLike("Fourth").get(0);
|
||||||
final var givenContact = contactRepo.findContactByOptionalLabelLike("forth contact").get(0);
|
final var givenContact = contactRepo.findContactByOptionalLabelLike("fourth contact").get(0);
|
||||||
final var newDebitor = HsOfficeDebitorEntity.builder()
|
final var newDebitor = HsOfficeDebitorEntity.builder()
|
||||||
.debitorNumberSuffix((byte)22)
|
.debitorNumberSuffix((byte)22)
|
||||||
.partner(givenPartner)
|
.partner(givenPartner)
|
||||||
@ -151,16 +151,16 @@ class HsOfficeDebitorRepositoryIntegrationTest extends ContextBasedTest {
|
|||||||
// then
|
// then
|
||||||
assertThat(roleNamesOf(rawRoleRepo.findAll())).containsExactlyInAnyOrder(Array.from(
|
assertThat(roleNamesOf(rawRoleRepo.findAll())).containsExactlyInAnyOrder(Array.from(
|
||||||
initialRoleNames,
|
initialRoleNames,
|
||||||
"hs_office_debitor#1000422:Fourthe.G.-forthcontact.owner",
|
"hs_office_debitor#1000422:Fourthe.G.-fourthcontact.owner",
|
||||||
"hs_office_debitor#1000422:Fourthe.G.-forthcontact.admin",
|
"hs_office_debitor#1000422:Fourthe.G.-fourthcontact.admin",
|
||||||
"hs_office_debitor#1000422:Fourthe.G.-forthcontact.agent",
|
"hs_office_debitor#1000422:Fourthe.G.-fourthcontact.agent",
|
||||||
"hs_office_debitor#1000422:Fourthe.G.-forthcontact.tenant",
|
"hs_office_debitor#1000422:Fourthe.G.-fourthcontact.tenant",
|
||||||
"hs_office_debitor#1000422:Fourthe.G.-forthcontact.guest"));
|
"hs_office_debitor#1000422:Fourthe.G.-fourthcontact.guest"));
|
||||||
assertThat(grantDisplaysOf(rawGrantRepo.findAll()))
|
assertThat(grantDisplaysOf(rawGrantRepo.findAll()))
|
||||||
.map(s -> s.replace("superuser-alex@hostsharing.net", "superuser-alex"))
|
.map(s -> s.replace("superuser-alex@hostsharing.net", "superuser-alex"))
|
||||||
.map(s -> s.replace("22Fourthe.G.-forthcontact", "FeG"))
|
.map(s -> s.replace("22Fourthe.G.-fourthcontact", "FeG"))
|
||||||
.map(s -> s.replace("Fourthe.G.-forthcontact", "FeG"))
|
.map(s -> s.replace("Fourthe.G.-fourthcontact", "FeG"))
|
||||||
.map(s -> s.replace("forthcontact", "4th"))
|
.map(s -> s.replace("fourthcontact", "4th"))
|
||||||
.map(s -> s.replace("hs_office_", ""))
|
.map(s -> s.replace("hs_office_", ""))
|
||||||
.containsExactlyInAnyOrder(Array.fromFormatted(
|
.containsExactlyInAnyOrder(Array.fromFormatted(
|
||||||
initialGrantNames,
|
initialGrantNames,
|
||||||
@ -290,7 +290,7 @@ class HsOfficeDebitorRepositoryIntegrationTest extends ContextBasedTest {
|
|||||||
final var givenDebitor = givenSomeTemporaryDebitor("Fourth", "fifth contact", "Fourth", "fif");
|
final var givenDebitor = givenSomeTemporaryDebitor("Fourth", "fifth contact", "Fourth", "fif");
|
||||||
assertThatDebitorIsVisibleForUserWithRole(
|
assertThatDebitorIsVisibleForUserWithRole(
|
||||||
givenDebitor,
|
givenDebitor,
|
||||||
"hs_office_partner#10004:Fourthe.G.-forthcontact.admin");
|
"hs_office_partner#10004:Fourthe.G.-fourthcontact.admin");
|
||||||
assertThatDebitorActuallyInDatabase(givenDebitor);
|
assertThatDebitorActuallyInDatabase(givenDebitor);
|
||||||
final var givenNewPartner = partnerRepo.findPartnerByOptionalNameLike("First").get(0);
|
final var givenNewPartner = partnerRepo.findPartnerByOptionalNameLike("First").get(0);
|
||||||
final var givenNewContact = contactRepo.findContactByOptionalLabelLike("sixth contact").get(0);
|
final var givenNewContact = contactRepo.findContactByOptionalLabelLike("sixth contact").get(0);
|
||||||
@ -320,7 +320,7 @@ class HsOfficeDebitorRepositoryIntegrationTest extends ContextBasedTest {
|
|||||||
// ... partner role was reassigned:
|
// ... partner role was reassigned:
|
||||||
assertThatDebitorIsNotVisibleForUserWithRole(
|
assertThatDebitorIsNotVisibleForUserWithRole(
|
||||||
result.returnedValue(),
|
result.returnedValue(),
|
||||||
"hs_office_partner#10004:Fourthe.G.-forthcontact.agent");
|
"hs_office_partner#10004:Fourthe.G.-fourthcontact.agent");
|
||||||
assertThatDebitorIsVisibleForUserWithRole(
|
assertThatDebitorIsVisibleForUserWithRole(
|
||||||
result.returnedValue(),
|
result.returnedValue(),
|
||||||
"hs_office_partner#10001:FirstGmbH-firstcontact.agent");
|
"hs_office_partner#10001:FirstGmbH-firstcontact.agent");
|
||||||
@ -349,7 +349,7 @@ class HsOfficeDebitorRepositoryIntegrationTest extends ContextBasedTest {
|
|||||||
final var givenDebitor = givenSomeTemporaryDebitor("Fourth", "fifth contact", null, "fig");
|
final var givenDebitor = givenSomeTemporaryDebitor("Fourth", "fifth contact", null, "fig");
|
||||||
assertThatDebitorIsVisibleForUserWithRole(
|
assertThatDebitorIsVisibleForUserWithRole(
|
||||||
givenDebitor,
|
givenDebitor,
|
||||||
"hs_office_partner#10004:Fourthe.G.-forthcontact.admin");
|
"hs_office_partner#10004:Fourthe.G.-fourthcontact.admin");
|
||||||
assertThatDebitorActuallyInDatabase(givenDebitor);
|
assertThatDebitorActuallyInDatabase(givenDebitor);
|
||||||
final var givenNewBankAccount = bankAccountRepo.findByOptionalHolderLike("first").get(0);
|
final var givenNewBankAccount = bankAccountRepo.findByOptionalHolderLike("first").get(0);
|
||||||
|
|
||||||
@ -379,7 +379,7 @@ class HsOfficeDebitorRepositoryIntegrationTest extends ContextBasedTest {
|
|||||||
final var givenDebitor = givenSomeTemporaryDebitor("Fourth", "fifth contact", "Fourth", "fih");
|
final var givenDebitor = givenSomeTemporaryDebitor("Fourth", "fifth contact", "Fourth", "fih");
|
||||||
assertThatDebitorIsVisibleForUserWithRole(
|
assertThatDebitorIsVisibleForUserWithRole(
|
||||||
givenDebitor,
|
givenDebitor,
|
||||||
"hs_office_partner#10004:Fourthe.G.-forthcontact.admin");
|
"hs_office_partner#10004:Fourthe.G.-fourthcontact.admin");
|
||||||
assertThatDebitorActuallyInDatabase(givenDebitor);
|
assertThatDebitorActuallyInDatabase(givenDebitor);
|
||||||
|
|
||||||
// when
|
// when
|
||||||
@ -408,12 +408,12 @@ class HsOfficeDebitorRepositoryIntegrationTest extends ContextBasedTest {
|
|||||||
final var givenDebitor = givenSomeTemporaryDebitor("Fourth", "eighth", "Fourth", "eig");
|
final var givenDebitor = givenSomeTemporaryDebitor("Fourth", "eighth", "Fourth", "eig");
|
||||||
assertThatDebitorIsVisibleForUserWithRole(
|
assertThatDebitorIsVisibleForUserWithRole(
|
||||||
givenDebitor,
|
givenDebitor,
|
||||||
"hs_office_partner#10004:Fourthe.G.-forthcontact.admin");
|
"hs_office_partner#10004:Fourthe.G.-fourthcontact.admin");
|
||||||
assertThatDebitorActuallyInDatabase(givenDebitor);
|
assertThatDebitorActuallyInDatabase(givenDebitor);
|
||||||
|
|
||||||
// when
|
// when
|
||||||
final var result = jpaAttempt.transacted(() -> {
|
final var result = jpaAttempt.transacted(() -> {
|
||||||
context("superuser-alex@hostsharing.net", "hs_office_partner#10004:Fourthe.G.-forthcontact.admin");
|
context("superuser-alex@hostsharing.net", "hs_office_partner#10004:Fourthe.G.-fourthcontact.admin");
|
||||||
givenDebitor.setVatId("NEW-VAT-ID");
|
givenDebitor.setVatId("NEW-VAT-ID");
|
||||||
return debitorRepo.save(givenDebitor);
|
return debitorRepo.save(givenDebitor);
|
||||||
});
|
});
|
||||||
|
@ -225,6 +225,7 @@ public class ImportOfficeData extends ContextBasedTest {
|
|||||||
""");
|
""");
|
||||||
assertThat(toFormattedString(persons)).isEqualToIgnoringWhitespace("""
|
assertThat(toFormattedString(persons)).isEqualToIgnoringWhitespace("""
|
||||||
{
|
{
|
||||||
|
1=person(personType='LP', tradeName='Hostsharing eG'),
|
||||||
1101=person(personType='NP', tradeName='', familyName='Mellies', givenName='Michael'),
|
1101=person(personType='NP', tradeName='', familyName='Mellies', givenName='Michael'),
|
||||||
1200=person(personType='LP', tradeName='JM e.K.', familyName='', givenName=''),
|
1200=person(personType='LP', tradeName='JM e.K.', familyName='', givenName=''),
|
||||||
1201=person(personType='LP', tradeName='JM GmbH', familyName='Meyer-Billing', givenName='Jenny'),
|
1201=person(personType='LP', tradeName='JM GmbH', familyName='Meyer-Billing', givenName='Jenny'),
|
||||||
@ -249,14 +250,17 @@ public class ImportOfficeData extends ContextBasedTest {
|
|||||||
""");
|
""");
|
||||||
assertThat(toFormattedString(relationships)).isEqualToIgnoringWhitespace("""
|
assertThat(toFormattedString(relationships)).isEqualToIgnoringWhitespace("""
|
||||||
{
|
{
|
||||||
2000000=rel(relAnchor='NP Mellies, Michael', relType='OPERATIONS', relHolder='NP Mellies, Michael', contact='Herr Michael Mellies '),
|
2000000=rel(relAnchor='LP Hostsharing eG', relType='PARTNER', relHolder='NP Mellies, Michael', contact='Herr Michael Mellies '),
|
||||||
2000001=rel(relAnchor='LP JM GmbH', relType='EX_PARTNER', relHolder='LP JM e.K.', contact='JM e.K.'),
|
2000001=rel(relAnchor='LP Hostsharing eG', relType='PARTNER', relHolder='LP JM GmbH', contact='Herr Philip Meyer-Contract , JM GmbH'),
|
||||||
2000002=rel(relAnchor='LP JM GmbH', relType='OPERATIONS', relHolder='LP JM GmbH', contact='Herr Andrew Meyer-Operation , JM GmbH'),
|
2000002=rel(relAnchor='LP Hostsharing eG', relType='PARTNER', relHolder='?? Test PS', contact='Petra Schmidt , Test PS'),
|
||||||
2000003=rel(relAnchor='LP JM GmbH', relType='VIP_CONTACT', relHolder='LP JM GmbH', contact='Herr Andrew Meyer-Operation , JM GmbH'),
|
2000003=rel(relAnchor='NP Mellies, Michael', relType='OPERATIONS', relHolder='NP Mellies, Michael', contact='Herr Michael Mellies '),
|
||||||
2000004=rel(relAnchor='LP JM GmbH', relType='REPRESENTATIVE', relHolder='LP JM GmbH', contact='Herr Philip Meyer-Contract , JM GmbH'),
|
2000004=rel(relAnchor='LP JM GmbH', relType='EX_PARTNER', relHolder='LP JM e.K.', contact='JM e.K.'),
|
||||||
2000005=rel(relAnchor='?? Test PS', relType='OPERATIONS', relHolder='?? Test PS', contact='Petra Schmidt , Test PS'),
|
2000005=rel(relAnchor='LP JM GmbH', relType='OPERATIONS', relHolder='LP JM GmbH', contact='Herr Andrew Meyer-Operation , JM GmbH'),
|
||||||
2000006=rel(relAnchor='?? Test PS', relType='REPRESENTATIVE', relHolder='?? Test PS', contact='Petra Schmidt , Test PS'),
|
2000006=rel(relAnchor='LP JM GmbH', relType='VIP_CONTACT', relHolder='LP JM GmbH', contact='Herr Andrew Meyer-Operation , JM GmbH'),
|
||||||
2000007=rel(relAnchor='NP Mellies, Michael', relType='REPRESENTATIVE', relHolder='NP Mellies, Michael', contact='Herr Michael Mellies ')
|
2000007=rel(relAnchor='LP JM GmbH', relType='REPRESENTATIVE', relHolder='LP JM GmbH', contact='Herr Philip Meyer-Contract , JM GmbH'),
|
||||||
|
2000008=rel(relAnchor='?? Test PS', relType='OPERATIONS', relHolder='?? Test PS', contact='Petra Schmidt , Test PS'),
|
||||||
|
2000009=rel(relAnchor='?? Test PS', relType='REPRESENTATIVE', relHolder='?? Test PS', contact='Petra Schmidt , Test PS'),
|
||||||
|
2000010=rel(relAnchor='NP Mellies, Michael', relType='REPRESENTATIVE', relHolder='NP Mellies, Michael', contact='Herr Michael Mellies ')
|
||||||
}
|
}
|
||||||
""");
|
""");
|
||||||
}
|
}
|
||||||
@ -339,14 +343,14 @@ public class ImportOfficeData extends ContextBasedTest {
|
|||||||
|
|
||||||
assertThat(toFormattedString(coopAssets)).isEqualToIgnoringWhitespace("""
|
assertThat(toFormattedString(coopAssets)).isEqualToIgnoringWhitespace("""
|
||||||
{
|
{
|
||||||
30000=CoopAssetsTransaction(10017, 2000-12-06, DEPOSIT, 1280.00, for subscription A),
|
30000=CoopAssetsTransaction(1001700, 2000-12-06, DEPOSIT, 1280.00, for subscription A),
|
||||||
31000=CoopAssetsTransaction(10020, 2000-12-06, DEPOSIT, 128.00, for subscription B),
|
31000=CoopAssetsTransaction(1002000, 2000-12-06, DEPOSIT, 128.00, for subscription B),
|
||||||
32000=CoopAssetsTransaction(10017, 2005-01-10, DEPOSIT, 2560.00, for subscription C),
|
32000=CoopAssetsTransaction(1001700, 2005-01-10, DEPOSIT, 2560.00, for subscription C),
|
||||||
33001=CoopAssetsTransaction(10017, 2005-01-10, TRANSFER, -512.00, for transfer to 10),
|
33001=CoopAssetsTransaction(1001700, 2005-01-10, TRANSFER, -512.00, for transfer to 10),
|
||||||
33002=CoopAssetsTransaction(10020, 2005-01-10, ADOPTION, 512.00, for transfer from 7),
|
33002=CoopAssetsTransaction(1002000, 2005-01-10, ADOPTION, 512.00, for transfer from 7),
|
||||||
34001=CoopAssetsTransaction(10020, 2016-12-31, CLEARING, -8.00, for cancellation D),
|
34001=CoopAssetsTransaction(1002000, 2016-12-31, CLEARING, -8.00, for cancellation D),
|
||||||
34002=CoopAssetsTransaction(10020, 2016-12-31, DISBURSAL, -100.00, for cancellation D),
|
34002=CoopAssetsTransaction(1002000, 2016-12-31, DISBURSAL, -100.00, for cancellation D),
|
||||||
34003=CoopAssetsTransaction(10020, 2016-12-31, LOSS, -20.00, for cancellation D)
|
34003=CoopAssetsTransaction(1002000, 2016-12-31, LOSS, -20.00, for cancellation D)
|
||||||
}
|
}
|
||||||
""");
|
""");
|
||||||
}
|
}
|
||||||
@ -440,7 +444,6 @@ public class ImportOfficeData extends ContextBasedTest {
|
|||||||
private void deleteTestDataFromHsOfficeTables() {
|
private void deleteTestDataFromHsOfficeTables() {
|
||||||
jpaAttempt.transacted(() -> {
|
jpaAttempt.transacted(() -> {
|
||||||
context(rbacSuperuser);
|
context(rbacSuperuser);
|
||||||
em.createNativeQuery("delete from hs_office_relationship where true").executeUpdate();
|
|
||||||
em.createNativeQuery("delete from hs_office_coopassetstransaction where true").executeUpdate();
|
em.createNativeQuery("delete from hs_office_coopassetstransaction where true").executeUpdate();
|
||||||
em.createNativeQuery("delete from hs_office_coopassetstransaction_legacy_id where true").executeUpdate();
|
em.createNativeQuery("delete from hs_office_coopassetstransaction_legacy_id where true").executeUpdate();
|
||||||
em.createNativeQuery("delete from hs_office_coopsharestransaction where true").executeUpdate();
|
em.createNativeQuery("delete from hs_office_coopsharestransaction where true").executeUpdate();
|
||||||
@ -452,6 +455,7 @@ public class ImportOfficeData extends ContextBasedTest {
|
|||||||
em.createNativeQuery("delete from hs_office_bankaccount where true").executeUpdate();
|
em.createNativeQuery("delete from hs_office_bankaccount where true").executeUpdate();
|
||||||
em.createNativeQuery("delete from hs_office_partner where true").executeUpdate();
|
em.createNativeQuery("delete from hs_office_partner where true").executeUpdate();
|
||||||
em.createNativeQuery("delete from hs_office_partner_details where true").executeUpdate();
|
em.createNativeQuery("delete from hs_office_partner_details where true").executeUpdate();
|
||||||
|
em.createNativeQuery("delete from hs_office_relationship where true").executeUpdate();
|
||||||
em.createNativeQuery("delete from hs_office_contact where true").executeUpdate();
|
em.createNativeQuery("delete from hs_office_contact where true").executeUpdate();
|
||||||
em.createNativeQuery("delete from hs_office_person where true").executeUpdate();
|
em.createNativeQuery("delete from hs_office_person where true").executeUpdate();
|
||||||
}).assertSuccessful();
|
}).assertSuccessful();
|
||||||
@ -542,15 +546,30 @@ public class ImportOfficeData extends ContextBasedTest {
|
|||||||
|
|
||||||
final var columns = new Columns(header);
|
final var columns = new Columns(header);
|
||||||
|
|
||||||
|
final var mandant = HsOfficePersonEntity.builder()
|
||||||
|
.personType(HsOfficePersonType.LEGAL_PERSON)
|
||||||
|
.tradeName("Hostsharing eG")
|
||||||
|
.build();
|
||||||
|
persons.put(1, mandant);
|
||||||
|
|
||||||
records.stream()
|
records.stream()
|
||||||
.map(this::trimAll)
|
.map(this::trimAll)
|
||||||
.map(row -> new Record(columns, row))
|
.map(row -> new Record(columns, row))
|
||||||
.forEach(rec -> {
|
.forEach(rec -> {
|
||||||
final var person = HsOfficePersonEntity.builder().build();
|
final var person = HsOfficePersonEntity.builder().build();
|
||||||
|
|
||||||
|
final var partnerRelationship = HsOfficeRelationshipEntity.builder()
|
||||||
|
.relHolder(person)
|
||||||
|
.relType(HsOfficeRelationshipType.PARTNER)
|
||||||
|
.relAnchor(mandant)
|
||||||
|
.contact(null) // is set during contacts import depending on assigned roles
|
||||||
|
.build();
|
||||||
|
relationships.put(relationshipId++, partnerRelationship);
|
||||||
|
|
||||||
final var partner = HsOfficePartnerEntity.builder()
|
final var partner = HsOfficePartnerEntity.builder()
|
||||||
.partnerNumber(rec.getInteger("member_id"))
|
.partnerNumber(rec.getInteger("member_id"))
|
||||||
.details(HsOfficePartnerDetailsEntity.builder().build())
|
.details(HsOfficePartnerDetailsEntity.builder().build())
|
||||||
|
.partnerRole(partnerRelationship)
|
||||||
.contact(null) // is set during contacts import depending on assigned roles
|
.contact(null) // is set during contacts import depending on assigned roles
|
||||||
.person(person)
|
.person(person)
|
||||||
.build();
|
.build();
|
||||||
@ -709,7 +728,7 @@ public class ImportOfficeData extends ContextBasedTest {
|
|||||||
final var debitor = debitors.get(rec.getInteger("bp_id"));
|
final var debitor = debitors.get(rec.getInteger("bp_id"));
|
||||||
|
|
||||||
final var partnerPerson = partner.getPerson();
|
final var partnerPerson = partner.getPerson();
|
||||||
if (containsRole(rec)) {
|
if (containsPartnerRole(rec)) {
|
||||||
initPerson(partner.getPerson(), rec);
|
initPerson(partner.getPerson(), rec);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -723,9 +742,10 @@ public class ImportOfficeData extends ContextBasedTest {
|
|||||||
final var contact = HsOfficeContactEntity.builder().build();
|
final var contact = HsOfficeContactEntity.builder().build();
|
||||||
initContact(contact, rec);
|
initContact(contact, rec);
|
||||||
|
|
||||||
if (containsRole(rec, "partner")) {
|
if (containsPartnerRole(rec)) {
|
||||||
assertThat(partner.getContact()).isNull();
|
assertThat(partner.getContact()).isNull();
|
||||||
partner.setContact(contact);
|
partner.setContact(contact);
|
||||||
|
partner.getPartnerRole().setContact(contact);
|
||||||
}
|
}
|
||||||
if (containsRole(rec, "billing")) {
|
if (containsRole(rec, "billing")) {
|
||||||
assertThat(debitor.getBillingContact()).isNull();
|
assertThat(debitor.getBillingContact()).isNull();
|
||||||
@ -763,7 +783,7 @@ public class ImportOfficeData extends ContextBasedTest {
|
|||||||
return ("," + roles + ",").contains("," + role + ",");
|
return ("," + roles + ",").contains("," + role + ",");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean containsRole(final Record rec) {
|
private static boolean containsPartnerRole(final Record rec) {
|
||||||
return containsRole(rec, "partner");
|
return containsRole(rec, "partner");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,27 +78,32 @@ class HsOfficePartnerControllerAcceptanceTest {
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"person": { "familyName": "Smith" },
|
"person": { "familyName": "Smith" },
|
||||||
|
"partnerRole": { },
|
||||||
"contact": { "label": "fifth contact" },
|
"contact": { "label": "fifth contact" },
|
||||||
"details": { "birthday": "1987-10-31" }
|
"details": { "birthday": "1987-10-31" }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"person": { "tradeName": "First GmbH" },
|
"person": { "tradeName": "First GmbH" },
|
||||||
|
"partnerRole": { },
|
||||||
"contact": { "label": "first contact" },
|
"contact": { "label": "first contact" },
|
||||||
"details": { "registrationOffice": "Hamburg" }
|
"details": { "registrationOffice": "Hamburg" }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"person": { "tradeName": "Third OHG" },
|
"person": { "tradeName": "Third OHG" },
|
||||||
|
"partnerRole": { },
|
||||||
"contact": { "label": "third contact" },
|
"contact": { "label": "third contact" },
|
||||||
"details": { "registrationOffice": "Hamburg" }
|
"details": { "registrationOffice": "Hamburg" }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"person": { "tradeName": "Second e.K." },
|
"person": { "tradeName": "Second e.K." },
|
||||||
|
"partnerRole": { },
|
||||||
"contact": { "label": "second contact" },
|
"contact": { "label": "second contact" },
|
||||||
"details": { "registrationOffice": "Hamburg" }
|
"details": { "registrationOffice": "Hamburg" }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"person": { "personType": "INCORPORATED_FIRM" },
|
"person": { "personType": "INCORPORATED_FIRM" },
|
||||||
"contact": { "label": "forth contact" },
|
"partnerRole": { },
|
||||||
|
"contact": { "label": "fourth contact" },
|
||||||
"details": { "registrationOffice": "Hamburg" }
|
"details": { "registrationOffice": "Hamburg" }
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -326,7 +331,7 @@ class HsOfficePartnerControllerAcceptanceTest {
|
|||||||
assertThat(partnerRepo.findByUuid(givenPartner.getUuid())).isPresent().get()
|
assertThat(partnerRepo.findByUuid(givenPartner.getUuid())).isPresent().get()
|
||||||
.matches(person -> {
|
.matches(person -> {
|
||||||
assertThat(person.getPerson().getTradeName()).isEqualTo("Third OHG");
|
assertThat(person.getPerson().getTradeName()).isEqualTo("Third OHG");
|
||||||
assertThat(person.getContact().getLabel()).isEqualTo("forth contact");
|
assertThat(person.getContact().getLabel()).isEqualTo("fourth contact");
|
||||||
assertThat(person.getDetails().getRegistrationOffice()).isEqualTo("Temp Registergericht Aurich");
|
assertThat(person.getDetails().getRegistrationOffice()).isEqualTo("Temp Registergericht Aurich");
|
||||||
assertThat(person.getDetails().getRegistrationNumber()).isEqualTo("222222");
|
assertThat(person.getDetails().getRegistrationNumber()).isEqualTo("222222");
|
||||||
assertThat(person.getDetails().getBirthName()).isEqualTo("Maja Schmidt");
|
assertThat(person.getDetails().getBirthName()).isEqualTo("Maja Schmidt");
|
||||||
@ -411,11 +416,11 @@ class HsOfficePartnerControllerAcceptanceTest {
|
|||||||
void contactAdminUser_canNotDeleteRelatedPartner() {
|
void contactAdminUser_canNotDeleteRelatedPartner() {
|
||||||
context.define("superuser-alex@hostsharing.net");
|
context.define("superuser-alex@hostsharing.net");
|
||||||
final var givenPartner = givenSomeTemporaryPartnerBessler();
|
final var givenPartner = givenSomeTemporaryPartnerBessler();
|
||||||
assertThat(givenPartner.getContact().getLabel()).isEqualTo("forth contact");
|
assertThat(givenPartner.getContact().getLabel()).isEqualTo("fourth contact");
|
||||||
|
|
||||||
RestAssured // @formatter:off
|
RestAssured // @formatter:off
|
||||||
.given()
|
.given()
|
||||||
.header("current-user", "contact-admin@forthcontact.example.com")
|
.header("current-user", "contact-admin@fourthcontact.example.com")
|
||||||
.port(port)
|
.port(port)
|
||||||
.when()
|
.when()
|
||||||
.delete("http://localhost/api/hs/office/partners/" + givenPartner.getUuid())
|
.delete("http://localhost/api/hs/office/partners/" + givenPartner.getUuid())
|
||||||
@ -431,7 +436,7 @@ class HsOfficePartnerControllerAcceptanceTest {
|
|||||||
void normalUser_canNotDeleteUnrelatedPartner() {
|
void normalUser_canNotDeleteUnrelatedPartner() {
|
||||||
context.define("superuser-alex@hostsharing.net");
|
context.define("superuser-alex@hostsharing.net");
|
||||||
final var givenPartner = givenSomeTemporaryPartnerBessler();
|
final var givenPartner = givenSomeTemporaryPartnerBessler();
|
||||||
assertThat(givenPartner.getContact().getLabel()).isEqualTo("forth contact");
|
assertThat(givenPartner.getContact().getLabel()).isEqualTo("fourth contact");
|
||||||
|
|
||||||
RestAssured // @formatter:off
|
RestAssured // @formatter:off
|
||||||
.given()
|
.given()
|
||||||
@ -451,7 +456,7 @@ class HsOfficePartnerControllerAcceptanceTest {
|
|||||||
return jpaAttempt.transacted(() -> {
|
return jpaAttempt.transacted(() -> {
|
||||||
context.define("superuser-alex@hostsharing.net");
|
context.define("superuser-alex@hostsharing.net");
|
||||||
final var givenPerson = personRepo.findPersonByOptionalNameLike("Erben Bessler").get(0);
|
final var givenPerson = personRepo.findPersonByOptionalNameLike("Erben Bessler").get(0);
|
||||||
final var givenContact = contactRepo.findContactByOptionalLabelLike("forth contact").get(0);
|
final var givenContact = contactRepo.findContactByOptionalLabelLike("fourth contact").get(0);
|
||||||
final var newPartner = HsOfficePartnerEntity.builder()
|
final var newPartner = HsOfficePartnerEntity.builder()
|
||||||
.person(givenPerson)
|
.person(givenPerson)
|
||||||
.contact(givenContact)
|
.contact(givenContact)
|
||||||
|
@ -4,6 +4,9 @@ import net.hostsharing.hsadminng.context.Context;
|
|||||||
import net.hostsharing.hsadminng.context.ContextBasedTest;
|
import net.hostsharing.hsadminng.context.ContextBasedTest;
|
||||||
import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRepository;
|
import net.hostsharing.hsadminng.hs.office.contact.HsOfficeContactRepository;
|
||||||
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRepository;
|
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRepository;
|
||||||
|
import net.hostsharing.hsadminng.hs.office.relationship.HsOfficeRelationshipEntity;
|
||||||
|
import net.hostsharing.hsadminng.hs.office.relationship.HsOfficeRelationshipRepository;
|
||||||
|
import net.hostsharing.hsadminng.hs.office.relationship.HsOfficeRelationshipType;
|
||||||
import net.hostsharing.hsadminng.rbac.rbacgrant.RawRbacGrantRepository;
|
import net.hostsharing.hsadminng.rbac.rbacgrant.RawRbacGrantRepository;
|
||||||
import net.hostsharing.hsadminng.rbac.rbacrole.RawRbacRoleRepository;
|
import net.hostsharing.hsadminng.rbac.rbacrole.RawRbacRoleRepository;
|
||||||
import net.hostsharing.test.Array;
|
import net.hostsharing.test.Array;
|
||||||
@ -37,6 +40,9 @@ class HsOfficePartnerRepositoryIntegrationTest extends ContextBasedTest {
|
|||||||
@Autowired
|
@Autowired
|
||||||
HsOfficePartnerRepository partnerRepo;
|
HsOfficePartnerRepository partnerRepo;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
HsOfficeRelationshipRepository relationshipRepo;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
HsOfficePersonRepository personRepo;
|
HsOfficePersonRepository personRepo;
|
||||||
|
|
||||||
@ -96,37 +102,68 @@ class HsOfficePartnerRepositoryIntegrationTest extends ContextBasedTest {
|
|||||||
final var initialRoleNames = roleNamesOf(rawRoleRepo.findAll());
|
final var initialRoleNames = roleNamesOf(rawRoleRepo.findAll());
|
||||||
final var initialGrantNames = grantDisplaysOf(rawGrantRepo.findAll()).stream()
|
final var initialGrantNames = grantDisplaysOf(rawGrantRepo.findAll()).stream()
|
||||||
.map(s -> s.replace("ErbenBesslerMelBessler", "EBess"))
|
.map(s -> s.replace("ErbenBesslerMelBessler", "EBess"))
|
||||||
.map(s -> s.replace("forthcontact", "4th"))
|
.map(s -> s.replace("fourthcontact", "4th"))
|
||||||
.map(s -> s.replace("hs_office_", ""))
|
.map(s -> s.replace("hs_office_", ""))
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
// when
|
// when
|
||||||
attempt(em, () -> {
|
attempt(em, () -> {
|
||||||
final var givenPerson = personRepo.findPersonByOptionalNameLike("Erben Bessler").get(0);
|
final var givenPartnerPerson = personRepo.findPersonByOptionalNameLike("Erben Bessler").get(0);
|
||||||
final var givenContact = contactRepo.findContactByOptionalLabelLike("forth contact").get(0);
|
final var givenContact = contactRepo.findContactByOptionalLabelLike("fourth contact").get(0);
|
||||||
|
final var givenMandantPerson = personRepo.findPersonByOptionalNameLike("Hostsharing eG").get(0);
|
||||||
|
|
||||||
|
final var newRelationship = HsOfficeRelationshipEntity.builder()
|
||||||
|
.relHolder(givenPartnerPerson)
|
||||||
|
.relType(HsOfficeRelationshipType.PARTNER)
|
||||||
|
.relAnchor(givenMandantPerson)
|
||||||
|
.contact(givenContact)
|
||||||
|
.build();
|
||||||
|
relationshipRepo.save(newRelationship);
|
||||||
|
|
||||||
final var newPartner = toCleanup(HsOfficePartnerEntity.builder()
|
final var newPartner = toCleanup(HsOfficePartnerEntity.builder()
|
||||||
.partnerNumber(22222)
|
.partnerNumber(22222)
|
||||||
.person(givenPerson)
|
.partnerRole(newRelationship)
|
||||||
|
.person(givenPartnerPerson)
|
||||||
.contact(givenContact)
|
.contact(givenContact)
|
||||||
.details(HsOfficePartnerDetailsEntity.builder().build())
|
.details(HsOfficePartnerDetailsEntity.builder().build())
|
||||||
.build());
|
.build());
|
||||||
return partnerRepo.save(newPartner);
|
return partnerRepo.save(newPartner);
|
||||||
});
|
}).assertSuccessful();
|
||||||
|
|
||||||
// then
|
// then
|
||||||
assertThat(roleNamesOf(rawRoleRepo.findAll())).containsExactlyInAnyOrder(Array.from(
|
assertThat(roleNamesOf(rawRoleRepo.findAll())).containsExactlyInAnyOrder(Array.from(
|
||||||
initialRoleNames,
|
initialRoleNames,
|
||||||
"hs_office_partner#22222:ErbenBesslerMelBessler-forthcontact.admin",
|
"hs_office_relationship#HostsharingeG-with-PARTNER-ErbenBesslerMelBessler.admin",
|
||||||
"hs_office_partner#22222:ErbenBesslerMelBessler-forthcontact.agent",
|
"hs_office_relationship#HostsharingeG-with-PARTNER-ErbenBesslerMelBessler.owner",
|
||||||
"hs_office_partner#22222:ErbenBesslerMelBessler-forthcontact.owner",
|
"hs_office_relationship#HostsharingeG-with-PARTNER-ErbenBesslerMelBessler.tenant",
|
||||||
"hs_office_partner#22222:ErbenBesslerMelBessler-forthcontact.tenant",
|
"hs_office_partner#22222:ErbenBesslerMelBessler-fourthcontact.admin",
|
||||||
"hs_office_partner#22222:ErbenBesslerMelBessler-forthcontact.guest"));
|
"hs_office_partner#22222:ErbenBesslerMelBessler-fourthcontact.agent",
|
||||||
|
"hs_office_partner#22222:ErbenBesslerMelBessler-fourthcontact.owner",
|
||||||
|
"hs_office_partner#22222:ErbenBesslerMelBessler-fourthcontact.tenant",
|
||||||
|
"hs_office_partner#22222:ErbenBesslerMelBessler-fourthcontact.guest"));
|
||||||
assertThat(grantDisplaysOf(rawGrantRepo.findAll()))
|
assertThat(grantDisplaysOf(rawGrantRepo.findAll()))
|
||||||
.map(s -> s.replace("ErbenBesslerMelBessler", "EBess"))
|
.map(s -> s.replace("ErbenBesslerMelBessler", "EBess"))
|
||||||
.map(s -> s.replace("forthcontact", "4th"))
|
.map(s -> s.replace("fourthcontact", "4th"))
|
||||||
.map(s -> s.replace("hs_office_", ""))
|
.map(s -> s.replace("hs_office_", ""))
|
||||||
.containsExactlyInAnyOrder(Array.fromFormatted(
|
.containsExactlyInAnyOrder(Array.fromFormatted(
|
||||||
initialGrantNames,
|
initialGrantNames,
|
||||||
|
// relationship - TODO: check and cleanup
|
||||||
|
"{ grant role relationship#HostsharingeG-with-PARTNER-EBess.owner to role global#global.admin by system and assume }",
|
||||||
|
"{ grant role relationship#HostsharingeG-with-PARTNER-EBess.tenant to role contact#4th.admin by system and assume }",
|
||||||
|
"{ grant role person#HostsharingeG.tenant to role person#EBess.admin by system and assume }",
|
||||||
|
"{ grant role relationship#HostsharingeG-with-PARTNER-EBess.tenant to role person#EBess.admin by system and assume }",
|
||||||
|
"{ grant role person#EBess.tenant to role person#HostsharingeG.admin by system and assume }",
|
||||||
|
"{ grant role relationship#HostsharingeG-with-PARTNER-EBess.owner to role person#HostsharingeG.admin by system and assume }",
|
||||||
|
"{ grant role relationship#HostsharingeG-with-PARTNER-EBess.tenant to role person#HostsharingeG.admin by system and assume }",
|
||||||
|
"{ grant perm edit on relationship#HostsharingeG-with-PARTNER-EBess to role relationship#HostsharingeG-with-PARTNER-EBess.admin by system and assume }",
|
||||||
|
"{ grant role relationship#HostsharingeG-with-PARTNER-EBess.tenant to role relationship#HostsharingeG-with-PARTNER-EBess.admin by system and assume }",
|
||||||
|
"{ grant perm * on relationship#HostsharingeG-with-PARTNER-EBess to role relationship#HostsharingeG-with-PARTNER-EBess.owner by system and assume }",
|
||||||
|
"{ grant role relationship#HostsharingeG-with-PARTNER-EBess.admin to role relationship#HostsharingeG-with-PARTNER-EBess.owner by system and assume }",
|
||||||
|
"{ grant perm view on relationship#HostsharingeG-with-PARTNER-EBess to role relationship#HostsharingeG-with-PARTNER-EBess.tenant by system and assume }",
|
||||||
|
"{ grant role contact#4th.tenant to role relationship#HostsharingeG-with-PARTNER-EBess.tenant by system and assume }",
|
||||||
|
"{ grant role person#EBess.tenant to role relationship#HostsharingeG-with-PARTNER-EBess.tenant by system and assume }",
|
||||||
|
"{ grant role person#HostsharingeG.tenant to role relationship#HostsharingeG-with-PARTNER-EBess.tenant by system and assume }",
|
||||||
|
|
||||||
// owner
|
// owner
|
||||||
"{ grant perm * on partner#22222:EBess-4th to role partner#22222:EBess-4th.owner by system and assume }",
|
"{ grant perm * on partner#22222:EBess-4th to role partner#22222:EBess-4th.owner by system and assume }",
|
||||||
"{ grant perm * on partner_details#22222:EBess-4th-details to role partner#22222:EBess-4th.owner by system and assume }",
|
"{ grant perm * on partner_details#22222:EBess-4th-details to role partner#22222:EBess-4th.owner by system and assume }",
|
||||||
|
@ -88,7 +88,7 @@ class HsOfficePersonControllerAcceptanceTest {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"personType": "INCORPORATED_FIRM",
|
"personType": "INCORPORATED_FIRM",
|
||||||
"tradeName": "Fourth e.G.",
|
"tradeName": "Fourth eG",
|
||||||
"givenName": null,
|
"givenName": null,
|
||||||
"familyName": null
|
"familyName": null
|
||||||
},
|
},
|
||||||
|
@ -167,7 +167,7 @@ class HsOfficeRelationshipControllerAcceptanceTest {
|
|||||||
.body("relType", is("ACCOUNTING"))
|
.body("relType", is("ACCOUNTING"))
|
||||||
.body("relAnchor.tradeName", is("Third OHG"))
|
.body("relAnchor.tradeName", is("Third OHG"))
|
||||||
.body("relHolder.givenName", is("Paul"))
|
.body("relHolder.givenName", is("Paul"))
|
||||||
.body("contact.label", is("forth contact"))
|
.body("contact.label", is("fourth contact"))
|
||||||
.header("Location", startsWith("http://localhost"))
|
.header("Location", startsWith("http://localhost"))
|
||||||
.extract().header("Location"); // @formatter:on
|
.extract().header("Location"); // @formatter:on
|
||||||
|
|
||||||
@ -390,7 +390,7 @@ class HsOfficeRelationshipControllerAcceptanceTest {
|
|||||||
.body("relType", is("REPRESENTATIVE"))
|
.body("relType", is("REPRESENTATIVE"))
|
||||||
.body("relAnchor.tradeName", is("Erben Bessler"))
|
.body("relAnchor.tradeName", is("Erben Bessler"))
|
||||||
.body("relHolder.familyName", is("Winkler"))
|
.body("relHolder.familyName", is("Winkler"))
|
||||||
.body("contact.label", is("forth contact"));
|
.body("contact.label", is("fourth contact"));
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
|
|
||||||
// finally, the relationship is actually updated
|
// finally, the relationship is actually updated
|
||||||
@ -399,7 +399,7 @@ class HsOfficeRelationshipControllerAcceptanceTest {
|
|||||||
.matches(rel -> {
|
.matches(rel -> {
|
||||||
assertThat(rel.getRelAnchor().getTradeName()).contains("Bessler");
|
assertThat(rel.getRelAnchor().getTradeName()).contains("Bessler");
|
||||||
assertThat(rel.getRelHolder().getFamilyName()).contains("Winkler");
|
assertThat(rel.getRelHolder().getFamilyName()).contains("Winkler");
|
||||||
assertThat(rel.getContact().getLabel()).isEqualTo("forth contact");
|
assertThat(rel.getContact().getLabel()).isEqualTo("fourth contact");
|
||||||
assertThat(rel.getRelType()).isEqualTo(HsOfficeRelationshipType.REPRESENTATIVE);
|
assertThat(rel.getRelType()).isEqualTo(HsOfficeRelationshipType.REPRESENTATIVE);
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
@ -70,7 +70,7 @@ class HsOfficeRelationshipRepositoryIntegrationTest extends ContextBasedTest {
|
|||||||
final var count = relationshipRepo.count();
|
final var count = relationshipRepo.count();
|
||||||
final var givenAnchorPerson = personRepo.findPersonByOptionalNameLike("Bessler").get(0);
|
final var givenAnchorPerson = personRepo.findPersonByOptionalNameLike("Bessler").get(0);
|
||||||
final var givenHolderPerson = personRepo.findPersonByOptionalNameLike("Anita").get(0);
|
final var givenHolderPerson = personRepo.findPersonByOptionalNameLike("Anita").get(0);
|
||||||
final var givenContact = contactRepo.findContactByOptionalLabelLike("forth contact").get(0);
|
final var givenContact = contactRepo.findContactByOptionalLabelLike("fourth contact").get(0);
|
||||||
|
|
||||||
// when
|
// when
|
||||||
final var result = attempt(em, () -> {
|
final var result = attempt(em, () -> {
|
||||||
@ -101,7 +101,7 @@ class HsOfficeRelationshipRepositoryIntegrationTest extends ContextBasedTest {
|
|||||||
attempt(em, () -> {
|
attempt(em, () -> {
|
||||||
final var givenAnchorPerson = personRepo.findPersonByOptionalNameLike("Bessler").get(0);
|
final var givenAnchorPerson = personRepo.findPersonByOptionalNameLike("Bessler").get(0);
|
||||||
final var givenHolderPerson = personRepo.findPersonByOptionalNameLike("Anita").get(0);
|
final var givenHolderPerson = personRepo.findPersonByOptionalNameLike("Anita").get(0);
|
||||||
final var givenContact = contactRepo.findContactByOptionalLabelLike("forth contact").get(0);
|
final var givenContact = contactRepo.findContactByOptionalLabelLike("fourth contact").get(0);
|
||||||
final var newRelationship = toCleanup(HsOfficeRelationshipEntity.builder()
|
final var newRelationship = toCleanup(HsOfficeRelationshipEntity.builder()
|
||||||
.relAnchor(givenAnchorPerson)
|
.relAnchor(givenAnchorPerson)
|
||||||
.relHolder(givenHolderPerson)
|
.relHolder(givenHolderPerson)
|
||||||
@ -128,11 +128,11 @@ class HsOfficeRelationshipRepositoryIntegrationTest extends ContextBasedTest {
|
|||||||
"{ grant role hs_office_relationship#BesslerAnita-with-REPRESENTATIVE-BesslerAnita.admin to role hs_office_relationship#BesslerAnita-with-REPRESENTATIVE-BesslerAnita.owner by system and assume }",
|
"{ grant role hs_office_relationship#BesslerAnita-with-REPRESENTATIVE-BesslerAnita.admin to role hs_office_relationship#BesslerAnita-with-REPRESENTATIVE-BesslerAnita.owner by system and assume }",
|
||||||
|
|
||||||
"{ grant perm view on hs_office_relationship#BesslerAnita-with-REPRESENTATIVE-BesslerAnita to role hs_office_relationship#BesslerAnita-with-REPRESENTATIVE-BesslerAnita.tenant by system and assume }",
|
"{ grant perm view on hs_office_relationship#BesslerAnita-with-REPRESENTATIVE-BesslerAnita to role hs_office_relationship#BesslerAnita-with-REPRESENTATIVE-BesslerAnita.tenant by system and assume }",
|
||||||
"{ grant role hs_office_relationship#BesslerAnita-with-REPRESENTATIVE-BesslerAnita.tenant to role hs_office_contact#forthcontact.admin by system and assume }",
|
"{ grant role hs_office_relationship#BesslerAnita-with-REPRESENTATIVE-BesslerAnita.tenant to role hs_office_contact#fourthcontact.admin by system and assume }",
|
||||||
"{ grant role hs_office_relationship#BesslerAnita-with-REPRESENTATIVE-BesslerAnita.tenant to role hs_office_person#BesslerAnita.admin by system and assume }",
|
"{ grant role hs_office_relationship#BesslerAnita-with-REPRESENTATIVE-BesslerAnita.tenant to role hs_office_person#BesslerAnita.admin by system and assume }",
|
||||||
|
|
||||||
"{ grant role hs_office_relationship#BesslerAnita-with-REPRESENTATIVE-BesslerAnita.tenant to role hs_office_relationship#BesslerAnita-with-REPRESENTATIVE-BesslerAnita.admin by system and assume }",
|
"{ grant role hs_office_relationship#BesslerAnita-with-REPRESENTATIVE-BesslerAnita.tenant to role hs_office_relationship#BesslerAnita-with-REPRESENTATIVE-BesslerAnita.admin by system and assume }",
|
||||||
"{ grant role hs_office_contact#forthcontact.tenant to role hs_office_relationship#BesslerAnita-with-REPRESENTATIVE-BesslerAnita.tenant by system and assume }",
|
"{ grant role hs_office_contact#fourthcontact.tenant to role hs_office_relationship#BesslerAnita-with-REPRESENTATIVE-BesslerAnita.tenant by system and assume }",
|
||||||
"{ grant role hs_office_person#BesslerAnita.tenant to role hs_office_relationship#BesslerAnita-with-REPRESENTATIVE-BesslerAnita.tenant by system and assume }",
|
"{ grant role hs_office_person#BesslerAnita.tenant to role hs_office_relationship#BesslerAnita-with-REPRESENTATIVE-BesslerAnita.tenant by system and assume }",
|
||||||
null)
|
null)
|
||||||
);
|
);
|
||||||
|
@ -320,7 +320,7 @@ class HsOfficeSepaMandateRepositoryIntegrationTest extends ContextBasedTest {
|
|||||||
public void globalAdmin_withoutAssumedRole_canDeleteAnySepaMandate() {
|
public void globalAdmin_withoutAssumedRole_canDeleteAnySepaMandate() {
|
||||||
// given
|
// given
|
||||||
context("superuser-alex@hostsharing.net", null);
|
context("superuser-alex@hostsharing.net", null);
|
||||||
final var givenSepaMandate = givenSomeTemporarySepaMandateBessler("Fourth e.G.");
|
final var givenSepaMandate = givenSomeTemporarySepaMandateBessler("Fourth eG");
|
||||||
|
|
||||||
// when
|
// when
|
||||||
final var result = jpaAttempt.transacted(() -> {
|
final var result = jpaAttempt.transacted(() -> {
|
||||||
|
Loading…
Reference in New Issue
Block a user