Search in sources :

Example 1 with ListApplicationsResponse

use of org.cloudfoundry.client.v3.applications.ListApplicationsResponse in project promregator by promregator.

the class CFAccessorMock method retrieveApplicationId.

@Override
public Mono<ListApplicationsResponse> retrieveApplicationId(String orgId, String spaceId, String applicationName) {
    if (orgId.equals(UNITTEST_ORG_UUID) && spaceId.equals(UNITTEST_SPACE_UUID)) {
        ApplicationResource ar = null;
        if (applicationName.equals("testapp")) {
            ar = ApplicationResource.builder().entity(ApplicationEntity.builder().name(applicationName).build()).metadata(Metadata.builder().createdAt(CREATED_AT_TIMESTAMP).id(UNITTEST_APP1_UUID).build()).build();
        } else if (applicationName.equals("testapp2")) {
            ar = ApplicationResource.builder().entity(ApplicationEntity.builder().name(applicationName).build()).metadata(Metadata.builder().createdAt(CREATED_AT_TIMESTAMP).id(UNITTEST_APP2_UUID).build()).build();
        } else {
            Assert.fail("Invalid ApplicationId request, application name is invalid");
        }
        List<ApplicationResource> list = new LinkedList<>();
        list.add(ar);
        ListApplicationsResponse resp = ListApplicationsResponse.builder().addAllResources(list).build();
        return Mono.just(resp);
    }
    Assert.fail("Invalid ApplicationId request");
    return null;
}
Also used : ApplicationResource(org.cloudfoundry.client.v2.applications.ApplicationResource) ListApplicationsResponse(org.cloudfoundry.client.v2.applications.ListApplicationsResponse) LinkedList(java.util.LinkedList)

Aggregations

LinkedList (java.util.LinkedList)1 ApplicationResource (org.cloudfoundry.client.v2.applications.ApplicationResource)1 ListApplicationsResponse (org.cloudfoundry.client.v2.applications.ListApplicationsResponse)1