FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

adds tests · cloudfoundry/cf-java-client@bccf442 · GitHub

Repository navigation

Commit bccf442

Browse files
committed
adds tests
1 parent ab50897 commit bccf442

2 files changed

Lines changed: 79 additions & 0 deletions

File tree

‎cloudfoundry-operations/src/test/java/org/cloudfoundry/operations/applications/ApplicationManifestUtilsV3Test.java‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import java.io.IOException;
88
import java.nio.file.Files;
99
import java.nio.file.Path;
10+
import java.util.Map;
1011

1112
import static org.junit.jupiter.api.Assertions.assertEquals;
1213

@@ -39,6 +40,22 @@ void testWithFeature() throws IOException {
3940
assertSerializeDeserialize(manifest);
4041
}
4142

43+
@Test
44+
void testWithFeatureAsMap() throws IOException {
45+
Map<String, Boolean> features = new java.util.HashMap<>();
46+
features.put("file-based-vcap-services", true);
47+
ManifestV3 manifest =
48+
ManifestV3.builder()
49+
.application(
50+
ManifestV3Application.builder()
51+
.name("test-app")
52+
.features(features)
53+
.build())
54+
.build();
55+
56+
assertSerializeDeserialize(manifest);
57+
}
58+
4259
@Test
4360
void testGenericApplication() throws IOException {
4461
ManifestV3 manifest =

‎integration-test/src/test/java/org/cloudfoundry/operations/ApplicationsTest.java‎

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
import org.cloudfoundry.CloudFoundryVersion;
3131
import org.cloudfoundry.IfCloudFoundryVersion;
3232
import org.cloudfoundry.client.CloudFoundryClient;
33+
import org.cloudfoundry.client.v3.applications.ApplicationFeatureResource;
34+
import org.cloudfoundry.client.v3.applications.ListApplicationFeaturesRequest;
3335
import org.cloudfoundry.operations.applications.ApplicationDetail;
3436
import org.cloudfoundry.operations.applications.ApplicationEnvironments;
3537
import org.cloudfoundry.operations.applications.ApplicationEvent;
@@ -79,6 +81,7 @@
7981
import org.cloudfoundry.operations.services.GetServiceInstanceRequest;
8082
import org.cloudfoundry.operations.services.ServiceInstance;
8183
import org.cloudfoundry.util.FluentMap;
84+
import org.cloudfoundry.util.PaginationUtils;
8285
import org.junit.jupiter.api.Test;
8386
import org.springframework.beans.factory.annotation.Autowired;
8487
import org.springframework.beans.factory.annotation.Qualifier;
@@ -573,6 +576,65 @@ public void pushBindServices() throws IOException {
573576
.verify(Duration.ofMinutes(5));
574577
}
575578

579+
@Test
580+
public void pushAppFeatures() throws IOException {
581+
String applicationName = this.nameFactory.getApplicationName();
582+
String serviceInstanceName = this.nameFactory.getServiceInstanceName();
583+
584+
final String featureKey = "file-based-vcap-services";
585+
createServiceInstance(
586+
this.cloudFoundryOperations,
587+
this.planName,
588+
serviceInstanceName,
589+
this.serviceName)
590+
.then(
591+
this.cloudFoundryOperations
592+
.applications()
593+
.pushManifest(
594+
PushApplicationManifestRequest.builder()
595+
.manifest(
596+
ApplicationManifest.builder()
597+
.path(
598+
new ClassPathResource(
599+
"test-application.zip")
600+
.getFile()
601+
.toPath())
602+
.buildpack("staticfile_buildpack")
603+
.disk(512)
604+
.healthCheckType(
605+
ApplicationHealthCheck.PORT)
606+
.memory(64)
607+
.name(applicationName)
608+
.service(serviceInstanceName)
609+
.feature(featureKey, true)
610+
.build())
611+
.noStart(false)
612+
.build()))
613+
.then(
614+
this.cloudFoundryOperations
615+
.applications()
616+
.get(GetApplicationRequest.builder().name(applicationName).build()))
617+
.map(ApplicationDetail::getId)
618+
.flatMapMany(
619+
applicationId ->
620+
PaginationUtils.requestClientV3Resources(
621+
page ->
622+
this.cloudFoundryClient
623+
.applicationsV3()
624+
.listFeatures(
625+
ListApplicationFeaturesRequest
626+
.builder()
627+
.applicationId(applicationId)
628+
.page(page)
629+
.build())))
630+
.filter(feature -> featureKey.equals(feature.getName()))
631+
.map(ApplicationFeatureResource::getEnabled)
632+
.as(StepVerifier::create)
633+
.expectNext(true)
634+
.expectComplete()
635+
.verify(Duration.ofMinutes(5));
636+
}
637+
576638
@Test
577639
public void pushDirectory() throws IOException {
578640
String applicationName = this.nameFactory.getApplicationName();

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL