Compare commits
5 Commits
2aeb8fef6f
...
066e19185c
Author | SHA1 | Date | |
---|---|---|---|
|
066e19185c | ||
|
26bb14ebd7 | ||
|
5b5e911030 | ||
|
78b4fce761 | ||
|
f626311273 |
@ -36,7 +36,7 @@ public class HsOfficeContactEntity implements Stringifyable, HasUuid {
|
||||
private String label;
|
||||
|
||||
@Column(name = "postaladdress")
|
||||
private String postalAddress;
|
||||
private String postalAddress; // TODO: check if we really want multiple, if so: JSON-Array or Postgres-Array?
|
||||
|
||||
@Column(name = "emailaddresses", columnDefinition = "json")
|
||||
private String emailAddresses; // TODO: check if we can really add multiple. format: ["eins@...", "zwei@..."]
|
||||
|
@ -7,6 +7,7 @@ components:
|
||||
type: string
|
||||
enum:
|
||||
- UNKNOWN
|
||||
- PARTNER
|
||||
- EX_PARTNER
|
||||
- REPRESENTATIVE,
|
||||
- VIP_CONTACT
|
||||
|
@ -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.', 'Sandra', 'Miller');
|
||||
call createHsOfficePersonTestData('LP', 'Second e.K.', 'Smith', 'Peter');
|
||||
call createHsOfficePersonTestData('IF', 'Third OHG');
|
||||
call createHsOfficePersonTestData('IF', 'Fourth eG');
|
||||
call createHsOfficePersonTestData('UF', 'Erben Bessler', 'Mel', 'Bessler');
|
||||
|
@ -182,7 +182,8 @@ public class ImportOfficeData extends ContextBasedTest {
|
||||
{
|
||||
17=partner(null null, null),
|
||||
20=partner(null null, null),
|
||||
22=partner(null null, null)
|
||||
22=partner(null null, null),
|
||||
99=partner(null null, null)
|
||||
}
|
||||
""");
|
||||
assertThat(toFormattedString(contacts)).isEqualTo("{}");
|
||||
@ -190,7 +191,9 @@ 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)}
|
||||
22=debitor(D-1102200: null null, null: xxx),
|
||||
99=debitor(D-1999900: null null, null: zzz)
|
||||
}
|
||||
""");
|
||||
assertThat(toFormattedString(memberships)).isEqualToIgnoringWhitespace("""
|
||||
{
|
||||
@ -222,7 +225,8 @@ 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)
|
||||
22=partner(?? Test PS: Petra Schmidt , Test PS),
|
||||
99=partner(null null, null)
|
||||
}
|
||||
""");
|
||||
assertThat(toFormattedString(contacts)).isEqualToIgnoringWhitespace("""
|
||||
@ -232,7 +236,9 @@ 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'),
|
||||
1301=contact(label='Petra Schmidt , Test PS', emailAddresses='ps@example.com')
|
||||
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')
|
||||
}
|
||||
""");
|
||||
assertThat(toFormattedString(persons)).isEqualToIgnoringWhitespace("""
|
||||
@ -243,14 +249,17 @@ 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'),
|
||||
1301=person(personType='??', tradeName='Test PS', familyName='Schmidt', givenName='Petra')
|
||||
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')
|
||||
}
|
||||
""");
|
||||
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)
|
||||
22=debitor(D-1102200: ?? Test PS: xxx),
|
||||
99=debitor(D-1999900: null null, null: zzz)
|
||||
}
|
||||
""");
|
||||
assertThat(toFormattedString(memberships)).isEqualToIgnoringWhitespace("""
|
||||
@ -265,17 +274,21 @@ 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='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 ')
|
||||
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')
|
||||
}
|
||||
""");
|
||||
}
|
||||
@ -372,6 +385,73 @@ 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() {
|
||||
|
||||
@ -441,13 +521,13 @@ public class ImportOfficeData extends ContextBasedTest {
|
||||
|
||||
private void persist(final Integer id, final HasUuid entity) {
|
||||
try {
|
||||
System.out.println("persisting #" + entity.hashCode() + ": " + entity.toString());
|
||||
System.out.println("persisting #" + entity.hashCode() + ": " + entity);
|
||||
em.persist(entity);
|
||||
em.flush();
|
||||
System.out.println("persisted #" + entity.hashCode() + " as " + entity.getUuid());
|
||||
} catch (Exception x) {
|
||||
System.out.println("failed to persist: " + entity.toString());
|
||||
throw x;
|
||||
} catch (Exception exc) {
|
||||
System.err.println("failed to persist #" + entity.hashCode() + ": " + entity);
|
||||
System.err.println(exc);
|
||||
}
|
||||
|
||||
}
|
||||
@ -602,8 +682,6 @@ 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()
|
||||
|
@ -23,8 +23,7 @@ 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.is;
|
||||
import static org.hamcrest.Matchers.startsWith;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
|
||||
@SpringBootTest(
|
||||
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
|
||||
@ -66,59 +65,7 @@ class HsOfficePersonControllerAcceptanceTest {
|
||||
.then().log().all().assertThat()
|
||||
.statusCode(200)
|
||||
.contentType("application/json")
|
||||
.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"
|
||||
}
|
||||
]
|
||||
"""
|
||||
));
|
||||
.body("", hasSize(12));
|
||||
// @formatter:on
|
||||
}
|
||||
}
|
||||
|
@ -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., Sandra, Miller, hs_office_person, INSERT]");
|
||||
"[creating person test-data Second e.K., Smith, Peter, hs_office_person, INSERT]");
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
|
@ -35,6 +35,7 @@ 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;
|
||||
|
||||
@ -67,7 +68,7 @@ class HsOfficeRelationshipControllerAcceptanceTest {
|
||||
|
||||
// given
|
||||
context.define("superuser-alex@hostsharing.net");
|
||||
final var givenPerson = personRepo.findPersonByOptionalNameLike("Smith").get(0);
|
||||
final var givenPerson = personRepo.findPersonByOptionalNameLike("Hostsharing eG").get(0);
|
||||
|
||||
RestAssured // @formatter:off
|
||||
.given()
|
||||
@ -75,55 +76,47 @@ class HsOfficeRelationshipControllerAcceptanceTest {
|
||||
.port(port)
|
||||
.when()
|
||||
.get("http://localhost/api/hs/office/relationships?personUuid=%s&relationshipType=%s"
|
||||
.formatted(givenPerson.getUuid(), HsOfficeRelationshipTypeResource.REPRESENTATIVE))
|
||||
.formatted(givenPerson.getUuid(), HsOfficeRelationshipTypeResource.PARTNER))
|
||||
.then().log().all().assertThat()
|
||||
.statusCode(200)
|
||||
.contentType("application/json")
|
||||
.body("", lenientlyEquals("""
|
||||
[
|
||||
{
|
||||
"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" }
|
||||
}
|
||||
]
|
||||
{
|
||||
"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" }
|
||||
}
|
||||
]
|
||||
"""));
|
||||
// @formatter:on
|
||||
}
|
||||
@ -139,7 +132,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("forth").get(0);
|
||||
final var givenContact = contactRepo.findContactByOptionalLabelLike("second").get(0);
|
||||
|
||||
final var location = RestAssured // @formatter:off
|
||||
.given()
|
||||
@ -167,7 +160,7 @@ class HsOfficeRelationshipControllerAcceptanceTest {
|
||||
.body("relType", is("ACCOUNTING"))
|
||||
.body("relAnchor.tradeName", is("Third OHG"))
|
||||
.body("relHolder.givenName", is("Paul"))
|
||||
.body("contact.label", is("fourth contact"))
|
||||
.body("contact.label", is("second contact"))
|
||||
.header("Location", startsWith("http://localhost"))
|
||||
.extract().header("Location"); // @formatter:on
|
||||
|
||||
@ -181,9 +174,9 @@ class HsOfficeRelationshipControllerAcceptanceTest {
|
||||
void globalAdmin_canNotAddRelationship_ifAnchorPersonDoesNotExist() {
|
||||
|
||||
context.define("superuser-alex@hostsharing.net");
|
||||
final var givenAnchorPersonUuid = UUID.fromString("3fa85f64-5717-4562-b3fc-2c963f66afa6");
|
||||
final var givenAnchorPersonUuid = GIVEN_NON_EXISTING_HOLDER_PERSON_UUID;
|
||||
final var givenHolderPerson = personRepo.findPersonByOptionalNameLike("Smith").get(0);
|
||||
final var givenContact = contactRepo.findContactByOptionalLabelLike("forth").get(0);
|
||||
final var givenContact = contactRepo.findContactByOptionalLabelLike("fourth").get(0);
|
||||
|
||||
final var location = RestAssured // @formatter:off
|
||||
.given()
|
||||
@ -206,7 +199,7 @@ class HsOfficeRelationshipControllerAcceptanceTest {
|
||||
.post("http://localhost/api/hs/office/relationships")
|
||||
.then().log().all().assertThat()
|
||||
.statusCode(404)
|
||||
.body("message", is("cannot find relAnchorUuid 3fa85f64-5717-4562-b3fc-2c963f66afa6"));
|
||||
.body("message", is("cannot find relAnchorUuid " + GIVEN_NON_EXISTING_HOLDER_PERSON_UUID));
|
||||
// @formatter:on
|
||||
}
|
||||
|
||||
@ -215,8 +208,7 @@ class HsOfficeRelationshipControllerAcceptanceTest {
|
||||
|
||||
context.define("superuser-alex@hostsharing.net");
|
||||
final var givenAnchorPerson = personRepo.findPersonByOptionalNameLike("Third").get(0);
|
||||
final var givenHolderPersonUuid = UUID.fromString("3fa85f64-5717-4562-b3fc-2c963f66afa6");
|
||||
final var givenContact = contactRepo.findContactByOptionalLabelLike("forth").get(0);
|
||||
final var givenContact = contactRepo.findContactByOptionalLabelLike("fourth").get(0);
|
||||
|
||||
final var location = RestAssured // @formatter:off
|
||||
.given()
|
||||
@ -232,14 +224,14 @@ class HsOfficeRelationshipControllerAcceptanceTest {
|
||||
""".formatted(
|
||||
HsOfficeRelationshipTypeResource.ACCOUNTING,
|
||||
givenAnchorPerson.getUuid(),
|
||||
givenHolderPersonUuid,
|
||||
GIVEN_NON_EXISTING_HOLDER_PERSON_UUID,
|
||||
givenContact.getUuid()))
|
||||
.port(port)
|
||||
.when()
|
||||
.post("http://localhost/api/hs/office/relationships")
|
||||
.then().log().all().assertThat()
|
||||
.statusCode(404)
|
||||
.body("message", is("cannot find relHolderUuid 3fa85f64-5717-4562-b3fc-2c963f66afa6"));
|
||||
.body("message", is("cannot find relHolderUuid " + GIVEN_NON_EXISTING_HOLDER_PERSON_UUID));
|
||||
// @formatter:on
|
||||
}
|
||||
|
||||
@ -284,7 +276,7 @@ class HsOfficeRelationshipControllerAcceptanceTest {
|
||||
@Test
|
||||
void globalAdmin_withoutAssumedRole_canGetArbitraryRelationship() {
|
||||
context.define("superuser-alex@hostsharing.net");
|
||||
final UUID givenRelationshipUuid = findRelationship("First", "Smith").getUuid();
|
||||
final UUID givenRelationshipUuid = findRelationship("First", "Firby").getUuid();
|
||||
|
||||
RestAssured // @formatter:off
|
||||
.given()
|
||||
@ -298,7 +290,7 @@ class HsOfficeRelationshipControllerAcceptanceTest {
|
||||
.body("", lenientlyEquals("""
|
||||
{
|
||||
"relAnchor": { "tradeName": "First GmbH" },
|
||||
"relHolder": { "familyName": "Smith" },
|
||||
"relHolder": { "familyName": "Firby" },
|
||||
"contact": { "label": "first contact" }
|
||||
}
|
||||
""")); // @formatter:on
|
||||
@ -308,7 +300,7 @@ class HsOfficeRelationshipControllerAcceptanceTest {
|
||||
@Accepts({ "Relationship:X(Access Control)" })
|
||||
void normalUser_canNotGetUnrelatedRelationship() {
|
||||
context.define("superuser-alex@hostsharing.net");
|
||||
final UUID givenRelationshipUuid = findRelationship("First", "Smith").getUuid();
|
||||
final UUID givenRelationshipUuid = findRelationship("First", "Firby").getUuid();
|
||||
|
||||
RestAssured // @formatter:off
|
||||
.given()
|
||||
@ -324,7 +316,7 @@ class HsOfficeRelationshipControllerAcceptanceTest {
|
||||
@Accepts({ "Relationship:X(Access Control)" })
|
||||
void contactAdminUser_canGetRelatedRelationship() {
|
||||
context.define("superuser-alex@hostsharing.net");
|
||||
final var givenRelationship = findRelationship("First", "Smith");
|
||||
final var givenRelationship = findRelationship("First", "Firby");
|
||||
assertThat(givenRelationship.getContact().getLabel()).isEqualTo("first contact");
|
||||
|
||||
RestAssured // @formatter:off
|
||||
@ -339,7 +331,7 @@ class HsOfficeRelationshipControllerAcceptanceTest {
|
||||
.body("", lenientlyEquals("""
|
||||
{
|
||||
"relAnchor": { "tradeName": "First GmbH" },
|
||||
"relHolder": { "familyName": "Smith" },
|
||||
"relHolder": { "familyName": "Firby" },
|
||||
"contact": { "label": "first contact" }
|
||||
}
|
||||
""")); // @formatter:on
|
||||
@ -369,7 +361,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("forth").get(0);
|
||||
final var givenContact = contactRepo.findContactByOptionalLabelLike("fourth").get(0);
|
||||
|
||||
final var location = RestAssured // @formatter:off
|
||||
.given()
|
||||
|
@ -151,7 +151,7 @@ class HsOfficeRelationshipRepositoryIntegrationTest extends ContextBasedTest {
|
||||
public void globalAdmin_withoutAssumedRole_canViewAllRelationshipsOfArbitraryPerson() {
|
||||
// given
|
||||
context("superuser-alex@hostsharing.net");
|
||||
final var person = personRepo.findPersonByOptionalNameLike("Smith").stream().findFirst().orElseThrow();
|
||||
final var person = personRepo.findPersonByOptionalNameLike("Second e.K.").stream().findFirst().orElseThrow();
|
||||
|
||||
// when
|
||||
final var result = relationshipRepo.findRelationshipRelatedToPersonUuid(person.getUuid());
|
||||
@ -159,8 +159,7 @@ class HsOfficeRelationshipRepositoryIntegrationTest extends ContextBasedTest {
|
||||
// then
|
||||
allTheseRelationshipsAreReturned(
|
||||
result,
|
||||
"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 Hostsharing eG', relType='PARTNER', relHolder='LP Second e.K.', contact='second contact')",
|
||||
"rel(relAnchor='LP Second e.K.', relType='REPRESENTATIVE', relHolder='NP Smith, Peter', contact='second contact')");
|
||||
}
|
||||
|
||||
@ -176,7 +175,8 @@ class HsOfficeRelationshipRepositoryIntegrationTest extends ContextBasedTest {
|
||||
// then:
|
||||
exactlyTheseRelationshipsAreReturned(
|
||||
result,
|
||||
"rel(relAnchor='LP First GmbH', relType='REPRESENTATIVE', relHolder='NP Smith, Peter', contact='first contact')");
|
||||
"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')");
|
||||
}
|
||||
}
|
||||
|
||||
@ -380,8 +380,8 @@ class HsOfficeRelationshipRepositoryIntegrationTest extends ContextBasedTest {
|
||||
|
||||
// then
|
||||
assertThat(customerLogEntries).map(Arrays::toString).contains(
|
||||
"[creating relationship test-data FirstGmbH-Smith, hs_office_relationship, INSERT]",
|
||||
"[creating relationship test-data Seconde.K.-Smith, hs_office_relationship, INSERT]");
|
||||
"[creating relationship test-data HostsharingeG-FirstGmbH, hs_office_relationship, INSERT]",
|
||||
"[creating relationship test-data FirstGmbH-Firby, hs_office_relationship, INSERT]");
|
||||
}
|
||||
|
||||
private HsOfficeRelationshipEntity givenSomeTemporaryRelationshipBessler(final String holderPerson, final String contact) {
|
||||
|
@ -2,3 +2,4 @@ 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;
|
||||
|
|
@ -8,6 +8,10 @@ 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
|
||||
|
|
Loading…
Reference in New Issue
Block a user