use of io.cdap.cdap.etl.mock.common.MockPipelineConfigurer in project hydrator-plugins by cdapio.
the class CompressorTest method testSchemaValidation.
@Test
public void testSchemaValidation() {
Transform<StructuredRecord, StructuredRecord> transform = new Compressor(new Compressor.Config("a:GZIP", OUTPUT.toString()));
MockPipelineConfigurer mockPipelineConfigurer = new MockPipelineConfigurer(INPUT);
transform.configurePipeline(mockPipelineConfigurer);
Assert.assertEquals(OUTPUT, mockPipelineConfigurer.getOutputSchema());
}
use of io.cdap.cdap.etl.mock.common.MockPipelineConfigurer in project hydrator-plugins by cdapio.
the class SolrSearchSinkTest method testInvalidInputDataType.
@Test(expected = IllegalArgumentException.class)
public void testInvalidInputDataType() {
Schema inputSchema = Schema.recordOf("input-record", Schema.Field.of("id", Schema.of(Schema.Type.STRING)), Schema.Field.of("firstname", Schema.of(Schema.Type.STRING)), Schema.Field.of("lastname", Schema.of(Schema.Type.STRING)), Schema.Field.of("office address", Schema.of(Schema.Type.STRING)), Schema.Field.of("pincode", Schema.nullableOf(Schema.of(Schema.Type.BYTES))));
SolrSearchSink.BatchSolrSearchConfig config = new SolrSearchSink.BatchSolrSearchConfig("SolrSink", SolrSearchSinkConfig.SINGLE_NODE_MODE, "localhost:8983", "collection1", "id", "office address:address", "1000");
SolrSearchSink sinkObject = new SolrSearchSink(config);
MockPipelineConfigurer configurer = new MockPipelineConfigurer(inputSchema);
sinkObject.configurePipeline(configurer);
}
use of io.cdap.cdap.etl.mock.common.MockPipelineConfigurer in project hydrator-plugins by cdapio.
the class CompressorTest method testSchemaValidationWithInvalidInputSchema.
@Test
public void testSchemaValidationWithInvalidInputSchema() {
Transform<StructuredRecord, StructuredRecord> transform = new Compressor(new Compressor.Config("a:ZIP", OUTPUT.toString()));
Schema invalidInput = Schema.recordOf("input", Schema.Field.of("a", Schema.of(Schema.Type.INT)), Schema.Field.of("b", Schema.of(Schema.Type.STRING)));
MockPipelineConfigurer mockPipelineConfigurer = new MockPipelineConfigurer(invalidInput);
FailureCollector collector = mockPipelineConfigurer.getStageConfigurer().getFailureCollector();
transform.configurePipeline(mockPipelineConfigurer);
Assert.assertEquals(1, collector.getValidationFailures().size());
}
use of io.cdap.cdap.etl.mock.common.MockPipelineConfigurer in project hydrator-plugins by cdapio.
the class CompressorTest method testSchemaValidationWithValidInputSchema.
@Test
public void testSchemaValidationWithValidInputSchema() {
Transform<StructuredRecord, StructuredRecord> transform = new Compressor(new Compressor.Config("a:NONE", OUTPUT.toString()));
Schema validInput = Schema.recordOf("input", Schema.Field.of("a", Schema.of(Schema.Type.INT)), Schema.Field.of("b", Schema.of(Schema.Type.STRING)));
MockPipelineConfigurer mockPipelineConfigurer = new MockPipelineConfigurer(validInput);
transform.configurePipeline(mockPipelineConfigurer);
Assert.assertEquals(OUTPUT, mockPipelineConfigurer.getOutputSchema());
}
use of io.cdap.cdap.etl.mock.common.MockPipelineConfigurer in project hydrator-plugins by cdapio.
the class DecoderTest method testSchemaValidation.
@Test
public void testSchemaValidation() {
Transform<StructuredRecord, StructuredRecord> decoder = new Decoder(new Decoder.Config("a:BASE64", OUTPUT.toString()));
MockPipelineConfigurer mockPipelineConfigurer = new MockPipelineConfigurer(INPUT);
decoder.configurePipeline(mockPipelineConfigurer);
Assert.assertEquals(OUTPUT, mockPipelineConfigurer.getOutputSchema());
}
Aggregations