Add resource hints for SBOM endpoint
Closes gh-40939
This commit is contained in:
@@ -22,6 +22,9 @@ import java.nio.charset.StandardCharsets;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.aot.hint.RuntimeHints;
|
||||
import org.springframework.aot.hint.predicate.RuntimeHintsPredicates;
|
||||
import org.springframework.boot.actuate.sbom.SbomEndpoint.SbomEndpointRuntimeHints;
|
||||
import org.springframework.boot.actuate.sbom.SbomEndpoint.Sboms;
|
||||
import org.springframework.boot.actuate.sbom.SbomProperties.Sbom;
|
||||
import org.springframework.context.support.GenericApplicationContext;
|
||||
@@ -81,6 +84,14 @@ class SbomEndpointTests {
|
||||
assertThat(createEndpoint().sbom("application")).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldRegisterHints() {
|
||||
RuntimeHints hints = new RuntimeHints();
|
||||
new SbomEndpointRuntimeHints().registerHints(hints, getClass().getClassLoader());
|
||||
assertThat(RuntimeHintsPredicates.resource().forResource("META-INF/sbom/bom.json")).accepts(hints);
|
||||
assertThat(RuntimeHintsPredicates.resource().forResource("META-INF/sbom/application.cdx.json")).accepts(hints);
|
||||
}
|
||||
|
||||
private Sbom sbom(String location) {
|
||||
Sbom result = new Sbom();
|
||||
result.setLocation(location);
|
||||
|
||||
Reference in New Issue
Block a user