memberNumber as partnerNumber+memberNumberSuffix #13
@ -60,11 +60,11 @@ public class ImportBusinessPartners extends ContextBasedTest {
|
||||
|
||||
@Test
|
||||
@Order(1)
|
||||
void importsBusinessPartners() {
|
||||
void importBusinessPartners() {
|
||||
|
||||
try (Reader reader = resourceReader("migration/business-partners.csv")) {
|
||||
final var records = readAllLines(reader);
|
||||
importsBusinessPartners(records);
|
||||
importBusinessPartners(records);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
@ -72,11 +72,11 @@ public class ImportBusinessPartners extends ContextBasedTest {
|
||||
|
||||
@Test
|
||||
@Order(2)
|
||||
void importsContacts() {
|
||||
void importContacts() {
|
||||
|
||||
try (Reader reader = resourceReader("migration/contacts.csv")) {
|
||||
final var records = readAllLines(reader);
|
||||
importsContacts(records);
|
||||
importContacts(records);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
@ -91,7 +91,9 @@ public class ImportBusinessPartners extends ContextBasedTest {
|
||||
contacts.forEach((id, contact) -> em.persist(contact));
|
||||
persons.forEach((id, person) -> em.persist(person));
|
||||
partners.forEach((id, partner) -> em.persist(partner));
|
||||
});
|
||||
debitors.forEach((id, debitor) -> em.persist(debitor));
|
||||
memberships.forEach((id, membership) -> em.persist(membership));
|
||||
}).assertSuccessful();
|
||||
}
|
||||
|
||||
public List<String[]> readAllLines(Reader reader) throws Exception {
|
||||
@ -109,7 +111,7 @@ public class ImportBusinessPartners extends ContextBasedTest {
|
||||
}
|
||||
}
|
||||
|
||||
private void importsBusinessPartners(final List<String[]> records) {
|
||||
private void importBusinessPartners(final List<String[]> records) {
|
||||
records.stream()
|
||||
.map(this::trimAll)
|
||||
.forEach(record -> {
|
||||
@ -136,6 +138,7 @@ public class ImportBusinessPartners extends ContextBasedTest {
|
||||
.vatBusiness("GROSS".equals(record[10]))
|
||||
.vatId(record[11])
|
||||
.build();
|
||||
debitors.put(toInt(record[0]), debitor);
|
||||
|
||||
partners.put(toInt(record[0]), partner);
|
||||
|
||||
@ -155,7 +158,7 @@ public class ImportBusinessPartners extends ContextBasedTest {
|
||||
});
|
||||
}
|
||||
|
||||
private void importsContacts(final List<String[]> records) {
|
||||
private void importContacts(final List<String[]> records) {
|
||||
records.stream()
|
||||
.map(this::trimAll)
|
||||
.forEach(record -> {
|
||||
@ -171,6 +174,7 @@ public class ImportBusinessPartners extends ContextBasedTest {
|
||||
person.setGivenName(record[4]);
|
||||
|
||||
initContact(partner.getContact(), record);
|
||||
|
||||
} else {
|
||||
initContact(new HsOfficeContactEntity(), record);
|
||||
// TODO: create relationship
|
||||
|
Loading…
Reference in New Issue
Block a user