use of org.apache.beam.sdk.extensions.sql.meta.BeamSqlTable in project beam by apache.
the class KafkaTableProviderTest method testBuildBeamSqlCSVTable.
@Test
public void testBuildBeamSqlCSVTable() {
Table table = mockTable("hello");
BeamSqlTable sqlTable = provider.buildBeamSqlTable(table);
assertNotNull(sqlTable);
assertTrue(sqlTable instanceof BeamKafkaCSVTable);
BeamKafkaCSVTable kafkaTable = (BeamKafkaCSVTable) sqlTable;
assertEquals(LOCATION_BROKER, kafkaTable.getBootstrapServers());
assertEquals(ImmutableList.of(LOCATION_TOPIC), kafkaTable.getTopics());
}
use of org.apache.beam.sdk.extensions.sql.meta.BeamSqlTable in project beam by apache.
the class KafkaTableProviderTest method testBuildWithExtraTopics.
@Test
public void testBuildWithExtraTopics() {
Table table = mockTableWithExtraTopics("hello", ImmutableList.of("topic2", "topic3"));
BeamSqlTable sqlTable = provider.buildBeamSqlTable(table);
assertNotNull(sqlTable);
assertTrue(sqlTable instanceof BeamKafkaCSVTable);
BeamKafkaCSVTable kafkaTable = (BeamKafkaCSVTable) sqlTable;
assertEquals(LOCATION_BROKER, kafkaTable.getBootstrapServers());
assertEquals(ImmutableList.of(LOCATION_TOPIC, "topic2", "topic3"), kafkaTable.getTopics());
}
use of org.apache.beam.sdk.extensions.sql.meta.BeamSqlTable in project beam by apache.
the class MongoDbTableProviderTest method testBuildBeamSqlTable_withUsernameAndPassword.
@Test
public void testBuildBeamSqlTable_withUsernameAndPassword() {
Table table = fakeTable("TEST", "mongodb://username:pasword@localhost:27017/database/collection");
BeamSqlTable sqlTable = provider.buildBeamSqlTable(table);
assertNotNull(sqlTable);
assertTrue(sqlTable instanceof MongoDbTable);
MongoDbTable mongoTable = (MongoDbTable) sqlTable;
assertEquals("mongodb://username:pasword@localhost:27017", mongoTable.dbUri);
assertEquals("database", mongoTable.dbName);
assertEquals("collection", mongoTable.dbCollection);
}
use of org.apache.beam.sdk.extensions.sql.meta.BeamSqlTable in project beam by apache.
the class MongoDbTableProviderTest method testBuildBeamSqlTable_withUsernameOnly.
@Test
public void testBuildBeamSqlTable_withUsernameOnly() {
Table table = fakeTable("TEST", "mongodb://username@localhost:27017/database/collection");
BeamSqlTable sqlTable = provider.buildBeamSqlTable(table);
assertNotNull(sqlTable);
assertTrue(sqlTable instanceof MongoDbTable);
MongoDbTable mongoTable = (MongoDbTable) sqlTable;
assertEquals("mongodb://username@localhost:27017", mongoTable.dbUri);
assertEquals("database", mongoTable.dbName);
assertEquals("collection", mongoTable.dbCollection);
}
use of org.apache.beam.sdk.extensions.sql.meta.BeamSqlTable in project beam by apache.
the class PubsubTableProviderTest method testCreatesFlatTable.
@Test
public void testCreatesFlatTable() {
PubsubTableProvider provider = new PubsubTableProvider();
Schema messageSchema = Schema.builder().addDateTimeField("event_timestamp").addStringField("someField").build();
Table tableDefinition = tableDefinition().schema(messageSchema).build();
BeamSqlTable pubsubTable = provider.buildBeamSqlTable(tableDefinition);
assertNotNull(pubsubTable);
assertEquals(messageSchema, pubsubTable.getSchema());
}
Aggregations