PasswordGeneratorPipe extends FixedForwardPipe { protected String generate(int numOfLCharacters, int numOfUCharacters, int numOfSigns, int numOfNumbers){ StringBuffer resultSb=new StringBuffer(); resultSb.append(getRandomElementsOfString(getLCharacters(), numOfLCharacters)); resultSb.append(getRandomElementsOfString(getUCharacters(), numOfUCharacters)); resultSb.append(getRandomElementsOfString(getSigns(), numOfSigns)); resultSb.append(getRandomElementsOfString(getNumbers(), numOfNumbers)); String result=garbleString(resultSb.toString()); return 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 testGenerate() throws Exception { pipe.configure(); String res = pipe.generate(3, 4, 2, 1); assertEquals(res.length(), 10); assertFalse(res.isEmpty()); }