|
27 | 27 | import org.cloudfoundry.client.v3.Pagination; |
28 | 28 | import org.cloudfoundry.client.v3.Relationship; |
29 | 29 | import org.cloudfoundry.client.v3.ToOneRelationship; |
| 30 | +import org.cloudfoundry.client.v3.applications.ApplicationFeatureResource; |
30 | 31 | import org.cloudfoundry.client.v3.applications.ApplicationRelationships; |
31 | 32 | import org.cloudfoundry.client.v3.applications.ApplicationResource; |
32 | 33 | import org.cloudfoundry.client.v3.applications.ApplicationState; |
|
41 | 42 | import org.cloudfoundry.client.v3.applications.GetApplicationEnvironmentResponse; |
42 | 43 | import org.cloudfoundry.client.v3.applications.GetApplicationEnvironmentVariablesRequest; |
43 | 44 | import org.cloudfoundry.client.v3.applications.GetApplicationEnvironmentVariablesResponse; |
| 45 | +import org.cloudfoundry.client.v3.applications.GetApplicationFeatureRequest; |
| 46 | +import org.cloudfoundry.client.v3.applications.GetApplicationFeatureResponse; |
44 | 47 | import org.cloudfoundry.client.v3.applications.GetApplicationProcessRequest; |
45 | 48 | import org.cloudfoundry.client.v3.applications.GetApplicationProcessResponse; |
46 | 49 | import org.cloudfoundry.client.v3.applications.GetApplicationProcessStatisticsRequest; |
|
51 | 54 | import org.cloudfoundry.client.v3.applications.ListApplicationBuildsResponse; |
52 | 55 | import org.cloudfoundry.client.v3.applications.ListApplicationDropletsRequest; |
53 | 56 | import org.cloudfoundry.client.v3.applications.ListApplicationDropletsResponse; |
| 57 | +import org.cloudfoundry.client.v3.applications.ListApplicationFeaturesRequest; |
| 58 | +import org.cloudfoundry.client.v3.applications.ListApplicationFeaturesResponse; |
54 | 59 | import org.cloudfoundry.client.v3.applications.ListApplicationPackagesRequest; |
55 | 60 | import org.cloudfoundry.client.v3.applications.ListApplicationPackagesResponse; |
56 | 61 | import org.cloudfoundry.client.v3.applications.ListApplicationProcessesRequest; |
|
72 | 77 | import org.cloudfoundry.client.v3.applications.TerminateApplicationInstanceRequest; |
73 | 78 | import org.cloudfoundry.client.v3.applications.UpdateApplicationEnvironmentVariablesRequest; |
74 | 79 | import org.cloudfoundry.client.v3.applications.UpdateApplicationEnvironmentVariablesResponse; |
| 80 | +import org.cloudfoundry.client.v3.applications.UpdateApplicationFeatureRequest; |
| 81 | +import org.cloudfoundry.client.v3.applications.UpdateApplicationFeatureResponse; |
75 | 82 | import org.cloudfoundry.client.v3.applications.UpdateApplicationRequest; |
76 | 83 | import org.cloudfoundry.client.v3.applications.UpdateApplicationResponse; |
77 | 84 | import org.cloudfoundry.client.v3.builds.BuildResource; |
|
96 | 103 | import org.cloudfoundry.client.v3.routes.Application; |
97 | 104 | import org.cloudfoundry.client.v3.routes.Destination; |
98 | 105 | import org.cloudfoundry.client.v3.routes.Process; |
99 | | -import org.cloudfoundry.client.v3.routes.Protocol; |
100 | 106 | import org.cloudfoundry.client.v3.routes.RouteRelationships; |
101 | 107 | import org.cloudfoundry.client.v3.routes.RouteResource; |
102 | 108 | import org.cloudfoundry.client.v3.tasks.Result; |
|
118 | 124 | import static io.netty.handler.codec.http.HttpMethod.GET; |
119 | 125 | import static io.netty.handler.codec.http.HttpMethod.PATCH; |
120 | 126 | import static io.netty.handler.codec.http.HttpMethod.POST; |
121 | | -import static io.netty.handler.codec.http.HttpMethod.PUT; |
122 | 127 | import static io.netty.handler.codec.http.HttpResponseStatus.ACCEPTED; |
123 | 128 | import static io.netty.handler.codec.http.HttpResponseStatus.CREATED; |
124 | 129 | import static io.netty.handler.codec.http.HttpResponseStatus.NO_CONTENT; |
@@ -499,6 +504,33 @@ public void getEnvironmentVariables() { |
499 | 504 | .verify(Duration.ofSeconds(5)); |
500 | 505 | } |
501 | 506 |
|
| 507 | + @Test |
| 508 | + public void getFeature() { |
| 509 | + mockRequest(InteractionContext.builder() |
| 510 | + .request(TestRequest.builder() |
| 511 | + .method(GET).path("/apps/test-application-id/features/test-feature-name") |
| 512 | + .build()) |
| 513 | + .response(TestResponse.builder() |
| 514 | + .status(OK) |
| 515 | + .payload("fixtures/client/v3/apps/GET_{id}_features_{name}_response.json") |
| 516 | + .build()) |
| 517 | + .build()); |
| 518 | + |
| 519 | + this.applications |
| 520 | + .getFeature(GetApplicationFeatureRequest.builder() |
| 521 | + .applicationId("test-application-id") |
| 522 | + .featureName("test-feature-name") |
| 523 | + .build()) |
| 524 | + .as(StepVerifier::create) |
| 525 | + .expectNext(GetApplicationFeatureResponse.builder() |
| 526 | + .description("Enable SSHing into the app.") |
| 527 | + .enabled(true) |
| 528 | + .name("ssh") |
| 529 | + .build()) |
| 530 | + .expectComplete() |
| 531 | + .verify(Duration.ofSeconds(5)); |
| 532 | + } |
| 533 | + |
502 | 534 | @Test |
503 | 535 | public void getProcess() { |
504 | 536 | mockRequest(InteractionContext.builder() |
@@ -918,6 +950,49 @@ public void listDroplets() { |
918 | 950 | .verify(Duration.ofSeconds(5)); |
919 | 951 | } |
920 | 952 |
|
| 953 | + @Test |
| 954 | + public void listFeatures() { |
| 955 | + mockRequest(InteractionContext.builder() |
| 956 | + .request(TestRequest.builder() |
| 957 | + .method(GET).path("/apps/test-application-id/features") |
| 958 | + .build()) |
| 959 | + .response(TestResponse.builder() |
| 960 | + .status(OK) |
| 961 | + .payload("fixtures/client/v3/apps/GET_{id}_features_response.json") |
| 962 | + .build()) |
| 963 | + .build()); |
| 964 | + |
| 965 | + this.applications |
| 966 | + .listFeatures(ListApplicationFeaturesRequest.builder() |
| 967 | + .applicationId("test-application-id") |
| 968 | + .build()) |
| 969 | + .as(StepVerifier::create) |
| 970 | + .expectNext(ListApplicationFeaturesResponse.builder() |
| 971 | + .pagination(Pagination.builder() |
| 972 | + .totalResults(1) |
| 973 | + .totalPages(1) |
| 974 | + .first(Link.builder() |
| 975 | + .href("/v3/apps/05d39de4-2c9e-4c76-8fd6-10417da07e42/features") |
| 976 | + .build()) |
| 977 | + .last(Link.builder() |
| 978 | + .href("/v3/apps/05d39de4-2c9e-4c76-8fd6-10417da07e42/features") |
| 979 | + .build()) |
| 980 | + .build()) |
| 981 | + .resource(ApplicationFeatureResource.builder() |
| 982 | + .name("ssh") |
| 983 | + .description("Enable SSHing into the app.") |
| 984 | + .enabled(true) |
| 985 | + .build()) |
| 986 | + .resource(ApplicationFeatureResource.builder() |
| 987 | + .name("revisions") |
| 988 | + .description("Enable versioning of an application") |
| 989 | + .enabled(false) |
| 990 | + .build()) |
| 991 | + .build()) |
| 992 | + .expectComplete() |
| 993 | + .verify(Duration.ofSeconds(5)); |
| 994 | + } |
| 995 | + |
921 | 996 | @Test |
922 | 997 | public void listPackages() { |
923 | 998 | mockRequest(InteractionContext.builder() |
@@ -1679,4 +1754,33 @@ public void updateEnvironmentVariables() { |
1679 | 1754 | .verify(Duration.ofSeconds(5)); |
1680 | 1755 | } |
1681 | 1756 |
|
| 1757 | + @Test |
| 1758 | + public void updateFeature() { |
| 1759 | + mockRequest(InteractionContext.builder() |
| 1760 | + .request(TestRequest.builder() |
| 1761 | + .method(PATCH).path("/apps/test-application-id/features/ssh") |
| 1762 | + .payload("fixtures/client/v3/apps/PATCH_{id}_features_{name}_request.json") |
| 1763 | + .build()) |
| 1764 | + .response(TestResponse.builder() |
| 1765 | + .status(OK) |
| 1766 | + .payload("fixtures/client/v3/apps/PATCH_{id}_features_{name}_response.json") |
| 1767 | + .build()) |
| 1768 | + .build()); |
| 1769 | + |
| 1770 | + this.applications |
| 1771 | + .updateFeature(UpdateApplicationFeatureRequest.builder() |
| 1772 | + .applicationId("test-application-id") |
| 1773 | + .enabled(false) |
| 1774 | + .featureName("ssh") |
| 1775 | + .build()) |
| 1776 | + .as(StepVerifier::create) |
| 1777 | + .expectNext(UpdateApplicationFeatureResponse.builder() |
| 1778 | + .description("Enable SSHing into the app.") |
| 1779 | + .enabled(true) |
| 1780 | + .name("ssh") |
| 1781 | + .build()) |
| 1782 | + .expectComplete() |
| 1783 | + .verify(Duration.ofSeconds(5)); |
| 1784 | + } |
| 1785 | + |
1682 | 1786 | } |
0 commit comments