use of io.confluent.ksql.schema.ksql.types.SqlPrimitiveType in project ksql by confluentinc.
the class SqlTypeWalkerTest method shouldVisitBoolean.
@Test
public void shouldVisitBoolean() {
// Given:
final SqlPrimitiveType type = SqlTypes.BOOLEAN;
when(visitor.visitBoolean(any())).thenReturn("Expected");
// When:
final String result = SqlTypeWalker.visit(type, visitor);
// Then:
verify(visitor).visitBoolean(same(type));
assertThat(result, is("Expected"));
}
use of io.confluent.ksql.schema.ksql.types.SqlPrimitiveType in project ksql by confluentinc.
the class SqlTypeWalkerTest method shouldVisitInt.
@Test
public void shouldVisitInt() {
// Given:
final SqlPrimitiveType type = SqlTypes.INTEGER;
when(visitor.visitInt(any())).thenReturn("Expected");
// When:
final String result = SqlTypeWalker.visit(type, visitor);
// Then:
verify(visitor).visitInt(same(type));
assertThat(result, is("Expected"));
}
use of io.confluent.ksql.schema.ksql.types.SqlPrimitiveType in project ksql by confluentinc.
the class SqlTypeWalkerTest method shouldVisitTimestamp.
@Test
public void shouldVisitTimestamp() {
// Given:
final SqlPrimitiveType type = SqlTypes.TIMESTAMP;
when(visitor.visitTimestamp(any())).thenReturn("Expected");
// When:
final String result = SqlTypeWalker.visit(type, visitor);
// Then:
verify(visitor).visitTimestamp(same(type));
assertThat(result, is("Expected"));
}
use of io.confluent.ksql.schema.ksql.types.SqlPrimitiveType in project ksql by confluentinc.
the class TimestampExtractionPolicyFactoryTest method shouldThrowIfTimestampFieldTypeIsNotLongOrTimestampOrString.
@Test
public void shouldThrowIfTimestampFieldTypeIsNotLongOrTimestampOrString() {
final Set<SqlPrimitiveType> allowedTypes = Sets.newHashSet(SqlTypes.BIGINT, SqlTypes.STRING, SqlTypes.TIMESTAMP);
for (SqlPrimitiveType sqlType : SqlTypes.ALL) {
if (allowedTypes.contains(sqlType)) {
continue;
}
// Given:
final String field = "blah_" + sqlType.toString();
final LogicalSchema schema = schemaBuilder2.valueColumn(ColumnName.of(field.toUpperCase()), sqlType).build();
// When:
assertThrows(KsqlException.class, () -> TimestampExtractionPolicyFactory.create(ksqlConfig, schema, Optional.of(new TimestampColumn(ColumnName.of(field), Optional.empty()))));
}
}
use of io.confluent.ksql.schema.ksql.types.SqlPrimitiveType in project ksql by confluentinc.
the class SqlTypeWalkerTest method shouldVisitBigInt.
@Test
public void shouldVisitBigInt() {
// Given:
final SqlPrimitiveType type = SqlTypes.BIGINT;
when(visitor.visitBigInt(any())).thenReturn("Expected");
// When:
final String result = SqlTypeWalker.visit(type, visitor);
// Then:
verify(visitor).visitBigInt(same(type));
assertThat(result, is("Expected"));
}
Aggregations