109 lines
4.3 KiB
Java
109 lines
4.3 KiB
Java
package testdata;
|
|
|
|
import de.accso.flexinale.FlexinaleDistributedApplicationTestdata;
|
|
import de.accso.flexinale.backoffice.application.services.FilmUploadService;
|
|
import de.accso.flexinale.backoffice.application.services.KinoUploadService;
|
|
import de.accso.flexinale.backoffice.application.services.KinoSaalUploadService;
|
|
import de.accso.flexinale.backoffice.application.services.VorfuehrungUploadService;
|
|
import de.accso.flexinale.backoffice.domain.dao.FilmDao;
|
|
import de.accso.flexinale.backoffice.domain.dao.KinoDao;
|
|
import de.accso.flexinale.backoffice.domain.dao.VorfuehrungDao;
|
|
import de.accso.flexinale.common.shared_kernel.DoNotCheckInArchitectureTests;
|
|
import de.accso.flexinale.security.infrastructure.persistence.BenutzerDao;
|
|
import de.accso.flexinale.security.infrastructure.persistence.BenutzerUploadService;
|
|
import org.junit.jupiter.api.Nested;
|
|
import org.junit.jupiter.api.Test;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.boot.test.context.SpringBootTest;
|
|
import org.springframework.test.annotation.DirtiesContext;
|
|
import org.springframework.test.context.ActiveProfiles;
|
|
import org.springframework.test.context.DynamicPropertyRegistry;
|
|
import org.springframework.test.context.DynamicPropertySource;
|
|
|
|
import java.io.IOException;
|
|
|
|
import static testdata.DatabaseConfig.*;
|
|
|
|
@DoNotCheckInArchitectureTests
|
|
@SuppressWarnings("NewClassNamingConvention")
|
|
class AllTestDataLoader {
|
|
|
|
@Nested
|
|
@SpringBootTest(classes = {FlexinaleDistributedApplicationTestdata.class})
|
|
@DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_CLASS)
|
|
@ActiveProfiles({ "testdata", "testdata-backoffice" })
|
|
public class AllDatabaseLoaderForBackoffice {
|
|
@Autowired
|
|
private KinoUploadService kinoUploadService;
|
|
|
|
@Autowired
|
|
private KinoSaalUploadService kinoSaalUploadService;
|
|
|
|
@Autowired
|
|
private FilmUploadService filmUploadService;
|
|
|
|
@Autowired
|
|
private VorfuehrungUploadService vorfuehrungUploadService;
|
|
|
|
@Autowired
|
|
private KinoDao kinoDao;
|
|
|
|
@Autowired
|
|
private FilmDao filmDao;
|
|
|
|
@Autowired
|
|
private VorfuehrungDao vorfuehrungDao;
|
|
|
|
@Autowired
|
|
private BenutzerUploadService benutzerDataLoader;
|
|
|
|
@Autowired
|
|
private BenutzerDao benutzerDao;
|
|
|
|
@DynamicPropertySource // @TestPropertySource would work as well
|
|
static void registerDynamicProperties(DynamicPropertyRegistry registry) {
|
|
registry.add(dataBaseUrlKey, () -> databaseBackoffice);
|
|
registry.add(dataBaseDDLAutoKey, () -> dataBaseDDLAuto_Update);
|
|
}
|
|
|
|
@Test
|
|
public void loadAllBenutzerAndFilmeAndKinosAndVorfuehrungenToDatabase() throws IOException {
|
|
FKKsVTestDataLoader.internal_loadFilmeTestDataAndPersistToDatabase(
|
|
filmUploadService, filmDao);
|
|
FKKsVTestDataLoader.internal_loadKinosAndKinoSaeleTestDataAndPersistToDatabase(
|
|
kinoSaalUploadService, kinoUploadService, kinoDao);
|
|
FKKsVTestDataLoader.internal_loadVorfuehrungenTestDataAndPersistToDatabase(
|
|
vorfuehrungUploadService, vorfuehrungDao);
|
|
}
|
|
|
|
@Test
|
|
public void loadAllBenutzerToDatabase() throws IOException {
|
|
BenutzerTestDataLoader.internal_loadBenutzerTestDataAndPersistToDatabase(
|
|
benutzerDataLoader, benutzerDao);
|
|
}
|
|
}
|
|
|
|
@Nested
|
|
@SpringBootTest(classes = {FlexinaleDistributedApplicationTestdata.class})
|
|
@DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_CLASS)
|
|
@ActiveProfiles({ "testdata", "testdata-besucherportal" })
|
|
public class AllDatabaseLoaderForBesucherportal {
|
|
@Autowired
|
|
private BenutzerUploadService benutzerDataLoader;
|
|
|
|
@Autowired
|
|
private BenutzerDao benutzerDao;
|
|
|
|
@DynamicPropertySource // @TestPropertySource would work as well
|
|
static void registerDynamicProperties(DynamicPropertyRegistry registry) {
|
|
registry.add(dataBaseUrlKey, () -> databaseBesucherportal);
|
|
registry.add(dataBaseDDLAutoKey, () -> dataBaseDDLAuto_Update);
|
|
}
|
|
|
|
@Test
|
|
public void loadAllBenutzerToDatabase() throws IOException {
|
|
BenutzerTestDataLoader.internal_loadBenutzerTestDataAndPersistToDatabase(
|
|
benutzerDataLoader, benutzerDao);
|
|
}
|
|
}
|
|
}
|