Clean up CC stubbing in component tests.

This commit is contained in:
Scott Frederick
2019-01-15 16:17:46 -06:00
parent 77db951c65
commit 856eeb904d
17 changed files with 185 additions and 136 deletions

View File

@@ -35,6 +35,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import org.cloudfoundry.AbstractCloudFoundryException;
import org.cloudfoundry.UnknownCloudFoundryException;
import org.cloudfoundry.client.CloudFoundryClient;
import org.cloudfoundry.client.v2.organizations.ListOrganizationSpacesRequest;
import org.cloudfoundry.client.v2.spaces.CreateSpaceRequest;
import org.cloudfoundry.client.v2.spaces.DeleteSpaceRequest;
import org.cloudfoundry.client.v3.Relationship;
@@ -76,9 +77,8 @@ import org.cloudfoundry.operations.services.BindServiceInstanceRequest;
import org.cloudfoundry.operations.services.GetServiceInstanceRequest;
import org.cloudfoundry.operations.services.ServiceInstance;
import org.cloudfoundry.operations.services.UnbindServiceInstanceRequest;
import org.cloudfoundry.operations.spaces.GetSpaceRequest;
import org.cloudfoundry.operations.spaces.SpaceDetail;
import org.cloudfoundry.util.DelayUtils;
import org.cloudfoundry.util.PaginationUtils;
import org.reactivestreams.Publisher;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -513,12 +513,16 @@ public class CloudFoundryAppDeployer implements AppDeployer, ResourceLoaderAware
}
private Mono<String> getSpaceIdFromName(String spaceName) {
return this.operations.spaces()
.get(GetSpaceRequest.builder()
.name(spaceName)
.build())
.map(SpaceDetail::getId)
.onErrorResume(e -> Mono.empty());
return getDefaultOrganizationId()
.flatMap(orgId -> PaginationUtils.requestClientV2Resources(page -> client.organizations()
.listSpaces(ListOrganizationSpacesRequest.builder()
.name(spaceName)
.organizationId(orgId)
.page(page)
.build()))
.filter(resource -> resource.getEntity().getName().equals(spaceName))
.map(resource -> resource.getMetadata().getId())
.next());
}
private CloudFoundryOperations createCloudFoundryOperationsForSpace(String space) {

View File

@@ -75,30 +75,4 @@ class CreateInstanceComponentTest extends WiremockComponentTest {
String state = brokerFixture.waitForAsyncOperationComplete("instance-id");
assertThat(state).isEqualTo(OperationState.SUCCEEDED.toString());
}
@Test
void updateAppsWhenTheyExist() {
cloudControllerFixture.stubAppExists(APP_NAME_1);
cloudControllerFixture.stubUpdateApp(APP_NAME_1);
cloudControllerFixture.stubAppExists(APP_NAME_2);
cloudControllerFixture.stubUpdateApp(APP_NAME_2);
// when a service instance is created
given(brokerFixture.serviceInstanceRequest())
.when()
.put(brokerFixture.createServiceInstanceUrl(), "instance-id")
.then()
.statusCode(HttpStatus.ACCEPTED.value());
// when the "last_operation" API is polled
given(brokerFixture.serviceInstanceRequest())
.when()
.get(brokerFixture.getLastInstanceOperationUrl(), "instance-id")
.then()
.statusCode(HttpStatus.OK.value())
.body("state", is(equalTo(OperationState.IN_PROGRESS.toString())));
String state = brokerFixture.waitForAsyncOperationComplete("instance-id");
assertThat(state).isEqualTo(OperationState.SUCCEEDED.toString());
}
}

View File

