use of io.confluent.ksql.rest.entity.ClusterTerminateRequest in project ksql by confluentinc.
the class KsqlResourceTest method shouldThrowOnHandleTerminateIfNotConfigured.
@Test
public void shouldThrowOnHandleTerminateIfNotConfigured() {
// Given:
ksqlResource = new KsqlResource(ksqlEngine, commandRunner, DISTRIBUTED_COMMAND_RESPONSE_TIMEOUT, activenessRegistrar, (ec, sc) -> InjectorChain.of(schemaInjectorFactory.apply(sc), topicInjectorFactory.apply(ec), new TopicDeleteInjector(ec, sc)), Optional.of(authorizationValidator), errorsHandler, connectErrorHandler, denyListPropertyValidator, commandRunnerWarning);
// When:
final KsqlRestException e = assertThrows(KsqlRestException.class, () -> ksqlResource.terminateCluster(securityContext, new ClusterTerminateRequest(ImmutableList.of(""))));
// Then:
assertThat(e, exceptionStatusCode(CoreMatchers.is(SERVICE_UNAVAILABLE.code())));
assertThat(e, exceptionErrorMessage(errorMessage(Matchers.is("Server initializing"))));
}
use of io.confluent.ksql.rest.entity.ClusterTerminateRequest in project ksql by confluentinc.
the class ClusterTerminationTest method terminateCluster.
private static void terminateCluster(final List<String> deleteTopicList) {
HttpResponse<Buffer> resp = RestIntegrationTestUtil.rawRestRequest(REST_APP, HttpVersion.HTTP_1_1, HttpMethod.POST, "/ksql/terminate", new ClusterTerminateRequest(deleteTopicList), Optional.empty());
assertThat(resp.statusCode(), is(OK.code()));
}
use of io.confluent.ksql.rest.entity.ClusterTerminateRequest in project ksql by confluentinc.
the class KsqlResourceTest method shouldFailTerminateOnInvalidDeleteTopicPattern.
@Test
public void shouldFailTerminateOnInvalidDeleteTopicPattern() {
// Given:
final ClusterTerminateRequest request = new ClusterTerminateRequest(ImmutableList.of("[Invalid Regex"));
// When:
final KsqlRestException e = assertThrows(KsqlRestException.class, () -> ksqlResource.terminateCluster(securityContext, request));
// Then:
assertThat(e, exceptionStatusCode(is(BAD_REQUEST.code())));
assertThat(e, exceptionErrorMessage(errorMessage(is("Invalid pattern: [Invalid Regex"))));
}
Aggregations