Search in sources :

Example 11 with Type

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

the class QueryErrorClassifierTest method shouldChainDiffering.

@Test
public void shouldChainDiffering() {
    // Given:
    when(classifierA.classify(any())).thenReturn(Type.USER);
    when(classifierB.classify(any())).thenReturn(Type.SYSTEM);
    // When:
    final Type type = classifierA.and(classifierB).classify(error);
    // Then:
    assertThat(type, is(Type.UNKNOWN));
}
Also used : Type(io.confluent.ksql.query.QueryError.Type) Test(org.junit.Test)

Example 12 with Type

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

the class QueryErrorClassifierTest method shouldChainSomethingUnknown.

@Test
public void shouldChainSomethingUnknown() {
    // Given:
    when(classifierA.classify(any())).thenReturn(Type.USER);
    when(classifierB.classify(any())).thenReturn(Type.UNKNOWN);
    // When:
    final Type type = classifierA.and(classifierB).classify(error);
    // Then:
    assertThat(type, is(Type.USER));
}
Also used : Type(io.confluent.ksql.query.QueryError.Type) Test(org.junit.Test)

Example 13 with Type

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

the class RegexClassifierTest method shouldClassifyWithRegex.

@Test
public void shouldClassifyWithRegex() {
    // Given:
    final QueryErrorClassifier classifier = RegexClassifier.fromConfig("USER .*foo.*", "id");
    givenMessage(error, "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 14 with Type

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

the class RegexClassifierTest method shouldClassifyAsUnknownIfBadRegex.

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

Example 15 with Type

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

the class AuthorizationClassifierTest method shouldClassifyAuthorizationExceptionAsUserError.

@Test
public void shouldClassifyAuthorizationExceptionAsUserError() {
    // Given:
    final Exception e = 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) 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)

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