@@ -35,6 +35,10 @@ applyv25patches() {
3535      # # TODO: Update test to use Mockito extension instead of Spring Boot test
3636      patchTestCrudWithVaadin
3737      ;;
38+     spring-petclinic-vaadin-flow)
39+       # # TODO: Update test to not use configuration
40+       patchTestPetClinic
41+       ;;
3842  esac 
3943  # # TODO: document in migration guide to 25
4044  patchImports ' import com.fasterxml.jackson.core.type.TypeReference;' ' import tools.jackson.core.type.TypeReference;' 
@@ -65,7 +69,7 @@ cleanAfterBumpingVersions() {
6569    runCmd " Cleaning project after version bump" " $GRADLE  clean vaadinClean" 
6670    return 
6771  fi 
68-   [ -n  " $NOCURRENT " &&  exit 
72+   [ -n  " $NOCURRENT " &&  return 
6973  # # vaadin:clean-frontend is not enough it needs to clean target too
7074  # # note that archetype-spring (and maybe others) needs the production profile to have vaadin plugin available
7175  for  i  in  ` getPomFiles` ;  do 
@@ -252,4 +256,49 @@ patchTestCrudWithVaadin() {
252256  perl -pi -e ' s|(\s*)\@InjectMocks\s*|$1|' " $test_file " 
253257  #  5. Add editor instantiation in init method
254258  perl -0777 -pi -e ' s|(\@BeforeEach\s*\n\s*public\s+void\s+init\(\)\s*\{\s*)|${1}editor = new CustomerEditor(customerRepository);\n\t\t|s' " $test_file " 
259+ }
260+ 
261+ 
262+ # # TODO: needs to be documented that EHCache is configured via spring-boot-starter-cache and ehcache dependency.
263+ patchTestPetClinic () {
264+   local  T=src/main/java/org/springframework/samples/petclinic/backend/system/CacheConfiguration.java
265+   [ !  -f  $T  ] &&  err " No test found: $T " &&  return  1
266+   [ -z  " $TEST " &&  warn " patching $T " ||  cmd " ## updating CacheConfiguration to use EHCache autoconfiguration" 
267+   cat << EOF  > $T 
268+ /* 
269+  * Copyright 2012-2019 the original author or authors. 
270+  * 
271+  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 
272+  * in compliance with the License. You may obtain a copy of the License at 
273+  * 
274+  * https://www.apache.org/licenses/LICENSE-2.0 
275+  * 
276+  * Unless required by applicable law or agreed to in writing, software distributed under the License 
277+  * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 
278+  * or implied. See the License for the specific language governing permissions and limitations under 
279+  * the License. 
280+  */ 
281+ 
282+ package org.springframework.samples.petclinic.backend.system; 
283+ 
284+ import org.springframework.cache.CacheManager; 
285+ import org.springframework.cache.annotation.EnableCaching; 
286+ import org.springframework.cache.concurrent.ConcurrentMapCacheManager; 
287+ import org.springframework.context.annotation.Bean; 
288+ import org.springframework.context.annotation.Configuration; 
289+ 
290+ /** 
291+  * Cache configuration for the Pet Clinic application. 
292+  * This configuration enables Spring's caching abstraction and defines the required caches. 
293+  */ 
294+ @Configuration(proxyBeanMethods = false) 
295+ @EnableCaching 
296+ class CacheConfiguration { 
297+         @Bean 
298+         public CacheManager cacheManager() { 
299+                 // Create a simple in-memory cache manager with the required caches 
300+                 return new ConcurrentMapCacheManager("vets"); 
301+         } 
302+ } 
303+ EOF 
255304}
0 commit comments