FixedResult extends FixedForwardPipe { @Override public void configure() throws ConfigurationException { super.configure(); appConstants = AppConstants.getInstance(getConfigurationClassLoader()); if (StringUtils.isNotEmpty(getFileName()) && !isLookupAtRuntime()) { URL resource = null; try { resource = ClassUtils.getResourceURL(getConfigurationClassLoader(), getFileName()); } catch (Throwable e) { throw new ConfigurationException(getLogPrefix(null)+"got exception searching for ["+getFileName()+"]", e); } if (resource==null) { throw new ConfigurationException(getLogPrefix(null)+"cannot find resource ["+getFileName()+"]"); } try { returnString = Misc.resourceToString(resource, SystemUtils.LINE_SEPARATOR); } catch (Throwable e) { throw new ConfigurationException(getLogPrefix(null)+"got exception loading ["+getFileName()+"]", e); } } if ((StringUtils.isEmpty(fileName)) && (StringUtils.isEmpty(fileNameSessionKey)) && returnString==null) { throw new ConfigurationException(getLogPrefix(null)+"has neither fileName nor fileNameSessionKey nor returnString specified"); } if (StringUtils.isNotEmpty(replaceFrom)) { returnString = replace(returnString, replaceFrom, replaceTo ); } }  @Override void configure(); @Override PipeRunResult doPipe(Message message, IPipeLineSession session); static String replace(String target, String from, String to); @IbisDoc({"should values between ${ and } be resolved from the pipelinesession (search order: 1) system properties 2) pipelinesession variables 3) application properties)", "false"}) void setSubstituteVars(boolean substitute); boolean getSubstituteVars(); @IbisDoc({"name of the file containing the resultmessage", ""}) void setFileName(String fileName); String getFileName(); @IbisDoc({"name of the session key containing the file name of the file containing the result message", ""}) void setFileNameSessionKey(String filenameSessionKey); String getFileNameSessionKey(); @IbisDoc({"returned message", ""}) void setReturnString(String returnString); String getReturnString(); String getReplaceFrom(); void setReplaceFrom(String replaceFrom); String getReplaceTo(); void setReplaceTo(String replaceTo); String getStyleSheetName(); void setStyleSheetName(String styleSheetName); @IbisDoc({"when set <code>true</code>, the lookup of the file will be done at runtime instead of at configuration time", "false"}) void setLookupAtRuntime(boolean b); boolean isLookupAtRuntime(); @IbisDoc({"when set <code>true</code>, any parameter is used for replacements but with <code>name-of-parameter</code> and not <code>${name-of-parameter}</code>", "false"}) void setReplaceFixedParams(boolean b); boolean isReplaceFixedParams();  }
@Test public void testEmptyFileName() throws Exception{ exception.expectMessage("Pipe [FixedResult under test] has neither fileName nor fileNameSessionKey nor returnString specified"); pipe.configure(); fail("this should fail"); }