Skip to content

Commit

Permalink
Merge pull request #316 from SAP/add-none-healthcheck-type
Browse files Browse the repository at this point in the history
Handle deprecated health check type NONE
  • Loading branch information
Yavor16 authored Jan 18, 2024
2 parents 9343529 + feb6893 commit 230f977
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.sap.cloudfoundry.client.facade.domain;

public enum HealthCheckType {
HTTP, PORT, PROCESS;
HTTP, PORT, PROCESS, @Deprecated NONE;

@Override
public String toString() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import com.sap.cloudfoundry.client.facade.domain.Staging;
import com.sap.cloudfoundry.client.facade.domain.Status;
import com.sap.cloudfoundry.client.facade.dto.ApplicationToCreateDto;
import com.sap.cloudfoundry.client.facade.domain.CloudProcess;
import com.sap.cloudfoundry.client.facade.dto.ImmutableApplicationToCreateDto;

class ApplicationsCloudControllerClientIntegrationTest extends CloudControllerClientIntegrationTest {
Expand Down Expand Up @@ -148,6 +149,29 @@ void testApplicationEnvironment() {
}
}

@Test
@DisplayName("Create application, update its healthcheck type and verify it ")
void updateApplicationHealthcheckType() {
String applicationName = "test-application-16";
try {
createAndVerifyDefaultApplication(applicationName);
UUID applicationGuid = client.getApplicationGuid(applicationName);
delegate.applicationsV2()
.update(org.cloudfoundry.client.v2.applications.UpdateApplicationRequest
.builder()
.applicationId(applicationGuid.toString())
.healthCheckType(HealthCheckType.NONE.getValue())
.build())
.block();
CloudProcess cloudProcess = client.getApplicationProcess(applicationGuid);
assertEquals(com.sap.cloudfoundry.client.facade.domain.HealthCheckType.NONE, cloudProcess.getHealthCheckType());
} catch (Exception e) {
fail(e);
} finally {
client.deleteApplication(applicationName);
}
}

@Test
@DisplayName("Create application, upload a package, verify package exists")
void uploadApplication() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
import java.util.HashMap;
import java.util.Map;

import com.sap.cloudfoundry.client.facade.rest.CloudControllerRestClient;
import com.sap.cloudfoundry.client.facade.rest.CloudControllerRestClientFactory;
import org.cloudfoundry.client.CloudFoundryClient;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
Expand All @@ -30,6 +33,7 @@ abstract class CloudControllerClientIntegrationTest {
protected static final String DEFAULT_STACK = "cflinuxfs4";

protected static CloudControllerClient client;
protected static CloudFoundryClient delegate;
protected static CloudSpace target;

@BeforeAll
Expand All @@ -45,6 +49,7 @@ static void login() throws MalformedURLException {
CloudSpaceClient spaceClient = clientFactory.createSpaceClient(apiUrl, oauthClient, Collections.emptyMap());
target = spaceClient.getSpace(ITVariable.ORG.getValue(), ITVariable.SPACE.getValue());
client = new CloudControllerClientImpl(apiUrl, credentials, target, true);
delegate = clientFactory.createClient(apiUrl, oauthClient, Collections.emptyMap());
}

@BeforeEach
Expand Down

0 comments on commit 230f977

Please sign in to comment.