Search in sources :

Example 6 with Type

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

the class RegexClassifierTest method shouldClassifyAsUnknown.

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

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

the class RegexClassifierTest method shouldClassifyNPEAsUnknwon.

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

Example 8 with Type

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

the class QueryErrorClassifierTest method shouldChainIdentical.

@Test
public void shouldChainIdentical() {
    // Given:
    when(classifierA.classify(any())).thenReturn(Type.USER);
    when(classifierB.classify(any())).thenReturn(Type.USER);
    // 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 9 with Type

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

the class QueryErrorClassifierTest method shouldChainUnknownUnknown.

@Test
public void shouldChainUnknownUnknown() {
    // Given:
    when(classifierA.classify(any())).thenReturn(Type.UNKNOWN);
    when(classifierB.classify(any())).thenReturn(Type.UNKNOWN);
    // 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 10 with Type

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

the class QueryErrorClassifierTest method shouldChainUnknownSomething.

@Test
public void shouldChainUnknownSomething() {
    // Given:
    when(classifierA.classify(any())).thenReturn(Type.UNKNOWN);
    when(classifierB.classify(any())).thenReturn(Type.USER);
    // 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)

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