use of io.cdap.cdap.etl.mock.common.MockPipelineConfigurer in project hydrator-plugins by cdapio.
the class TableSinkTest method testTableSinkWithOutputSchemaWithOneNonRowKeyField.
@Test(expected = IllegalArgumentException.class)
public void testTableSinkWithOutputSchemaWithOneNonRowKeyField() {
Schema outputSchema = Schema.recordOf("purchase", Schema.Field.of("user", Schema.of(Schema.Type.STRING)));
Schema inputSchema = Schema.recordOf("purchase", Schema.Field.of("rowkey", Schema.of(Schema.Type.STRING)), Schema.Field.of("user", Schema.of(Schema.Type.STRING)), Schema.Field.of("count", Schema.of(Schema.Type.INT)));
TableSinkConfig tableSinkConfig = new TableSinkConfig("tableSink", "rowkey", outputSchema.toString());
TableSink tableSink = new TableSink(tableSinkConfig);
MockPipelineConfigurer mockPipelineConfigurer = new MockPipelineConfigurer(inputSchema);
tableSink.configurePipeline(mockPipelineConfigurer);
}
use of io.cdap.cdap.etl.mock.common.MockPipelineConfigurer in project hydrator-plugins by cdapio.
the class TableSinkTest method testTableSinkWithOutputSchemaExtraField.
@Test
public void testTableSinkWithOutputSchemaExtraField() {
Schema outputSchema = Schema.recordOf("purchase", Schema.Field.of("rowkey", Schema.of(Schema.Type.STRING)), Schema.Field.of("user", Schema.of(Schema.Type.STRING)), Schema.Field.of("points", Schema.of(Schema.Type.DOUBLE)));
Schema inputSchema = Schema.recordOf("purchase", Schema.Field.of("rowkey", Schema.of(Schema.Type.STRING)), Schema.Field.of("user", Schema.of(Schema.Type.STRING)));
TableSinkConfig tableSinkConfig = new TableSinkConfig("tableSink", "rowkey", outputSchema.toString());
TableSink tableSink = new TableSink(tableSinkConfig);
MockPipelineConfigurer mockPipelineConfigurer = new MockPipelineConfigurer(inputSchema);
tableSink.configurePipeline(mockPipelineConfigurer);
FailureCollector collector = mockPipelineConfigurer.getStageConfigurer().getFailureCollector();
Assert.assertEquals(1, collector.getValidationFailures().size());
}
use of io.cdap.cdap.etl.mock.common.MockPipelineConfigurer in project hydrator-plugins by cdapio.
the class TableSinkTest method testTableSinkWithFieldTypeMismatch.
@Test
public void testTableSinkWithFieldTypeMismatch() {
Schema outputSchema = Schema.recordOf("purchase", Schema.Field.of("rowkey", Schema.of(Schema.Type.STRING)), Schema.Field.of("user", Schema.of(Schema.Type.STRING)), Schema.Field.of("item", Schema.of(Schema.Type.INT)));
Schema inputSchema = Schema.recordOf("purchase", Schema.Field.of("rowkey", Schema.of(Schema.Type.STRING)), Schema.Field.of("user", Schema.of(Schema.Type.STRING)), Schema.Field.of("item", Schema.of(Schema.Type.STRING)));
TableSinkConfig tableSinkConfig = new TableSinkConfig("tableSink", "rowkey", outputSchema.toString());
TableSink tableSink = new TableSink(tableSinkConfig);
MockPipelineConfigurer mockPipelineConfigurer = new MockPipelineConfigurer(inputSchema);
tableSink.configurePipeline(mockPipelineConfigurer);
FailureCollector collector = mockPipelineConfigurer.getStageConfigurer().getFailureCollector();
Assert.assertEquals(1, collector.getValidationFailures().size());
}
use of io.cdap.cdap.etl.mock.common.MockPipelineConfigurer in project hydrator-plugins by cdapio.
the class TableSinkTest method testTableSinkWithMissingOutputSchema.
@Test
public void testTableSinkWithMissingOutputSchema() {
TableSinkConfig tableSinkConfig = new TableSinkConfig("tableSink", "rowkey", null);
TableSink tableSink = new TableSink(tableSinkConfig);
MockPipelineConfigurer mockPipelineConfigurer = new MockPipelineConfigurer(null);
tableSink.configurePipeline(mockPipelineConfigurer);
}
use of io.cdap.cdap.etl.mock.common.MockPipelineConfigurer in project hydrator-plugins by cdapio.
the class TableSinkTest method testTableSinkWithComplexTypeSkipped.
@Test
public void testTableSinkWithComplexTypeSkipped() {
Schema outputSchema = Schema.recordOf("purchase", Schema.Field.of("rowkey", Schema.of(Schema.Type.STRING)), Schema.Field.of("user", Schema.of(Schema.Type.STRING)));
Schema inputSchema = Schema.recordOf("purchase", Schema.Field.of("rowkey", Schema.of(Schema.Type.STRING)), Schema.Field.of("user", Schema.of(Schema.Type.STRING)), Schema.Field.of("complex", Schema.mapOf(Schema.of(Schema.Type.STRING), Schema.of(Schema.Type.STRING))));
TableSinkConfig tableSinkConfig = new TableSinkConfig("tableSink", "rowkey", outputSchema.toString());
TableSink tableSink = new TableSink(tableSinkConfig);
MockPipelineConfigurer mockPipelineConfigurer = new MockPipelineConfigurer(inputSchema);
tableSink.configurePipeline(mockPipelineConfigurer);
}
Aggregations