BAEL-2351 fixed integration tests
This commit is contained in:
parent
7e3e9db288
commit
7a23ac4f53
|
@ -1,4 +1,7 @@
|
|||
management.endpoints.web.exposure.include=*
|
||||
management.metrics.enable.root=true
|
||||
management.metrics.enable.jvm=true
|
||||
management.endpoint.restart.enabled=true
|
||||
management.endpoint.restart.enabled=true
|
||||
spring.datasource.jmx-enabled=false
|
||||
spring.main.allow-bean-definition-overriding=true
|
||||
management.endpoint.shutdown.enabled=true
|
|
@ -2,20 +2,25 @@ package com.baeldung.restart;
|
|||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.boot.test.web.client.TestRestTemplate;
|
||||
import org.springframework.boot.web.client.RestTemplateBuilder;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
|
||||
import java.time.Duration;
|
||||
|
||||
public class RestartApplicationIntegrationTest {
|
||||
|
||||
private TestRestTemplate template = new TestRestTemplate();
|
||||
|
||||
private TestRestTemplate restTemplate = new TestRestTemplate();
|
||||
|
||||
@Test
|
||||
public void givenBootApp_whenRestart_thenOk() throws Exception {
|
||||
Application.main(new String[0]);
|
||||
|
||||
ResponseEntity response = template.exchange("http://localhost:8080/restart",
|
||||
|
||||
ResponseEntity response = restTemplate.exchange("http://localhost:8080/restart",
|
||||
HttpMethod.POST, null, Object.class);
|
||||
|
||||
assertEquals(200, response.getStatusCode().value());
|
||||
|
@ -24,11 +29,11 @@ public class RestartApplicationIntegrationTest {
|
|||
@Test
|
||||
public void givenBootApp_whenRestartUsingActuator_thenOk() throws Exception {
|
||||
Application.main(new String[] { "--server.port=8090" });
|
||||
|
||||
ResponseEntity response = template.exchange("http://localhost:8090/restartApp",
|
||||
|
||||
ResponseEntity response = restTemplate.exchange("http://localhost:8090/restartApp",
|
||||
HttpMethod.POST, null, Object.class);
|
||||
|
||||
assertEquals(200, response.getStatusCode().value());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -6,4 +6,7 @@ management.endpoints.web.exposure.include=*
|
|||
management.endpoint.shutdown.enabled=true
|
||||
endpoints.shutdown.enabled=true
|
||||
|
||||
management.endpoint.restart.enabled=true
|
||||
management.endpoint.restart.enabled=true
|
||||
|
||||
spring.main.allow-bean-definition-overriding=true
|
||||
spring.jmx.unique-names=true
|
Loading…
Reference in New Issue