Skip to content

Commit

Permalink
Added necessary handling of java 21 in fx_strings.go
Browse files Browse the repository at this point in the history
  • Loading branch information
computerlove committed Dec 2, 2024
1 parent f32b194 commit 9566e47
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
19 changes: 19 additions & 0 deletions internal/services/appservice/helpers/fx_strings.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ func decodeApplicationStackLinux(fxString string) ApplicationStackLinux {
if strings.HasPrefix(javaParts[0], "17") {
result.JavaVersion = "17"
}
if strings.HasPrefix(javaParts[0], "21") {
result.JavaVersion = "21"
}
result.JavaServerVersion = javaParts[0]

case FxStringPrefixTomcat:
Expand Down Expand Up @@ -278,6 +281,22 @@ func JavaLinuxFxStringBuilder(javaMajorVersion, javaServer, javaServerVersion st
default:
return pointer.To(fmt.Sprintf("%s|%s-java17", javaServer, javaServerVersion)), nil
}
case "21":
switch javaServer {
case LinuxJavaServerJava:
if len(strings.Split(javaServerVersion, ".")) == 3 {
return pointer.To(fmt.Sprintf("%s|%s", LinuxJavaServerJava, javaServerVersion)), nil // "JAVA|21.0.4"
} else {
return pointer.To(fmt.Sprintf("%s|%s-java21", LinuxJavaServerJava, javaServerVersion)), nil // "JAVA|21-21"
}

case LinuxJavaServerTomcat:
return pointer.To(fmt.Sprintf("%s|%s-java21", LinuxJavaServerTomcat, javaServerVersion)), nil // e,g, TOMCAT|10.0-java21 / TOMCAT|10.0.20-java21
case LinuxJavaServerJboss:
return nil, fmt.Errorf("java 21 is not supported on %s", LinuxJavaServerJboss)
default:
return pointer.To(fmt.Sprintf("%s|%s-java21", javaServer, javaServerVersion)), nil
}

default:
return pointer.To(fmt.Sprintf("%s|%s-%s", javaServer, javaServerVersion, javaMajorVersion)), nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1225,7 +1225,7 @@ func TestAccLinuxWebApp_withJre21Java(t *testing.T) {
Config: r.java(data, "21", "JAVA", "21"),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
check.That(data.ResourceName).Key("site_config.0.linux_fx_version").HasValue("JAVA|21-21"),
check.That(data.ResourceName).Key("site_config.0.linux_fx_version").HasValue("JAVA|21-java21"),
),
},
data.ImportStep("site_credential.0.password"),
Expand Down

0 comments on commit 9566e47

Please sign in to comment.