@Test public void testBadCredentials() throws Exception { List<JdbcFieldColumnMapping> columnMappings = ImmutableList.of(new JdbcFieldColumnMapping("P_ID", "[2]")); JdbcLookupDProcessor processor = new JdbcLookupDProcessor(); processor.hikariConfigBean = createConfigBean(h2ConnectionString, "foo", "bar"); ProcessorRunner processorRunner = new ProcessorRunner.Builder(JdbcLookupDProcessor.class, processor) .addConfiguration("query", listQuery) .addConfiguration("columnMappings", columnMappings) .addConfiguration("maxClobSize", 1000) .addConfiguration("maxBlobSize", 1000) .addOutputLane("lane") .build(); List<Stage.ConfigIssue> issues = processorRunner.runValidateConfigs(); assertEquals(1, issues.size()); }
@Test public void testIncorrectDatabase() throws Exception { List<GeolocationFieldConfig> configs = new ArrayList<>(); GeolocationFieldConfig config; config = new GeolocationFieldConfig(); config.inputFieldName = "/ipAsInt"; config.outputFieldName = "/intIpCountry"; config.targetType = GeolocationField.CITY_NAME; configs.add(config); ProcessorRunner runner = new ProcessorRunner.Builder(GeolocationDProcessor.class) .addConfiguration("fieldTypeConverterConfigs", configs) .addConfiguration("geoIP2DBFile", databaseFile.getAbsolutePath()) .addOutputLane("a") .build(); List<Stage.ConfigIssue> configErrors = runner.runValidateConfigs(); Assert.assertEquals(String.valueOf(configErrors), 1, configErrors.size()); Assert.assertTrue( String.valueOf(configErrors.get(0)), String.valueOf(configErrors.get(0)).contains(Errors.GEOIP_05.name())); }