Skip to content

Commit

Permalink
Upgrading CFJC
Browse files Browse the repository at this point in the history
  • Loading branch information
Albertoimpl committed Jul 9, 2024
1 parent 3e48da3 commit 4d03dcf
Show file tree
Hide file tree
Showing 33 changed files with 383 additions and 40 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import java.util.concurrent.ConcurrentHashMap
buildscript {
ext {
blockHoundVersion = "1.0.9.RELEASE"
cfJavaClientVersion = "5.10.0.RELEASE"
cfJavaClientVersion = "5.12.1.RELEASE"
commonsTextVersion = "1.12.0"
immutablesVersion = "2.10.1"
openServiceBrokerVersion = "4.1.2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class CreateInstanceComponentTest extends WiremockComponentTest {

@Test
void pushAppsWhenTheyDoNotExist() {
cloudControllerFixture.stubFindSpaceV3();
cloudControllerFixture.stubAppDoesNotExist(APP_NAME_1);
cloudControllerFixture.stubPushApp(APP_NAME_1,
matchingJsonPath("$.environment_json[?(@.SPRING_APPLICATION_JSON =~ " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class CreateInstanceWithCustomParametersMappingComponentTest extends WiremockCom

@Test
void pushAppWithParametersTransformedUsingCustomTransformer() {
cloudControllerFixture.stubFindSpaceV3();
cloudControllerFixture.stubAppDoesNotExist(APP_NAME);
cloudControllerFixture.stubPushApp(APP_NAME,
matchingJsonPath(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,11 @@ void pushAppWithServicesInSpace() {
String serviceInstanceId = "instance-id";
String customSpace = "my-space";
String customSpaceGuid = "my-space-guid";

cloudControllerFixture.stubFindTestOrg();
cloudControllerFixture.stubFindSpaceV3(customSpace, customSpaceGuid);
cloudControllerFixture.stubCreateSpace(customSpace, customSpaceGuid);
cloudControllerFixture.stubAssociatePermissions(customSpace, customSpaceGuid);
cloudControllerFixture.stubAssociatePermissions();
cloudControllerFixture.stubPushApp(APP_NAME);

// given services are available in the marketplace
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class CreateInstanceWithEnvironmentComponentTest extends WiremockComponentTest {

@Test
void pushAppWithEnvironmentVariables() {
cloudControllerFixture.stubFindSpaceV3();
cloudControllerFixture.stubAppDoesNotExist(APP_NAME_1);
cloudControllerFixture.stubPushApp(APP_NAME_1,
matchingJsonPath("$.environment_json[?(@.SPRING_APPLICATION_JSON =~ /.*ENV_VAR_1.*:.*value1.*/)]"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class CreateInstanceWithExistingServicesComponentTest extends WiremockComponentT

@Test
void pushAppWithServicesWhenServicesExist() {
cloudControllerFixture.stubFindSpaceV3();
cloudControllerFixture.stubAppDoesNotExist(APP_NAME);
cloudControllerFixture.stubPushApp(APP_NAME);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class CreateInstanceWithOnlyABackingServiceComponentTest extends WiremockCompone

@Test
void createsServicesWhenOnlyBackingServiceIsRequested() {

cloudControllerFixture.stubFindSpaceV3();
// given services are available in the marketplace
cloudControllerFixture.stubServiceExists(BACKING_SERVICE_NAME, BACKING_PLAN_NAME);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class CreateInstanceWithParametersMappingComponentTest extends WiremockComponent

@Test
void pushAppWithParametersTransformedToEnvironmentVariables() {
cloudControllerFixture.stubFindSpaceV3();
cloudControllerFixture.stubAppDoesNotExist(APP_NAME);
cloudControllerFixture.stubPushApp(APP_NAME,
matchingJsonPath("$.environment_json[?(@.SPRING_APPLICATION_JSON =~ /.*parameter1.*:.*value1.*/)]"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class CreateInstanceWithPropertiesComponentTest extends WiremockComponentTest {

@Test
void pushAppWithProperties() {
cloudControllerFixture.stubFindSpaceV3();
cloudControllerFixture.stubAppDoesNotExist(APP_NAME);
cloudControllerFixture.stubPushApp(APP_NAME,
matchingJsonPath("$.[?(@.memory == '2048')]"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ void deployAppsWithServiceInstanceGuidSuffixOnCreateServiceWhenCreatingMoreThanO
String applicationName = APP_NAME + "-" + serviceInstanceId;
String backingServiceInstanceName = BACKING_SI_NAME + "-" + serviceInstanceId;

cloudControllerFixture.stubFindSpaceV3();
cloudControllerFixture.stubAppDoesNotExist(applicationName);
cloudControllerFixture.stubPushApp(applicationName);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class CreateInstanceWithServicesComponentTest extends WiremockComponentTest {

@Test
void pushAppWithServicesWhenServicesExist() {
cloudControllerFixture.stubFindSpaceV3();
cloudControllerFixture.stubAppDoesNotExist(APP_NAME);
cloudControllerFixture.stubPushApp(APP_NAME);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class CreateInstanceWithServicesParametersComponentTest extends WiremockComponen

@Test
void pushAppWithBackingServicesParameters() {
cloudControllerFixture.stubFindSpaceV3();
cloudControllerFixture.stubAppDoesNotExist(APP_NAME);
cloudControllerFixture.stubPushApp(APP_NAME);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,10 @@ void pushAppWithServicesInSpace() {
String serviceInstanceId = "instance-id";
String backingSpaceGuid = "my-space-guid";

cloudControllerFixture.stubFindTestOrg();
cloudControllerFixture.stubFindSpaceV3(serviceInstanceId, backingSpaceGuid);
cloudControllerFixture.stubCreateSpace(serviceInstanceId, backingSpaceGuid);
cloudControllerFixture.stubAssociatePermissions(serviceInstanceId, backingSpaceGuid);
cloudControllerFixture.stubAssociatePermissions();
cloudControllerFixture.stubPushAppWithHost(APP_NAME, APP_NAME + "-" + serviceInstanceId);

// given services are available in the marketplace
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ class DeleteInstanceComponentTest extends WiremockComponentTest {

@Test
void deleteAppsWhenTheyExist() {
cloudControllerFixture.stubAppExists(APP_NAME_1);
cloudControllerFixture.stubAppExists(APP_NAME_2);
cloudControllerFixture.stubAppExistsV3(APP_NAME_1);
cloudControllerFixture.stubAppExistsV3(APP_NAME_2);

cloudControllerFixture.stubServiceBindingDoesNotExist(APP_NAME_1);
cloudControllerFixture.stubServiceBindingDoesNotExist(APP_NAME_2);
Expand Down Expand Up @@ -90,6 +90,7 @@ void deleteAppsWhenTheyExist() {

@Test
void deleteAppsWhenTheyDoNotExist() {
cloudControllerFixture.stubFindSpaceV3();
cloudControllerFixture.stubAppDoesNotExist(APP_NAME_1);
cloudControllerFixture.stubAppDoesNotExist(APP_NAME_2);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ class DeleteInstanceWithAppsAndServicesComponentTest extends WiremockComponentTe

@Test
void deleteAppsAndServicesWhenTheyExist() {
cloudControllerFixture.stubFindSpaceV3();
cloudControllerFixture.stubFindSpace();
cloudControllerFixture.stubAppExistsWithBackingService(APP_NAME, BACKING_SI_NAME,
BACKING_SERVICE_NAME, BACKING_PLAN_NAME);
cloudControllerFixture.stubServiceBindingDoesNotExist(APP_NAME);
Expand Down Expand Up @@ -101,6 +103,7 @@ void deleteAppsAndServicesWhenTheyExist() {

@Test
void deleteAppsWhenTheyExistAndServicesWhenTheyDoNotExist() {
cloudControllerFixture.stubFindSpace();
cloudControllerFixture.stubAppExists(APP_NAME);
cloudControllerFixture.stubServiceBindingDoesNotExist(APP_NAME);
cloudControllerFixture.stubDeleteApp(APP_NAME);
Expand All @@ -126,6 +129,7 @@ void deleteAppsWhenTheyExistAndServicesWhenTheyDoNotExist() {

@Test
void deleteAppsAndServicesWhenTheyDoNotExist() {
cloudControllerFixture.stubFindSpace();
cloudControllerFixture.stubAppDoesNotExist(APP_NAME);

// when the service instance is deleted
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ void deleteServicesWhenTheyExist() {

@Test
void deleteServicesWhenTheyDoNotExist() {
cloudControllerFixture.stubFindSpaceV3();
// when the service instance is deleted
given(brokerFixture.serviceInstanceRequest())
.when()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class UpdateInstanceComponentTest extends WiremockComponentTest {

@Test
void updateAppsWhenTheyExist() {
cloudControllerFixture.stubFindSpaceV3();
cloudControllerFixture.stubAppExists(APP_NAME_1);
cloudControllerFixture.stubUpdateApp(APP_NAME_1);
cloudControllerFixture.stubAppExists(APP_NAME_2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import org.springframework.http.HttpStatus;
import org.springframework.test.context.TestPropertySource;

import static com.github.tomakehurst.wiremock.stubbing.Scenario.STARTED;
import static io.restassured.RestAssured.given;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.Matchers.equalTo;
Expand Down Expand Up @@ -80,8 +79,10 @@ void updateAppWithNewServiceAndTarget() {
final String backingSpaceGuid = "instance-id-space-guid";
final String serviceInstanceId = "instance-id";

cloudControllerFixture.stubFindSpace(serviceInstanceId, backingSpaceGuid, STARTED);
cloudControllerFixture.stubSpaceExists(serviceInstanceId, backingSpaceGuid, STARTED);
cloudControllerFixture.stubFindTestOrg();
cloudControllerFixture.stubFindSpace(serviceInstanceId, backingSpaceGuid);
cloudControllerFixture.stubFindSpaceV3(serviceInstanceId, backingSpaceGuid);
cloudControllerFixture.stubSpaceExists(serviceInstanceId, backingSpaceGuid);
cloudControllerFixture.stubAppExistsWithBackingService(APP_NAME, BACKING_SI_NAME,
BACKING_SERVICE_NAME, BACKING_PLAN_NAME, backingSpaceGuid);
cloudControllerFixture.stubUpdateAppWithTarget(APP_NAME, backingSpaceGuid);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ class UpdateInstanceWithNewServiceComponentTest extends WiremockComponentTest {

@Test
void updateAppWithNewService() {
cloudControllerFixture.stubFindSpaceV3();
cloudControllerFixture.stubAppExistsWithBackingService(APP_NAME, BACKING_SI_NAME,
BACKING_SERVICE_NAME, BACKING_PLAN_NAME);
cloudControllerFixture.stubUpdateApp(APP_NAME);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class UpdateInstanceWithServicesComponentTest extends WiremockComponentTest {

@Test
void updateAppWithServices() {
cloudControllerFixture.stubFindSpaceV3();
cloudControllerFixture.stubAppExistsWithBackingService(APP_NAME, BACKING_SERVICE_INSTANCE_NAME,
BACKING_SERVICE_NAME, BACKING_PLAN_NAME);
cloudControllerFixture.stubUpdateApp(APP_NAME);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ class UpdateInstanceWithServicesHostAndDomainComponentTest extends WiremockCompo

@Test
void updateAppWithHostAndDomain() {
cloudControllerFixture.stubFindTestOrg();
cloudControllerFixture.stubFindSpaceV3();
cloudControllerFixture.stubAppExists(APP_NAME);
cloudControllerFixture.stubUpdateAppWithHostAndDomain(APP_NAME);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ class UpdateInstanceWithServicesParametersComponentTest extends WiremockComponen

@Test
void updateAppWithBackingServicesParameters() {
cloudControllerFixture.stubFindSpaceV3();
cloudControllerFixture.stubAppExistsWithBackingService(APP_NAME, BACKING_SI_NAME, BACKING_SERVICE_NAME,
BACKING_PLAN_NAME);
cloudControllerFixture.stubUpdateApp(APP_NAME);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ class UpdateInstanceWithServicesRebindComponentTest extends WiremockComponentTes

@Test
void updateAppWithServices() {
cloudControllerFixture.stubFindSpaceV3();
cloudControllerFixture.stubAppExistsWithBackingService(APP_NAME, BACKING_SI_NAME, BACKING_SERVICE_NAME,
BACKING_PLAN_NAME);
cloudControllerFixture.stubUpdateApp(APP_NAME);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class UpdateInstanceWithUpgradeComponentTest extends WiremockComponentTest {

@Test
void updateAppsWhenTheyExist() {
cloudControllerFixture.stubFindSpaceV3();
cloudControllerFixture.stubAppExists(APP_NAME_1);
cloudControllerFixture.stubUpdateAppWithUpgrade(APP_NAME_1);

Expand Down
Loading

0 comments on commit 4d03dcf

Please sign in to comment.