PasswordGeneratorPipe extends FixedForwardPipe { @Override public PipeRunResult doPipe (Message message, IPipeLineSession session) throws PipeRunException { String result; try { result = generate(getNumOfLCharacters(),getNumOfUCharacters(),getNumOfSigns(),getNumOfDigits()); } catch (Exception e) { throw new PipeRunException(this, "failed to generate password",e); } return new PipeRunResult(getForward(),result); }  @Override void configure(); @Override PipeRunResult doPipe(Message message, IPipeLineSession session); boolean isUseSecureRandom(); @IbisDoc({"whether the securerandom algorithm is to be used (slower)", "true"}) void setUseSecureRandom(boolean b); String getLCharacters(); @IbisDoc({"the lowercase characters to use", "('a'..'z')"}) void setLCharacters(String lCharacters); String getUCharacters(); @IbisDoc({"the uppercase characters to use", "('a'..'z')"}) void setUCharacters(String uCharacters); String getNumbers(); @IbisDoc({"the numbers to use", "('0'..'9')"}) void setNumbers(String numbers); String getSigns(); @IbisDoc({"the signs to use", "(;:_%$#@!&gt;&lt;)"}) void setSigns(String signs); int getNumOfLCharacters(); int getNumOfDigits(); int getNumOfSigns(); int getNumOfUCharacters(); @IbisDoc({"the number of lowercase characters in the generated password", "2"}) void setNumOfLCharacters(int i); @IbisDoc({"the number of digits in the generated password", "2"}) void setNumOfDigits(int i); @IbisDoc({"the number of sign characters in the generated password", "2"}) void setNumOfSigns(int i); @IbisDoc({"the number of uppercase characters in the generated password", "2"}) void setNumOfUCharacters(int i);  }
@Test public void testDoPipe() throws Exception { pipe.setLCharacters("abcd"); pipe.setNumbers("12342"); pipe.setUCharacters("ASDF"); pipe.setSigns("!@#@"); pipe.setNumOfDigits(3); pipe.setNumOfLCharacters(4); pipe.setNumOfUCharacters(2); pipe.setNumOfSigns(2); pipe.setUseSecureRandom(false); pipe.configure(); PipeRunResult res = doPipe(pipe, "pipey", session); assertEquals(11, res.getResult().asString().length()); }