@@ -135,7 +135,7 @@ func testTomcat(platform switchblade.Platform, fixtures string) func(*testing.T,
135135 Execute (name , filepath .Join (fixtures , "containers" , "tomcat_javax" ))
136136 Expect (err ).NotTo (HaveOccurred (), logs .String )
137137
138- Expect (logs .String ()).To (ContainSubstring ("OpenJDK" ))
138+ Expect (logs .String ()).To (ContainSubstring ("Installing OpenJDK 8. " ))
139139 Expect (logs .String ()).To (ContainSubstring ("Tomcat 9" ))
140140 Eventually (deployment ).Should (matchers .Serve (ContainSubstring ("OK" )))
141141 })
@@ -148,7 +148,7 @@ func testTomcat(platform switchblade.Platform, fixtures string) func(*testing.T,
148148 Execute (name , filepath .Join (fixtures , "containers" , "tomcat_jakarta" ))
149149 Expect (err ).NotTo (HaveOccurred (), logs .String )
150150
151- Expect (logs .String ()).To (ContainSubstring ("OpenJDK" ))
151+ Expect (logs .String ()).To (ContainSubstring ("Installing OpenJDK 11. " ))
152152 Expect (logs .String ()).To (ContainSubstring ("Tomcat 10" ))
153153 Eventually (deployment ).Should (matchers .Serve (ContainSubstring ("OK" )))
154154 })
@@ -161,24 +161,24 @@ func testTomcat(platform switchblade.Platform, fixtures string) func(*testing.T,
161161 Execute (name , filepath .Join (fixtures , "containers" , "tomcat_jakarta" ))
162162 Expect (err ).NotTo (HaveOccurred (), logs .String )
163163
164- Expect (logs .String ()).To (ContainSubstring ("OpenJDK" ))
164+ Expect (logs .String ()).To (ContainSubstring ("Installing OpenJDK 17. " ))
165165 Expect (logs .String ()).To (ContainSubstring ("Tomcat 10" ))
166166 Eventually (deployment ).Should (matchers .Serve (ContainSubstring ("OK" )))
167167 })
168168 })
169169
170170 context ("with memory limits" , func () {
171- it ("respects memory calculator settings" , func () {
171+ it ("respects memory calculator settings with JAVA_OPTS " , func () {
172172 deployment , logs , err := platform .Deploy .
173173 WithEnv (map [string ]string {
174- "BP_JAVA_VERSION" : "11" ,
175- "JAVA_OPTS" : "-Xmx256m" ,
176- "JBP_CONFIG_OPEN_JDK_JRE" : "{jre: {version: 11.+}}" ,
174+ "BP_JAVA_VERSION" : "11" ,
175+ "JAVA_OPTS" : "-Xmx256m" ,
177176 }).
178177 Execute (name , filepath .Join (fixtures , "containers" , "tomcat_jakarta" ))
179178
180179 Expect (err ).NotTo (HaveOccurred (), logs .String )
181180
181+ Expect (logs .String ()).To (ContainSubstring ("Installing OpenJDK 11." ))
182182 Expect (logs .String ()).To (ContainSubstring ("memory" ))
183183 Eventually (deployment ).Should (matchers .Serve (ContainSubstring ("OK" )))
184184 })
@@ -215,19 +215,14 @@ func testTomcat(platform switchblade.Platform, fixtures string) func(*testing.T,
215215 deployment , logs , err := platform .Deploy .
216216 WithBuildpacks ("https://github.com/cloudfoundry/java-buildpack.git#feature/go-migration" ).
217217 WithEnv (map [string ]string {
218- "BP_JAVA_VERSION" : "21" ,
219- "JBP_CONFIG_OPEN_JDK_JRE" : "{jre: {version: 21.+}}" ,
218+ "BP_JAVA_VERSION" : "21" ,
220219 }).
221220 Execute (name , filepath .Join (fixtures , "containers" , "tomcat_jakarta" ))
222221
223222 Expect (err ).NotTo (HaveOccurred (), logs .String )
224223
225- // Verify Java 21 is used
226- Expect (logs .String ()).To (ContainSubstring ("OpenJDK" ))
227- Expect (logs .String ()).To (Or (
228- ContainSubstring ("21." ),
229- ContainSubstring ("Tomcat" ),
230- ))
224+ Expect (logs .String ()).To (ContainSubstring ("Installing OpenJDK 21." ))
225+ Expect (logs .String ()).To (ContainSubstring ("Tomcat" ))
231226
232227 // If deployment succeeds, it means:
233228 // 1. bin/detect succeeded (detected Tomcat)
@@ -239,6 +234,34 @@ func testTomcat(platform switchblade.Platform, fixtures string) func(*testing.T,
239234 })
240235 })
241236
237+ context ("with JBP_CONFIG_OPEN_JDK_JRE version selection" , func () {
238+ it ("respects JBP_CONFIG_OPEN_JDK_JRE version pattern" , func () {
239+ deployment , logs , err := platform .Deploy .
240+ WithEnv (map [string ]string {
241+ "JBP_CONFIG_OPEN_JDK_JRE" : "{jre: {version: 17.+}}" ,
242+ }).
243+ Execute (name , filepath .Join (fixtures , "containers" , "tomcat_jakarta" ))
244+
245+ Expect (err ).NotTo (HaveOccurred (), logs .String )
246+
247+ Expect (logs .String ()).To (ContainSubstring ("Installing OpenJDK 17." ))
248+ Eventually (deployment ).Should (matchers .Serve (ContainSubstring ("OK" )))
249+ })
250+
251+ it ("respects JBP_CONFIG_OPEN_JDK_JRE over manifest default" , func () {
252+ deployment , logs , err := platform .Deploy .
253+ WithEnv (map [string ]string {
254+ "JBP_CONFIG_OPEN_JDK_JRE" : "{jre: {version: 21.+}}" ,
255+ }).
256+ Execute (name , filepath .Join (fixtures , "containers" , "tomcat_jakarta" ))
257+
258+ Expect (err ).NotTo (HaveOccurred (), logs .String )
259+
260+ Expect (logs .String ()).To (ContainSubstring ("Installing OpenJDK 21." ))
261+ Eventually (deployment ).Should (matchers .Serve (ContainSubstring ("OK" )))
262+ })
263+ })
264+
242265 context ("with external Tomcat configuration" , func () {
243266 it ("downloads and applies configuration from real repository" , func () {
244267 // This test verifies the external configuration workflow:
0 commit comments