use of io.cdap.cdap.etl.api.PipelineConfigurer in project hydrator-plugins by cdapio.
the class XMLToJSONConverterTest method testInvalidInputFieldType.
@Test
public void testInvalidInputFieldType() throws Exception {
Schema schema = Schema.recordOf("input1", Schema.Field.of("body", Schema.of(Schema.Type.INT)));
XMLToJSON.Config config = new XMLToJSON.Config("body", "jsonevent", OUTPUT.toString());
PipelineConfigurer configurer = new MockPipelineConfigurer(schema);
FailureCollector collector = configurer.getStageConfigurer().getFailureCollector();
XMLToJSON converter = new XMLToJSON(config);
converter.configurePipeline(configurer);
Assert.assertEquals(1, collector.getValidationFailures().size());
Assert.assertEquals(2, collector.getValidationFailures().get(0).getCauses().size());
}
use of io.cdap.cdap.etl.api.PipelineConfigurer in project hydrator-plugins by cdapio.
the class XMLToJSONConverterTest method testInvalidInputField.
@Test
public void testInvalidInputField() throws Exception {
XMLToJSON.Config config = new XMLToJSON.Config("does_not_exist", "jsonevent", OUTPUT.toString());
PipelineConfigurer configurer = new MockPipelineConfigurer(INPUT);
FailureCollector collector = configurer.getStageConfigurer().getFailureCollector();
XMLToJSON converter = new XMLToJSON(config);
converter.configurePipeline(configurer);
Assert.assertEquals(1, collector.getValidationFailures().size());
Assert.assertEquals(1, collector.getValidationFailures().get(0).getCauses().size());
Cause expectedCause = new Cause();
expectedCause.addAttribute(CauseAttributes.STAGE_CONFIG, "inputField");
Assert.assertEquals(expectedCause, collector.getValidationFailures().get(0).getCauses().get(0));
}
Aggregations