@Test(expected=RuntimeException.class) public void testSetupWithoutNamedOutputFault() throws Exception { Configuration conf = new Configuration(); conf.set(NAMED_OUTPUT_META, "meta"); doReturn(conf).when(context).getConfiguration(); mapper.setup(context); }
@Override protected void setup(Mapper<AvroKey<DocumentText>, NullWritable, NullWritable, NullWritable>.Context context) throws IOException, InterruptedException { namedOutputMeta = context.getConfiguration().get(NAMED_OUTPUT_META); if (namedOutputMeta == null || namedOutputMeta.isEmpty()) { throw new RuntimeException("no named output provided for metadata"); } namedOutputFault = context.getConfiguration().get(NAMED_OUTPUT_FAULT); if (namedOutputFault == null || namedOutputFault.isEmpty()) { throw new RuntimeException("no named output provided for fault"); } mos = instantiateMultipleOutputs(context); oaiNamespace = Namespace.getNamespace(context.getConfiguration().get(PARAM_INGEST_METADATA_OAI_NAMESPACE, "http: String excludedIdsCSV = context.getConfiguration().get(EXCLUDED_IDS); if (excludedIdsCSV != null && !excludedIdsCSV.trim().isEmpty() && !WorkflowRuntimeParameters.UNDEFINED_NONEMPTY_VALUE.equals(excludedIdsCSV)) { log.info("got excluded ids: " + excludedIdsCSV); excludedIds = new HashSet<String>(Arrays.asList(StringUtils.split(excludedIdsCSV.trim(), ','))); } else { log.info("got no excluded ids"); } }
MetadataImporter extends Mapper<AvroKey<DocumentText>, NullWritable, NullWritable, NullWritable> { @Override protected void setup(Mapper<AvroKey<DocumentText>, NullWritable, NullWritable, NullWritable>.Context context) throws IOException, InterruptedException { namedOutputMeta = context.getConfiguration().get(NAMED_OUTPUT_META); if (namedOutputMeta == null || namedOutputMeta.isEmpty()) { throw new RuntimeException("no named output provided for metadata"); } namedOutputFault = context.getConfiguration().get(NAMED_OUTPUT_FAULT); if (namedOutputFault == null || namedOutputFault.isEmpty()) { throw new RuntimeException("no named output provided for fault"); } mos = instantiateMultipleOutputs(context); oaiNamespace = Namespace.getNamespace(context.getConfiguration().get(PARAM_INGEST_METADATA_OAI_NAMESPACE, "http: String excludedIdsCSV = context.getConfiguration().get(EXCLUDED_IDS); if (excludedIdsCSV != null && !excludedIdsCSV.trim().isEmpty() && !WorkflowRuntimeParameters.UNDEFINED_NONEMPTY_VALUE.equals(excludedIdsCSV)) { log.info("got excluded ids: " + excludedIdsCSV); excludedIds = new HashSet<String>(Arrays.asList(StringUtils.split(excludedIdsCSV.trim(), ','))); } else { log.info("got no excluded ids"); } } }
MetadataImporter extends Mapper<AvroKey<DocumentText>, NullWritable, NullWritable, NullWritable> { @Override protected void setup(Mapper<AvroKey<DocumentText>, NullWritable, NullWritable, NullWritable>.Context context) throws IOException, InterruptedException { namedOutputMeta = context.getConfiguration().get(NAMED_OUTPUT_META); if (namedOutputMeta == null || namedOutputMeta.isEmpty()) { throw new RuntimeException("no named output provided for metadata"); } namedOutputFault = context.getConfiguration().get(NAMED_OUTPUT_FAULT); if (namedOutputFault == null || namedOutputFault.isEmpty()) { throw new RuntimeException("no named output provided for fault"); } mos = instantiateMultipleOutputs(context); oaiNamespace = Namespace.getNamespace(context.getConfiguration().get(PARAM_INGEST_METADATA_OAI_NAMESPACE, "http: String excludedIdsCSV = context.getConfiguration().get(EXCLUDED_IDS); if (excludedIdsCSV != null && !excludedIdsCSV.trim().isEmpty() && !WorkflowRuntimeParameters.UNDEFINED_NONEMPTY_VALUE.equals(excludedIdsCSV)) { log.info("got excluded ids: " + excludedIdsCSV); excludedIds = new HashSet<String>(Arrays.asList(StringUtils.split(excludedIdsCSV.trim(), ','))); } else { log.info("got no excluded ids"); } }  }
MetadataImporter extends Mapper<AvroKey<DocumentText>, NullWritable, NullWritable, NullWritable> { @Override protected void setup(Mapper<AvroKey<DocumentText>, NullWritable, NullWritable, NullWritable>.Context context) throws IOException, InterruptedException { namedOutputMeta = context.getConfiguration().get(NAMED_OUTPUT_META); if (namedOutputMeta == null || namedOutputMeta.isEmpty()) { throw new RuntimeException("no named output provided for metadata"); } namedOutputFault = context.getConfiguration().get(NAMED_OUTPUT_FAULT); if (namedOutputFault == null || namedOutputFault.isEmpty()) { throw new RuntimeException("no named output provided for fault"); } mos = instantiateMultipleOutputs(context); oaiNamespace = Namespace.getNamespace(context.getConfiguration().get(PARAM_INGEST_METADATA_OAI_NAMESPACE, "http: String excludedIdsCSV = context.getConfiguration().get(EXCLUDED_IDS); if (excludedIdsCSV != null && !excludedIdsCSV.trim().isEmpty() && !WorkflowRuntimeParameters.UNDEFINED_NONEMPTY_VALUE.equals(excludedIdsCSV)) { log.info("got excluded ids: " + excludedIdsCSV); excludedIds = new HashSet<String>(Arrays.asList(StringUtils.split(excludedIdsCSV.trim(), ','))); } else { log.info("got no excluded ids"); } }  @Override void cleanup(Context context); }
MetadataImporter extends Mapper<AvroKey<DocumentText>, NullWritable, NullWritable, NullWritable> { @Override protected void setup(Mapper<AvroKey<DocumentText>, NullWritable, NullWritable, NullWritable>.Context context) throws IOException, InterruptedException { namedOutputMeta = context.getConfiguration().get(NAMED_OUTPUT_META); if (namedOutputMeta == null || namedOutputMeta.isEmpty()) { throw new RuntimeException("no named output provided for metadata"); } namedOutputFault = context.getConfiguration().get(NAMED_OUTPUT_FAULT); if (namedOutputFault == null || namedOutputFault.isEmpty()) { throw new RuntimeException("no named output provided for fault"); } mos = instantiateMultipleOutputs(context); oaiNamespace = Namespace.getNamespace(context.getConfiguration().get(PARAM_INGEST_METADATA_OAI_NAMESPACE, "http: String excludedIdsCSV = context.getConfiguration().get(EXCLUDED_IDS); if (excludedIdsCSV != null && !excludedIdsCSV.trim().isEmpty() && !WorkflowRuntimeParameters.UNDEFINED_NONEMPTY_VALUE.equals(excludedIdsCSV)) { log.info("got excluded ids: " + excludedIdsCSV); excludedIds = new HashSet<String>(Arrays.asList(StringUtils.split(excludedIdsCSV.trim(), ','))); } else { log.info("got no excluded ids"); } }  @Override void cleanup(Context context); static final String NAMED_OUTPUT_META; static final String NAMED_OUTPUT_FAULT; static final String EXCLUDED_IDS; static final String FAULT_TEXT; static final String PARAM_INGEST_METADATA_OAI_NAMESPACE; }