Compare commits

..

No commits in common. "066e19185c8edf321fcd66a05e8caedb8de5b413" and "2aeb8fef6f41c304a1551234620858fc6c36315d" have entirely different histories.

10 changed files with 147 additions and 170 deletions

View File

@ -36,7 +36,7 @@ public class HsOfficeContactEntity implements Stringifyable, HasUuid {
private String label;
@Column(name = "postaladdress")
private String postalAddress; // TODO: check if we really want multiple, if so: JSON-Array or Postgres-Array?
private String postalAddress;
@Column(name = "emailaddresses", columnDefinition = "json")
private String emailAddresses; // TODO: check if we can really add multiple. format: ["eins@...", "zwei@..."]

View File

@ -7,7 +7,6 @@ components:
type: string
enum:
- UNKNOWN
- PARTNER
- EX_PARTNER
- REPRESENTATIVE,
- VIP_CONTACT

View File

@ -65,7 +65,7 @@ do language plpgsql $$
call createHsOfficePersonTestData('NP', null, 'Smith', 'Peter');
call createHsOfficePersonTestData('NP', null, 'Tucker', 'Jack');
call createHsOfficePersonTestData('NP', null, 'Fouler', 'Ellie');
call createHsOfficePersonTestData('LP', 'Second e.K.', 'Smith', 'Peter');
call createHsOfficePersonTestData('LP', 'Second e.K.', 'Sandra', 'Miller');
call createHsOfficePersonTestData('IF', 'Third OHG');
call createHsOfficePersonTestData('IF', 'Fourth eG');
call createHsOfficePersonTestData('UF', 'Erben Bessler', 'Mel', 'Bessler');

View File

@ -182,8 +182,7 @@ public class ImportOfficeData extends ContextBasedTest {
{
17=partner(null null, null),
20=partner(null null, null),
22=partner(null null, null),
99=partner(null null, null)
22=partner(null null, null)
}
""");
assertThat(toFormattedString(contacts)).isEqualTo("{}");
@ -191,9 +190,7 @@ public class ImportOfficeData extends ContextBasedTest {
{
17=debitor(D-1001700: null null, null: mih),
20=debitor(D-1002000: null null, null: xyz),
22=debitor(D-1102200: null null, null: xxx),
99=debitor(D-1999900: null null, null: zzz)
}
22=debitor(D-1102200: null null, null: xxx)}
""");
assertThat(toFormattedString(memberships)).isEqualToIgnoringWhitespace("""
{
@ -225,8 +222,7 @@ public class ImportOfficeData extends ContextBasedTest {
{
17=partner(NP Mellies, Michael: Herr Michael Mellies ),
20=partner(LP JM GmbH: Herr Philip Meyer-Contract , JM GmbH),
22=partner(?? Test PS: Petra Schmidt , Test PS),
99=partner(null null, null)
22=partner(?? Test PS: Petra Schmidt , Test PS)
}
""");
assertThat(toFormattedString(contacts)).isEqualToIgnoringWhitespace("""
@ -236,9 +232,7 @@ public class ImportOfficeData extends ContextBasedTest {
1201=contact(label='Frau Dr. Jenny Meyer-Billing , JM GmbH', emailAddresses='jm-billing@example.org'),
1202=contact(label='Herr Andrew Meyer-Operation , JM GmbH', emailAddresses='am-operation@example.org'),
1203=contact(label='Herr Philip Meyer-Contract , JM GmbH', emailAddresses='pm-partner@example.org'),
1204=contact(label='Frau Tammy Meyer-VIP , JM GmbH', emailAddresses='tm-vip@example.org'),
1301=contact(label='Petra Schmidt , Test PS', emailAddresses='ps@example.com'),
1401=contact(label='Frau Frauke Fanninga ', emailAddresses='ff@example.org')
1301=contact(label='Petra Schmidt , Test PS', emailAddresses='ps@example.com')
}
""");
assertThat(toFormattedString(persons)).isEqualToIgnoringWhitespace("""
@ -249,17 +243,14 @@ public class ImportOfficeData extends ContextBasedTest {
1201=person(personType='LP', tradeName='JM GmbH', familyName='Meyer-Billing', givenName='Jenny'),
1202=person(personType='LP', tradeName='JM GmbH', familyName='Meyer-Operation', givenName='Andrew'),
1203=person(personType='LP', tradeName='JM GmbH', familyName='Meyer-Contract', givenName='Philip'),
1204=person(personType='LP', tradeName='JM GmbH', familyName='Meyer-VIP', givenName='Tammy'),
1301=person(personType='??', tradeName='Test PS', familyName='Schmidt', givenName='Petra'),
1401=person(personType='NP', tradeName='', familyName='Fanninga', givenName='Frauke')
1301=person(personType='??', tradeName='Test PS', familyName='Schmidt', givenName='Petra')
}
""");
assertThat(toFormattedString(debitors)).isEqualToIgnoringWhitespace("""
{
17=debitor(D-1001700: NP Mellies, Michael: mih),
20=debitor(D-1002000: LP JM GmbH: xyz),
22=debitor(D-1102200: ?? Test PS: xxx),
99=debitor(D-1999900: null null, null: zzz)
22=debitor(D-1102200: ?? Test PS: xxx)
}
""");
assertThat(toFormattedString(memberships)).isEqualToIgnoringWhitespace("""
@ -274,21 +265,17 @@ public class ImportOfficeData extends ContextBasedTest {
2000000=rel(relAnchor='LP Hostsharing eG', relType='PARTNER', relHolder='NP Mellies, Michael', contact='Herr Michael Mellies '),
2000001=rel(relAnchor='LP Hostsharing eG', relType='PARTNER', relHolder='LP JM GmbH', contact='Herr Philip Meyer-Contract , JM GmbH'),
2000002=rel(relAnchor='LP Hostsharing eG', relType='PARTNER', relHolder='?? Test PS', contact='Petra Schmidt , Test PS'),
2000003=rel(relAnchor='LP Hostsharing eG', relType='PARTNER', relHolder='null null, null'),
2000004=rel(relAnchor='NP Mellies, Michael', relType='OPERATIONS', relHolder='NP Mellies, Michael', contact='Herr Michael Mellies '),
2000005=rel(relAnchor='LP JM GmbH', relType='EX_PARTNER', relHolder='LP JM e.K.', contact='JM e.K.'),
2000006=rel(relAnchor='LP JM GmbH', relType='OPERATIONS', relHolder='LP JM GmbH', contact='Herr Andrew Meyer-Operation , JM GmbH'),
2000007=rel(relAnchor='LP JM GmbH', relType='VIP_CONTACT', relHolder='LP JM GmbH', contact='Herr Andrew Meyer-Operation , JM GmbH'),
2000008=rel(relAnchor='LP JM GmbH', relType='SUBSCRIBER', relMark='operations-announce', relHolder='LP JM GmbH', contact='Herr Andrew Meyer-Operation , JM GmbH'),
2000009=rel(relAnchor='LP JM GmbH', relType='REPRESENTATIVE', relHolder='LP JM GmbH', contact='Herr Philip Meyer-Contract , JM GmbH'),
2000010=rel(relAnchor='LP JM GmbH', relType='SUBSCRIBER', relMark='members-announce', relHolder='LP JM GmbH', contact='Herr Philip Meyer-Contract , JM GmbH'),
2000011=rel(relAnchor='LP JM GmbH', relType='SUBSCRIBER', relMark='customers-announce', relHolder='LP JM GmbH', contact='Herr Philip Meyer-Contract , JM GmbH'),
2000012=rel(relAnchor='LP JM GmbH', relType='VIP_CONTACT', relHolder='LP JM GmbH', contact='Frau Tammy Meyer-VIP , JM GmbH'),
2000013=rel(relAnchor='?? Test PS', relType='OPERATIONS', relHolder='?? Test PS', contact='Petra Schmidt , Test PS'),
2000014=rel(relAnchor='?? Test PS', relType='REPRESENTATIVE', relHolder='?? Test PS', contact='Petra Schmidt , Test PS'),
2000015=rel(relAnchor='NP Mellies, Michael', relType='SUBSCRIBER', relMark='operations-announce', relHolder='NP Fanninga, Frauke', contact='Frau Frauke Fanninga '),
2000016=rel(relAnchor='NP Mellies, Michael', relType='REPRESENTATIVE', relHolder='NP Mellies, Michael', contact='Herr Michael Mellies '),
2000017=rel(relAnchor='null null, null', relType='REPRESENTATIVE', relHolder='null null, null')
2000003=rel(relAnchor='NP Mellies, Michael', relType='OPERATIONS', relHolder='NP Mellies, Michael', contact='Herr Michael Mellies '),
2000004=rel(relAnchor='LP JM GmbH', relType='EX_PARTNER', relHolder='LP JM e.K.', contact='JM e.K.'),
2000005=rel(relAnchor='LP JM GmbH', relType='OPERATIONS', relHolder='LP JM GmbH', contact='Herr Andrew Meyer-Operation , JM GmbH'),
2000006=rel(relAnchor='LP JM GmbH', relType='VIP_CONTACT', relHolder='LP JM GmbH', contact='Herr Andrew Meyer-Operation , JM GmbH'),
2000007=rel(relAnchor='LP JM GmbH', relType='SUBSCRIBER', relMark='operations-announce', relHolder='LP JM GmbH', contact='Herr Andrew Meyer-Operation , JM GmbH'),
2000008=rel(relAnchor='LP JM GmbH', relType='REPRESENTATIVE', relHolder='LP JM GmbH', contact='Herr Philip Meyer-Contract , JM GmbH'),
2000009=rel(relAnchor='LP JM GmbH', relType='SUBSCRIBER', relMark='members-announce', relHolder='LP JM GmbH', contact='Herr Philip Meyer-Contract , JM GmbH'),
2000010=rel(relAnchor='LP JM GmbH', relType='SUBSCRIBER', relMark='customers-announce', relHolder='LP JM GmbH', contact='Herr Philip Meyer-Contract , JM GmbH'),
2000011=rel(relAnchor='?? Test PS', relType='OPERATIONS', relHolder='?? Test PS', contact='Petra Schmidt , Test PS'),
2000012=rel(relAnchor='?? Test PS', relType='REPRESENTATIVE', relHolder='?? Test PS', contact='Petra Schmidt , Test PS'),
2000013=rel(relAnchor='NP Mellies, Michael', relType='REPRESENTATIVE', relHolder='NP Mellies, Michael', contact='Herr Michael Mellies ')
}
""");
}
@ -385,73 +372,6 @@ public class ImportOfficeData extends ContextBasedTest {
@Test
@Order(2000)
void verifyAllPartnersHavePersons() {
partners.forEach((id, p) -> {
if ( id != 99 ) {
assertThat(p.getContact()).describedAs("partner " + id + " without contact").isNotNull();
assertThat(p.getContact().getLabel()).describedAs("partner " + id + " without valid contact").isNotNull();
assertThat(p.getPerson()).describedAs("partner " + id + " without person").isNotNull();
assertThat(p.getPerson().getPersonType()).describedAs("partner " + id + " without valid person").isNotNull();
}
});
}
@Test
@Order(2001)
void removeEmptyRelationships() {
assumeThatWeAreImportingControlledTestData();
// avoid a error when persisting the deliberetely invalid partner entry #99
final var idsToRemove = new HashSet<Integer>();
relationships.forEach( (id, r) -> {
// such a record
if (r.getContact() == null || r.getContact().getLabel() == null ||
r.getRelHolder() == null | r.getRelHolder().getPersonType() == null ) {
idsToRemove.add(id);
}
});
assertThat(idsToRemove.size()).isEqualTo(2); // only from partner #99 (partner+contractual roles)
idsToRemove.forEach(id -> relationships.remove(id));
}
@Test
@Order(2002)
void removeEmptyPartners() {
assumeThatWeAreImportingControlledTestData();
// avoid a error when persisting the deliberetely invalid partner entry #99
final var idsToRemove = new HashSet<Integer>();
partners.forEach( (id, r) -> {
// such a record
if (r.getContact() == null || r.getContact().getLabel() == null ||
r.getPerson() == null | r.getPerson().getPersonType() == null ) {
idsToRemove.add(id);
}
});
assertThat(idsToRemove.size()).isEqualTo(1); // only from partner #99
idsToRemove.forEach(id -> partners.remove(id));
}
@Test
@Order(2003)
void removeEmptyDebitors() {
assumeThatWeAreImportingControlledTestData();
// avoid a error when persisting the deliberetely invalid partner entry #99
final var idsToRemove = new HashSet<Integer>();
debitors.forEach( (id, r) -> {
// such a record
if (r.getBillingContact() == null || r.getBillingContact().getLabel() == null ||
r.getPartner().getPerson() == null | r.getPartner().getPerson().getPersonType() == null ) {
idsToRemove.add(id);
}
});
assertThat(idsToRemove.size()).isEqualTo(1); // only from partner #99
idsToRemove.forEach(id -> debitors.remove(id));
}
@Test
@Order(3000)
@Commit
void persistEntities() {
@ -521,13 +441,13 @@ public class ImportOfficeData extends ContextBasedTest {
private void persist(final Integer id, final HasUuid entity) {
try {
System.out.println("persisting #" + entity.hashCode() + ": " + entity);
System.out.println("persisting #" + entity.hashCode() + ": " + entity.toString());
em.persist(entity);
em.flush();
System.out.println("persisted #" + entity.hashCode() + " as " + entity.getUuid());
} catch (Exception exc) {
System.err.println("failed to persist #" + entity.hashCode() + ": " + entity);
System.err.println(exc);
} catch (Exception x) {
System.out.println("failed to persist: " + entity.toString());
throw x;
}
}
@ -682,6 +602,8 @@ public class ImportOfficeData extends ContextBasedTest {
.build();
debitors.put(rec.getInteger("bp_id"), debitor);
partners.put(rec.getInteger("bp_id"), partner);
if (isNotBlank(rec.getString("member_since"))) {
assertThat(rec.getInteger("member_id")).isEqualTo(partner.getPartnerNumber());
final var membership = HsOfficeMembershipEntity.builder()

View File

@ -23,7 +23,8 @@ import java.util.UUID;
import static net.hostsharing.test.IsValidUuidMatcher.isUuidValid;
import static net.hostsharing.test.JsonMatcher.lenientlyEquals;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.Matchers.*;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.startsWith;
@SpringBootTest(
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
@ -65,7 +66,59 @@ class HsOfficePersonControllerAcceptanceTest {
.then().log().all().assertThat()
.statusCode(200)
.contentType("application/json")
.body("", hasSize(12));
.body("", lenientlyEquals("""
[
{
"personType": "LEGAL_PERSON",
"tradeName": "First GmbH",
"givenName": null,
"familyName": null
},
{
"personType": "LEGAL_PERSON",
"tradeName": "Second e.K.",
"givenName": "Miller",
"familyName": "Sandra"
},
{
"personType": "INCORPORATED_FIRM",
"tradeName": "Third OHG",
"givenName": null,
"familyName": null
},
{
"personType": "INCORPORATED_FIRM",
"tradeName": "Fourth eG",
"givenName": null,
"familyName": null
},
{
"personType": "NATURAL_PERSON",
"tradeName": null,
"givenName": "Anita",
"familyName": "Bessler"
},
{
"personType": "UNINCORPORATED_FIRM",
"tradeName": "Erben Bessler",
"givenName": "Bessler",
"familyName": "Mel"
},
{
"personType": "NATURAL_PERSON",
"tradeName": null,
"givenName": "Peter",
"familyName": "Smith"
},
{
"personType": "NATURAL_PERSON",
"tradeName": null,
"givenName": "Paul",
"familyName": "Winkler"
}
]
"""
));
// @formatter:on
}
}

View File

@ -273,7 +273,7 @@ class HsOfficePersonRepositoryIntegrationTest extends ContextBasedTest {
// then
assertThat(customerLogEntries).map(Arrays::toString).contains(
"[creating person test-data First GmbH, hs_office_person, INSERT]",
"[creating person test-data Second e.K., Smith, Peter, hs_office_person, INSERT]");
"[creating person test-data Second e.K., Sandra, Miller, hs_office_person, INSERT]");
}
@AfterEach

View File

@ -35,7 +35,6 @@ import static org.hamcrest.Matchers.startsWith;
@Transactional
class HsOfficeRelationshipControllerAcceptanceTest {
public static final UUID GIVEN_NON_EXISTING_HOLDER_PERSON_UUID = UUID.fromString("3fa85f64-5717-4562-b3fc-2c963f66afa6");
@LocalServerPort
private Integer port;
@ -68,7 +67,7 @@ class HsOfficeRelationshipControllerAcceptanceTest {
// given
context.define("superuser-alex@hostsharing.net");
final var givenPerson = personRepo.findPersonByOptionalNameLike("Hostsharing eG").get(0);
final var givenPerson = personRepo.findPersonByOptionalNameLike("Smith").get(0);
RestAssured // @formatter:off
.given()
@ -76,47 +75,55 @@ class HsOfficeRelationshipControllerAcceptanceTest {
.port(port)
.when()
.get("http://localhost/api/hs/office/relationships?personUuid=%s&relationshipType=%s"
.formatted(givenPerson.getUuid(), HsOfficeRelationshipTypeResource.PARTNER))
.formatted(givenPerson.getUuid(), HsOfficeRelationshipTypeResource.REPRESENTATIVE))
.then().log().all().assertThat()
.statusCode(200)
.contentType("application/json")
.body("", lenientlyEquals("""
[
{
"relAnchor": { "personType": "LEGAL_PERSON", "tradeName": "Hostsharing eG" },
"relHolder": { "personType": "LEGAL_PERSON", "tradeName": "First GmbH" },
"relType": "PARTNER",
"relMark": null,
"contact": { "label": "first contact" }
},
{
"relAnchor": { "personType": "LEGAL_PERSON", "tradeName": "Hostsharing eG" },
"relHolder": { "personType": "INCORPORATED_FIRM", "tradeName": "Fourth eG" },
"relType": "PARTNER",
"contact": { "label": "fourth contact" }
},
{
"relAnchor": { "personType": "LEGAL_PERSON", "tradeName": "Hostsharing eG" },
"relHolder": { "personType": "LEGAL_PERSON", "tradeName": "Second e.K.", "givenName": "Peter", "familyName": "Smith" },
"relType": "PARTNER",
"relMark": null,
"contact": { "label": "second contact" }
},
{
"relAnchor": { "personType": "LEGAL_PERSON", "tradeName": "Hostsharing eG" },
"relHolder": { "personType": "NATURAL_PERSON", "givenName": "Peter", "familyName": "Smith" },
"relType": "PARTNER",
"relMark": null,
"contact": { "label": "sixth contact" }
},
{
"relAnchor": { "personType": "LEGAL_PERSON", "tradeName": "Hostsharing eG" },
"relHolder": { "personType": "INCORPORATED_FIRM", "tradeName": "Third OHG" },
"relType": "PARTNER",
"relMark": null,
"contact": { "label": "third contact" }
}
]
{
"relAnchor": {
"personType": "INCORPORATED_FIRM",
"tradeName": "Third OHG"
},
"relHolder": {
"personType": "NATURAL_PERSON",
"givenName": "Peter",
"familyName": "Smith"
},
"relType": "REPRESENTATIVE",
"contact": { "label": "third contact" }
},
{
"relAnchor": {
"personType": "LEGAL_PERSON",
"tradeName": "Second e.K.",
"givenName": "Miller",
"familyName": "Sandra"
},
"relHolder": {
"personType": "NATURAL_PERSON",
"givenName": "Peter",
"familyName": "Smith"
},
"relType": "REPRESENTATIVE",
"contact": { "label": "second contact" }
},
{
"relAnchor": {
"personType": "LEGAL_PERSON",
"tradeName": "First GmbH"
},
"relHolder": {
"personType": "NATURAL_PERSON",
"tradeName": null,
"givenName": "Peter",
"familyName": "Smith"
},
"relType": "REPRESENTATIVE",
"contact": { "label": "first contact" }
}
]
"""));
// @formatter:on
}
@ -132,7 +139,7 @@ class HsOfficeRelationshipControllerAcceptanceTest {
context.define("superuser-alex@hostsharing.net");
final var givenAnchorPerson = personRepo.findPersonByOptionalNameLike("Third").get(0);
final var givenHolderPerson = personRepo.findPersonByOptionalNameLike("Paul").get(0);
final var givenContact = contactRepo.findContactByOptionalLabelLike("second").get(0);
final var givenContact = contactRepo.findContactByOptionalLabelLike("forth").get(0);
final var location = RestAssured // @formatter:off
.given()
@ -160,7 +167,7 @@ class HsOfficeRelationshipControllerAcceptanceTest {
.body("relType", is("ACCOUNTING"))
.body("relAnchor.tradeName", is("Third OHG"))
.body("relHolder.givenName", is("Paul"))
.body("contact.label", is("second contact"))
.body("contact.label", is("fourth contact"))
.header("Location", startsWith("http://localhost"))
.extract().header("Location"); // @formatter:on
@ -174,9 +181,9 @@ class HsOfficeRelationshipControllerAcceptanceTest {
void globalAdmin_canNotAddRelationship_ifAnchorPersonDoesNotExist() {
context.define("superuser-alex@hostsharing.net");
final var givenAnchorPersonUuid = GIVEN_NON_EXISTING_HOLDER_PERSON_UUID;
final var givenAnchorPersonUuid = UUID.fromString("3fa85f64-5717-4562-b3fc-2c963f66afa6");
final var givenHolderPerson = personRepo.findPersonByOptionalNameLike("Smith").get(0);
final var givenContact = contactRepo.findContactByOptionalLabelLike("fourth").get(0);
final var givenContact = contactRepo.findContactByOptionalLabelLike("forth").get(0);
final var location = RestAssured // @formatter:off
.given()
@ -199,7 +206,7 @@ class HsOfficeRelationshipControllerAcceptanceTest {
.post("http://localhost/api/hs/office/relationships")
.then().log().all().assertThat()
.statusCode(404)
.body("message", is("cannot find relAnchorUuid " + GIVEN_NON_EXISTING_HOLDER_PERSON_UUID));
.body("message", is("cannot find relAnchorUuid 3fa85f64-5717-4562-b3fc-2c963f66afa6"));
// @formatter:on
}
@ -208,7 +215,8 @@ class HsOfficeRelationshipControllerAcceptanceTest {
context.define("superuser-alex@hostsharing.net");
final var givenAnchorPerson = personRepo.findPersonByOptionalNameLike("Third").get(0);
final var givenContact = contactRepo.findContactByOptionalLabelLike("fourth").get(0);
final var givenHolderPersonUuid = UUID.fromString("3fa85f64-5717-4562-b3fc-2c963f66afa6");
final var givenContact = contactRepo.findContactByOptionalLabelLike("forth").get(0);
final var location = RestAssured // @formatter:off
.given()
@ -224,14 +232,14 @@ class HsOfficeRelationshipControllerAcceptanceTest {
""".formatted(
HsOfficeRelationshipTypeResource.ACCOUNTING,
givenAnchorPerson.getUuid(),
GIVEN_NON_EXISTING_HOLDER_PERSON_UUID,
givenHolderPersonUuid,
givenContact.getUuid()))
.port(port)
.when()
.post("http://localhost/api/hs/office/relationships")
.then().log().all().assertThat()
.statusCode(404)
.body("message", is("cannot find relHolderUuid " + GIVEN_NON_EXISTING_HOLDER_PERSON_UUID));
.body("message", is("cannot find relHolderUuid 3fa85f64-5717-4562-b3fc-2c963f66afa6"));
// @formatter:on
}
@ -276,7 +284,7 @@ class HsOfficeRelationshipControllerAcceptanceTest {
@Test
void globalAdmin_withoutAssumedRole_canGetArbitraryRelationship() {
context.define("superuser-alex@hostsharing.net");
final UUID givenRelationshipUuid = findRelationship("First", "Firby").getUuid();
final UUID givenRelationshipUuid = findRelationship("First", "Smith").getUuid();
RestAssured // @formatter:off
.given()
@ -290,7 +298,7 @@ class HsOfficeRelationshipControllerAcceptanceTest {
.body("", lenientlyEquals("""
{
"relAnchor": { "tradeName": "First GmbH" },
"relHolder": { "familyName": "Firby" },
"relHolder": { "familyName": "Smith" },
"contact": { "label": "first contact" }
}
""")); // @formatter:on
@ -300,7 +308,7 @@ class HsOfficeRelationshipControllerAcceptanceTest {
@Accepts({ "Relationship:X(Access Control)" })
void normalUser_canNotGetUnrelatedRelationship() {
context.define("superuser-alex@hostsharing.net");
final UUID givenRelationshipUuid = findRelationship("First", "Firby").getUuid();
final UUID givenRelationshipUuid = findRelationship("First", "Smith").getUuid();
RestAssured // @formatter:off
.given()
@ -316,7 +324,7 @@ class HsOfficeRelationshipControllerAcceptanceTest {
@Accepts({ "Relationship:X(Access Control)" })
void contactAdminUser_canGetRelatedRelationship() {
context.define("superuser-alex@hostsharing.net");
final var givenRelationship = findRelationship("First", "Firby");
final var givenRelationship = findRelationship("First", "Smith");
assertThat(givenRelationship.getContact().getLabel()).isEqualTo("first contact");
RestAssured // @formatter:off
@ -331,7 +339,7 @@ class HsOfficeRelationshipControllerAcceptanceTest {
.body("", lenientlyEquals("""
{
"relAnchor": { "tradeName": "First GmbH" },
"relHolder": { "familyName": "Firby" },
"relHolder": { "familyName": "Smith" },
"contact": { "label": "first contact" }
}
""")); // @formatter:on
@ -361,7 +369,7 @@ class HsOfficeRelationshipControllerAcceptanceTest {
context.define("superuser-alex@hostsharing.net");
final var givenRelationship = givenSomeTemporaryRelationshipBessler();
assertThat(givenRelationship.getContact().getLabel()).isEqualTo("seventh contact");
final var givenContact = contactRepo.findContactByOptionalLabelLike("fourth").get(0);
final var givenContact = contactRepo.findContactByOptionalLabelLike("forth").get(0);
final var location = RestAssured // @formatter:off
.given()

View File

@ -151,7 +151,7 @@ class HsOfficeRelationshipRepositoryIntegrationTest extends ContextBasedTest {
public void globalAdmin_withoutAssumedRole_canViewAllRelationshipsOfArbitraryPerson() {
// given
context("superuser-alex@hostsharing.net");
final var person = personRepo.findPersonByOptionalNameLike("Second e.K.").stream().findFirst().orElseThrow();
final var person = personRepo.findPersonByOptionalNameLike("Smith").stream().findFirst().orElseThrow();
// when
final var result = relationshipRepo.findRelationshipRelatedToPersonUuid(person.getUuid());
@ -159,7 +159,8 @@ class HsOfficeRelationshipRepositoryIntegrationTest extends ContextBasedTest {
// then
allTheseRelationshipsAreReturned(
result,
"rel(relAnchor='LP Hostsharing eG', relType='PARTNER', relHolder='LP Second e.K.', contact='second contact')",
"rel(relAnchor='LP First GmbH', relType='REPRESENTATIVE', relHolder='NP Smith, Peter', contact='first contact')",
"rel(relAnchor='IF Third OHG', relType='REPRESENTATIVE', relHolder='NP Smith, Peter', contact='third contact')",
"rel(relAnchor='LP Second e.K.', relType='REPRESENTATIVE', relHolder='NP Smith, Peter', contact='second contact')");
}
@ -175,8 +176,7 @@ class HsOfficeRelationshipRepositoryIntegrationTest extends ContextBasedTest {
// then:
exactlyTheseRelationshipsAreReturned(
result,
"rel(relAnchor='LP Hostsharing eG', relType='PARTNER', relHolder='LP First GmbH', contact='first contact')",
"rel(relAnchor='LP First GmbH', relType='REPRESENTATIVE', relHolder='NP Firby, Susan', contact='first contact')");
"rel(relAnchor='LP First GmbH', relType='REPRESENTATIVE', relHolder='NP Smith, Peter', contact='first contact')");
}
}
@ -380,8 +380,8 @@ class HsOfficeRelationshipRepositoryIntegrationTest extends ContextBasedTest {
// then
assertThat(customerLogEntries).map(Arrays::toString).contains(
"[creating relationship test-data HostsharingeG-FirstGmbH, hs_office_relationship, INSERT]",
"[creating relationship test-data FirstGmbH-Firby, hs_office_relationship, INSERT]");
"[creating relationship test-data FirstGmbH-Smith, hs_office_relationship, INSERT]",
"[creating relationship test-data Seconde.K.-Smith, hs_office_relationship, INSERT]");
}
private HsOfficeRelationshipEntity givenSomeTemporaryRelationshipBessler(final String holderPerson, final String contact) {

View File

@ -2,4 +2,3 @@ bp_id;member_id;member_code;member_since;member_until;member_role;author_contrac
17;10017;hsh00-mih;2000-12-06;;Aufsichtsrat;2006-10-15;2001-10-15;false;false;NET;DE-VAT-007
20;10020;hsh00-xyz;2000-12-06;2015-12-31;;;;false;false;GROSS;
22;11022;hsh00-xxx;2021-04-01;;;;;true;true;GROSS;
99;19999;hsh00-zzz;;;;;;false;false;GROSS;

1 bp_id member_id member_code member_since member_until member_role author_contract nondisc_contract free exempt_vat indicator_vat uid_vat
2 17 10017 hsh00-mih 2000-12-06 Aufsichtsrat 2006-10-15 2001-10-15 false false NET DE-VAT-007
3 20 10020 hsh00-xyz 2000-12-06 2015-12-31 false false GROSS
4 22 11022 hsh00-xxx 2021-04-01 true true GROSS
99 19999 hsh00-zzz false false GROSS

View File

@ -8,10 +8,6 @@ contact_id; bp_id; salut; first_name; last_name; title; firma; co; street; zip
1201; 20; Frau; Jenny; Meyer-Billing; Dr.; JM GmbH;; Waldweg 5; 11001; Berlin; DE; +49 30 7777777; +49 30 1111111; ; +49 30 2222222; jm-billing@example.org; billing
1202; 20; Herr; Andrew; Meyer-Operation; ; JM GmbH;; Waldweg 5; 11001; Berlin; DE; +49 30 6666666; +49 30 3333333; ; +49 30 4444444; am-operation@example.org; operation,vip-contact,subscriber:operations-announce
1203; 20; Herr; Philip; Meyer-Contract; ; JM GmbH;; Waldweg 5; 11001; Berlin; DE; +49 30 6666666; +49 30 5555555; ; +49 30 6666666; pm-partner@example.org; partner,contractual,subscriber:members-announce,subscriber:customers-announce
1204; 20; Frau; Tammy; Meyer-VIP; ; JM GmbH;; Waldweg 5; 11001; Berlin; DE; +49 30 999999; +49 30 999999; ; +49 30 6666666; tm-vip@example.org; vip-contact
# eine juristische Person mit nur einem Ansprechpartner und explizitem contractual
1301; 22; ; Petra; Schmidt; ; Test PS;; ; ; ; ; ; ; ; ; ps@example.com; partner,billing,contractual,operation
# eine natürliche Person, die nur Subscriber ist
1401; 17; Frau; Frauke; Fanninga; ; ; ; Am Walde 1; 29456; Hitzacker; DE; ; ; ;; ff@example.org; subscriber:operations-announce

1 contact_id; bp_id; salut; first_name; last_name; title; firma; co; street; zipcode;city; country; phone_private; phone_office; phone_mobile; fax; email; roles
8 1203; 20; Herr; Philip; Meyer-Contract; ; JM GmbH;; Waldweg 5; 11001; Berlin; DE; +49 30 6666666; +49 30 5555555; ; +49 30 6666666; pm-partner@example.org; partner,contractual,subscriber:members-announce,subscriber:customers-announce
9 1204; 20; Frau; Tammy; Meyer-VIP; ; JM GmbH;; Waldweg 5; 11001; Berlin; DE; +49 30 999999; +49 30 999999; ; +49 30 6666666; tm-vip@example.org; vip-contact # eine juristische Person mit nur einem Ansprechpartner und explizitem contractual
10 # eine juristische Person mit nur einem Ansprechpartner und explizitem contractual 1301; 22; ; Petra; Schmidt; ; Test PS;; ; ; ; ; ; ; ; ; ps@example.com; partner,billing,contractual,operation
1301; 22; ; Petra; Schmidt; ; Test PS;; ; ; ; ; ; ; ; ; ps@example.com; partner,billing,contractual,operation
11
12
13