List of usage examples for org.apache.commons.lang3 RandomStringUtils randomAlphabetic
public static String randomAlphabetic(final int count)
Creates a random string whose length is the number of characters specified.
Characters will be chosen from the set of alphabetic characters.
From source file:db.Db.java
/** * @param args the command line arguments *///w w w.j av a2 s . c om static void genAccount(String a[][], String mSuffix, int f) throws Exception { String account[] = { RandomStringUtils.randomAlphabetic(6), //name RandomStringUtils.randomAlphabetic(9), //shurname RandomStringUtils.randomAlphanumeric(10), //password (RandomStringUtils.randomAlphanumeric(10)) + mSuffix }; //mail+mSuffix for (int i = 0; i < a[f].length; i++) a[f][i] = account[i]; }
From source file:com.thoughtworks.go.helper.AccessTokenMother.java
public static AccessToken.AccessTokenWithDisplayValue randomAccessToken() { return randomAccessTokenForUser(RandomStringUtils.randomAlphabetic(32)); }
From source file:com.thoughtworks.go.helper.AccessTokenMother.java
public static AccessToken.AccessTokenWithDisplayValue randomAccessTokenForUser(String username) { return AccessToken.create(RandomStringUtils.randomAlphabetic(32), username, RandomStringUtils.randomAlphabetic(32), new TestingClock()); }
From source file:eu.riscoss.RemoteRiskAnalyserMain.java
static void loadJSmile() throws Exception { File dir = new File(FileUtils.getTempDirectory(), "jnativelibs-" + RandomStringUtils.randomAlphabetic(30)); if (!dir.mkdir()) { throw new Exception("failed to make dir"); }//ww w . j a va 2s .c o m File jsmile = new File(dir, "libjsmile.so"); URL jsmURL = Thread.currentThread().getContextClassLoader().getResource("libjsmile.so"); FileUtils.copyURLToFile(jsmURL, jsmile); System.setProperty("java.library.path", System.getProperty("java.library.path") + ":" + dir.getAbsolutePath()); // flush the library paths Field sysPathsField = ClassLoader.class.getDeclaredField("sys_paths"); sysPathsField.setAccessible(true); sysPathsField.set(null, null); // Check that it works... System.loadLibrary("jsmile"); dir.deleteOnExit(); jsmile.deleteOnExit(); }
From source file:ke.co.tawi.babblesms.server.utils.StringUtil.java
/** * This method should return a string random enough such that there is no * need to do a database lookup to see whether another one exists. It * therefore relies on a random string generator method together with the * current time to create a String.// ww w .java 2 s. co m * * @return String */ public static String getRandomStr() { return RandomStringUtils.randomAlphabetic(RANDOM_STRING_SIZE) + (new Date()).getTime(); }
From source file:net.acesinc.data.json.generator.types.AlphaType.java
@Override public String getNextRandomValue() { return RandomStringUtils.randomAlphabetic(length); }
From source file:com.fredhopper.core.connector.index.FileUtils.java
/** * Create a subdirectory of parentDir. The name is a random 15 character alphabetic string * * @param parentDir/*from w w w.j a v a 2s . c o m*/ * @throws IOException */ public static File createRandomDirectory(final File parentDir) throws IOException { final String tempDirName = RandomStringUtils.randomAlphabetic(15); final File tempDir = new File(parentDir.getAbsoluteFile() + File.separator + tempDirName); org.apache.commons.io.FileUtils.forceMkdir(tempDir); return tempDir; }
From source file:net.lshift.diffa.dbapp.HsqldbTestSchema.java
public HsqldbTestSchema(String jdbcUrl) { if (jdbcUrl == null) { this.jdbcUrl = "jdbc:hsqldb:mem:" + RandomStringUtils.randomAlphabetic(5); } else {/*ww w. j a va 2s . c o m*/ this.jdbcUrl = jdbcUrl; } }
From source file:com.webbfontaine.valuewebb.irms.core.DefaultRuleScriptSourceGenerator.java
@Override public String generateScriptName(String baseName, String scriptText) { return String.format("%s%s%d", baseName, RandomStringUtils.randomAlphabetic(8), System.nanoTime()); }
From source file:com.awcoleman.ExampleJobSummaryLogWithOutput.utility.CreateBinaryDatafile.java
public CreateBinaryDatafile(int numrecs) throws IOException { Random rangen = new Random(); long recid = 0; try (DataOutputStream out = new DataOutputStream(new FileOutputStream("/tmp/sampleDatafile.bin"));) { for (int ii = 0; ii < numrecs; ii++) { out.writeUTF(RandomStringUtils.randomAlphabetic(10)); out.writeLong(++recid);//w w w . ja v a 2s . co m out.writeInt(rangen.nextInt(32)); out.writeInt(rangen.nextInt(3600)); out.writeUTF(generateDatetime()); } } }