Skip to content

Commit 38890c6

Browse files
committed
Merge branch '1010-scale-app' into 3.x
2 parents fcca362 + c85a215 commit 38890c6

File tree

3 files changed

+35
-2
lines changed

3 files changed

+35
-2
lines changed

cloudfoundry-client-reactor/src/main/java/org/cloudfoundry/reactor/client/v3/applications/ReactorApplicationsV3.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ public Mono<ListApplicationTasksResponse> listTasks(ListApplicationTasksRequest
183183

184184
@Override
185185
public Mono<ScaleApplicationResponse> scale(ScaleApplicationRequest request) {
186-
return put(request, ScaleApplicationResponse.class, builder -> builder.pathSegment("apps", request.getApplicationId(), "processes", request.getType(), "actions", "scale"))
186+
return post(request, ScaleApplicationResponse.class, builder -> builder.pathSegment("apps", request.getApplicationId(), "processes", request.getType(), "actions", "scale"))
187187
.checkpoint();
188188
}
189189

cloudfoundry-client-reactor/src/test/java/org/cloudfoundry/reactor/client/v3/applications/ReactorApplicationsV3Test.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1278,7 +1278,7 @@ public void listTasks() {
12781278
public void scale() {
12791279
mockRequest(InteractionContext.builder()
12801280
.request(TestRequest.builder()
1281-
.method(PUT).path("/apps/test-application-id/processes/test-type/actions/scale")
1281+
.method(POST).path("/apps/test-application-id/processes/test-type/actions/scale")
12821282
.payload("fixtures/client/v3/apps/PUT_{id}_processes_{type}_actions_scale_request.json")
12831283
.build())
12841284
.response(TestResponse.builder()

integration-test/src/test/java/org/cloudfoundry/client/v3/ApplicationsTest.java

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@
2323
import org.cloudfoundry.client.v3.applications.ApplicationRelationships;
2424
import org.cloudfoundry.client.v3.applications.CreateApplicationRequest;
2525
import org.cloudfoundry.client.v3.applications.CreateApplicationResponse;
26+
import org.cloudfoundry.client.v3.applications.GetApplicationProcessRequest;
27+
import org.cloudfoundry.client.v3.applications.GetApplicationProcessResponse;
2628
import org.cloudfoundry.client.v3.applications.ListApplicationRoutesRequest;
29+
import org.cloudfoundry.client.v3.applications.ScaleApplicationRequest;
2730
import org.cloudfoundry.client.v3.domains.CreateDomainRequest;
2831
import org.cloudfoundry.client.v3.domains.CreateDomainResponse;
2932
import org.cloudfoundry.client.v3.domains.DomainRelationships;
@@ -335,6 +338,28 @@ public void listApplicationRoutesBySpaceId() {
335338
.verify(Duration.ofMinutes(5));
336339
}
337340

341+
@IfCloudFoundryVersion(greaterThanOrEqualTo = CloudFoundryVersion.PCF_2_9)
342+
@Test
343+
public void scale() {
344+
String applicationName = this.nameFactory.getApplicationName();
345+
346+
this.spaceId
347+
.flatMap(spaceId -> createApplicationId(this.cloudFoundryClient, applicationName, spaceId))
348+
.flatMap(applicationId -> this.cloudFoundryClient.applicationsV3()
349+
.scale(ScaleApplicationRequest.builder()
350+
.applicationId(applicationId)
351+
.diskInMb(404)
352+
.type("web")
353+
.build())
354+
.thenReturn(applicationId))
355+
.flatMap(applicationId -> requestApplicationProcess(this.cloudFoundryClient, applicationId))
356+
.map(GetApplicationProcessResponse::getDiskInMb)
357+
.as(StepVerifier::create)
358+
.expectNext(404)
359+
.expectComplete()
360+
.verify(Duration.ofMinutes(5));
361+
}
362+
338363
private static Mono<String> createApplicationId(CloudFoundryClient cloudFoundryClient, String applicationName, String spaceId) {
339364
return requestCreateApplication(cloudFoundryClient, applicationName, spaceId)
340365
.map(CreateApplicationResponse::getId);
@@ -365,6 +390,14 @@ private static Mono<String> createSpaceId(CloudFoundryClient cloudFoundryClient,
365390
.map(CreateSpaceResponse::getId);
366391
}
367392

393+
private static Mono<GetApplicationProcessResponse> requestApplicationProcess(CloudFoundryClient cloudFoundryClient, String applicationId) {
394+
return cloudFoundryClient.applicationsV3()
395+
.getProcess(GetApplicationProcessRequest.builder()
396+
.applicationId(applicationId)
397+
.type("web")
398+
.build());
399+
}
400+
368401
private static Mono<CreateApplicationResponse> requestCreateApplication(CloudFoundryClient cloudFoundryClient, String applicationName, String spaceId) {
369402
return cloudFoundryClient.applicationsV3()
370403
.create(CreateApplicationRequest.builder()

0 commit comments

Comments
 (0)