Skip to content
Snippets Groups Projects
Commit 6bb4c73d authored by Lukas Malte Monnerjahn's avatar Lukas Malte Monnerjahn
Browse files

keep application context open in tests

parent bba76c5d
No related branches found
No related tags found
1 merge request!2OZG-7491 pipeline: Change version format
Pipeline #1621 passed with warnings
......@@ -35,7 +35,6 @@ import de.ozgcloud.eingang.semantik.SemantikAdapter;
import lombok.NonNull;
import lombok.extern.log4j.Log4j2;
@Profile({ "!itcase" })
@Log4j2
@Component
class XtaRunner implements ApplicationListener<ContextRefreshedEvent> {
......@@ -45,13 +44,12 @@ class XtaRunner implements ApplicationListener<ContextRefreshedEvent> {
@Autowired
private SemantikAdapter semantikAdapter;
@Autowired
private ConfigurableApplicationContext context;
private ShutdownService shutdownService;
@Override
public void onApplicationEvent(ContextRefreshedEvent event) {
LOG.info("Fetching XTA Messages");
runGetXtaMessages();
context.close();
shutdownService.shutdown();
}
void runGetXtaMessages() {
......
......@@ -49,6 +49,9 @@ class SemantikAdapterITCase {
@MockitoBean
private VorgangService vorgangService;
@MockitoBean
private ShutdownService shutdownService;
@Nested
class TestForFim {
private final Map<String, Object> excpectedFormDataMap = FimFormDataTestFactory.FORM_DATA_MAP;
......
......@@ -23,11 +23,12 @@
*/
package de.ozgcloud.eingang.xta;
import static org.junit.jupiter.api.Assertions.*;
import static org.junit.jupiter.api.Assertions.assertTrue;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import de.ozgcloud.eingang.Application;
......@@ -35,9 +36,12 @@ import de.ozgcloud.eingang.Application;
@SpringBootTest(classes = Application.class)
class XtaApplicationTest {
@MockitoBean
private ShutdownService shutdownService;
@Test
void startup() {
// should start without exception;
// should start without exception
assertTrue(true);
}
......
......@@ -44,8 +44,6 @@ import org.mockito.Captor;
import org.mockito.Mock;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.boot.test.mock.mockito.SpyBean;
import org.springframework.context.annotation.Bean;
import org.springframework.test.context.ActiveProfiles;
......@@ -58,6 +56,8 @@ import de.ozgcloud.vorgang.grpc.binaryFile.BinaryFileServiceGrpc.BinaryFileServi
import de.ozgcloud.vorgang.vorgang.GrpcEingang;
import de.ozgcloud.vorgang.vorgang.VorgangServiceGrpc.VorgangServiceBlockingStub;
import io.grpc.Channel;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import org.springframework.test.context.bean.override.mockito.MockitoSpyBean;
@SpringBootTest(classes = {
Application.class,
......@@ -66,9 +66,9 @@ import io.grpc.Channel;
@ActiveProfiles({ "itcase" })
class XtaITCase {
@SpyBean
@MockitoSpyBean
private VorgangRemoteService vorgangRemoteService;
@MockBean
@MockitoBean
private VorgangManagerServerResolver resolver;
@Mock
......@@ -83,8 +83,10 @@ class XtaITCase {
@Mock
private Channel channel;
@MockBean
@MockitoBean
private XtaRemoteService xtaRemoteService;
@MockitoBean
private ShutdownService shutdownService;
@Captor
private ArgumentCaptor<FormData> formDataArgumentCaptor;
......@@ -114,6 +116,11 @@ class XtaITCase {
doReturn("vorgangId(unused)").when(vorgangRemoteService).createVorgang(any(), any(), any(), any());
}
@DisplayName("should shut down context after processing")
void shouldShutdownContextAfterProcessing() {
verify(shutdownService, times(1)).shutdown();
}
@DisplayName("should have three representations with pdf")
@TestZipFileNamesWithPdf
void shouldHaveThreeRepresentationsWithPdf(String zipFileName) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment