Search in sources :

Example 1 with Type

use of io.confluent.ksql.query.QueryError.Type in project ksql by confluentinc.

the class AuthorizationClassifierTest method shouldClassifySubTypeOfAuthorizationExceptionAsUserError.

@Test
public void shouldClassifySubTypeOfAuthorizationExceptionAsUserError() {
    // Given:
    final Exception e = new TopicAuthorizationException("foo");
    // When:
    final Type type = new AuthorizationClassifier("").classify(e);
    // Then:
    assertThat(type, is(Type.USER));
}
Also used : Type(io.confluent.ksql.query.QueryError.Type) AuthorizationException(org.apache.kafka.common.errors.AuthorizationException) TopicAuthorizationException(org.apache.kafka.common.errors.TopicAuthorizationException) StreamsException(org.apache.kafka.streams.errors.StreamsException) TransactionalIdAuthorizationException(org.apache.kafka.common.errors.TransactionalIdAuthorizationException) TopicAuthorizationException(org.apache.kafka.common.errors.TopicAuthorizationException) Test(org.junit.Test)

Example 2 with Type

use of io.confluent.ksql.query.QueryError.Type in project ksql by confluentinc.

the class AuthorizationClassifierTest method shouldClassifyNoTransactionalIdAuthorizationExceptionAsUnknownError.

@Test
public void shouldClassifyNoTransactionalIdAuthorizationExceptionAsUnknownError() {
    // Given:
    final Exception e = new Exception("foo");
    // When:
    final Type type = new AuthorizationClassifier("").classify(e);
    // Then:
    assertThat(type, is(Type.UNKNOWN));
}
Also used : Type(io.confluent.ksql.query.QueryError.Type) AuthorizationException(org.apache.kafka.common.errors.AuthorizationException) TopicAuthorizationException(org.apache.kafka.common.errors.TopicAuthorizationException) StreamsException(org.apache.kafka.streams.errors.StreamsException) TransactionalIdAuthorizationException(org.apache.kafka.common.errors.TransactionalIdAuthorizationException) Test(org.junit.Test)

Example 3 with Type

use of io.confluent.ksql.query.QueryError.Type in project ksql by confluentinc.

the class AuthorizationClassifierTest method shouldClassifyWrappedAuthorizationExceptionAsUserError.

@Test
public void shouldClassifyWrappedAuthorizationExceptionAsUserError() {
    // Given:
    final Exception e = new StreamsException(new AuthorizationException("foo"));
    // When:
    final Type type = new AuthorizationClassifier("").classify(e);
    // Then:
    assertThat(type, is(Type.USER));
}
Also used : Type(io.confluent.ksql.query.QueryError.Type) AuthorizationException(org.apache.kafka.common.errors.AuthorizationException) TopicAuthorizationException(org.apache.kafka.common.errors.TopicAuthorizationException) TransactionalIdAuthorizationException(org.apache.kafka.common.errors.TransactionalIdAuthorizationException) StreamsException(org.apache.kafka.streams.errors.StreamsException) AuthorizationException(org.apache.kafka.common.errors.AuthorizationException) TopicAuthorizationException(org.apache.kafka.common.errors.TopicAuthorizationException) StreamsException(org.apache.kafka.streams.errors.StreamsException) TransactionalIdAuthorizationException(org.apache.kafka.common.errors.TransactionalIdAuthorizationException) Test(org.junit.Test)

Example 4 with Type

use of io.confluent.ksql.query.QueryError.Type in project ksql by confluentinc.

the class RegexClassifierTest method shouldClassifyWithRegexInCause.

@Test
public void shouldClassifyWithRegexInCause() {
    // Given:
    final QueryErrorClassifier classifier = RegexClassifier.fromConfig("USER .*foo.*", "id");
    when(error.getCause()).thenReturn(cause);
    givenMessage(error, "bar");
    givenMessage(cause, "foo");
    // When:
    final Type type = classifier.classify(error);
    // Then:
    assertThat(type, is(Type.USER));
}
Also used : Type(io.confluent.ksql.query.QueryError.Type) Test(org.junit.Test)

Example 5 with Type

use of io.confluent.ksql.query.QueryError.Type in project ksql by confluentinc.

the class RegexClassifierTest method shouldClassifyNPEIfConfigured.

@Test
public void shouldClassifyNPEIfConfigured() {
    // Given:
    final QueryErrorClassifier classifier = RegexClassifier.fromConfig("USER .*NullPointerException", "id");
    // When:
    final Type type = classifier.classify(npe());
    // Then:
    assertThat(type, is(Type.USER));
}
Also used : Type(io.confluent.ksql.query.QueryError.Type) Test(org.junit.Test)

Aggregations

Type (io.confluent.ksql.query.QueryError.Type)17 Test (org.junit.Test)17 AuthorizationException (org.apache.kafka.common.errors.AuthorizationException)4 TopicAuthorizationException (org.apache.kafka.common.errors.TopicAuthorizationException)4 TransactionalIdAuthorizationException (org.apache.kafka.common.errors.TransactionalIdAuthorizationException)4 StreamsException (org.apache.kafka.streams.errors.StreamsException)4 MissingSourceTopicException (org.apache.kafka.streams.errors.MissingSourceTopicException)2