|
| 1 | +package software.xdev.spring.data.eclipse.store.demo.dual.storage; |
| 2 | + |
| 3 | +import java.io.File; |
| 4 | + |
| 5 | +import org.junit.jupiter.api.BeforeAll; |
| 6 | +import org.junit.jupiter.api.Test; |
| 7 | +import org.springframework.beans.factory.annotation.Autowired; |
| 8 | +import org.springframework.boot.test.context.SpringBootTest; |
| 9 | + |
| 10 | +import software.xdev.spring.data.eclipse.store.demo.TestUtil; |
| 11 | +import software.xdev.spring.data.eclipse.store.demo.dual.storage.invoice.PersistenceInvoiceConfiguration; |
| 12 | +import software.xdev.spring.data.eclipse.store.demo.dual.storage.person.PersistencePersonConfiguration; |
| 13 | + |
| 14 | + |
| 15 | +@SpringBootTest(classes = DualStorageDemoApplication.class) |
| 16 | +class DualStorageDemoApplicationTest |
| 17 | +{ |
| 18 | + private final PersistenceInvoiceConfiguration invoiceConfiguration; |
| 19 | + private final PersistencePersonConfiguration personConfiguration; |
| 20 | + |
| 21 | + @Autowired |
| 22 | + public DualStorageDemoApplicationTest( |
| 23 | + final PersistenceInvoiceConfiguration invoiceConfiguration, |
| 24 | + final PersistencePersonConfiguration personConfiguration) |
| 25 | + { |
| 26 | + this.invoiceConfiguration = invoiceConfiguration; |
| 27 | + this.personConfiguration = personConfiguration; |
| 28 | + } |
| 29 | + |
| 30 | + @BeforeAll |
| 31 | + static void clearPreviousData() |
| 32 | + { |
| 33 | + TestUtil.deleteDirectory(new File("./" + PersistenceInvoiceConfiguration.STORAGE_PATH)); |
| 34 | + TestUtil.deleteDirectory(new File("./" + PersistencePersonConfiguration.STORAGE_PATH)); |
| 35 | + } |
| 36 | + |
| 37 | + @Test |
| 38 | + void checkPossibilityToSimplyStartAndRestartApplication() |
| 39 | + { |
| 40 | + this.invoiceConfiguration.getStorageInstance().stop(); |
| 41 | + this.personConfiguration.getStorageInstance().stop(); |
| 42 | + DualStorageDemoApplication.main(new String[]{}); |
| 43 | + } |
| 44 | +} |
0 commit comments