use test database
This commit is contained in:
parent
e1dd9b08c2
commit
a4c1614939
@ -24,6 +24,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
|
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
|
||||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||||
import org.springframework.context.annotation.Import;
|
import org.springframework.context.annotation.Import;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import jakarta.persistence.EntityManager;
|
import jakarta.persistence.EntityManager;
|
||||||
import jakarta.persistence.PersistenceContext;
|
import jakarta.persistence.PersistenceContext;
|
||||||
@ -170,9 +171,9 @@ public class ImportBusinessPartners extends ContextBasedTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Order(10)
|
@Order(10)
|
||||||
|
@Transactional
|
||||||
void persistEntities() {
|
void persistEntities() {
|
||||||
jpaAttempt.transacted(() -> {
|
context("superuser-alex@hostsharing.net"); // TODO: use real user for actual import
|
||||||
context("superuser-alex@hostsharing.net"); // TODO: use real user
|
|
||||||
|
|
||||||
contacts.forEach((id, contact) -> em.persist(contact));
|
contacts.forEach((id, contact) -> em.persist(contact));
|
||||||
persons.forEach((id, person) -> em.persist(person));
|
persons.forEach((id, person) -> em.persist(person));
|
||||||
@ -181,7 +182,8 @@ public class ImportBusinessPartners extends ContextBasedTest {
|
|||||||
memberships.forEach((id, membership) -> em.persist(membership));
|
memberships.forEach((id, membership) -> em.persist(membership));
|
||||||
bankAccounts.forEach((id, account) -> em.persist(account));
|
bankAccounts.forEach((id, account) -> em.persist(account));
|
||||||
sepaMandates.forEach((id, mandate) -> em.persist(mandate));
|
sepaMandates.forEach((id, mandate) -> em.persist(mandate));
|
||||||
}).assertSuccessful();
|
|
||||||
|
em.flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String[]> readAllLines(Reader reader) throws Exception {
|
public List<String[]> readAllLines(Reader reader) throws Exception {
|
||||||
|
@ -4,8 +4,8 @@ spring:
|
|||||||
platform: postgres
|
platform: postgres
|
||||||
|
|
||||||
datasource:
|
datasource:
|
||||||
url-tc: jdbc:tc:postgresql:13.7-bullseye:///spring_boot_testcontainers
|
url: jdbc:tc:postgresql:13.7-bullseye:///spring_boot_testcontainers
|
||||||
url: jdbc:postgresql://localhost:5432/postgres
|
url-local: jdbc:postgresql://localhost:5432/postgres
|
||||||
username: postgres
|
username: postgres
|
||||||
password: password
|
password: password
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user