@Test public void checkValidStatus() throws Exception { manager.setStatus(SERVICE1, ServingStatus.NOT_SERVING); manager.setStatus(SERVICE2, ServingStatus.SERVING); HealthCheckRequest request = HealthCheckRequest.newBuilder().setService(SERVICE1).build(); HealthCheckResponse response = blockingStub.withDeadlineAfter(5, TimeUnit.SECONDS).check(request); assertThat(response).isEqualTo( HealthCheckResponse.newBuilder().setStatus(ServingStatus.NOT_SERVING).build()); request = HealthCheckRequest.newBuilder().setService(SERVICE2).build(); response = blockingStub.withDeadlineAfter(5, TimeUnit.SECONDS).check(request); assertThat(response).isEqualTo( HealthCheckResponse.newBuilder().setStatus(ServingStatus.SERVING).build()); assertThat(service.numWatchersForTest(SERVICE1)).isEqualTo(0); assertThat(service.numWatchersForTest(SERVICE2)).isEqualTo(0); }
public void setStatus(String service, ServingStatus status) { checkNotNull(status, "status"); healthService.setStatus(service, status); }
HealthStatusManager { public void setStatus(String service, ServingStatus status) { checkNotNull(status, "status"); healthService.setStatus(service, status); } }
HealthStatusManager { public void setStatus(String service, ServingStatus status) { checkNotNull(status, "status"); healthService.setStatus(service, status); } HealthStatusManager(); }
HealthStatusManager { public void setStatus(String service, ServingStatus status) { checkNotNull(status, "status"); healthService.setStatus(service, status); } HealthStatusManager(); BindableService getHealthService(); void setStatus(String service, ServingStatus status); void clearStatus(String service); }
HealthStatusManager { public void setStatus(String service, ServingStatus status) { checkNotNull(status, "status"); healthService.setStatus(service, status); } HealthStatusManager(); BindableService getHealthService(); void setStatus(String service, ServingStatus status); void clearStatus(String service); static final String SERVICE_NAME_ALL_SERVICES; }