@Test public void checkPlatformHealthConainerInstanceStarting () { Integer INSTANCE_ID = 0; ApplicationsV2 applicationsV2 = mock(ApplicationsV2.class); ApplicationInstancesResponse applicationInstancesResponse = ApplicationInstancesResponse.builder() .instance(INSTANCE_ID.toString(), ApplicationInstanceInfo .builder() .consoleIp("") .consolePort(22) .debugIp("") .debugPort(8888) .details("") .since(0D) .state(CLOUDFOUNDRY_STARTING_STATE) .uptime(0L) .build()) .build(); Mono<ApplicationInstancesResponse> applicationInstancesResponseMono = Mono.just(applicationInstancesResponse); doReturn(applicationsV2).when(cloudFoundryClient).applicationsV2(); doReturn(applicationInstancesResponseMono).when(applicationsV2).instances(any(ApplicationInstancesRequest.class)); Flux<ApplicationSummary> applicationsFlux = Flux.just(applicationSummary1); doReturn(applications).when(cloudFoundryOperations).applications(); doReturn(applicationsFlux).when(applications).list(); assertEquals(ContainerHealth.RUNNING_EXPERIMENT, cloudFoundryApplicationPlatform.checkPlatformHealth()); }
public ContainerHealth checkPlatformHealth () { Iterable<ApplicationSummary> apps = cloudFoundryOperations.applications() .list() .filter(app -> app.getRequestedState().equals(CLOUDFOUNDRY_APPLICATION_STARTED)) .filter(app -> app.getInstances() > 0) .toIterable(); for (ApplicationSummary app : apps) { ContainerHealth appHealth = checkApplicationHealth(app.getName(), app.getId()); if (ContainerHealth.NORMAL != appHealth) { return appHealth; } } return ContainerHealth.NORMAL; }
CloudFoundryApplicationPlatform extends CloudFoundryPlatform { public ContainerHealth checkPlatformHealth () { Iterable<ApplicationSummary> apps = cloudFoundryOperations.applications() .list() .filter(app -> app.getRequestedState().equals(CLOUDFOUNDRY_APPLICATION_STARTED)) .filter(app -> app.getInstances() > 0) .toIterable(); for (ApplicationSummary app : apps) { ContainerHealth appHealth = checkApplicationHealth(app.getName(), app.getId()); if (ContainerHealth.NORMAL != appHealth) { return appHealth; } } return ContainerHealth.NORMAL; } }
CloudFoundryApplicationPlatform extends CloudFoundryPlatform { public ContainerHealth checkPlatformHealth () { Iterable<ApplicationSummary> apps = cloudFoundryOperations.applications() .list() .filter(app -> app.getRequestedState().equals(CLOUDFOUNDRY_APPLICATION_STARTED)) .filter(app -> app.getInstances() > 0) .toIterable(); for (ApplicationSummary app : apps) { ContainerHealth appHealth = checkApplicationHealth(app.getName(), app.getId()); if (ContainerHealth.NORMAL != appHealth) { return appHealth; } } return ContainerHealth.NORMAL; } @Autowired  CloudFoundryApplicationPlatform(); }
CloudFoundryApplicationPlatform extends CloudFoundryPlatform { public ContainerHealth checkPlatformHealth () { Iterable<ApplicationSummary> apps = cloudFoundryOperations.applications() .list() .filter(app -> app.getRequestedState().equals(CLOUDFOUNDRY_APPLICATION_STARTED)) .filter(app -> app.getInstances() > 0) .toIterable(); for (ApplicationSummary app : apps) { ContainerHealth appHealth = checkApplicationHealth(app.getName(), app.getId()); if (ContainerHealth.NORMAL != appHealth) { return appHealth; } } return ContainerHealth.NORMAL; } @Autowired  CloudFoundryApplicationPlatform(); ContainerHealth checkPlatformHealth(); @Override List<Container> generateRoster(); @Override boolean isContainerRecycled(Container container); void rescaleApplication(String applicationName, int instances); void restartApplication(String applicationName); void unmapRoute(UnmapRouteRequest unmapRouteRequest); void mapRoute(MapRouteRequest mapRouteRequest); }
CloudFoundryApplicationPlatform extends CloudFoundryPlatform { public ContainerHealth checkPlatformHealth () { Iterable<ApplicationSummary> apps = cloudFoundryOperations.applications() .list() .filter(app -> app.getRequestedState().equals(CLOUDFOUNDRY_APPLICATION_STARTED)) .filter(app -> app.getInstances() > 0) .toIterable(); for (ApplicationSummary app : apps) { ContainerHealth appHealth = checkApplicationHealth(app.getName(), app.getId()); if (ContainerHealth.NORMAL != appHealth) { return appHealth; } } return ContainerHealth.NORMAL; } @Autowired  CloudFoundryApplicationPlatform(); ContainerHealth checkPlatformHealth(); @Override List<Container> generateRoster(); @Override boolean isContainerRecycled(Container container); void rescaleApplication(String applicationName, int instances); void restartApplication(String applicationName); void unmapRoute(UnmapRouteRequest unmapRouteRequest); void mapRoute(MapRouteRequest mapRouteRequest);  }