use of org.cloudfoundry.client.v3.processes.ProcessResource.Builder 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;
}
use of org.cloudfoundry.client.v3.processes.ProcessResource.Builder in project cf-java-client by cloudfoundry.
the class DefaultApplicationsTest method requestListMatchingResources.
private static void requestListMatchingResources(CloudFoundryClient cloudFoundryClient, Collection<ResourceMatchingUtils.ArtifactMetadata> artifactMetadatas) {
ListMatchingResourcesRequest request = artifactMetadatas.stream().reduce(ListMatchingResourcesRequest.builder(), (builder, artifactMetadata) -> builder.resource(Resource.builder().hash(artifactMetadata.getHash()).mode(artifactMetadata.getPermissions()).size(artifactMetadata.getSize()).build()), (a, b) -> a.addAllResources(b.build().getResources())).build();
when(cloudFoundryClient.resourceMatch().list(request)).thenReturn(Mono.just(ListMatchingResourcesResponse.builder().build()));
}
Aggregations