use of org.springframework.boot.actuate.health.HealthEndpointGroups in project spring-boot by spring-projects.
the class AutoConfiguredHealthEndpointGroupsTests method createWhenHasHttpCodeStatusMapperPropertyAndGroupSpecificPropertyReturnsInstanceWithPropertyUsedForExpectedGroups.
@Test
void createWhenHasHttpCodeStatusMapperPropertyAndGroupSpecificPropertyReturnsInstanceWithPropertyUsedForExpectedGroups() {
this.contextRunner.withPropertyValues("management.endpoint.health.status.http-mapping.down=201", "management.endpoint.health.group.a.include=*", "management.endpoint.health.group.a.status.http-mapping.down=202", "management.endpoint.health.group.b.include=*").run((context) -> {
HealthEndpointGroups groups = context.getBean(HealthEndpointGroups.class);
HealthEndpointGroup primary = groups.getPrimary();
HealthEndpointGroup groupA = groups.get("a");
HealthEndpointGroup groupB = groups.get("b");
assertThat(primary.getHttpCodeStatusMapper().getStatusCode(Status.DOWN)).isEqualTo(201);
assertThat(groupA.getHttpCodeStatusMapper().getStatusCode(Status.DOWN)).isEqualTo(202);
assertThat(groupB.getHttpCodeStatusMapper().getStatusCode(Status.DOWN)).isEqualTo(201);
});
}
use of org.springframework.boot.actuate.health.HealthEndpointGroups in project spring-boot by spring-projects.
the class AutoConfiguredHealthEndpointGroupsTests method createWhenGroupWithNoShowDetailsOverrideInheritsShowDetails.
@Test
void createWhenGroupWithNoShowDetailsOverrideInheritsShowDetails() {
this.contextRunner.withPropertyValues("management.endpoint.health.show-details=always", "management.endpoint.health.group.a.include=*").run((context) -> {
HealthEndpointGroups groups = context.getBean(HealthEndpointGroups.class);
HealthEndpointGroup groupA = groups.get("a");
assertThat(groupA.showDetails(SecurityContext.NONE)).isTrue();
});
}
use of org.springframework.boot.actuate.health.HealthEndpointGroups in project spring-boot by spring-projects.
the class AutoConfiguredHealthEndpointGroupsTests method createWhenHasGroupSpecificHttpCodeStatusMapperPropertyAndGroupQualifiedBeanReturnsInstanceWithBeanUsedForExpectedGroups.
@Test
void createWhenHasGroupSpecificHttpCodeStatusMapperPropertyAndGroupQualifiedBeanReturnsInstanceWithBeanUsedForExpectedGroups() {
this.contextRunner.withUserConfiguration(CustomHttpCodeStatusMapperGroupAConfiguration.class).withPropertyValues("management.endpoint.health.group.a.include=*", "management.endpoint.health.group.a.status.http-mapping.down=201", "management.endpoint.health.group.b.include=*", "management.endpoint.health.group.b.status.http-mapping.down=201").run((context) -> {
HealthEndpointGroups groups = context.getBean(HealthEndpointGroups.class);
HealthEndpointGroup primary = groups.getPrimary();
HealthEndpointGroup groupA = groups.get("a");
HealthEndpointGroup groupB = groups.get("b");
assertThat(primary.getHttpCodeStatusMapper().getStatusCode(Status.DOWN)).isEqualTo(503);
assertThat(groupA.getHttpCodeStatusMapper().getStatusCode(Status.DOWN)).isEqualTo(200);
assertThat(groupB.getHttpCodeStatusMapper().getStatusCode(Status.DOWN)).isEqualTo(201);
});
}
use of org.springframework.boot.actuate.health.HealthEndpointGroups in project spring-boot by spring-projects.
the class AutoConfiguredHealthEndpointGroupsTests method createWhenHasHttpCodeStatusMapperBeanAndGroupSpecificPropertyReturnsInstanceThatUsesBeanOnlyForUnconfiguredGroups.
@Test
void createWhenHasHttpCodeStatusMapperBeanAndGroupSpecificPropertyReturnsInstanceThatUsesBeanOnlyForUnconfiguredGroups() {
this.contextRunner.withUserConfiguration(CustomHttpCodeStatusMapperConfiguration.class).withPropertyValues("management.endpoint.health.group.a.include=*", "management.endpoint.health.group.a.status.http-mapping.down=201", "management.endpoint.health.group.b.include=*").run((context) -> {
HealthEndpointGroups groups = context.getBean(HealthEndpointGroups.class);
HealthEndpointGroup primary = groups.getPrimary();
HealthEndpointGroup groupA = groups.get("a");
HealthEndpointGroup groupB = groups.get("b");
assertThat(primary.getHttpCodeStatusMapper().getStatusCode(Status.DOWN)).isEqualTo(200);
assertThat(groupA.getHttpCodeStatusMapper().getStatusCode(Status.DOWN)).isEqualTo(201);
assertThat(groupB.getHttpCodeStatusMapper().getStatusCode(Status.DOWN)).isEqualTo(200);
});
}
use of org.springframework.boot.actuate.health.HealthEndpointGroups in project spring-boot by spring-projects.
the class AutoConfiguredHealthEndpointGroupsTests method createWhenHasHttpCodeStatusMapperBeanReturnsInstanceWithMapperUsedForAllGroups.
@Test
void createWhenHasHttpCodeStatusMapperBeanReturnsInstanceWithMapperUsedForAllGroups() {
this.contextRunner.withUserConfiguration(CustomHttpCodeStatusMapperConfiguration.class).withPropertyValues("management.endpoint.health.status.http-mapping.down=201", "management.endpoint.health.group.a.include=*").run((context) -> {
HealthEndpointGroups groups = context.getBean(HealthEndpointGroups.class);
HealthEndpointGroup primary = groups.getPrimary();
HealthEndpointGroup groupA = groups.get("a");
assertThat(primary.getHttpCodeStatusMapper().getStatusCode(Status.DOWN)).isEqualTo(200);
assertThat(groupA.getHttpCodeStatusMapper().getStatusCode(Status.DOWN)).isEqualTo(200);
});
}
Aggregations