2121import static org .cloudfoundry .client .v3 .LifecycleType .DOCKER ;
2222import static org .cloudfoundry .operations .TestObjects .fill ;
2323import static org .mockito .ArgumentMatchers .any ;
24+ import static org .mockito .ArgumentMatchers .argThat ;
2425import static org .mockito .Mockito .RETURNS_SMART_NULLS ;
2526import static org .mockito .Mockito .mock ;
27+ import static org .mockito .Mockito .verify ;
2628import static org .mockito .Mockito .when ;
2729
2830import java .io .IOException ;
140142import org .cloudfoundry .client .v3 .processes .HealthCheckType ;
141143import org .cloudfoundry .client .v3 .processes .ProcessState ;
142144import org .cloudfoundry .client .v3 .processes .ProcessStatisticsResource ;
145+ import org .cloudfoundry .client .v3 .processes .UpdateProcessRequest ;
146+ import org .cloudfoundry .client .v3 .processes .UpdateProcessResponse ;
143147import org .cloudfoundry .client .v3 .tasks .CancelTaskRequest ;
144148import org .cloudfoundry .client .v3 .tasks .CancelTaskResponse ;
145149import org .cloudfoundry .client .v3 .tasks .CreateTaskRequest ;
@@ -3695,13 +3699,15 @@ void setEnvironmentVariableNoApp() {
36953699
36963700 @ Test
36973701 void setHealthCheck () {
3698- requestApplications (
3702+ requestApplicationsV3 (
36993703 this .cloudFoundryClient ,
37003704 "test-application-name" ,
37013705 TEST_SPACE_ID ,
37023706 "test-application-id" );
3707+ requestApplicationProcesses (
3708+ cloudFoundryClient , "test-application-id" , HealthCheckType .HTTP );
37033709 requestUpdateApplicationHealthCheck (
3704- this .cloudFoundryClient , "test-application -id" , ApplicationHealthCheck .PORT );
3710+ this .cloudFoundryClient , "test-process -id" , ApplicationHealthCheck .PORT );
37053711
37063712 this .applications
37073713 .setHealthCheck (
@@ -3712,6 +3718,14 @@ void setHealthCheck() {
37123718 .as (StepVerifier ::create )
37133719 .expectComplete ()
37143720 .verify (Duration .ofSeconds (5 ));
3721+
3722+ verify (this .cloudFoundryClient .processes ())
3723+ .update (
3724+ argThat (
3725+ argument ->
3726+ argument .getHealthCheck ()
3727+ .getType ()
3728+ .equals (HealthCheckType .PORT )));
37153729 }
37163730
37173731 @ Test
@@ -4782,7 +4796,7 @@ private static void requestApplicationProcesses(
47824796 .build ()))
47834797 .thenReturn (
47844798 Mono .just (
4785- fill (GetApplicationProcessResponse .builder ())
4799+ fill (GetApplicationProcessResponse .builder (), "process-" )
47864800 .healthCheck (fill (HealthCheck .builder ()).type (type ).build ())
47874801 .build ()));
47884802 }
@@ -5860,25 +5874,18 @@ private static void requestUpdateApplicationEnvironment(
58605874 }
58615875
58625876 private static void requestUpdateApplicationHealthCheck (
5863- CloudFoundryClient cloudFoundryClient ,
5864- String applicationId ,
5865- ApplicationHealthCheck type ) {
5877+ CloudFoundryClient cloudFoundryClient , String processId , ApplicationHealthCheck type ) {
58665878 when (cloudFoundryClient
5867- .applicationsV2 ()
5879+ .processes ()
58685880 .update (
5869- UpdateApplicationRequest .builder ()
5870- .applicationId (applicationId )
5871- .healthCheckType (type .getValue ())
5872- .build ()))
5873- .thenReturn (
5874- Mono .just (
5875- fill (UpdateApplicationResponse .builder ())
5876- .entity (
5877- fill (
5878- ApplicationEntity .builder (),
5879- "application-entity-" )
5881+ UpdateProcessRequest .builder ()
5882+ .processId (processId )
5883+ .healthCheck (
5884+ HealthCheck .builder ()
5885+ .type (HealthCheckType .from (type .getValue ()))
58805886 .build ())
5881- .build ()));
5887+ .build ()))
5888+ .thenReturn (Mono .just (fill (UpdateProcessResponse .builder ()).build ()));
58825889 }
58835890
58845891 private static void requestUpdateApplicationRename (
0 commit comments