Upgrading CFJC
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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 =~ " +
|
||||
|
||||
@@ -71,6 +71,7 @@ class CreateInstanceWithCustomParametersMappingComponentTest extends WiremockCom
|
||||
|
||||
@Test
|
||||
void pushAppWithParametersTransformedUsingCustomTransformer() {
|
||||
cloudControllerFixture.stubFindSpaceV3();
|
||||
cloudControllerFixture.stubAppDoesNotExist(APP_NAME);
|
||||
cloudControllerFixture.stubPushApp(APP_NAME,
|
||||
matchingJsonPath(
|
||||
|
||||
@@ -77,8 +77,11 @@ class CreateInstanceWithCustomTargetComponentTest extends WiremockComponentTest
|
||||
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
|
||||
|
||||
@@ -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.*/)]"),
|
||||
|
||||
@@ -57,6 +57,7 @@ class CreateInstanceWithExistingServicesComponentTest extends WiremockComponentT
|
||||
|
||||
@Test
|
||||
void pushAppWithServicesWhenServicesExist() {
|
||||
cloudControllerFixture.stubFindSpaceV3();
|
||||
cloudControllerFixture.stubAppDoesNotExist(APP_NAME);
|
||||
cloudControllerFixture.stubPushApp(APP_NAME);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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.*/)]"),
|
||||
|
||||
@@ -57,6 +57,7 @@ class CreateInstanceWithPropertiesComponentTest extends WiremockComponentTest {
|
||||
|
||||
@Test
|
||||
void pushAppWithProperties() {
|
||||
cloudControllerFixture.stubFindSpaceV3();
|
||||
cloudControllerFixture.stubAppDoesNotExist(APP_NAME);
|
||||
cloudControllerFixture.stubPushApp(APP_NAME,
|
||||
matchingJsonPath("$.[?(@.memory == '2048')]"),
|
||||
|
||||
@@ -68,6 +68,7 @@ class CreateInstanceWithServiceInstanceGuidSuffixTargetComponentTest extends Wir
|
||||
String applicationName = APP_NAME + "-" + serviceInstanceId;
|
||||
String backingServiceInstanceName = BACKING_SI_NAME + "-" + serviceInstanceId;
|
||||
|
||||
cloudControllerFixture.stubFindSpaceV3();
|
||||
cloudControllerFixture.stubAppDoesNotExist(applicationName);
|
||||
cloudControllerFixture.stubPushApp(applicationName);
|
||||
|
||||
|
||||
@@ -61,6 +61,7 @@ class CreateInstanceWithServicesComponentTest extends WiremockComponentTest {
|
||||
|
||||
@Test
|
||||
void pushAppWithServicesWhenServicesExist() {
|
||||
cloudControllerFixture.stubFindSpaceV3();
|
||||
cloudControllerFixture.stubAppDoesNotExist(APP_NAME);
|
||||
cloudControllerFixture.stubPushApp(APP_NAME);
|
||||
|
||||
|
||||
@@ -66,6 +66,7 @@ class CreateInstanceWithServicesParametersComponentTest extends WiremockComponen
|
||||
|
||||
@Test
|
||||
void pushAppWithBackingServicesParameters() {
|
||||
cloudControllerFixture.stubFindSpaceV3();
|
||||
cloudControllerFixture.stubAppDoesNotExist(APP_NAME);
|
||||
cloudControllerFixture.stubPushApp(APP_NAME);
|
||||
|
||||
|
||||
@@ -67,8 +67,10 @@ class CreateInstanceWithSpacePerServiceInstanceTargetComponentTest extends Wirem
|
||||
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
|
||||
|
||||
@@ -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);
|
||||
@@ -90,6 +90,7 @@ class DeleteInstanceComponentTest extends WiremockComponentTest {
|
||||
|
||||
@Test
|
||||
void deleteAppsWhenTheyDoNotExist() {
|
||||
cloudControllerFixture.stubFindSpaceV3();
|
||||
cloudControllerFixture.stubAppDoesNotExist(APP_NAME_1);
|
||||
cloudControllerFixture.stubAppDoesNotExist(APP_NAME_2);
|
||||
|
||||
|
||||
@@ -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);
|
||||
@@ -101,6 +103,7 @@ class DeleteInstanceWithAppsAndServicesComponentTest extends WiremockComponentTe
|
||||
|
||||
@Test
|
||||
void deleteAppsWhenTheyExistAndServicesWhenTheyDoNotExist() {
|
||||
cloudControllerFixture.stubFindSpace();
|
||||
cloudControllerFixture.stubAppExists(APP_NAME);
|
||||
cloudControllerFixture.stubServiceBindingDoesNotExist(APP_NAME);
|
||||
cloudControllerFixture.stubDeleteApp(APP_NAME);
|
||||
@@ -126,6 +129,7 @@ class DeleteInstanceWithAppsAndServicesComponentTest extends WiremockComponentTe
|
||||
|
||||
@Test
|
||||
void deleteAppsAndServicesWhenTheyDoNotExist() {
|
||||
cloudControllerFixture.stubFindSpace();
|
||||
cloudControllerFixture.stubAppDoesNotExist(APP_NAME);
|
||||
|
||||
// when the service instance is deleted
|
||||
|
||||
@@ -89,6 +89,7 @@ class DeleteInstanceWithServicesComponentTest extends WiremockComponentTest {
|
||||
|
||||
@Test
|
||||
void deleteServicesWhenTheyDoNotExist() {
|
||||
cloudControllerFixture.stubFindSpaceV3();
|
||||
// when the service instance is deleted
|
||||
given(brokerFixture.serviceInstanceRequest())
|
||||
.when()
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -25,7 +25,6 @@ import org.springframework.cloud.servicebroker.model.instance.OperationState;
|
||||
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;
|
||||
@@ -80,8 +79,10 @@ class UpdateInstanceWithNewServiceAndTargetComponentTest extends WiremockCompone
|
||||
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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -53,6 +53,8 @@ class UpdateInstanceWithServicesHostAndDomainComponentTest extends WiremockCompo
|
||||
|
||||
@Test
|
||||
void updateAppWithHostAndDomain() {
|
||||
cloudControllerFixture.stubFindTestOrg();
|
||||
cloudControllerFixture.stubFindSpaceV3();
|
||||
cloudControllerFixture.stubAppExists(APP_NAME);
|
||||
cloudControllerFixture.stubUpdateAppWithHostAndDomain(APP_NAME);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -54,6 +54,7 @@ class UpdateInstanceWithUpgradeComponentTest extends WiremockComponentTest {
|
||||
|
||||
@Test
|
||||
void updateAppsWhenTheyExist() {
|
||||
cloudControllerFixture.stubFindSpaceV3();
|
||||
cloudControllerFixture.stubAppExists(APP_NAME_1);
|
||||
cloudControllerFixture.stubUpdateAppWithUpgrade(APP_NAME_1);
|
||||
|
||||
|
||||
@@ -35,15 +35,10 @@ import static com.github.tomakehurst.wiremock.client.WireMock.post;
|
||||
import static com.github.tomakehurst.wiremock.client.WireMock.put;
|
||||
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
|
||||
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
|
||||
import static com.github.tomakehurst.wiremock.stubbing.Scenario.STARTED;
|
||||
|
||||
@TestComponent
|
||||
public class CloudControllerStubFixture extends WiremockStubFixture {
|
||||
|
||||
private static final String SCENARIO_NAME = "CreateSpace";
|
||||
|
||||
private static final String SPACE_CREATED_STATE = "SpaceCreated";
|
||||
|
||||
private static final String TEST_SPACE_GUID = "TEST-SPACE-GUID";
|
||||
|
||||
private static final String TEST_ORG_GUID = "TEST-ORG-GUID";
|
||||
@@ -56,8 +51,8 @@ public class CloudControllerStubFixture extends WiremockStubFixture {
|
||||
|
||||
public void stubCommonCloudControllerRequests() {
|
||||
stubGetPlatformInfo();
|
||||
stubFindTestOrg();
|
||||
stubFindSpace("development", TEST_SPACE_GUID, STARTED);
|
||||
stubFindTestOrgV3();
|
||||
stubFindSpace("development", TEST_SPACE_GUID);
|
||||
stubFindDomains();
|
||||
}
|
||||
|
||||
@@ -73,7 +68,7 @@ public class CloudControllerStubFixture extends WiremockStubFixture {
|
||||
.withBody(cc("get-info"))));
|
||||
}
|
||||
|
||||
private void stubFindTestOrg() {
|
||||
public void stubFindTestOrg() {
|
||||
stubFor(get(urlPathEqualTo("/v2/organizations"))
|
||||
.withMetadata(optionalStubMapping())
|
||||
.willReturn(ok()
|
||||
@@ -87,10 +82,22 @@ public class CloudControllerStubFixture extends WiremockStubFixture {
|
||||
replace("@org-guid", TEST_ORG_GUID)))));
|
||||
}
|
||||
|
||||
public void stubFindSpace(String spaceName, String spaceGuid, String scenario) {
|
||||
private void stubFindTestOrgV3() {
|
||||
stubFor(get(urlPathEqualTo("/v3/organizations"))
|
||||
.withMetadata(optionalStubMapping())
|
||||
.willReturn(ok()
|
||||
.withBody(cc("list-organizations-v3",
|
||||
replace("@org-guid", TEST_ORG_GUID)))));
|
||||
|
||||
stubFor(get(urlPathEqualTo("/v3/organizations/" + TEST_ORG_GUID))
|
||||
.withMetadata(optionalStubMapping())
|
||||
.willReturn(ok()
|
||||
.withBody(cc("get-organization-v3",
|
||||
replace("@org-guid", TEST_ORG_GUID)))));
|
||||
}
|
||||
|
||||
public void stubFindSpace(String spaceName, String spaceGuid) {
|
||||
stubFor(get(urlPathEqualTo("/v2/spaces"))
|
||||
.inScenario(SCENARIO_NAME)
|
||||
.whenScenarioStateIs(scenario)
|
||||
.withQueryParam("q", equalTo("name:" + spaceName))
|
||||
.withMetadata(optionalStubMapping())
|
||||
.willReturn(ok()
|
||||
@@ -100,8 +107,6 @@ public class CloudControllerStubFixture extends WiremockStubFixture {
|
||||
replace("@space-guid", spaceGuid)))));
|
||||
|
||||
stubFor(get(urlPathEqualTo("/v2/spaces/" + spaceGuid))
|
||||
.inScenario(SCENARIO_NAME)
|
||||
.whenScenarioStateIs(scenario)
|
||||
.withMetadata(optionalStubMapping())
|
||||
.willReturn(ok()
|
||||
.withBody(cc("get-space",
|
||||
@@ -110,16 +115,51 @@ public class CloudControllerStubFixture extends WiremockStubFixture {
|
||||
replace("@space-guid", spaceGuid)))));
|
||||
|
||||
stubFor(get(urlPathEqualTo("/v2/spaces/" + spaceGuid + "/apps"))
|
||||
.inScenario(SCENARIO_NAME)
|
||||
.whenScenarioStateIs(scenario)
|
||||
.withQueryParam("page", equalTo("1"))
|
||||
.withMetadata(optionalStubMapping())
|
||||
.willReturn(ok()
|
||||
.withBody(cc("empty-query-results"))));
|
||||
|
||||
stubFor(get(urlPathEqualTo("/v2/spaces/" + spaceGuid + "/security_groups"))
|
||||
.inScenario(SCENARIO_NAME)
|
||||
.whenScenarioStateIs(scenario)
|
||||
.withMetadata(optionalStubMapping())
|
||||
.willReturn(ok()
|
||||
.withBody(cc("get-space-security_groups"))));
|
||||
}
|
||||
|
||||
public void stubFindSpaceV3() {
|
||||
stubFindSpaceV3("development", TEST_SPACE_GUID);
|
||||
}
|
||||
|
||||
public void stubFindSpace() {
|
||||
stubFindSpace("development", TEST_SPACE_GUID);
|
||||
}
|
||||
|
||||
public void stubFindSpaceV3(String spaceName, String spaceGuid) {
|
||||
stubFor(get(urlPathEqualTo("/v3/spaces"))
|
||||
.withQueryParam("names", equalTo(spaceName))
|
||||
.withQueryParam("organization_guids", equalTo(TEST_ORG_GUID))
|
||||
.withQueryParam("page", equalTo("1"))
|
||||
.willReturn(ok()
|
||||
.withBody(cc("list-spaces-v3",
|
||||
replace("@org-guid", TEST_ORG_GUID),
|
||||
replace("@name", spaceName),
|
||||
replace("@space-guid", spaceGuid)))));
|
||||
|
||||
stubFor(get(urlPathEqualTo("/v3/spaces/" + spaceGuid))
|
||||
.withMetadata(optionalStubMapping())
|
||||
.willReturn(ok()
|
||||
.withBody(cc("get-space-v3",
|
||||
replace("@name", "test"),
|
||||
replace("@org-guid", TEST_ORG_GUID),
|
||||
replace("@space-guid", spaceGuid)))));
|
||||
|
||||
stubFor(get(urlPathEqualTo("/v3/spaces/" + spaceGuid + "/apps"))
|
||||
.withQueryParam("page", equalTo("1"))
|
||||
.withMetadata(optionalStubMapping())
|
||||
.willReturn(ok()
|
||||
.withBody(cc("empty-query-results"))));
|
||||
|
||||
stubFor(get(urlPathEqualTo("/v3/spaces/" + spaceGuid + "/security_groups"))
|
||||
.withMetadata(optionalStubMapping())
|
||||
.willReturn(ok()
|
||||
.withBody(cc("get-space-security_groups"))));
|
||||
@@ -161,9 +201,6 @@ public class CloudControllerStubFixture extends WiremockStubFixture {
|
||||
|
||||
public void stubCreateSpace(final String spaceName, final String spaceGuid) {
|
||||
stubFor(post(urlPathEqualTo("/v2/spaces"))
|
||||
.inScenario(SCENARIO_NAME)
|
||||
.whenScenarioStateIs(STARTED)
|
||||
.willSetStateTo(SPACE_CREATED_STATE)
|
||||
.withRequestBody(matchingJsonPath("$.[?(@.name == '" + spaceName + "')]"))
|
||||
.withRequestBody(matchingJsonPath("$.[?(@.organization_guid == '" + TEST_ORG_GUID + "')]"))
|
||||
.willReturn(ok()
|
||||
@@ -172,7 +209,7 @@ public class CloudControllerStubFixture extends WiremockStubFixture {
|
||||
replace("@space-guid", spaceGuid),
|
||||
replace("@org-guid", TEST_ORG_GUID)))));
|
||||
|
||||
stubFindSpace(spaceName, spaceGuid, SPACE_CREATED_STATE);
|
||||
stubFindSpace(spaceName, spaceGuid);
|
||||
}
|
||||
|
||||
public void stubAppDoesNotExist(final String appName) {
|
||||
@@ -224,10 +261,55 @@ public class CloudControllerStubFixture extends WiremockStubFixture {
|
||||
replace("@guid", stackGuid(appName))))));
|
||||
}
|
||||
|
||||
public void stubAppExistsInSpaceV3(final String appName, final String spaceGuid) {
|
||||
stubFor(get(urlPathEqualTo("/v3/apps/" + appGuid(appName)))
|
||||
.withMetadata(optionalStubMapping())
|
||||
.willReturn(ok()
|
||||
.withBody(cc("get-app-STAGED-v3",
|
||||
replace("@name", appName)))));
|
||||
|
||||
stubFor(get(urlPathEqualTo("/v2/spaces/" + spaceGuid + "/apps"))
|
||||
.withQueryParam("q", equalTo("name:" + appName))
|
||||
.withQueryParam("page", equalTo("1"))
|
||||
.willReturn(ok()
|
||||
.withBody(cc("list-space-apps",
|
||||
replace("@name", appName),
|
||||
replace("@guid", appGuid(appName)),
|
||||
replace("@space-guid", spaceGuid),
|
||||
replace("@stack-guid", stackGuid(appName))))));
|
||||
|
||||
stubFor(get(urlPathEqualTo("/v2/apps/" + appGuid(appName) + "/instances"))
|
||||
.willReturn(ok()
|
||||
.withBody(cc("get-app-instances"))));
|
||||
|
||||
stubFor(get(urlPathEqualTo("/v2/apps/" + appGuid(appName) + "/summary"))
|
||||
.withMetadata(optionalStubMapping())
|
||||
.willReturn(ok()
|
||||
.withBody(cc("get-app-summary",
|
||||
replace("@name", appName),
|
||||
replace("@guid", appGuid(appName)),
|
||||
replace("@stack-guid", stackGuid(appName)),
|
||||
replace("@route-guid", routeGuid(appName))))));
|
||||
|
||||
stubFor(get(urlPathEqualTo("/v2/apps/" + appGuid(appName) + "/stats"))
|
||||
.willReturn(ok()
|
||||
.withBody(cc("get-app-stats",
|
||||
replace("@name", appName)))));
|
||||
|
||||
stubFor(get(urlPathEqualTo("/v2/stacks/" + stackGuid(appName)))
|
||||
.willReturn(ok()
|
||||
.withBody(cc("get-stack",
|
||||
replace("@guid", stackGuid(appName))))));
|
||||
}
|
||||
|
||||
public void stubAppExists(final String appName) {
|
||||
stubAppExistsInSpace(appName, TEST_SPACE_GUID);
|
||||
}
|
||||
|
||||
public void stubAppExistsV3(final String appName) {
|
||||
stubAppExistsInSpaceV3(appName, TEST_SPACE_GUID);
|
||||
}
|
||||
|
||||
public void stubAppExistsWithBackingService(final String appName, final String serviceInstanceName,
|
||||
final String serviceName, final String planName) {
|
||||
stubAppExistsWithBackingService(appName, serviceInstanceName, serviceName, planName, TEST_SPACE_GUID);
|
||||
@@ -649,11 +731,10 @@ public class CloudControllerStubFixture extends WiremockStubFixture {
|
||||
.withBody(cc("empty-query-results"))));
|
||||
}
|
||||
|
||||
public void stubAssociatePermissions(final String spaceName, final String spaceGuid) {
|
||||
public void stubAssociatePermissions() {
|
||||
stubFor(get(urlPathEqualTo("/v2/config/feature_flags/set_roles_by_username"))
|
||||
.willReturn(ok()
|
||||
.withBody(cc("get-feature-flag-roles"))));
|
||||
stubSpaceExists(spaceName, spaceGuid, SPACE_CREATED_STATE);
|
||||
|
||||
stubFor(put(urlPathEqualTo("/v2/organizations/" + TEST_ORG_GUID + "/users"))
|
||||
.willReturn(ok()));
|
||||
@@ -674,10 +755,8 @@ public class CloudControllerStubFixture extends WiremockStubFixture {
|
||||
.replace("@service-name", serviceName))));
|
||||
}
|
||||
|
||||
public void stubSpaceExists(final String spaceName, final String spaceGuid, final String scenario) {
|
||||
public void stubSpaceExists(final String spaceName, final String spaceGuid) {
|
||||
stubFor(get(urlPathEqualTo("/v2/organizations/" + TEST_ORG_GUID + "/spaces"))
|
||||
.inScenario(SCENARIO_NAME)
|
||||
.whenScenarioStateIs(scenario)
|
||||
.withQueryParam("q", equalTo("name:" + spaceName))
|
||||
.willReturn(ok()
|
||||
.withBody(cc("list-spaces",
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
{
|
||||
"guid": "@guid",
|
||||
"name": "@name",
|
||||
"state": "started",
|
||||
"created_at": "2016-03-17T21:41:30Z",
|
||||
"updated_at": "2016-06-08T16:41:26Z",
|
||||
"lifecycle": {
|
||||
"type": "buildpack",
|
||||
"data": {
|
||||
"buildpacks": [
|
||||
"java_buildpack"
|
||||
],
|
||||
"stack": "cflinuxfs4"
|
||||
}
|
||||
},
|
||||
"relationships": {
|
||||
"space": {
|
||||
"data": {
|
||||
"guid": "@space-guid"
|
||||
}
|
||||
}
|
||||
},
|
||||
"links": {
|
||||
"self": {
|
||||
"href": "https://api.example.org/v3/apps/@guid"
|
||||
},
|
||||
"space": {
|
||||
"href": "https://api.example.org/v3/spaces/@space-guid"
|
||||
},
|
||||
"processes": {
|
||||
"href": "https://api.example.org/v3/apps/@guid/processes"
|
||||
},
|
||||
"packages": {
|
||||
"href": "https://api.example.org/v3/apps/@guid/packages"
|
||||
},
|
||||
"environment_variables": {
|
||||
"href": "https://api.example.org/v3/apps/@guid/environment_variables"
|
||||
},
|
||||
"current_droplet": {
|
||||
"href": "https://api.example.org/v3/apps/@guid/droplets/current"
|
||||
},
|
||||
"droplets": {
|
||||
"href": "https://api.example.org/v3/apps/@guid/droplets"
|
||||
},
|
||||
"tasks": {
|
||||
"href": "https://api.example.org/v3/apps/@guid/tasks"
|
||||
},
|
||||
"start": {
|
||||
"href": "https://api.example.org/v3/apps/@guid/actions/start",
|
||||
"method": "POST"
|
||||
},
|
||||
"stop": {
|
||||
"href": "https://api.example.org/v3/apps/@guid/actions/stop",
|
||||
"method": "POST"
|
||||
},
|
||||
"revisions": {
|
||||
"href": "https://api.example.org/v3/apps/@guid/revisions"
|
||||
},
|
||||
"deployed_revisions": {
|
||||
"href": "https://api.example.org/v3/apps/@guid/revisions/deployed"
|
||||
},
|
||||
"features": {
|
||||
"href": "https://api.example.org/v3/apps/@guid/features"
|
||||
}
|
||||
},
|
||||
"metadata": {
|
||||
"labels": {},
|
||||
"annotations": {}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"guid": "@org-guid",
|
||||
"created_at": "2017-02-01T01:33:58Z",
|
||||
"updated_at": "2017-02-01T01:33:58Z",
|
||||
"name": "my-organization",
|
||||
"suspended": false,
|
||||
"relationships": {
|
||||
"quota": {
|
||||
"data": {
|
||||
"guid": "b7887f5c-34bb-40c5-9778-577572e4fb2d"
|
||||
}
|
||||
}
|
||||
},
|
||||
"links": {
|
||||
"self": {
|
||||
"href": "https://api.example.org/v3/organizations/@org-guid"
|
||||
},
|
||||
"domains": {
|
||||
"href": "https://api.example.org/v3/organizations/@org-guid/domains"
|
||||
},
|
||||
"default_domain": {
|
||||
"href": "https://api.example.org/v3/organizations/@org-guid/domains/default"
|
||||
},
|
||||
"quota": {
|
||||
"href": "https://api.example.org/v3/organization_quotas/b7887f5c-34bb-40c5-9778-577572e4fb2d"
|
||||
}
|
||||
},
|
||||
"metadata": {
|
||||
"labels": {},
|
||||
"annotations": {}
|
||||
}
|
||||
}
|
||||
@@ -22,4 +22,4 @@
|
||||
"app_events_url": "/v2/organizations/@org-guid/app_events",
|
||||
"space_quota_definitions_url": "/v2/organizations/@org-guid/space_quota_definitions"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"guid": "@space-guid",
|
||||
"created_at": "2017-02-01T01:33:58Z",
|
||||
"updated_at": "2017-02-01T01:33:58Z",
|
||||
"name": "@name",
|
||||
"relationships": {
|
||||
"organization": {
|
||||
"data": {
|
||||
"guid": "@org-guid"
|
||||
}
|
||||
},
|
||||
"quota": {
|
||||
"data": null
|
||||
}
|
||||
},
|
||||
"links": {
|
||||
"self": {
|
||||
"href": "https://api.example.org/v3/spaces/@space-guid"
|
||||
},
|
||||
"features": {
|
||||
"href": "https://api.example.org/v3/spaces/@space-guid/features"
|
||||
},
|
||||
"organization": {
|
||||
"href": "https://api.example.org/v3/organizations/@org-guid"
|
||||
},
|
||||
"apply_manifest": {
|
||||
"href": "https://api.example.org/v3/spaces/@space-guid/actions/apply_manifest",
|
||||
"method": "POST"
|
||||
}
|
||||
},
|
||||
"metadata": {
|
||||
"labels": {},
|
||||
"annotations": {}
|
||||
}
|
||||
}
|
||||
@@ -2,14 +2,13 @@
|
||||
"metadata": {
|
||||
"guid": "@space-guid",
|
||||
"url": "/v2/spaces/@space-guid",
|
||||
"created_at": "2018-07-19T20:34:16Z",
|
||||
"updated_at": "2018-07-19T20:34:16Z"
|
||||
"created_at": "2016-06-08T16:41:40Z",
|
||||
"updated_at": "2016-06-08T16:41:26Z"
|
||||
},
|
||||
"entity": {
|
||||
"name": "@name",
|
||||
"organization_guid": "@org-guid",
|
||||
"space_quota_definition_guid": null,
|
||||
"isolation_segment_guid": null,
|
||||
"allow_ssh": true,
|
||||
"organization_url": "/v2/organizations/@org-guid",
|
||||
"developers_url": "/v2/spaces/@space-guid/developers",
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
{
|
||||
"pagination": {
|
||||
"total_results": 1,
|
||||
"total_pages": 1,
|
||||
"first": {
|
||||
"href": "https://api.example.org/v3/organizations?page=1&per_page=50"
|
||||
},
|
||||
"last": {
|
||||
"href": "https://api.example.org/v3/organizations?page=1&per_page=50"
|
||||
},
|
||||
"next": null,
|
||||
"previous": null
|
||||
},
|
||||
"resources": [
|
||||
{
|
||||
"guid": "TEST-ORG-GUID",
|
||||
"created_at": "2017-02-01T01:33:58Z",
|
||||
"updated_at": "2017-02-01T01:33:58Z",
|
||||
"name": "org1",
|
||||
"suspended": false,
|
||||
"relationships": {
|
||||
"quota": {
|
||||
"data": {
|
||||
"guid": "@org-guid"
|
||||
}
|
||||
}
|
||||
},
|
||||
"links": {
|
||||
"self": {
|
||||
"href": "https://api.example.org/v3/organizations/TEST-ORG-GUID"
|
||||
},
|
||||
"domains": {
|
||||
"href": "https://api.example.org/v3/organizations/TEST-ORG-GUID/domains"
|
||||
},
|
||||
"default_domain": {
|
||||
"href": "https://api.example.org/v3/organizations/TEST-ORG-GUID/domains/default"
|
||||
},
|
||||
"quota": {
|
||||
"href": "https://api.example.org/v3/organization_quotas/@org-guid"
|
||||
}
|
||||
},
|
||||
"metadata": {
|
||||
"labels": {},
|
||||
"annotations": {}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -30,4 +30,4 @@
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
{
|
||||
"pagination": {
|
||||
"total_results": 1,
|
||||
"total_pages": 1,
|
||||
"first": {
|
||||
"href": "https://api.example.org/v3/spaces?page=1&per_page=50"
|
||||
},
|
||||
"last": {
|
||||
"href": "https://api.example.org/v3/spaces?page=1&per_page=50"
|
||||
},
|
||||
"next": null,
|
||||
"previous": null
|
||||
},
|
||||
"resources": [
|
||||
{
|
||||
"guid": "@space-guid",
|
||||
"created_at": "2017-02-01T01:33:58Z",
|
||||
"updated_at": "2017-02-01T01:33:58Z",
|
||||
"name": "@name",
|
||||
"relationships": {
|
||||
"organization": {
|
||||
"data": {
|
||||
"guid": "@org-guid"
|
||||
}
|
||||
},
|
||||
"quota": {
|
||||
"data": null
|
||||
}
|
||||
},
|
||||
"links": {
|
||||
"self": {
|
||||
"href": "https://api.example.org/v3/spaces/@space-guid"
|
||||
},
|
||||
"features": {
|
||||
"href": "https://api.example.org/v3/spaces/@space-guid/features"
|
||||
},
|
||||
"organization": {
|
||||
"href": "https://api.example.org/v3/organizations/@org-guid"
|
||||
},
|
||||
"apply_manifest": {
|
||||
"href": "https://api.example.org/v3/spaces/@space-guid/actions/apply_manifest",
|
||||
"method": "POST"
|
||||
}
|
||||
},
|
||||
"metadata": {
|
||||
"labels": {},
|
||||
"annotations": {}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user