Search in sources :

Example 11 with HealthEndpointGroup

use of org.springframework.boot.actuate.health.HealthEndpointGroup in project spring-boot by spring-projects.

the class AdditionalHealthEndpointPathsWebMvcHandlerMapping method initHandlerMethods.

@Override
protected void initHandlerMethods() {
    for (WebOperation operation : this.endpoint.getOperations()) {
        WebOperationRequestPredicate predicate = operation.getRequestPredicate();
        String matchAllRemainingPathSegmentsVariable = predicate.getMatchAllRemainingPathSegmentsVariable();
        if (matchAllRemainingPathSegmentsVariable != null) {
            for (HealthEndpointGroup group : this.groups) {
                AdditionalHealthEndpointPath additionalPath = group.getAdditionalPath();
                if (additionalPath != null) {
                    registerMapping(this.endpoint, predicate, operation, additionalPath.getValue());
                }
            }
        }
    }
}
Also used : WebOperation(org.springframework.boot.actuate.endpoint.web.WebOperation) WebOperationRequestPredicate(org.springframework.boot.actuate.endpoint.web.WebOperationRequestPredicate) AdditionalHealthEndpointPath(org.springframework.boot.actuate.health.AdditionalHealthEndpointPath) HealthEndpointGroup(org.springframework.boot.actuate.health.HealthEndpointGroup)

Example 12 with HealthEndpointGroup

use of org.springframework.boot.actuate.health.HealthEndpointGroup in project spring-boot by spring-projects.

the class AvailabilityProbesHealthEndpointGroupsPostProcessorTests method postProcessHealthEndpointGroupsWhenAdditionalPathPropertyIsTrue.

@Test
void postProcessHealthEndpointGroupsWhenAdditionalPathPropertyIsTrue() {
    HealthEndpointGroups postProcessed = getPostProcessed("true");
    HealthEndpointGroup liveness = postProcessed.get("liveness");
    HealthEndpointGroup readiness = postProcessed.get("readiness");
    assertThat(liveness.getAdditionalPath().toString()).isEqualTo("server:/livez");
    assertThat(readiness.getAdditionalPath().toString()).isEqualTo("server:/readyz");
}
Also used : HealthEndpointGroups(org.springframework.boot.actuate.health.HealthEndpointGroups) HealthEndpointGroup(org.springframework.boot.actuate.health.HealthEndpointGroup) Test(org.junit.jupiter.api.Test)

Example 13 with HealthEndpointGroup

use of org.springframework.boot.actuate.health.HealthEndpointGroup in project spring-boot by spring-projects.

the class AvailabilityProbesHealthEndpointGroupsPostProcessorTests method postProcessHealthEndpointGroupsWhenAdditionalPathPropertyIsFalse.

@Test
void postProcessHealthEndpointGroupsWhenAdditionalPathPropertyIsFalse() {
    HealthEndpointGroups postProcessed = getPostProcessed("false");
    HealthEndpointGroup liveness = postProcessed.get("liveness");
    HealthEndpointGroup readiness = postProcessed.get("readiness");
    assertThat(liveness.getAdditionalPath()).isNull();
    assertThat(readiness.getAdditionalPath()).isNull();
}
Also used : HealthEndpointGroups(org.springframework.boot.actuate.health.HealthEndpointGroups) HealthEndpointGroup(org.springframework.boot.actuate.health.HealthEndpointGroup) Test(org.junit.jupiter.api.Test)

Example 14 with HealthEndpointGroup

use of org.springframework.boot.actuate.health.HealthEndpointGroup in project spring-boot by spring-projects.

the class AvailabilityProbesHealthEndpointGroupsTests method getReadinessProbeHasOnlyReadinessStateAsMember.

@Test
void getReadinessProbeHasOnlyReadinessStateAsMember() {
    HealthEndpointGroups availabilityProbes = new AvailabilityProbesHealthEndpointGroups(this.delegate, false);
    HealthEndpointGroup probeGroup = availabilityProbes.get("readiness");
    assertThat(probeGroup.isMember("livenessState")).isFalse();
    assertThat(probeGroup.isMember("readinessState")).isTrue();
}
Also used : HealthEndpointGroups(org.springframework.boot.actuate.health.HealthEndpointGroups) HealthEndpointGroup(org.springframework.boot.actuate.health.HealthEndpointGroup) Test(org.junit.jupiter.api.Test)

Example 15 with HealthEndpointGroup

use of org.springframework.boot.actuate.health.HealthEndpointGroup in project spring-boot by spring-projects.

the class AvailabilityProbesHealthEndpointGroupsPostProcessorTests method postProcessHealthEndpointGroupsWhenAdditionalPathPropertyIsNull.

@Test
void postProcessHealthEndpointGroupsWhenAdditionalPathPropertyIsNull() {
    HealthEndpointGroups groups = mock(HealthEndpointGroups.class);
    HealthEndpointGroups postProcessed = this.postProcessor.postProcessHealthEndpointGroups(groups);
    HealthEndpointGroup liveness = postProcessed.get("liveness");
    HealthEndpointGroup readiness = postProcessed.get("readiness");
    assertThat(liveness.getAdditionalPath()).isNull();
    assertThat(readiness.getAdditionalPath()).isNull();
}
Also used : HealthEndpointGroups(org.springframework.boot.actuate.health.HealthEndpointGroups) HealthEndpointGroup(org.springframework.boot.actuate.health.HealthEndpointGroup) Test(org.junit.jupiter.api.Test)

Aggregations

HealthEndpointGroup (org.springframework.boot.actuate.health.HealthEndpointGroup)25 Test (org.junit.jupiter.api.Test)22 HealthEndpointGroups (org.springframework.boot.actuate.health.HealthEndpointGroups)22 AdditionalHealthEndpointPath (org.springframework.boot.actuate.health.AdditionalHealthEndpointPath)3 WebOperation (org.springframework.boot.actuate.endpoint.web.WebOperation)2 WebOperationRequestPredicate (org.springframework.boot.actuate.endpoint.web.WebOperationRequestPredicate)2 LinkedHashMap (java.util.LinkedHashMap)1 Show (org.springframework.boot.actuate.autoconfigure.health.HealthProperties.Show)1 Status (org.springframework.boot.actuate.autoconfigure.health.HealthProperties.Status)1 HttpCodeStatusMapper (org.springframework.boot.actuate.health.HttpCodeStatusMapper)1 SimpleHttpCodeStatusMapper (org.springframework.boot.actuate.health.SimpleHttpCodeStatusMapper)1 SimpleStatusAggregator (org.springframework.boot.actuate.health.SimpleStatusAggregator)1 StatusAggregator (org.springframework.boot.actuate.health.StatusAggregator)1 RequestMappingInfo (org.springframework.web.reactive.result.method.RequestMappingInfo)1