@@ -60,14 +60,12 @@ class CreateInstanceWithServicesAndTargetComponentTest extends WiremockComponent
@Test
void pushAppWithServicesInSpace() {
String serviceInstanceId = "instance-id";
cloudControllerFixture.stubAppDoesNotExistInSpace(APP_NAME, serviceInstanceId);
final String host = APP_NAME + "-" + serviceInstanceId;
cloudControllerFixture.stubPushAppWithHost(APP_NAME, host);
// given that service instances does not exist
cloudControllerFixture.stubServiceInstanceDoesNotExists(BACKING_SI_NAME);
cloudControllerFixture.stubSpaceDoesNotExist(serviceInstanceId);
cloudControllerFixture.stubCreateSpace(serviceInstanceId);
cloudControllerFixture.stubPushAppWithHost(APP_NAME, APP_NAME + "-" + serviceInstanceId);
// and the services are available in the marketplace
// given services are available in the marketplace
cloudControllerFixture.stubServiceExists(BACKING_SERVICE_NAME);
// will create and bind the service instance
@@ -78,19 +76,19 @@ class CreateInstanceWithServicesAndTargetComponentTest extends WiremockComponent
// when a service instance is created
given(brokerFixture.serviceInstanceRequest())
.when()
.put(brokerFixture.createServiceInstanceUrl(), "instance-id")
.put(brokerFixture.createServiceInstanceUrl(), serviceInstanceId)
.then()
.statusCode(HttpStatus.ACCEPTED.value());
// when the "last_operation" API is polled
given(brokerFixture.serviceInstanceRequest())
.when()
.get(brokerFixture.getLastInstanceOperationUrl(), "instance-id")
.get(brokerFixture.getLastInstanceOperationUrl(), serviceInstanceId)
.then()
.statusCode(HttpStatus.OK.value())
.body("state", is(equalTo(OperationState.IN_PROGRESS.toString())));
String state = brokerFixture.waitForAsyncOperationComplete("instance-id");
String state = brokerFixture.waitForAsyncOperationComplete(serviceInstanceId);
assertThat(state).isEqualTo(OperationState.SUCCEEDED.toString());
}
}

View File

