Search in sources :

Example 1 with Data

use of org.cloudfoundry.client.v3.processes.Data in project promregator by promregator.

the class CFAccessorMock method retrieveProcesses.

@Override
public Mono<ListProcessesResponse> retrieveProcesses(String orgId, String spaceId, String appId) {
    if (orgId.equals(UNITTEST_ORG_UUID) && spaceId.equals(UNITTEST_SPACE_UUID)) {
        List<ProcessResource> list = new LinkedList<>();
        Data data = Data.builder().timeout(100).build();
        HealthCheck hc = HealthCheck.builder().type(HealthCheckType.HTTP).data(data).build();
        Builder builder = ProcessResource.builder().type("dummy").command("dummycommand").memoryInMb(1024).diskInMb(1024).healthCheck(hc).createdAt(CREATED_AT_TIMESTAMP).updatedAt(UPDATED_AT_TIMESTAMP);
        ProcessResource ar = null;
        if (appId.equals(UNITTEST_APP1_UUID)) {
            ar = builder.instances(2).id(UNITTEST_APP1_UUID).build();
        } else if (appId.equals(UNITTEST_APP2_UUID)) {
            ar = builder.instances(1).id(UNITTEST_APP2_UUID).build();
        }
        if (ar == null) {
            Assert.fail("Invalid process request, invalid app id provided");
            return null;
        }
        list.add(ar);
        ListProcessesResponse resp = ListProcessesResponse.builder().addAllResources(list).build();
        return Mono.just(resp);
    }
    Assert.fail("Invalid process request");
    return null;
}
Also used : ListProcessesResponse(org.cloudfoundry.client.v3.processes.ListProcessesResponse) Builder(org.cloudfoundry.client.v3.processes.ProcessResource.Builder) HealthCheck(org.cloudfoundry.client.v3.processes.HealthCheck) ProcessResource(org.cloudfoundry.client.v3.processes.ProcessResource) Data(org.cloudfoundry.client.v3.processes.Data) LinkedList(java.util.LinkedList)

Aggregations

LinkedList (java.util.LinkedList)1 Data (org.cloudfoundry.client.v3.processes.Data)1 HealthCheck (org.cloudfoundry.client.v3.processes.HealthCheck)1 ListProcessesResponse (org.cloudfoundry.client.v3.processes.ListProcessesResponse)1 ProcessResource (org.cloudfoundry.client.v3.processes.ProcessResource)1 Builder (org.cloudfoundry.client.v3.processes.ProcessResource.Builder)1