Search in sources :

Example 21 with Health

use of org.springframework.boot.actuate.health.Health in project cas by apereo.

the class SessionHealthIndicatorTests method verifyObserveWarnSessionsExceeded.

@Test
public void verifyObserveWarnSessionsExceeded() {
    addTicketsToRegistry(this.defaultRegistry, 10, 1);
    final SessionMonitor monitor = new SessionMonitor(defaultRegistry, 0, 5);
    final Health status = monitor.health();
    assertEquals("WARN", status.getStatus().getCode());
}
Also used : Health(org.springframework.boot.actuate.health.Health) Test(org.junit.Test)

Example 22 with Health

use of org.springframework.boot.actuate.health.Health in project cas by apereo.

the class JdbcDataSourceHealthIndicatorTests method verifyObserve.

@Test
public void verifyObserve() {
    final JdbcDataSourceHealthIndicator monitor = new JdbcDataSourceHealthIndicator(5000, this.dataSource, this.executor, "SELECT 1 FROM INFORMATION_SCHEMA.SYSTEM_USERS");
    final Health status = monitor.health();
    assertEquals(Status.UP, status.getStatus());
}
Also used : Health(org.springframework.boot.actuate.health.Health) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

Health (org.springframework.boot.actuate.health.Health)22 Test (org.junit.Test)20 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)4 ResponseEntity (org.springframework.http.ResponseEntity)4 HealthEndpoint (org.springframework.boot.actuate.endpoint.HealthEndpoint)3 HttpStatus (org.springframework.http.HttpStatus)3 Status (org.springframework.boot.actuate.health.Status)2 MockServletContext (org.springframework.mock.web.MockServletContext)2 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)2 AnnotationConfigWebApplicationContext (org.springframework.web.context.support.AnnotationConfigWebApplicationContext)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 Writer (java.io.Writer)1 MockServiceTicket (org.apereo.cas.mock.MockServiceTicket)1 MockTicketGrantingTicket (org.apereo.cas.mock.MockTicketGrantingTicket)1 MockHttpServletRequest (org.springframework.mock.web.MockHttpServletRequest)1 Authentication (org.springframework.security.core.Authentication)1 SimpleGrantedAuthority (org.springframework.security.core.authority.SimpleGrantedAuthority)1 Rollback (org.springframework.test.annotation.Rollback)1 GetMapping (org.springframework.web.bind.annotation.GetMapping)1