use of org.apache.flink.table.factories.TestDynamicTableFactory.DynamicTableSourceMock in project flink by apache.
the class FactoryUtilTest method testAllOptions.
@Test
public void testAllOptions() {
final Map<String, String> options = createAllOptions();
final DynamicTableSource actualSource = createTableSource(SCHEMA, options);
final DynamicTableSource expectedSource = new DynamicTableSourceMock("MyTarget", null, new DecodingFormatMock(",", false), new DecodingFormatMock("|", true));
assertThat(actualSource).isEqualTo(expectedSource);
final DynamicTableSink actualSink = createTableSink(SCHEMA, options);
final DynamicTableSink expectedSink = new DynamicTableSinkMock("MyTarget", 1000L, new EncodingFormatMock(","), new EncodingFormatMock("|"));
assertThat(actualSink).isEqualTo(expectedSink);
}
use of org.apache.flink.table.factories.TestDynamicTableFactory.DynamicTableSourceMock in project flink by apache.
the class FactoryUtilTest method testDiscoveryForSeparateSourceSinkFactory.
@Test
public void testDiscoveryForSeparateSourceSinkFactory() {
final Map<String, String> options = createAllOptions();
// the "test" source and sink factory is not in one factory class
// see TestDynamicTableSinkFactory and TestDynamicTableSourceFactory
options.put("connector", "test");
final DynamicTableSource actualSource = createTableSource(SCHEMA, options);
final DynamicTableSource expectedSource = new DynamicTableSourceMock("MyTarget", null, new DecodingFormatMock(",", false), new DecodingFormatMock("|", true));
assertThat(actualSource).isEqualTo(expectedSource);
final DynamicTableSink actualSink = createTableSink(SCHEMA, options);
final DynamicTableSink expectedSink = new DynamicTableSinkMock("MyTarget", 1000L, new EncodingFormatMock(","), new EncodingFormatMock("|"));
assertThat(actualSink).isEqualTo(expectedSink);
}
use of org.apache.flink.table.factories.TestDynamicTableFactory.DynamicTableSourceMock in project flink by apache.
the class FactoryUtilTest method testAlternativeValueFormat.
@Test
public void testAlternativeValueFormat() {
final Map<String, String> options = createAllOptions();
options.remove("value.format");
options.remove("value.test-format.delimiter");
options.remove("value.test-format.fail-on-missing");
options.put("format", "test-format");
options.put("test-format.delimiter", ";");
options.put("test-format.fail-on-missing", "true");
final DynamicTableSource actualSource = createTableSource(SCHEMA, options);
final DynamicTableSource expectedSource = new DynamicTableSourceMock("MyTarget", null, new DecodingFormatMock(",", false), new DecodingFormatMock(";", true));
assertThat(actualSource).isEqualTo(expectedSource);
final DynamicTableSink actualSink = createTableSink(SCHEMA, options);
final DynamicTableSink expectedSink = new DynamicTableSinkMock("MyTarget", 1000L, new EncodingFormatMock(","), new EncodingFormatMock(";"));
assertThat(actualSink).isEqualTo(expectedSink);
}
use of org.apache.flink.table.factories.TestDynamicTableFactory.DynamicTableSourceMock in project flink by apache.
the class FactoryUtilTest method testOptionalFormat.
@Test
public void testOptionalFormat() {
final Map<String, String> options = createAllOptions();
options.remove("key.format");
options.remove("key.test-format.delimiter");
final DynamicTableSource actualSource = createTableSource(SCHEMA, options);
final DynamicTableSource expectedSource = new DynamicTableSourceMock("MyTarget", null, null, new DecodingFormatMock("|", true));
assertThat(actualSource).isEqualTo(expectedSource);
final DynamicTableSink actualSink = createTableSink(SCHEMA, options);
final DynamicTableSink expectedSink = new DynamicTableSinkMock("MyTarget", 1000L, null, new EncodingFormatMock("|"));
assertThat(actualSink).isEqualTo(expectedSink);
}
Aggregations