use of org.springframework.cloud.gcp.autoconfigure.pubsub.health.PubSubHealthIndicator in project spring-cloud-gcp by spring-cloud.
the class PubSubHealthIndicatorTests method healthDownGenericException.
@Test
public void healthDownGenericException() {
when(pubSubTemplate.pull(anyString(), anyInt(), anyBoolean())).thenThrow(new IllegalStateException("Illegal State"));
PubSubHealthIndicator healthIndicator = new PubSubHealthIndicator(pubSubTemplate);
assertThat(healthIndicator.health().getStatus()).isEqualTo(Status.DOWN);
}
use of org.springframework.cloud.gcp.autoconfigure.pubsub.health.PubSubHealthIndicator in project spring-cloud-gcp by spring-cloud.
the class PubSubHealthIndicatorTests method healthUpFor403.
@Test
public void healthUpFor403() throws Exception {
when(pubSubTemplate.pull(anyString(), anyInt(), anyBoolean())).thenThrow(new ApiException(new IllegalStateException("Illegal State"), GrpcStatusCode.of(Code.PERMISSION_DENIED), false));
PubSubHealthIndicator healthIndicator = new PubSubHealthIndicator(pubSubTemplate);
assertThat(healthIndicator.health().getStatus()).isEqualTo(Status.UP);
}
use of org.springframework.cloud.gcp.autoconfigure.pubsub.health.PubSubHealthIndicator in project spring-cloud-gcp by spring-cloud.
the class PubSubHealthIndicatorTests method healthDown.
@Test
public void healthDown() {
when(pubSubTemplate.pull(anyString(), anyInt(), anyBoolean())).thenThrow(new ApiException(new IllegalStateException("Illegal State"), GrpcStatusCode.of(io.grpc.Status.Code.INVALID_ARGUMENT), false));
PubSubHealthIndicator healthIndicator = new PubSubHealthIndicator(pubSubTemplate);
assertThat(healthIndicator.health().getStatus()).isEqualTo(Status.DOWN);
}
use of org.springframework.cloud.gcp.autoconfigure.pubsub.health.PubSubHealthIndicator in project spring-cloud-gcp by spring-cloud.
the class PubSubHealthIndicatorTests method healthUpFor404.
@Test
public void healthUpFor404() throws Exception {
when(pubSubTemplate.pull(anyString(), anyInt(), anyBoolean())).thenThrow(new ApiException(new IllegalStateException("Illegal State"), GrpcStatusCode.of(io.grpc.Status.Code.NOT_FOUND), false));
PubSubHealthIndicator healthIndicator = new PubSubHealthIndicator(pubSubTemplate);
assertThat(healthIndicator.health().getStatus()).isEqualTo(Status.UP);
}
Aggregations