Example usage for org.apache.commons.lang RandomStringUtils randomAlphabetic

List of usage examples for org.apache.commons.lang RandomStringUtils randomAlphabetic

Introduction

In this page you can find the example usage for org.apache.commons.lang RandomStringUtils randomAlphabetic.

Prototype

public static String randomAlphabetic(int count) 

Source Link

Document

Creates a random string whose length is the number of characters specified.

Characters will be chosen from the set of alphabetic characters.

Usage

From source file:MainClass.java

public static void main(String[] args) {

    //Random 8 chars string Alphabets only
    System.out.print("4) 8 char string -Alphabets only >>>");
    System.out.println(RandomStringUtils.randomAlphabetic(8));

}

From source file:com.cms.utils.FileUtils.java

public static String getParthExportFileImportStock() {
    String path = VaadinService.getCurrent().getBaseDirectory().getAbsolutePath();

    String filePath = path + "/VAADIN/filetemplate/" + RandomStringUtils.randomAlphabetic(12) + ".docx";
    return filePath;
}

From source file:com.bstore.services.test.TestMD5.java

private static String generateToken() {
    MessageDigest md;//from  w  w  w  .  ja v  a 2 s.  c o  m
    try {
        md = MessageDigest.getInstance("MD5");
    } catch (NoSuchAlgorithmException e) {
        System.out.println("com.bstore.services.test.TestMD5.generateToken():" + e);
        throw new RuntimeException(e);
    }

    StringBuffer hexString = new StringBuffer();
    byte[] data = md.digest(RandomStringUtils.randomAlphabetic(10).getBytes());
    for (int i = 0; i < data.length; i++) {
        hexString.append(Integer.toHexString((data[i] >> 4) & 0x0F));
        hexString.append(Integer.toHexString(data[i] & 0x0F));
    }
    System.out.println("com.bstore.services.test.TestMD5.generateToken():: " + hexString.toString());
    return hexString.toString();
}

From source file:com.gtwm.pb.util.RandomString.java

/**
 * Creates a new random lowercase alphanumeric string. This can be used to
 * generate random passwords, internal table names etc. It will be a valid
 * Postgres object name so can be used for any database object.
 *///from w  ww  . j a  va  2s  . c  o m
public static String generate() {
    if (!AppProperties.testMode) {
        return (RandomStringUtils.randomAlphabetic(1) + RandomStringUtils.randomAlphanumeric(16)).toLowerCase();
    }
    rand++;
    return String.valueOf(rand);
    // For testing, use deterministic results - seed the random generator
    // with a constant
    /*      if (random == null) {
             random = new Random(42);
          }
          return RandomStringUtils.random(1, 0, 0, true, false, null, random)
    + RandomStringUtils.random(16, 0, 0, true, true, null, random);
    */ }

From source file:eu.scape_project.hawarp.utils.IOUtils.java

public static File copyStreamToTempFileInDir(InputStream inStream, String dir, String ext) throws IOException {
    String filename = System.currentTimeMillis() + RandomStringUtils.randomAlphabetic(5) + ext;
    if (!dir.endsWith("/")) {
        dir += "/";
    }/*from ww  w  .ja va2  s. co  m*/
    File tmpFile = new File(dir, filename);
    FileUtils.copyInputStreamToFile(inStream, tmpFile);
    return tmpFile;
}

From source file:com.ms.commons.test.tool.UnitTestTools.java

public static String nextAlphabet() {
    return RandomStringUtils.randomAlphabetic(4);
}

From source file:com.ms.commons.test.tool.UnitTestTools.java

/**
 * ??
 * 
 * @param count
 * @return
 */
public static String nextAlphabet(Integer count) {
    return RandomStringUtils.randomAlphabetic(count);
}

From source file:com.hybris.datahub.core.util.OutboundServiceDataGenerationTestUtils.java

public static Map<String, Object> createUniqueTestProductMap() {
    final String uniqueString = RandomStringUtils.randomAlphabetic(3);

    final Map<String, Object> testProductMap;

    testProductMap = new HashMap<>();
    testProductMap.put(BASE_NAME, BASE_NAME_VALUE + "-" + uniqueString);
    testProductMap.put(INTEGRATION_KEY, INTEGRATION_KEY_VALUE + "-" + uniqueString);
    testProductMap.put(ISO_CODE, ISO_CODE_VALUE + "-" + uniqueString);
    testProductMap.put(SIZE, SIZE_VALUE + "-" + uniqueString);
    testProductMap.put(SKU, SKU_VALUE + "-" + uniqueString);
    testProductMap.put(STYLE, STYLE_VALUE + "-" + uniqueString);
    testProductMap.put(UNIT, UNIT_VALUE + "-" + uniqueString);

    return testProductMap;
}

From source file:com.yolodata.tbana.hadoop.mapred.FileContentProvider.java

private static void addColumnWithMultiline(StringBuilder result, int multiLines) {
    result.append("\"");
    for (int i = 0; i < multiLines; i++) {
        result.append(RandomStringUtils.randomAlphabetic(10));
        result.append("\n");
    }//  w w  w  . j  ava 2  s  .co  m
    result.append(RandomStringUtils.randomAlphabetic(10));
    result.append("\"");
}

From source file:com.machinepublishers.jbrowserdriver.Util.java

static String randomPropertyName() {
    return new StringBuilder().append(RandomStringUtils.randomAlphabetic(1)).append(randomAlphanumeric())
            .toString();
}