Skip to content
This repository was archived by the owner on Sep 12, 2025. It is now read-only.

Commit c8d7b9f

Browse files
committed
Verify app features in integration tests
JIRA:LMCROSSITXSADEPLOY-3111
1 parent b3b33d7 commit c8d7b9f

File tree

1 file changed

+35
-12
lines changed

1 file changed

+35
-12
lines changed

src/test/java/com/sap/cloudfoundry/client/facade/ApplicationsCloudControllerClientIntegrationTest.java

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -298,8 +298,7 @@ void createDockerPackage() {
298298
try {
299299
verifyApplicationWillBeCreated(applicationName, ImmutableStaging.builder()
300300
.dockerInfo(dockerInfo)
301-
.build(),
302-
Set.of(getImmutableCloudRoute()));
301+
.build(), Set.of(getImmutableCloudRoute()));
303302
UUID applicationGuid = client.getApplicationGuid(applicationName);
304303
CloudPackage dockerPackage = client.createDockerPackage(applicationGuid, dockerInfo);
305304
assertEquals(CloudPackage.Type.DOCKER, dockerPackage.getType());
@@ -344,8 +343,7 @@ void getPackagesForApplication() {
344343
try {
345344
verifyApplicationWillBeCreated(applicationName, ImmutableStaging.builder()
346345
.dockerInfo(dockerInfo)
347-
.build(),
348-
Set.of(getImmutableCloudRoute()));
346+
.build(), Set.of(getImmutableCloudRoute()));
349347
UUID applicationGuid = client.getApplicationGuid(applicationName);
350348
CloudPackage dockerPackage = client.createDockerPackage(applicationGuid, dockerInfo);
351349
List<CloudPackage> packagesForApplication = client.getPackagesForApplication(applicationGuid);
@@ -374,10 +372,9 @@ void getBuildsForApplication() {
374372
.map(CloudMetadata::getGuid)
375373
.anyMatch(buildGuid -> buildGuid.equals(build.getGuid())));
376374
assertEquals(build.getMetadata()
377-
.getGuid(),
378-
client.getBuild(build.getMetadata()
379-
.getGuid())
380-
.getGuid());
375+
.getGuid(), client.getBuild(build.getMetadata()
376+
.getGuid())
377+
.getGuid());
381378
} catch (Exception e) {
382379
fail(e);
383380
} finally {
@@ -444,6 +441,22 @@ void createCnbApplication() {
444441
}
445442
}
446443

444+
@Test
445+
@DisplayName("Crete application with enabled SSH and vcap-file-based services feature")
446+
void createApplicationWithSshAndVcapFileBasedServices() {
447+
String applicationName = "test-app-18";
448+
Staging staging = ImmutableStaging.builder()
449+
.appFeatures(Map.of("file-based-vcap-services", true, "ssh", true))
450+
.build();
451+
try {
452+
verifyApplicationWillBeCreated(applicationName, staging, Set.of(getImmutableCloudRoute()));
453+
} catch (Exception e) {
454+
fail(e);
455+
} finally {
456+
client.deleteApplication(applicationName);
457+
}
458+
}
459+
447460
private void verifyApplicationWillBeCreated(String applicationName, Staging staging, Set<CloudRoute> routes) {
448461
ApplicationToCreateDto applicationToCreateDto = ImmutableApplicationToCreateDto.builder()
449462
.name(applicationName)
@@ -457,8 +470,7 @@ private void verifyApplicationWillBeCreated(String applicationName, Staging stag
457470
.name(applicationName)
458471
.state(CloudApplication.State.STOPPED)
459472
.lifecycle(createLifecycle(staging))
460-
.build(),
461-
staging, routes);
473+
.build(), staging, routes);
462474
}
463475

464476
private static void assertApplicationExists(CloudApplication cloudApplication, Staging staging, Set<CloudRoute> routes) {
@@ -473,12 +485,23 @@ private static void assertApplicationExists(CloudApplication cloudApplication, S
473485
}
474486
assertEquals(MEMORY_IN_MB, process.getMemoryInMb());
475487
assertEquals(DISK_IN_MB, process.getDiskInMb());
488+
assertAppFeatures(staging, application);
489+
}
490+
491+
private static void assertAppFeatures(Staging staging, CloudApplication application) {
492+
var appFeatures = client.getApplicationFeatures(application.getGuid());
493+
for (Map.Entry<String, Boolean> entry : staging.getAppFeatures()
494+
.entrySet()) {
495+
String featureName = entry.getKey();
496+
Boolean expectedValue = entry.getValue();
497+
Boolean actualValue = appFeatures.get(featureName);
498+
assertEquals(expectedValue, actualValue);
499+
}
476500
}
477501

478502
private void createAndVerifyDefaultApplication(String applicationName) {
479503
verifyApplicationWillBeCreated(applicationName, ImmutableStaging.builder()
480-
.build(),
481-
Set.of(getImmutableCloudRoute()));
504+
.build(), Set.of(getImmutableCloudRoute()));
482505
}
483506

484507
private ImmutableCloudRoute getImmutableCloudRoute() {

0 commit comments

Comments
 (0)