use of io.cdap.cdap.etl.mock.common.MockPipelineConfigurer in project hydrator-plugins by cdapio.
the class HBaseSinkTest 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)));
HBaseSink.HBaseSinkConfig tableSinkConfig = new HBaseSink.HBaseSinkConfig("hbaseSink", "rowkey", outputSchema.toString());
HBaseSink tableSink = new HBaseSink(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 HBaseSinkTest method testTableSinkWithMissingRowKeyField.
@Test
public void testTableSinkWithMissingRowKeyField() {
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("userid", Schema.of(Schema.Type.STRING)), Schema.Field.of("user", Schema.of(Schema.Type.STRING)));
HBaseSink.HBaseSinkConfig tableSinkConfig = new HBaseSink.HBaseSinkConfig("hbaseSink", "rowkey", outputSchema.toString());
HBaseSink tableSink = new HBaseSink(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 HBaseSinkTest 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)));
HBaseSink.HBaseSinkConfig tableSinkConfig = new HBaseSink.HBaseSinkConfig("hbaseSink", "rowkey", outputSchema.toString());
HBaseSink tableSink = new HBaseSink(tableSinkConfig);
MockPipelineConfigurer mockPipelineConfigurer = new MockPipelineConfigurer(inputSchema);
tableSink.configurePipeline(mockPipelineConfigurer);
FailureCollector collector = mockPipelineConfigurer.getStageConfigurer().getFailureCollector();
Assert.assertEquals(1, collector.getValidationFailures().size());
List<ValidationFailure.Cause> causes = collector.getValidationFailures().get(0).getCauses();
Assert.assertEquals(2, causes.size());
}
use of io.cdap.cdap.etl.mock.common.MockPipelineConfigurer in project hydrator-plugins by cdapio.
the class HBaseSinkTest 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))));
HBaseSink.HBaseSinkConfig tableSinkConfig = new HBaseSink.HBaseSinkConfig("hbaseSink", "rowkey", outputSchema.toString());
HBaseSink tableSink = new HBaseSink(tableSinkConfig);
MockPipelineConfigurer mockPipelineConfigurer = new MockPipelineConfigurer(inputSchema);
tableSink.configurePipeline(mockPipelineConfigurer);
}
Aggregations