Skip to content

Commit

Permalink
Merge branch '3.3.x'
Browse files Browse the repository at this point in the history
Closes gh-41891
  • Loading branch information
wilkinsona committed Aug 16, 2024
2 parents e3f4844 + d4762ec commit f78ec43
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ SbomEndpoint sbomEndpoint(ResourceLoader resourceLoader) {
@Bean
@ConditionalOnMissingBean
@ConditionalOnBean(SbomEndpoint.class)
@ConditionalOnAvailableEndpoint(exposure = EndpointExposure.WEB)
@ConditionalOnAvailableEndpoint(exposure = { EndpointExposure.WEB, EndpointExposure.CLOUD_FOUNDRY })
SbomEndpointWebExtension sbomEndpointWebExtension(SbomEndpoint sbomEndpoint) {
return new SbomEndpointWebExtension(sbomEndpoint, this.properties);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,19 @@ class SbomEndpointAutoConfigurationTests {
.withConfiguration(AutoConfigurations.of(SbomEndpointAutoConfiguration.class));

@Test
void runShouldHaveEndpointBean() {
void runWhenWebExposedShouldHaveEndpointBeanAndWebExtension() {
this.contextRunner.withPropertyValues("management.endpoints.web.exposure.include=sbom")
.run((context) -> assertThat(context).hasSingleBean(SbomEndpoint.class));
.run((context) -> assertThat(context).hasSingleBean(SbomEndpoint.class)
.hasSingleBean(SbomEndpointWebExtension.class));
}

@Test
void runWhenCloudFoundryExposedShouldHaveEndpointBeanAndWebExtension() {
this.contextRunner
.withPropertyValues("management.endpoints.cloud-foundry.exposure.include=sbom",
"spring.main.cloud-platform=cloud_foundry")
.run((context) -> assertThat(context).hasSingleBean(SbomEndpoint.class)
.hasSingleBean(SbomEndpointWebExtension.class));
}

@Test
Expand Down

0 comments on commit f78ec43

Please sign in to comment.