Compare commits
5 Commits
90508df42d
...
70621fd482
Author | SHA1 | Date | |
---|---|---|---|
|
70621fd482 | ||
|
e9a8699aa1 | ||
|
1299b4e20a | ||
|
76ad26b747 | ||
|
5162aa0606 |
@ -25,11 +25,14 @@ import static net.hostsharing.hsadminng.stringify.Stringify.stringify;
|
|||||||
@DisplayName("Debitor")
|
@DisplayName("Debitor")
|
||||||
public class HsOfficeDebitorEntity implements Stringifyable {
|
public class HsOfficeDebitorEntity implements Stringifyable {
|
||||||
|
|
||||||
|
// TODO: I would rather like to generate something matching this example:
|
||||||
|
// debitor(1234500: Test AG, tes)
|
||||||
|
// maybe remove withSepararator (always use ', ') and add withBusinessIdProp (with ': ' afterwards)?
|
||||||
private static Stringify<HsOfficeDebitorEntity> stringify =
|
private static Stringify<HsOfficeDebitorEntity> stringify =
|
||||||
stringify(HsOfficeDebitorEntity.class, "debitor")
|
stringify(HsOfficeDebitorEntity.class, "debitor")
|
||||||
.withProp(HsOfficeDebitorEntity::getDebitorNumber)
|
.withProp(HsOfficeDebitorEntity::getDebitorNumber)
|
||||||
.withProp(HsOfficeDebitorEntity::getPartner)
|
.withProp(HsOfficeDebitorEntity::getPartner)
|
||||||
// TODO: add defaultPrefix?
|
.withProp(HsOfficeDebitorEntity::getDefaultPrefix)
|
||||||
.withSeparator(": ")
|
.withSeparator(": ")
|
||||||
.quotedValues(false);
|
.quotedValues(false);
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
create table if not exists hs_office_contact
|
create table if not exists hs_office_contact
|
||||||
(
|
(
|
||||||
uuid uuid unique references RbacObject (uuid) initially deferred,
|
uuid uuid unique references RbacObject (uuid) initially deferred,
|
||||||
label varchar(96) not null,
|
label varchar(128) not null,
|
||||||
postalAddress text,
|
postalAddress text,
|
||||||
emailAddresses text, -- TODO.feat: change to json
|
emailAddresses text, -- TODO.feat: change to json
|
||||||
phoneNumbers text -- TODO.feat: change to json
|
phoneNumbers text -- TODO.feat: change to json
|
||||||
|
@ -26,9 +26,6 @@ create or replace function createRbacRolesForHsOfficeContact()
|
|||||||
returns trigger
|
returns trigger
|
||||||
language plpgsql
|
language plpgsql
|
||||||
strict as $$
|
strict as $$
|
||||||
declare
|
|
||||||
ownerRole uuid;
|
|
||||||
adminRole uuid;
|
|
||||||
begin
|
begin
|
||||||
if TG_OP <> 'INSERT' then
|
if TG_OP <> 'INSERT' then
|
||||||
raise exception 'invalid usage of TRIGGER AFTER INSERT';
|
raise exception 'invalid usage of TRIGGER AFTER INSERT';
|
||||||
|
@ -22,11 +22,12 @@ class HsOfficeDebitorEntityUnitTest {
|
|||||||
.debitorNumberPrefix(12345)
|
.debitorNumberPrefix(12345)
|
||||||
.build())
|
.build())
|
||||||
.billingContact(HsOfficeContactEntity.builder().label("some label").build())
|
.billingContact(HsOfficeContactEntity.builder().label("some label").build())
|
||||||
|
.defaultPrefix("som")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
final var result = given.toString();
|
final var result = given.toString();
|
||||||
|
|
||||||
assertThat(result).isEqualTo("debitor(1234567: some trade name)");
|
assertThat(result).isEqualTo("debitor(1234567: some trade name: som)");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -215,9 +215,9 @@ class HsOfficeDebitorRepositoryIntegrationTest extends ContextBasedTest {
|
|||||||
// then
|
// then
|
||||||
allTheseDebitorsAreReturned(
|
allTheseDebitorsAreReturned(
|
||||||
result,
|
result,
|
||||||
"debitor(1000111: First GmbH)",
|
"debitor(1000111: First GmbH: fir)",
|
||||||
"debitor(1000212: Second e.K.)",
|
"debitor(1000212: Second e.K.: sec)",
|
||||||
"debitor(1000313: Third OHG)");
|
"debitor(1000313: Third OHG: thi)");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ParameterizedTest
|
@ParameterizedTest
|
||||||
@ -234,7 +234,9 @@ class HsOfficeDebitorRepositoryIntegrationTest extends ContextBasedTest {
|
|||||||
final var result = debitorRepo.findDebitorByOptionalNameLike(null);
|
final var result = debitorRepo.findDebitorByOptionalNameLike(null);
|
||||||
|
|
||||||
// then:
|
// then:
|
||||||
exactlyTheseDebitorsAreReturned(result, "debitor(1000111: First GmbH)", "debitor(1000120: First GmbH)");
|
exactlyTheseDebitorsAreReturned(result,
|
||||||
|
"debitor(1000111: First GmbH: fir)",
|
||||||
|
"debitor(1000120: First GmbH: fif)");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -262,8 +264,7 @@ class HsOfficeDebitorRepositoryIntegrationTest extends ContextBasedTest {
|
|||||||
final var result = debitorRepo.findDebitorByDebitorNumber(1000313);
|
final var result = debitorRepo.findDebitorByDebitorNumber(1000313);
|
||||||
|
|
||||||
// then
|
// then
|
||||||
// exactlyTheseDebitorsAreReturned(result, "debitor(1000313: Third OHG)", "debitor(1000413: Fourth e.G.)");
|
exactlyTheseDebitorsAreReturned(result, "debitor(1000313: Third OHG: thi)");
|
||||||
exactlyTheseDebitorsAreReturned(result, "debitor(1000313: Third OHG)");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -279,7 +280,7 @@ class HsOfficeDebitorRepositoryIntegrationTest extends ContextBasedTest {
|
|||||||
final var result = debitorRepo.findDebitorByOptionalNameLike("third contact");
|
final var result = debitorRepo.findDebitorByOptionalNameLike("third contact");
|
||||||
|
|
||||||
// then
|
// then
|
||||||
exactlyTheseDebitorsAreReturned(result, "debitor(1000313: Third OHG)");
|
exactlyTheseDebitorsAreReturned(result, "debitor(1000313: Third OHG: thi)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,11 +56,15 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||||||
* which reads CSV files from the file system.
|
* which reads CSV files from the file system.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@DataJpaTest
|
@Disabled
|
||||||
|
@DataJpaTest(properties = "spring.datasource.url=jdbc:postgresql://localhost:5432/postgres")
|
||||||
@Import({ Context.class, JpaAttempt.class })
|
@Import({ Context.class, JpaAttempt.class })
|
||||||
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
|
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
|
||||||
public class ImportOfficeTables extends ContextBasedTest {
|
public class ImportOfficeTables extends ContextBasedTest {
|
||||||
|
|
||||||
|
// TODO: use real rbacSuperuser for actual import
|
||||||
|
private static final String rbacSuperuser = "superuser-alex@hostsharing.net";
|
||||||
|
|
||||||
private static NavigableMap<Integer, HsOfficeContactEntity> contacts = new TreeMap<>();
|
private static NavigableMap<Integer, HsOfficeContactEntity> contacts = new TreeMap<>();
|
||||||
private static NavigableMap<Integer, HsOfficePersonEntity> persons = new TreeMap<>();
|
private static NavigableMap<Integer, HsOfficePersonEntity> persons = new TreeMap<>();
|
||||||
private static NavigableMap<Integer, HsOfficePartnerEntity> partners = new TreeMap<>();
|
private static NavigableMap<Integer, HsOfficePartnerEntity> partners = new TreeMap<>();
|
||||||
@ -105,9 +109,9 @@ public class ImportOfficeTables extends ContextBasedTest {
|
|||||||
assertThat(contacts.toString()).isEqualTo("{}");
|
assertThat(contacts.toString()).isEqualTo("{}");
|
||||||
assertThat(debitors.toString()).isEqualToIgnoringWhitespace("""
|
assertThat(debitors.toString()).isEqualToIgnoringWhitespace("""
|
||||||
{
|
{
|
||||||
7=debitor(1000700: null, null),
|
7=debitor(1000700: null, null: mih),
|
||||||
10=debitor(1001000: null, null),
|
10=debitor(1001000: null, null: xyz),
|
||||||
12=debitor(1101200: null, null)}
|
12=debitor(1101200: null, null: xxx)}
|
||||||
""");
|
""");
|
||||||
assertThat(memberships.toString()).isEqualToIgnoringWhitespace("""
|
assertThat(memberships.toString()).isEqualToIgnoringWhitespace("""
|
||||||
{
|
{
|
||||||
@ -133,7 +137,7 @@ public class ImportOfficeTables extends ContextBasedTest {
|
|||||||
{
|
{
|
||||||
7=partner(Mellies, Michael: Herr Michael Mellies ),
|
7=partner(Mellies, Michael: Herr Michael Mellies ),
|
||||||
10=partner(JM e.K.: Frau Dr. Jenny Meyer , JM e.K.),
|
10=partner(JM e.K.: Frau Dr. Jenny Meyer , JM e.K.),
|
||||||
12=partner(Test PS: Paule Schmidt , Test PS)
|
12=partner(Test PS: Petra Schmidt , Test PS)
|
||||||
}
|
}
|
||||||
""");
|
""");
|
||||||
assertThat(contacts.toString()).isEqualToIgnoringWhitespace("""
|
assertThat(contacts.toString()).isEqualToIgnoringWhitespace("""
|
||||||
@ -141,21 +145,21 @@ public class ImportOfficeTables extends ContextBasedTest {
|
|||||||
71=contact(label='Herr Michael Mellies ', emailAddresses='mih@example.org'),
|
71=contact(label='Herr Michael Mellies ', emailAddresses='mih@example.org'),
|
||||||
101=contact(label='Frau Dr. Jenny Meyer , JM e.K.', emailAddresses='jm@example.org'),
|
101=contact(label='Frau Dr. Jenny Meyer , JM e.K.', emailAddresses='jm@example.org'),
|
||||||
102=contact(label='Herr Andrew Meyer , JM e.K.', emailAddresses='am@example.org'),
|
102=contact(label='Herr Andrew Meyer , JM e.K.', emailAddresses='am@example.org'),
|
||||||
121=contact(label='Paule Schmidt , Test PS', emailAddresses='ps@example.com')
|
121=contact(label='Petra Schmidt , Test PS', emailAddresses='ps@example.com')
|
||||||
}
|
}
|
||||||
""");
|
""");
|
||||||
assertThat(persons.toString()).isEqualToIgnoringWhitespace("""
|
assertThat(persons.toString()).isEqualToIgnoringWhitespace("""
|
||||||
{
|
{
|
||||||
7=person(personType='UNKNOWN', tradeName='', familyName='Mellies', givenName='Michael'),
|
7=person(personType='UNKNOWN', tradeName='', familyName='Mellies', givenName='Michael'),
|
||||||
10=person(personType='UNKNOWN', tradeName='JM e.K.', familyName='Meyer', givenName='Jenny'),
|
10=person(personType='UNKNOWN', tradeName='JM e.K.', familyName='Meyer', givenName='Jenny'),
|
||||||
12=person(personType='UNKNOWN', tradeName='Test PS', familyName='Schmidt', givenName='Paule')
|
12=person(personType='UNKNOWN', tradeName='Test PS', familyName='Schmidt', givenName='Petra')
|
||||||
}
|
}
|
||||||
""");
|
""");
|
||||||
assertThat(debitors.toString()).isEqualToIgnoringWhitespace("""
|
assertThat(debitors.toString()).isEqualToIgnoringWhitespace("""
|
||||||
{
|
{
|
||||||
7=debitor(1000700: Mellies, Michael),
|
7=debitor(1000700: Mellies, Michael: mih),
|
||||||
10=debitor(1001000: JM e.K.),
|
10=debitor(1001000: JM e.K.: xyz),
|
||||||
12=debitor(1101200: Test PS)
|
12=debitor(1101200: Test PS: xxx)
|
||||||
}
|
}
|
||||||
""");
|
""");
|
||||||
assertThat(memberships.toString()).isEqualToIgnoringWhitespace("""
|
assertThat(memberships.toString()).isEqualToIgnoringWhitespace("""
|
||||||
@ -241,36 +245,133 @@ public class ImportOfficeTables extends ContextBasedTest {
|
|||||||
@Test
|
@Test
|
||||||
@Order(10)
|
@Order(10)
|
||||||
@Commit
|
@Commit
|
||||||
//@Rollback(false)
|
|
||||||
void persistEntities() {
|
void persistEntities() {
|
||||||
|
|
||||||
context("superuser-alex@hostsharing.net"); // TODO: use real user for actual import
|
deleteTestDataFromHsOfficeTables();
|
||||||
|
resetFromHsOfficeSequences();
|
||||||
|
deleteFromTestTables();
|
||||||
|
deleteFromRbacTables();
|
||||||
|
|
||||||
|
jpaAttempt.transacted(() -> {
|
||||||
|
context(rbacSuperuser);
|
||||||
contacts.forEach((id, contact) -> em.persist(contact));
|
contacts.forEach((id, contact) -> em.persist(contact));
|
||||||
updateLegacyIds(contacts, "hs_office_contact_legacy_id", "contact_id");
|
updateLegacyIds(contacts, "hs_office_contact_legacy_id", "contact_id");
|
||||||
|
}).assertSuccessful();
|
||||||
|
|
||||||
|
jpaAttempt.transacted(() -> {
|
||||||
|
context(rbacSuperuser);
|
||||||
persons.forEach((id, person) -> em.persist(person));
|
persons.forEach((id, person) -> em.persist(person));
|
||||||
|
}).assertSuccessful();
|
||||||
|
|
||||||
|
jpaAttempt.transacted(() -> {
|
||||||
|
context(rbacSuperuser);
|
||||||
partners.forEach((id, partner) -> em.persist(partner));
|
partners.forEach((id, partner) -> em.persist(partner));
|
||||||
updateLegacyIds(partners, "hs_office_partner_legacy_id", "bp_id");
|
updateLegacyIds(partners, "hs_office_partner_legacy_id", "bp_id");
|
||||||
|
}).assertSuccessful();
|
||||||
|
|
||||||
|
jpaAttempt.transacted(() -> {
|
||||||
|
context(rbacSuperuser);
|
||||||
debitors.forEach((id, debitor) -> em.persist(debitor));
|
debitors.forEach((id, debitor) -> em.persist(debitor));
|
||||||
|
}).assertSuccessful();
|
||||||
|
|
||||||
|
jpaAttempt.transacted(() -> {
|
||||||
|
context(rbacSuperuser);
|
||||||
memberships.forEach((id, membership) -> em.persist(membership));
|
memberships.forEach((id, membership) -> em.persist(membership));
|
||||||
|
|
||||||
|
}).assertSuccessful();
|
||||||
|
|
||||||
|
jpaAttempt.transacted(() -> {
|
||||||
|
context(rbacSuperuser);
|
||||||
bankAccounts.forEach((id, account) -> em.persist(account));
|
bankAccounts.forEach((id, account) -> em.persist(account));
|
||||||
|
|
||||||
|
}).assertSuccessful();
|
||||||
|
|
||||||
|
jpaAttempt.transacted(() -> {
|
||||||
|
context(rbacSuperuser);
|
||||||
sepaMandates.forEach((id, mandate) -> em.persist(mandate));
|
sepaMandates.forEach((id, mandate) -> em.persist(mandate));
|
||||||
updateLegacyIds(sepaMandates, "hs_office_sepamandate_legacy_id", "sepa_mandate_id");
|
updateLegacyIds(sepaMandates, "hs_office_sepamandate_legacy_id", "sepa_mandate_id");
|
||||||
|
|
||||||
|
}).assertSuccessful();
|
||||||
|
|
||||||
|
jpaAttempt.transacted(() -> {
|
||||||
|
context(rbacSuperuser);
|
||||||
coopShares.forEach((id, shareTransaction) -> em.persist(shareTransaction));
|
coopShares.forEach((id, shareTransaction) -> em.persist(shareTransaction));
|
||||||
updateLegacyIds(coopShares, "hs_office_coopsharestransaction_legacy_id", "member_share_id");
|
updateLegacyIds(coopShares, "hs_office_coopsharestransaction_legacy_id", "member_share_id");
|
||||||
|
|
||||||
|
}).assertSuccessful();
|
||||||
|
|
||||||
|
jpaAttempt.transacted(() -> {
|
||||||
|
context(rbacSuperuser);
|
||||||
coopAssets.forEach((id, assetTransaction) -> em.persist(assetTransaction));
|
coopAssets.forEach((id, assetTransaction) -> em.persist(assetTransaction));
|
||||||
updateLegacyIds(coopShares, "hs_office_coopassetstransaction_legacy_id", "member_asset_id");
|
updateLegacyIds(coopShares, "hs_office_coopassetstransaction_legacy_id", "member_asset_id");
|
||||||
|
}).assertSuccessful();
|
||||||
|
|
||||||
em.flush();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private <E extends HasUuid> void updateLegacyIds(Map<Integer, E> entities, final String legacyIdTable, final String legacyIdColumn) {
|
private void deleteTestDataFromHsOfficeTables() {
|
||||||
|
jpaAttempt.transacted(() -> {
|
||||||
|
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_legacy_id WHERE true").executeUpdate();
|
||||||
|
em.createNativeQuery("DELETE FROM hs_office_coopsharestransaction WHERE true").executeUpdate();
|
||||||
|
em.createNativeQuery("DELETE FROM hs_office_coopsharestransaction_legacy_id WHERE true").executeUpdate();
|
||||||
|
em.createNativeQuery("DELETE FROM hs_office_membership WHERE true").executeUpdate();
|
||||||
|
em.createNativeQuery("DELETE FROM hs_office_sepamandate WHERE true").executeUpdate();
|
||||||
|
em.createNativeQuery("DELETE FROM hs_office_sepamandate_legacy_id WHERE true").executeUpdate();
|
||||||
|
em.createNativeQuery("DELETE FROM hs_office_debitor 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_details WHERE true").executeUpdate();
|
||||||
|
em.createNativeQuery("DELETE FROM hs_office_contact WHERE true").executeUpdate();
|
||||||
|
em.createNativeQuery("DELETE FROM hs_office_person WHERE true").executeUpdate();
|
||||||
|
}).assertSuccessful();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void resetFromHsOfficeSequences() {
|
||||||
|
jpaAttempt.transacted(() -> {
|
||||||
|
context(rbacSuperuser);
|
||||||
|
em.createNativeQuery("ALTER SEQUENCE hs_office_contact_legacy_id_seq RESTART WITH 1000000000;").executeUpdate();
|
||||||
|
em.createNativeQuery("ALTER SEQUENCE hs_office_coopassetstransaction_legacy_id_seq RESTART WITH 1000000000;").executeUpdate();
|
||||||
|
em.createNativeQuery("ALTER SEQUENCE public.hs_office_coopsharestransaction_legacy_id_seq RESTART WITH 1000000000;").executeUpdate();
|
||||||
|
em.createNativeQuery("ALTER SEQUENCE public.hs_office_partner_legacy_id_seq RESTART WITH 1000000000;").executeUpdate();
|
||||||
|
em.createNativeQuery("ALTER SEQUENCE public.hs_office_sepamandate_legacy_id_seq RESTART WITH 1000000000;").executeUpdate();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void deleteFromTestTables() {
|
||||||
|
jpaAttempt.transacted(() -> {
|
||||||
|
context(rbacSuperuser);
|
||||||
|
em.createNativeQuery("DELETE FROM test_domain WHERE true").executeUpdate();
|
||||||
|
em.createNativeQuery("DELETE FROM test_package WHERE true").executeUpdate();
|
||||||
|
em.createNativeQuery("DELETE FROM test_customer WHERE true").executeUpdate();
|
||||||
|
}).assertSuccessful();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void deleteFromRbacTables() {
|
||||||
|
jpaAttempt.transacted(() -> {
|
||||||
|
context(rbacSuperuser);
|
||||||
|
final var usersNotToDelete = em.createNativeQuery("SELECT name FROM rbacuser WHERE name like 'superuser-%'").getResultList();
|
||||||
|
final var usersToDelete = em.createNativeQuery("SELECT name FROM rbacuser WHERE name not like 'superuser-%'").getResultList();
|
||||||
|
System.getenv();
|
||||||
|
});
|
||||||
|
|
||||||
|
jpaAttempt.transacted(() -> {
|
||||||
|
context(rbacSuperuser);
|
||||||
|
// em.createNativeQuery("DELETE FROM rbacobject WHERE objecttable like 'hs_%'").executeUpdate();
|
||||||
|
// em.createNativeQuery("DELETE FROM rbacgrants WHERE true").executeUpdate();
|
||||||
|
// em.createNativeQuery("DELETE FROM rbacpermission WHERE true").executeUpdate();
|
||||||
|
// em.createNativeQuery("DELETE FROM rbacreference WHERE true").executeUpdate();
|
||||||
|
em.createNativeQuery("DELETE FROM rbacuser_rv WHERE name not like 'superuser-%'").executeUpdate();
|
||||||
|
em.createNativeQuery("DELETE FROM tx_journal WHERE true").executeUpdate();
|
||||||
|
em.createNativeQuery("DELETE FROM tx_context WHERE true").executeUpdate();
|
||||||
|
}).assertSuccessful();
|
||||||
|
}
|
||||||
|
|
||||||
|
private <E extends HasUuid> void updateLegacyIds(
|
||||||
|
Map<Integer, E> entities,
|
||||||
|
final String legacyIdTable,
|
||||||
|
final String legacyIdColumn) {
|
||||||
entities.forEach((id, entity) -> em.createNativeQuery("""
|
entities.forEach((id, entity) -> em.createNativeQuery("""
|
||||||
UPDATE ${legacyIdTable}
|
UPDATE ${legacyIdTable}
|
||||||
SET ${legacyIdColumn} = :legacyId
|
SET ${legacyIdColumn} = :legacyId
|
||||||
@ -338,7 +439,9 @@ public class ImportOfficeTables extends ContextBasedTest {
|
|||||||
final var membership = HsOfficeMembershipEntity.builder()
|
final var membership = HsOfficeMembershipEntity.builder()
|
||||||
.partner(partner)
|
.partner(partner)
|
||||||
.memberNumber(rec.getInteger("member_id"))
|
.memberNumber(rec.getInteger("member_id"))
|
||||||
.validity(toPostgresDateRange(rec.getLocalDate("member_since"), rec.getLocalDate("member_until")))
|
.validity(toPostgresDateRange(
|
||||||
|
rec.getLocalDate("member_since"),
|
||||||
|
rec.getLocalDate("member_until")))
|
||||||
.membershipFeeBillable(rec.isEmpty("member_role"))
|
.membershipFeeBillable(rec.isEmpty("member_role"))
|
||||||
.reasonForTermination(
|
.reasonForTermination(
|
||||||
isBlank(rec.getString("member_until"))
|
isBlank(rec.getString("member_until"))
|
||||||
@ -390,6 +493,7 @@ public class ImportOfficeTables extends ContextBasedTest {
|
|||||||
final var member = memberships.get(rec.getInteger("bp_id"));
|
final var member = memberships.get(rec.getInteger("bp_id"));
|
||||||
|
|
||||||
final var assetTypeMapping = new HashMap<String, HsOfficeCoopAssetsTransactionType>() {
|
final var assetTypeMapping = new HashMap<String, HsOfficeCoopAssetsTransactionType>() {
|
||||||
|
|
||||||
{
|
{
|
||||||
put("HANDOVER", HsOfficeCoopAssetsTransactionType.TRANSFER);
|
put("HANDOVER", HsOfficeCoopAssetsTransactionType.TRANSFER);
|
||||||
put("ADOPTION", HsOfficeCoopAssetsTransactionType.ADOPTION);
|
put("ADOPTION", HsOfficeCoopAssetsTransactionType.ADOPTION);
|
||||||
@ -481,7 +585,12 @@ public class ImportOfficeTables extends ContextBasedTest {
|
|||||||
private void initContact(final HsOfficeContactEntity contact, final Record rec) {
|
private void initContact(final HsOfficeContactEntity contact, final Record rec) {
|
||||||
contacts.put(rec.getInteger("contact_id"), contact);
|
contacts.put(rec.getInteger("contact_id"), contact);
|
||||||
|
|
||||||
contact.setLabel(toLabel(rec.getString("salut"), rec.getString("title"), rec.getString("first_name"), rec.getString("last_name"), rec.getString("firma")));
|
contact.setLabel(toLabel(
|
||||||
|
rec.getString("salut"),
|
||||||
|
rec.getString("title"),
|
||||||
|
rec.getString("first_name"),
|
||||||
|
rec.getString("last_name"),
|
||||||
|
rec.getString("firma")));
|
||||||
contact.setEmailAddresses(rec.getString("email"));
|
contact.setEmailAddresses(rec.getString("email"));
|
||||||
contact.setPostalAddress(toAddress(rec));
|
contact.setPostalAddress(toAddress(rec));
|
||||||
contact.setPhoneNumbers(toPhoneNumbers(rec));
|
contact.setPhoneNumbers(toPhoneNumbers(rec));
|
||||||
@ -495,6 +604,7 @@ public class ImportOfficeTables extends ContextBasedTest {
|
|||||||
}
|
}
|
||||||
return record;
|
return record;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String toPhoneNumbers(final Record rec) {
|
private String toPhoneNumbers(final Record rec) {
|
||||||
final var result = new StringBuilder("{\n");
|
final var result = new StringBuilder("{\n");
|
||||||
if (isNotBlank(rec.getString("phone_private")))
|
if (isNotBlank(rec.getString("phone_private")))
|
||||||
@ -510,7 +620,11 @@ public class ImportOfficeTables extends ContextBasedTest {
|
|||||||
|
|
||||||
private String toAddress(final Record rec) {
|
private String toAddress(final Record rec) {
|
||||||
final var result = new StringBuilder();
|
final var result = new StringBuilder();
|
||||||
final var name = toName(rec.getString("salut"), rec.getString("title"), rec.getString("first_name"), rec.getString("last_name"));
|
final var name = toName(
|
||||||
|
rec.getString("salut"),
|
||||||
|
rec.getString("title"),
|
||||||
|
rec.getString("first_name"),
|
||||||
|
rec.getString("last_name"));
|
||||||
if (isNotBlank(name))
|
if (isNotBlank(name))
|
||||||
result.append(name + "\n");
|
result.append(name + "\n");
|
||||||
if (isNotBlank(rec.getString("firma")))
|
if (isNotBlank(rec.getString("firma")))
|
||||||
@ -561,7 +675,6 @@ public class ImportOfficeTables extends ContextBasedTest {
|
|||||||
return toLabel(salut, title, firstname, lastname, null);
|
return toLabel(salut, title, firstname, lastname, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private Reader resourceReader(@NotNull final String resourcePath) {
|
private Reader resourceReader(@NotNull final String resourcePath) {
|
||||||
return new InputStreamReader(getClass().getClassLoader().getResourceAsStream(resourcePath));
|
return new InputStreamReader(getClass().getClassLoader().getResourceAsStream(resourcePath));
|
||||||
}
|
}
|
||||||
|
@ -376,7 +376,7 @@ class HsOfficeSepaMandateControllerAcceptanceTest {
|
|||||||
context.define("superuser-alex@hostsharing.net");
|
context.define("superuser-alex@hostsharing.net");
|
||||||
assertThat(sepaMandateRepo.findByUuid(givenSepaMandate.getUuid())).isPresent().get()
|
assertThat(sepaMandateRepo.findByUuid(givenSepaMandate.getUuid())).isPresent().get()
|
||||||
.matches(mandate -> {
|
.matches(mandate -> {
|
||||||
assertThat(mandate.getDebitor().toString()).isEqualTo("debitor(1000111: First GmbH)");
|
assertThat(mandate.getDebitor().toString()).isEqualTo("debitor(1000111: First GmbH: fir)");
|
||||||
assertThat(mandate.getBankAccount().toShortString()).isEqualTo("First GmbH");
|
assertThat(mandate.getBankAccount().toShortString()).isEqualTo("First GmbH");
|
||||||
assertThat(mandate.getReference()).isEqualTo("temp ref CAT Z - patched");
|
assertThat(mandate.getReference()).isEqualTo("temp ref CAT Z - patched");
|
||||||
assertThat(mandate.getValidFrom()).isEqualTo("2020-06-05");
|
assertThat(mandate.getValidFrom()).isEqualTo("2020-06-05");
|
||||||
@ -417,7 +417,7 @@ class HsOfficeSepaMandateControllerAcceptanceTest {
|
|||||||
// finally, the sepaMandate is actually updated
|
// finally, the sepaMandate is actually updated
|
||||||
assertThat(sepaMandateRepo.findByUuid(givenSepaMandate.getUuid())).isPresent().get()
|
assertThat(sepaMandateRepo.findByUuid(givenSepaMandate.getUuid())).isPresent().get()
|
||||||
.matches(mandate -> {
|
.matches(mandate -> {
|
||||||
assertThat(mandate.getDebitor().toString()).isEqualTo("debitor(1000111: First GmbH)");
|
assertThat(mandate.getDebitor().toString()).isEqualTo("debitor(1000111: First GmbH: fir)");
|
||||||
assertThat(mandate.getBankAccount().toShortString()).isEqualTo("First GmbH");
|
assertThat(mandate.getBankAccount().toShortString()).isEqualTo("First GmbH");
|
||||||
assertThat(mandate.getReference()).isEqualTo("temp ref CAT Z");
|
assertThat(mandate.getReference()).isEqualTo("temp ref CAT Z");
|
||||||
assertThat(mandate.getValidity().asString()).isEqualTo("[2022-11-01,2023-01-01)");
|
assertThat(mandate.getValidity().asString()).isEqualTo("[2022-11-01,2023-01-01)");
|
||||||
|
@ -2,4 +2,4 @@ contact_id; bp_id; salut; first_name; last_name; title; firma; co; street; zip
|
|||||||
71; 7; Herr; Michael; Mellies; ; ; ; Kleine Freiheit 50; 26524; Hage; DE; ; +49 4931 123456; +49 1522 123456;; mih@example.org; billing,operation
|
71; 7; Herr; Michael; Mellies; ; ; ; Kleine Freiheit 50; 26524; Hage; DE; ; +49 4931 123456; +49 1522 123456;; mih@example.org; billing,operation
|
||||||
101; 10; Frau; Jenny; Meyer; Dr.; JM e.K.;; Waldweg 5; 11001; Berlin; DE; +49 30 7777777; +49 30 8888888; ; +49 30 9999999; jm@example.org; billing
|
101; 10; Frau; Jenny; Meyer; Dr.; JM e.K.;; Waldweg 5; 11001; Berlin; DE; +49 30 7777777; +49 30 8888888; ; +49 30 9999999; jm@example.org; billing
|
||||||
102; 10; Herr; Andrew; Meyer; ; JM e.K.;; Waldweg 5; 11001; Berlin; DE; +49 30 6666666; +49 30 5555555; ; +49 30 9999999; am@example.org; operation
|
102; 10; Herr; Andrew; Meyer; ; JM e.K.;; Waldweg 5; 11001; Berlin; DE; +49 30 6666666; +49 30 5555555; ; +49 30 9999999; am@example.org; operation
|
||||||
121; 12; ; Paule; Schmidt; ; Test PS;; ; ; ; ; ; ; ; ; ps@example.com; billing,operation
|
121; 12; ; Petra; Schmidt; ; Test PS;; ; ; ; ; ; ; ; ; ps@example.com; billing,operation
|
||||||
|
|
Loading…
Reference in New Issue
Block a user