1 package io.micronaut.build.jib; 2 3 import org.junit.jupiter.params.ParameterizedTest; 4 import org.junit.jupiter.params.provider.CsvSource; 5 6 import static org.junit.jupiter.api.Assertions.assertEquals; 7 8 public class JibMicronautExtensionTest { 9 10 @ParameterizedTest 11 @CsvSource({ 12 "1.8.0_352, latest", 13 "10.0.1, latest", 14 "11.0.6, jre11-latest", 15 "14.0.2, jre11-latest", 16 "17.0.1, jre17-latest", 17 "17.0.4.1, jre17-latest", 18 "19.0.1, jre17-latest" 19 }) 20 void testDetermineJavaVersion(String javaVersion, String expectedFnVersion) { 21 String fnVersion = JibMicronautExtension.determineProjectFnVersion(javaVersion); 22 assertEquals(expectedFnVersion, fnVersion); 23 } 24 25 @ParameterizedTest 26 @CsvSource({ 27 "latest, /usr/java/latest/bin/java -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -XX:-UsePerfData -XX:MaxRAMFraction=2 -XX:+UseSerialGC -Xshare:on -Djava.library.path=/function/runtime/lib -cp /function/app/classes:/function/app/libs/*:/function/app/resources:/function/runtime/* com.fnproject.fn.runtime.EntryPoint", 28 "jre11-latest, /usr/java/latest/bin/java -XX:-UsePerfData -XX:+UseSerialGC -Xshare:on -Djava.awt.headless=true -Djava.library.path=/function/runtime/lib -cp /function/app/classes:/function/app/libs/*:/function/app/resources:/function/runtime/* com.fnproject.fn.runtime.EntryPoint", 29 "jre17-latest, /usr/java/latest/bin/java -XX:-UsePerfData -XX:+UseSerialGC -Xshare:on -Djava.awt.headless=true -Djava.library.path=/function/runtime/lib -cp /function/app/classes:/function/app/libs/*:/function/app/resources:/function/runtime/* com.fnproject.fn.runtime.EntryPoint" 30 }) 31 void testBuildProjectFnEntrypoint(String projectFnVersion, String expectedEntrypoint) { 32 String entrypoint = String.join(" ", JibMicronautExtension.buildProjectFnEntrypoint(projectFnVersion)); 33 assertEquals(expectedEntrypoint, entrypoint); 34 } 35 }