@Test public void testGetResultParameters() throws Exception { File confFile = temp.newFile("props.cfg"); FileUtils.writeLines(confFile, Arrays.asList( "processor.test.param.mime=image/jpeg", "processor.test.onExits=0, >10, 2\\,3, *", "processor.test.onExit.0.param.file=ERR_0\\:$${input.file.name}", "processor.test.onExit.>10.param.file=ERR_>10\\:$${input.file.name}", "processor.test.onExit.>10.stop=false", "processor.test.onExit.2,3.param.file=ERR_2\\,3\\:$${input.file.name}", "processor.test.onExit.*.param.file=ERR_*\\:$${input.file.name}", "processor.test.onSkip.param.file=SKIPPED\\:$${input.file.name}" )); PropertiesConfiguration pconf = new PropertiesConfiguration(confFile); String processorId = "processor.test"; Configuration conf = pconf.subset(processorId); conf.setProperty("id", processorId); GenericExternalProcess gep = new GenericExternalProcess(conf); gep.addInputFile(confFile); ProcessResult result = ProcessResult.getResultParameters(conf, gep.getParameters().getMap(), false, 0, null); assertEquals("image/jpeg", result.getParameters().get(processorId + ".param.mime")); assertEquals("ERR_0:props", result.getParameters().get(processorId + ".param.file")); assertEquals(Integer.valueOf(0), result.getExit().getExitCode()); assertFalse(result.getExit().isStop()); assertFalse(result.getExit().isSkip()); result = ProcessResult.getResultParameters(conf, gep.getParameters().getMap(), false, 3, null); assertEquals("image/jpeg", result.getParameters().get(processorId + ".param.mime")); assertEquals("ERR_2,3:props", result.getParameters().get(processorId + ".param.file")); assertEquals(Integer.valueOf(3), result.getExit().getExitCode()); assertTrue(result.getExit().isStop()); assertFalse(result.getExit().isSkip()); result = ProcessResult.getResultParameters(conf, gep.getParameters().getMap(), false, 11, null); assertEquals("image/jpeg", result.getParameters().get(processorId + ".param.mime")); assertEquals("ERR_>10:props", result.getParameters().get(processorId + ".param.file")); assertEquals(Integer.valueOf(11), result.getExit().getExitCode()); assertFalse(result.getExit().isStop()); assertFalse(result.getExit().isSkip()); result = ProcessResult.getResultParameters(conf, gep.getParameters().getMap(), false, -1, null); assertEquals("image/jpeg", result.getParameters().get(processorId + ".param.mime")); assertEquals("ERR_*:props", result.getParameters().get(processorId + ".param.file")); assertEquals(Integer.valueOf(-1), result.getExit().getExitCode()); assertTrue(result.getExit().isStop()); assertFalse(result.getExit().isSkip()); result = ProcessResult.getResultParameters(conf, gep.getParameters().getMap(), true, 0, null); assertEquals("image/jpeg", result.getParameters().get(processorId + ".param.mime")); assertEquals("SKIPPED:props", result.getParameters().get(processorId + ".param.file")); assertFalse(result.getExit().isStop()); assertTrue(result.getExit().isSkip()); }
public Map<String, String> getResultParameters() { return getResult().getParameters(); }
GenericExternalProcess extends ExternalProcess { public Map<String, String> getResultParameters() { return getResult().getParameters(); } }
GenericExternalProcess extends ExternalProcess { public Map<String, String> getResultParameters() { return getResult().getParameters(); } GenericExternalProcess(Configuration conf); }
GenericExternalProcess extends ExternalProcess { public Map<String, String> getResultParameters() { return getResult().getParameters(); } GenericExternalProcess(Configuration conf); GenericExternalProcess addInputFile(File file); File getInputFile(); GenericExternalProcess addOutputFile(File file); File getOutputFile(); ParamHandler getParameters(); Map<String, String> getResultParameters(); ProcessResult getResult(); @Override void run(); boolean isSkippedProcess(); }
GenericExternalProcess extends ExternalProcess { public Map<String, String> getResultParameters() { return getResult().getParameters(); } GenericExternalProcess(Configuration conf); GenericExternalProcess addInputFile(File file); File getInputFile(); GenericExternalProcess addOutputFile(File file); File getOutputFile(); ParamHandler getParameters(); Map<String, String> getResultParameters(); ProcessResult getResult(); @Override void run(); boolean isSkippedProcess(); static final String DST_PARENT; static final String DST_PATH; static final String SRC_EXT; static final String SRC_NAME; static final String SRC_NAME_EXT; static final String SRC_PATH; static final String SRC_PARENT; }