@Test public void testClusterModeHadoopDbFileAbsPath() { List<GeolocationFieldConfig> configs = new ArrayList<>(); GeolocationFieldConfig config; config = new GeolocationFieldConfig(); config.inputFieldName = "/ipAsInt"; config.outputFieldName = "/intIpCountry"; config.targetType = GeolocationField.COUNTRY_NAME; configs.add(config); ProcessorRunner runner = new ProcessorRunner.Builder(GeolocationDProcessor.class) .setOnRecordError(OnRecordError.STOP_PIPELINE) .addConfiguration("geoIP2DBFile", databaseFile.getAbsolutePath()) .addConfiguration("fieldTypeConverterConfigs", configs) .setExecutionMode(ExecutionMode.CLUSTER_BATCH) .addOutputLane("a") .build(); try { runner.runInit(); Assert.fail( Utils.format( "Expected StageException as absolute database file path '{}' is specified in cluster mode", databaseFile.getAbsolutePath())); } catch (StageException e) { Assert.assertTrue(e.getMessage().contains("GEOIP_10")); } }
@Override @SuppressWarnings("ThrowableResultOfMethodCallIgnored") public void reportError(Exception exception) { Preconditions.checkNotNull(exception, "exception cannot be null"); if (exception instanceof StageException) { StageException stageException = (StageException) exception; errorSink.addError( instanceName, new ErrorMessage(stageException.getErrorCode(), stageException.getParams())); } else { errorSink.addError( instanceName, new ErrorMessage(ContainerError.CONTAINER_0001, exception.toString())); } }