@@ -61,10 +61,7 @@ class CreateInstanceWithServicesComponentTest extends WiremockComponentTest {
cloudControllerFixture.stubAppDoesNotExist(APP_NAME);
cloudControllerFixture.stubPushApp(APP_NAME);
// given that service instances does not exist
cloudControllerFixture.stubServiceInstanceDoesNotExists(BACKING_SI_NAME);
// and the services are available in the marketplace
// given services are available in the marketplace
cloudControllerFixture.stubServiceExists(BACKING_SERVICE_NAME);
// will create and bind the service instance

View File

@@ -66,10 +66,7 @@ class CreateInstanceWithServicesParametersComponentTest extends WiremockComponen
cloudControllerFixture.stubAppDoesNotExist(APP_NAME);
cloudControllerFixture.stubPushApp(APP_NAME);
// given that service instances does not exist
cloudControllerFixture.stubServiceInstanceDoesNotExists(BACKING_SI_NAME);
// and the services are available in the marketplace
// given services are available in the marketplace
cloudControllerFixture.stubServiceExists(BACKING_SERVICE_NAME);
// will create with filtered parameters and bind the service instance

View File

@@ -51,26 +51,28 @@ class CreateInstanceWithTargetComponentTest extends WiremockComponentTest {
@Test
void shouldPushAppWithTargetWhenCreateServiceCalled() {
String serviceInstanceId = "instance-id";
cloudControllerFixture.stubAppDoesNotExistInSpace(APP_NAME, serviceInstanceId);
final String host = APP_NAME + "-" + serviceInstanceId;
cloudControllerFixture.stubPushAppWithHost(APP_NAME, host);
cloudControllerFixture.stubSpaceDoesNotExist(serviceInstanceId);
cloudControllerFixture.stubCreateSpace(serviceInstanceId);
cloudControllerFixture.stubPushAppWithHost(APP_NAME, APP_NAME + "-" + serviceInstanceId);
// when a service instance is created
given(brokerFixture.serviceInstanceRequest())
.when()
.put(brokerFixture.createServiceInstanceUrl(), "instance-id")
.put(brokerFixture.createServiceInstanceUrl(), serviceInstanceId)
.then()
.statusCode(HttpStatus.ACCEPTED.value());
// when the "last_operation" API is polled
given(brokerFixture.serviceInstanceRequest())
.when()
.get(brokerFixture.getLastInstanceOperationUrl(), "instance-id")
.get(brokerFixture.getLastInstanceOperationUrl(), serviceInstanceId)
.then()
.statusCode(HttpStatus.OK.value())
.body("state", is(equalTo(OperationState.IN_PROGRESS.toString())));
String state = brokerFixture.waitForAsyncOperationComplete("instance-id");
String state = brokerFixture.waitForAsyncOperationComplete(serviceInstanceId);
assertThat(state).isEqualTo(OperationState.SUCCEEDED.toString());
}

View File

@@ -60,9 +60,6 @@ class UpdateInstanceWithServicesComponentTest extends WiremockComponentTest {
cloudControllerFixture.stubAppExists(APP_NAME);
cloudControllerFixture.stubUpdateApp(APP_NAME);
cloudControllerFixture.stubServiceInstanceExists(SERVICE_INSTANCE_NAME);
cloudControllerFixture.stubCreateServiceBinding(APP_NAME, SERVICE_INSTANCE_NAME);
// when a service instance is updated
given(brokerFixture.serviceInstanceRequest())
.when()

View File

@@ -66,8 +66,6 @@ class UpdateInstanceWithServicesParametersComponentTest extends WiremockComponen
cloudControllerFixture.stubUpdateApp(APP_NAME);
cloudControllerFixture.stubServiceInstanceExists(BACKING_SI_NAME);
cloudControllerFixture.stubListServiceBindings(APP_NAME, BACKING_SI_NAME);
cloudControllerFixture.stubServiceBindingExists(APP_NAME, BACKING_SI_NAME);
// will update with filtered parameters and bind the service instance
HashMap<String, Object> expectedCreationParameters = new HashMap<>();
@@ -75,7 +73,6 @@ class UpdateInstanceWithServicesParametersComponentTest extends WiremockComponen
expectedCreationParameters.put("paramC", Collections.singletonMap("paramC1", "valueC1"));
cloudControllerFixture.stubUpdateServiceInstanceWithParameters(BACKING_SI_NAME, expectedCreationParameters);
cloudControllerFixture.stubCreateServiceBinding(APP_NAME, BACKING_SI_NAME);
// when a service instance is created with parameters
HashMap<String, Object> creationParameters = new HashMap<>();

View File

@@ -72,6 +72,12 @@ public class CloudControllerStubFixture extends WiremockStubFixture {
.willReturn(ok()
.withBody(cc("list-organizations",
replace("@org-guid", TEST_ORG_GUID)))));
stubFor(get(urlPathEqualTo("/v2/organizations/" + TEST_ORG_GUID))
.withMetadata(optionalStubMapping())
.willReturn(ok()
.withBody(cc("get-organization",
replace("@org-guid", TEST_ORG_GUID)))));
}
private void stubFindTestSpace() {
@@ -82,12 +88,24 @@ public class CloudControllerStubFixture extends WiremockStubFixture {
replace("@org-guid", TEST_ORG_GUID),
replace("@space-guid", TEST_SPACE_GUID)))));
stubFor(get(urlEqualTo("/v2/spaces/" + TEST_SPACE_GUID))
stubFor(get(urlPathEqualTo("/v2/spaces/" + TEST_SPACE_GUID))
.withMetadata(optionalStubMapping())
.willReturn(ok()
.withBody(cc("get-space",
replace("@name", "test"),
replace("@org-guid", TEST_ORG_GUID),
replace("@space-guid", TEST_SPACE_GUID)))));
stubFor(get(urlPathEqualTo("/v2/spaces/" + TEST_SPACE_GUID + "/apps"))
.withQueryParam("page", equalTo("1"))
.withMetadata(optionalStubMapping())
.willReturn(ok()
.withBody(cc("empty-query-results"))));
stubFor(get(urlPathEqualTo("/v2/spaces/" + TEST_SPACE_GUID + "/security_groups"))
.withMetadata(optionalStubMapping())
.willReturn(ok()
.withBody(cc("get-space-security_groups"))));
}
private void stubFindDomains() {
@@ -102,37 +120,47 @@ public class CloudControllerStubFixture extends WiremockStubFixture {
.willReturn(ok()
.withBody(cc("empty-query-results"))));
stubFor(get(urlEqualTo("/v2/organizations/" + TEST_ORG_GUID + "/spaces?page=1"))
stubFor(get(urlPathEqualTo("/v2/organizations/" + TEST_ORG_GUID + "/spaces"))
.withQueryParam("page", equalTo("1"))
.withMetadata(optionalStubMapping())
.willReturn(ok()
.withBody(cc("list-spaces",
replace("@org-guid", TEST_ORG_GUID),
replace("@space-guid", TEST_SPACE_GUID)))));
stubFor(get(urlEqualTo("/v2/organizations/" + TEST_ORG_GUID + "/space_quota_definitions?page=1"))
stubFor(get(urlPathEqualTo("/v2/organizations/" + TEST_ORG_GUID + "/space_quota_definitions"))
.withQueryParam("page", equalTo("1"))
.withMetadata(optionalStubMapping())
.willReturn(ok()
.withBody(cc("list-organizations-quota",
replace("@org-guid", TEST_ORG_GUID)))));
stubFor(get(urlEqualTo("/v2/quota_definitions/" + TEST_QUOTA_DEFINITION_GUID))
stubFor(get(urlPathEqualTo("/v2/quota_definitions/" + TEST_QUOTA_DEFINITION_GUID))
.withMetadata(optionalStubMapping())
.willReturn(ok()
.withBody(cc("get-organizations-quota",
replace("@org-guid", TEST_ORG_GUID)))));
}
public void stubAppDoesNotExist(final String appName) {
stubAppDoesNotExistInSpace(appName, TEST_SPACE_GUID);
}
public void stubAppDoesNotExistInSpace(final String appName, final String space) {
stubFor(get(urlPathEqualTo("/v2/spaces/" + space + "/apps"))
.withQueryParam("q", equalTo("name:" + appName))
.withQueryParam("page", equalTo("1"))
public void stubSpaceDoesNotExist(final String spaceName) {
stubFor(get(urlPathEqualTo("/v2/organizations/" + TEST_ORG_GUID + "/spaces"))
.withQueryParam("q", equalTo("name:" + spaceName))
.willReturn(ok()
.withBody(cc("empty-query-results"))));
}
public void stubCreateSpace(final String spaceName) {
stubFor(post(urlPathEqualTo("/v2/spaces"))
.willReturn(ok()));
.withRequestBody(matchingJsonPath("$.[?(@.name == '" + spaceName + "')]"))
.withRequestBody(matchingJsonPath("$.[?(@.organization_guid == '" + TEST_ORG_GUID + "')]"))
.willReturn(ok()
.withBody(cc("get-space",
replace("@name", spaceName),
replace("@space-guid", "CREATED-SPACE-GUID"),
replace("@org-guid", TEST_ORG_GUID)))));
}
public void stubAppDoesNotExist(final String appName) {
stubFor(get(urlPathEqualTo("/v2/spaces/" + TEST_SPACE_GUID + "/apps"))
.withQueryParam("q", equalTo("name:" + appName))
.withQueryParam("page", equalTo("1"))
@@ -142,6 +170,7 @@ public class CloudControllerStubFixture extends WiremockStubFixture {
public void stubAppExists(final String appName) {
stubFor(get(urlPathEqualTo("/v2/apps/" + appGuid(appName)))
.withMetadata(optionalStubMapping())
.willReturn(ok()
.withBody(cc("get-app-STAGED",
replace("@name", appName)))));
@@ -149,6 +178,7 @@ public class CloudControllerStubFixture extends WiremockStubFixture {
stubFor(get(urlPathEqualTo("/v2/spaces/" + TEST_SPACE_GUID + "/apps"))
.withQueryParam("q", equalTo("name:" + appName))
.withQueryParam("page", equalTo("1"))
.withMetadata(optionalStubMapping())
.willReturn(ok()
.withBody(cc("list-space-apps",
replace("@name", appName),
@@ -157,10 +187,12 @@ public class CloudControllerStubFixture extends WiremockStubFixture {
replace("@stack-guid", stackGuid(appName))))));
stubFor(get(urlPathEqualTo("/v2/apps/" + appGuid(appName) + "/instances"))
.withMetadata(optionalStubMapping())
.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),
@@ -169,11 +201,13 @@ public class CloudControllerStubFixture extends WiremockStubFixture {
replace("@route-guid", routeGuid(appName))))));
stubFor(get(urlPathEqualTo("/v2/apps/" + appGuid(appName) + "/stats"))
.withMetadata(optionalStubMapping())
.willReturn(ok()
.withBody(cc("get-app-stats",
replace("@name", appName)))));
stubFor(get(urlPathEqualTo("/v2/stacks/" + stackGuid(appName)))
.withMetadata(optionalStubMapping())
.willReturn(ok()
.withBody(cc("get-stack",
replace("@guid", stackGuid(appName))))));
@@ -190,12 +224,10 @@ public class CloudControllerStubFixture extends WiremockStubFixture {
}
public void stubUpdateApp(final String appName) {
stubGetApp(appName);
stubUpdateEnvironment(appName);
stubCreatePackage(appName);
stubCreateBuild(appName);
stubCreateDeployment(appName);
stubAppAfterCreation(appName, appName);
}
private void stubAppAfterCreation(String appName, String host) {
@@ -205,19 +237,6 @@ public class CloudControllerStubFixture extends WiremockStubFixture {
stubCheckAppState(appName);
}
private void stubGetApp(String appName) {
stubFor(get(urlPathEqualTo("/v2/apps/" + appGuid(appName)))
.willReturn(ok()
.withBody(cc("get-app-STARTED",
replace("@name", appName),
replace("@guid", appGuid(appName))))));
stubFor(get(urlPathEqualTo("/v2/apps/" + appGuid(appName) + "/routes?page=1"))
.willReturn(ok()
.withBody(cc("list-routes",
replace("@name", appName),
replace("@guid", appGuid(appName))))));
}
private void stubUpdateEnvironment(String appName) {
stubFor(put(urlPathEqualTo("/v2/apps/" + appGuid(appName)))
.withRequestBody(matchingJsonPath("$.[?(@.environment_json)]"))
@@ -233,41 +252,54 @@ public class CloudControllerStubFixture extends WiremockStubFixture {
matchingJsonPath("$.[?(@.relationships.app.data.guid == '" + appGuid(appName) + "')]"))
.willReturn(ok()
.withBody(cc("get-package-READY",
replace("@guid", appGuid(appName))))));
stubFor(post(urlPathEqualTo("/v3/packages/" + appGuid(appName) + "/upload"))
replace("@guid", packageGuid(appName)),
replace("@app-guid", appGuid(appName))))));
stubFor(post(urlPathEqualTo("/v3/packages/" + packageGuid(appName) + "/upload"))
.willReturn(ok()
.withBody(cc("get-package-READY",
replace("@guid", appGuid(appName))))));
stubFor(get(urlPathEqualTo("/v3/packages/" + appGuid(appName)))
replace("@guid", packageGuid(appName)),
replace("@app-guid", appGuid(appName))))));
stubFor(get(urlPathEqualTo("/v3/packages/" + packageGuid(appName)))
.willReturn(ok()
.withBody(cc("get-package-READY",
replace("@guid", appGuid(appName))))));
replace("@guid", packageGuid(appName)),
replace("@app-guid", appGuid(appName))))));
}
private void stubCreateBuild(String appName) {
stubFor(get(urlPathEqualTo("/v3/builds"))
.willReturn(ok()
.withBody(cc("get-build-STAGED",
replace("@guid", appGuid(appName))))));
stubFor(post(urlPathEqualTo("/v3/builds"))
.withRequestBody(
matchingJsonPath("$.[?(@.package.guid == '" + packageGuid(appName) + "')]"))
.willReturn(ok()
.withBody(cc("get-build-STAGED",
replace("@guid", appGuid(appName))))));
stubFor(get(urlPathEqualTo("/v3/builds/" + appGuid(appName)))
replace("@guid", buildGuid(appName)),
replace("@package-guid", packageGuid(appName)),
replace("@app-guid", appGuid(appName))))));
stubFor(get(urlPathEqualTo("/v3/builds/" + buildGuid(appName)))
.willReturn(ok()
.withBody(cc("get-build-STAGED",
replace("@guid", appGuid(appName))))));
replace("@guid", buildGuid(appName)),
replace("@package-guid", packageGuid(appName)),
replace("@app-guid", appGuid(appName))))));
}
private void stubCreateDeployment(String appName) {
stubFor(post(urlPathEqualTo("/v3/deployments"))
.withRequestBody(
matchingJsonPath("$.[?(@.relationships.app.data.guid == '" + appGuid(appName) + "')]"))
.willReturn(ok()
.withBody(cc("get-deployment-DEPLOYED",
replace("@guid", appGuid(appName))))));
stubFor(get(urlPathEqualTo("/v3/deployments/" + appGuid(appName)))
replace("@guid", deploymentGuid(appName)),
replace("@app-guid", appGuid(appName))))));
stubFor(get(urlPathEqualTo("/v3/deployments/" + deploymentGuid(appName)))
.willReturn(ok()
.withBody(cc("get-deployment-DEPLOYED",
replace("@guid", appGuid(appName))))));
replace("@guid", deploymentGuid(appName)),
replace("@app-guid", appGuid(appName))))));
}
private void stubCreateAppMetadata(String appName, ContentPattern<?>... appMetadataPatterns) {
@@ -285,6 +317,7 @@ public class CloudControllerStubFixture extends WiremockStubFixture {
private void stubMapRouteToApp(String appName, String host) {
stubFor(get(urlPathEqualTo("/v2/apps/" + appGuid(appName) + "/routes"))
.withQueryParam("page", equalTo("1"))
.willReturn(ok()
.withBody(cc("empty-query-results"))));
@@ -369,16 +402,9 @@ public class CloudControllerStubFixture extends WiremockStubFixture {
replace("@space-guid", TEST_SPACE_GUID),
replace("@name", serviceInstanceName),
replace("@guid", serviceInstanceName + "-GUID")))));
stubFor(get(urlPathEqualTo("/v2/service_instances/" + serviceInstanceGuid(serviceInstanceName)))
.willReturn(ok()
.withBody(cc("get-service_instances",
replace("@space-guid", TEST_SPACE_GUID),
replace("@name", serviceInstanceName),
replace("@guid", serviceInstanceName + "-GUID")))));
}
public void stubServiceInstanceDoesNotExists(String serviceInstanceName) {
public void stubServiceInstanceDoesNotExist(String serviceInstanceName) {
stubFor(get(urlPathEqualTo("/v2/spaces/" + TEST_SPACE_GUID + "/service_instances"))
.withQueryParam("q", equalTo("name:" + serviceInstanceName))
.withQueryParam("page", equalTo("1"))
@@ -445,15 +471,11 @@ public class CloudControllerStubFixture extends WiremockStubFixture {
}
public void stubDeleteServiceBinding(String appName, String serviceInstanceName) {
String appGuid = appGuid(appName);
String serviceBindingGuid = serviceBindingGuid(appName, serviceInstanceName);
stubFor(delete(urlPathEqualTo("/v2/service_bindings/" + serviceBindingGuid))
.withQueryParam("async", equalTo("true"))
.willReturn(noContent()));
stubFor(delete(urlPathEqualTo("/v2/apps/" + appGuid + "/service_bindings/" + serviceBindingGuid))
.willReturn(noContent()));
}
public void stubListServiceBindings(String appName, String serviceInstanceName) {
@@ -474,13 +496,6 @@ public class CloudControllerStubFixture extends WiremockStubFixture {
String serviceInstanceGuid = serviceInstanceGuid(serviceInstanceName);
String serviceBindingGuid = serviceBindingGuid(appName, serviceInstanceName);
stubFor(get(urlPathEqualTo("/v2/apps/" + appGuid(appName) + "/service_bindings"))
.willReturn(ok()
.withBody(cc("get-service_bindings",
replace("@service-binding-guid", serviceBindingGuid),
replace("@app-guid", appGuid(appName)),
replace("@service-instance-guid", serviceInstanceGuid)))));
stubFor(get(urlPathEqualTo("/v2/apps/" + appGuid(appName) + "/service_bindings"))
.withQueryParam("q", equalTo("service_instance_guid:" + serviceInstanceGuid))
.withQueryParam("page", equalTo("1"))
@@ -524,4 +539,16 @@ public class CloudControllerStubFixture extends WiremockStubFixture {
private String serviceBindingGuid(String appName, String serviceInstanceName) {
return appGuid(appName) + "-" + serviceInstanceGuid(serviceInstanceName);
}
private String packageGuid(String appName) {
return appName + "-PACKAGE-GUID";
}
private String buildGuid(String appName) {
return appName + "-BUILD-GUID";
}
private String deploymentGuid(String appname) {
return appname + "-DEPLOYMENT-GUID";
}
}

View File

@@ -82,12 +82,14 @@ public class UaaStubFixture extends WiremockStubFixture {
*/
private void stubRetrieveAccessToken() {
stubFor(post(urlPathEqualTo("/oauth/token"))
.withMetadata(optionalStubMapping())
.willReturn(ok()
.withBody(uaa("put-oauth-token"))));
}
private void stubRetrieveTokenKeys() {
stubFor(get(urlPathEqualTo("/token_keys"))
.withMetadata(optionalStubMapping())
.willReturn(ok()
.withBody(uaa("get-token-keys"))));
}

View File

@@ -60,8 +60,7 @@ public class WiremockServerFixture {
}
public void verifyAllRequiredStubsUsed() {
// todo: cleanup CC and UAA stubbing so used/unused can be verified
// verifyStubs(ccUaaWiremockServer);
verifyStubs(ccUaaWiremockServer);
verifyStubs(credHubWiremockServer);
}

View File

@@ -19,17 +19,17 @@
}
},
"package": {
"guid": "8e4da443-f255-499c-8b47-b3729b5b7432"
"guid": "@package-guid"
},
"droplet": {
"guid": "1e1186e7-d803-4c46-b9d6-5c81e50fe55a"
},
"links": {
"self": {
"href": "https://api.example.org/v3/builds/585bc3c1-3743-497d-88b0-403ad6b56d16"
"href": "https://api.example.org/v3/builds/@guid"
},
"app": {
"href": "https://api.example.org/v3/apps/7b34f1cf-7e73-428a-bb5a-8a17a8058396"
"href": "https://api.example.org/v3/apps/@app-guid"
}
}
}

View File

@@ -22,16 +22,16 @@
"relationships": {
"app": {
"data": {
"guid": "305cea31-5a44-45ca-b51b-e89c7a8ef8b2"
"guid": "@app-guid"
}
}
},
"links": {
"self": {
"href": "https://api.example.org/v3/deployments/59c3d133-2b83-46f3-960e-7765a129aea4"
"href": "https://api.example.org/v3/deployments/@guid"
},
"app": {
"href": "https://api.example.org/v3/apps/305cea31-5a44-45ca-b51b-e89c7a8ef8b2"
"href": "https://api.example.org/v3/apps/@app-guid"
}
}
}

View File

@@ -0,0 +1,25 @@
{
"metadata": {
"guid": "@org-guid",
"url": "/v2/organizations/@org-guid",
"created_at": "2018-07-19T20:33:45Z",
"updated_at": "2018-07-19T20:33:45Z"
},
"entity": {
"name": "test",
"billing_enabled": false,
"quota_definition_guid": "TEST-QUOTA-DEFINITION-GUID",
"status": "active",
"default_isolation_segment_guid": null,
"quota_definition_url": "/v2/quota_definitions/TEST-QUOTA-DEFINITION-GUID",
"spaces_url": "/v2/organizations/@org-guid/spaces",
"domains_url": "/v2/organizations/@org-guid/domains",
"private_domains_url": "/v2/organizations/@org-guid/private_domains",
"users_url": "/v2/organizations/@org-guid/users",
"managers_url": "/v2/organizations/@org-guid/managers",
"billing_managers_url": "/v2/organizations/@org-guid/billing_managers",
"auditors_url": "/v2/organizations/@org-guid/auditors",
"app_events_url": "/v2/organizations/@org-guid/app_events",
"space_quota_definitions_url": "/v2/organizations/@org-guid/space_quota_definitions"
}
}

View File

@@ -13,7 +13,7 @@
"updated_at": "2016-06-08T16:41:26Z",
"links": {
"self": {
"href": "https://api.example.org/v3/packages/44f7c078-0934-470f-9883-4fcddc5b8f13"
"href": "https://api.example.org/v3/packages/@guid"
},
"upload": {
"href": "https://api.example.org/v3/packages/44f7c078-0934-470f-9883-4fcddc5b8f13/upload",
@@ -24,7 +24,7 @@
"method": "GET"
},
"app": {
"href": "https://api.example.org/v3/apps/1d3bf0ec-5806-43c4-b64e-8364dba1086a"
"href": "https://api.example.org/v3/apps/@app-guid"
}
}
}

View File

@@ -0,0 +1,30 @@
{
"total_results": 1,
"total_pages": 1,
"prev_url": null,
"next_url": null,
"resources": [
{
"metadata": {
"guid": "3da034d1-f0e3-4bfe-8d42-0bf2822fe8cc",
"url": "/v2/security_groups/3da034d1-f0e3-4bfe-8d42-0bf2822fe8cc",
"created_at": "2016-06-08T16:41:40Z",
"updated_at": "2016-06-08T16:41:26Z"
},
"entity": {
"name": "name-2073",
"rules": [
{
"protocol": "udp",
"ports": "8080",
"destination": "198.41.191.47/1"
}
],
"running_default": false,
"staging_default": false,
"spaces_url": "/v2/security_groups/3da034d1-f0e3-4bfe-8d42-0bf2822fe8cc/spaces",
"staging_spaces_url": "/v2/security_groups/3da034d1-f0e3-4bfe-8d42-0bf2822fe8cc/staging_spaces"
}
}
]
}

View File

@@ -6,7 +6,7 @@
"updated_at": "2018-07-19T20:34:16Z"
},
"entity": {
"name": "development",
"name": "@name",
"organization_guid": "@org-guid",
"space_quota_definition_guid": null,
"isolation_segment_guid": null,