Example usage for org.springframework.boot.actuate.health Status OUT_OF_SERVICE

List of usage examples for org.springframework.boot.actuate.health Status OUT_OF_SERVICE

Introduction

In this page you can find the example usage for org.springframework.boot.actuate.health Status OUT_OF_SERVICE.

Prototype

Status OUT_OF_SERVICE

To view the source code for org.springframework.boot.actuate.health Status OUT_OF_SERVICE.

Click Source Link

Document

Status indicating that the component or subsystem has been taken out of service and should not be used.

Usage

From source file:com.netflix.spinnaker.kork.eureka.BootHealthCheckHandler.java

@Override
public InstanceInfo.InstanceStatus getStatus(InstanceInfo.InstanceStatus currentStatus) {
    final String statusCode = aggregateHealth.health().getStatus().getCode();
    if (Status.UP.getCode().equals(statusCode)) {
        return InstanceInfo.InstanceStatus.UP;
    } else if (Status.OUT_OF_SERVICE.getCode().equals(statusCode)) {
        return InstanceInfo.InstanceStatus.OUT_OF_SERVICE;
    } else if (Status.DOWN.getCode().equals(statusCode)) {
        return InstanceInfo.InstanceStatus.DOWN;
    } else {//from  w w w  . ja  v  a  2 s  .c  o  m
        return InstanceInfo.InstanceStatus.UNKNOWN;
    }
}

From source file:com.netflix.genie.web.health.GenieMemoryHealthIndicatorUnitTests.java

/**
 * Test to make sure the various health conditions are met.
 *///  w  w  w.j a  v  a 2  s.  c om
@Test
public void canGetHealth() {
    Mockito.when(this.jobMetricsService.getNumActiveJobs()).thenReturn(1, 2, 3);
    Mockito.when(this.jobMetricsService.getUsedMemory()).thenReturn(1024, 2048,
            MAX_SYSTEM_MEMORY - MAX_JOB_MEMORY + 1);
    Assert.assertThat(this.genieMemoryHealthIndicator.health().getStatus(), Matchers.is(Status.UP));
    Assert.assertThat(this.genieMemoryHealthIndicator.health().getStatus(), Matchers.is(Status.UP));
    Assert.assertThat(this.genieMemoryHealthIndicator.health().getStatus(), Matchers.is(Status.OUT_OF_SERVICE));
}