List of usage examples for org.apache.commons.lang RandomStringUtils randomAscii
public static String randomAscii(int count)
Creates a random string whose length is the number of characters specified.
Characters will be chosen from the set of characters whose ASCII value is between 32
and 126
(inclusive).
From source file:com.bloatit.data.DataManager.java
/** * Initialize the data layer. You can put here all the work that is needed * to be done on the db at the launching of the program. *//* w w w. j av a 2s.c o m*/ public static void initialize() { // Verify that we do not have old not Hashed password: open(); // "NO-SALT !" is the default value when adding the salt (in liquibase). final Query query = SessionManager.createQuery("FROM DaoMember WHERE salt=:salt").setString("salt", "NO-SALT !"); @SuppressWarnings("unchecked") final List<DaoMember> members = query.list(); for (final DaoMember member : members) { final String salt = RandomStringUtils.randomAscii(50); final String password = Hash.calculateHash(member.getPassword(), salt); member.setPassword(password); member.setSalt(salt); } close(); }
From source file:com.tesora.dve.server.connectionmanager.SSConnectionHandshake.java
String generateSalt() {
return RandomStringUtils.randomAscii(20);
}
From source file:net.sf.ipsedixit.core.impl.DefaultDataProvider.java
/** * {@inheritDoc}/* ww w . j a va2s . c o m*/ */ public String randomString(StringType stringType, int length) { if (stringType == StringType.ALPHANUMERIC) { return RandomStringUtils.randomAlphanumeric(length); } else if (stringType == StringType.ALPHA) { return RandomStringUtils.randomAlphabetic(length); } else if (stringType == StringType.NUMERIC) { return RandomStringUtils.randomNumeric(length); } return RandomStringUtils.randomAscii(length); }
From source file:com.merrill.examples.framework.lang.text.impl.CommonsRandomTextGenerator.java
public String randomAscii(int count) { return RandomStringUtils.randomAscii(count); }
From source file:com.redhat.rhn.frontend.action.kickstart.test.KickstartScriptActionTest.java
public void testExecuteLargeValueSubmit() throws Exception { String contents = RandomStringUtils.randomAscii(400000); String name = RandomStringUtils.randomAscii(20); // Lets zero out the scripts ksdata = clearScripts(ksdata);/* w w w .ja v a 2 s.co m*/ String language = "/usr/bin/perl"; addRequestParameter(KickstartScriptCreateAction.CONTENTS, contents); addRequestParameter(KickstartScriptCreateAction.LANGUAGE, language); addRequestParameter(KickstartScriptCreateAction.TYPE, KickstartScript.TYPE_POST); addRequestParameter(KickstartScriptCreateAction.SUBMITTED, Boolean.TRUE.toString()); addRequestParameter(KickstartScriptCreateAction.TEMPLATE, Boolean.TRUE.toString()); addRequestParameter(KickstartScriptCreateAction.SCRIPTNAME, name); setRequestPathInfo("/kickstart/KickstartScriptCreate"); actionPerform(); String[] keys = { "errors.maxlength" }; verifyActionErrors(keys); contents = RandomStringUtils.randomAscii(50000); addRequestParameter(KickstartScriptCreateAction.CONTENTS, contents); actionPerform(); String[] successkeys = { "kickstart.script.success" }; verifyActionMessages(successkeys); }
From source file:at.ac.tuwien.ims.latex2mobiformulaconv.tests.unit.MiTest.java
@Before public void setUp() throws Exception { mi = new Mi(); randomText = RandomStringUtils.randomAscii(new Random().nextInt(32) + 1).trim(); logger.debug("RandomText: " + randomText); mi.setValue(randomText);/* w ww. j a va 2 s. c o m*/ formulaElement = mi; }
From source file:at.ac.tuwien.ims.latex2mobiformulaconv.tests.unit.MnTest.java
@Before public void setUp() throws Exception { mn = new Mn(); randomText = RandomStringUtils.randomAscii(new Random().nextInt(32) + 1).trim(); logger.debug("RandomText: " + randomText); mn.setValue(randomText);/*from w ww.ja v a 2 s .c o m*/ formulaElement = mn; }
From source file:at.ac.tuwien.ims.latex2mobiformulaconv.tests.unit.MtextTest.java
@Before public void setUp() throws Exception { mtext = new Mtext(); randomText = RandomStringUtils.randomAscii(new Random().nextInt(200) + 1).trim(); logger.debug("RandomText: " + randomText); mtext.setValue(randomText);/*w ww.jav a 2s .c o m*/ formulaElement = mtext; }
From source file:at.ac.tuwien.ims.latex2mobiformulaconv.tests.unit.MsTest.java
@Before public void setUp() throws Exception { ms = new Ms(); randomString = RandomStringUtils.randomAscii(new Random().nextInt(32) + 1).trim(); logger.debug("Random string:\n" + randomString); ms.setValue(whitespace + randomString + whitespace); formulaElement = ms;/*w w w . jav a2 s . co m*/ }
From source file:fm.last.commons.test.LastAssertionsTest.java
@Test(expected = java.lang.AssertionError.class) public void assertFilesEqualWithDifferentFilesOneLargerThanMessageThreshold() throws IOException { File file1 = new File(dataFolder.getFolder(), "file1.txt"); File largeFile = temporaryFolder.newFile("largeFile.txt"); FileUtils.writeStringToFile(largeFile, RandomStringUtils.randomAscii((int) JedecByteUnit.MEGABYTES.toBytes(1.1))); LastAssertions.assertFileEquals(file1, largeFile); }