commit
73294ba86c
|
@ -339,6 +339,45 @@ class PaketoBuilderTests {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void classDataSharingApp() throws Exception {
|
||||||
|
writeMainClass();
|
||||||
|
String imageName = "paketo-integration/" + this.gradleBuild.getProjectDir().getName();
|
||||||
|
ImageReference imageReference = ImageReference.of(ImageName.of(imageName));
|
||||||
|
BuildResult result = buildImage(imageName);
|
||||||
|
assertThat(result.task(":bootBuildImage").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
|
||||||
|
assertThat(result.getOutput()).contains("Running creator");
|
||||||
|
try (GenericContainer<?> container = new GenericContainer<>(imageName)) {
|
||||||
|
container.withExposedPorts(8080);
|
||||||
|
container.waitingFor(Wait.forHttp("/test")).start();
|
||||||
|
ContainerConfig config = container.getContainerInfo().getConfig();
|
||||||
|
assertLabelsMatchManifestAttributes(config);
|
||||||
|
ImageAssertions.assertThat(config).buildMetadata((metadata) -> {
|
||||||
|
metadata.buildpacks()
|
||||||
|
.contains("paketo-buildpacks/ca-certificates", "paketo-buildpacks/bellsoft-liberica",
|
||||||
|
"paketo-buildpacks/executable-jar", "paketo-buildpacks/dist-zip",
|
||||||
|
"paketo-buildpacks/spring-boot");
|
||||||
|
metadata.processOfType("web")
|
||||||
|
.satisfiesExactly((command) -> assertThat(command).isEqualTo("java"),
|
||||||
|
(arg) -> assertThat(arg).isEqualTo("-cp"),
|
||||||
|
(arg) -> assertThat(arg).startsWith("runner.jar"),
|
||||||
|
(arg) -> assertThat(arg).isEqualTo("example.ExampleApplication"));
|
||||||
|
metadata.processOfType("spring-boot-app")
|
||||||
|
.satisfiesExactly((command) -> assertThat(command).isEqualTo("java"),
|
||||||
|
(arg) -> assertThat(arg).isEqualTo("-cp"),
|
||||||
|
(arg) -> assertThat(arg).startsWith("runner.jar"),
|
||||||
|
(arg) -> assertThat(arg).isEqualTo("example.ExampleApplication"));
|
||||||
|
metadata.processOfType("executable-jar")
|
||||||
|
.containsExactly("java", "org.springframework.boot.loader.launch.JarLauncher");
|
||||||
|
});
|
||||||
|
assertImageHasJvmSbomLayer(imageReference, config);
|
||||||
|
assertImageHasDependenciesSbomLayer(imageReference, config, "executable-jar");
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
removeImage(imageReference);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private BuildResult buildImage(String imageName, String... arguments) {
|
private BuildResult buildImage(String imageName, String... arguments) {
|
||||||
List<String> args = new ArrayList<>(List.of(arguments));
|
List<String> args = new ArrayList<>(List.of(arguments));
|
||||||
args.add("bootBuildImage");
|
args.add("bootBuildImage");
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
plugins {
|
||||||
|
id 'org.springframework.boot' version '{bootVersion}'
|
||||||
|
id 'io.spring.dependency-management' version '{dependencyManagementPluginVersion}'
|
||||||
|
id 'java'
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
exclusiveContent {
|
||||||
|
forRepository {
|
||||||
|
maven { url '{systemTestMavenRepository}' }
|
||||||
|
}
|
||||||
|
filter {
|
||||||
|
includeGroup "org.springframework.boot"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mavenCentral()
|
||||||
|
maven { url 'https://repo.spring.io/milestone' }
|
||||||
|
maven { url 'https://repo.spring.io/snapshot' }
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation("org.springframework.boot:spring-boot-starter-web:{bootVersion}")
|
||||||
|
}
|
||||||
|
|
||||||
|
bootJar {
|
||||||
|
manifest {
|
||||||
|
attributes(
|
||||||
|
'Implementation-Version': '1.0.0',
|
||||||
|
'Implementation-Title': "Paketo Test"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bootBuildImage {
|
||||||
|
environment = ['BP_JVM_CDS_ENABLED': 'true']
|
||||||
|
}
|
Loading…
Reference in New Issue