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:com.haulmont.cuba.gui.components.filter.descriptor.CustomConditionCreator.java

public CustomConditionCreator(String filterComponentName, CollectionDatasource datasource) {
    super(RandomStringUtils.randomAlphabetic(10), filterComponentName, datasource);

    Messages messages = AppBeans.get(Messages.NAME);
    this.locCaption = messages.getMainMessage("filter.customCondition.new");
    showImmediately = true;/*from  ww  w  . java  2  s .c  o  m*/
}

From source file:gov.nih.nci.cabig.caaers.service.adverseevent.AdditionalInformationDocumentServiceIntegrationTest.java

@Override
protected void setUp() throws Exception {
    super.setUp();

    file = File.createTempFile(RandomStringUtils.randomAlphabetic(4), ".txt");

    FileUtils.writeStringToFile(file, "sample text");

    additionalInformationDocumentService = (AdditionalInformationDocumentService) getDeployedApplicationContext()
            .getBean("additionalInformationDocumentService");
    expeditedAdverseEventReportDao = (ExpeditedAdverseEventReportDao) getDeployedApplicationContext()
            .getBean("expeditedAdverseEventReportDao");
    ExpeditedAdverseEventReport expeditedAdverseEventReport = expeditedAdverseEventReportDao.getById(-1);
    additionalInformation = expeditedAdverseEventReport.getAdditionalInformation();

}

From source file:com.bloatit.framework.webprocessor.components.advanced.showdown.MarkdownPreviewer.java

public MarkdownPreviewer(final MarkdownEditor source) {
    final HtmlDiv previewer = new HtmlDiv("md_previewer");
    final HtmlSpan mdTitle = new HtmlSpan("title");
    previewer.add(mdTitle);//from  w ww .j  av  a  2s .  c  o m

    mdTitle.addText(Context.tr("Markdown preview"));
    add(previewer);

    this.output = new HtmlDiv("md_preview");

    previewer.add(output);
    final String id = "blmdprev-" + RandomStringUtils.randomAlphabetic(10);
    output.setId(id);
    final HtmlScript script = new HtmlScript();

    script.append("setup_wmd({ input: \"" + source.getInputId() + "\", button_bar: \"" + source.getButtonBarId()
            + "\", preview: \"" + output.getId() + "\", output: \"copy_html\" });");
    previewer.add(script);
}

From source file:hr.fer.spocc.util.TokenListWriterTest.java

@Before
public void createTmpFile() throws IOException {
    tmpFile = File.createTempFile(RandomStringUtils.randomAlphabetic(3), null);
}

From source file:com.merrill.examples.framework.lang.text.impl.CommonsRandomTextGenerator.java

public String randomAlphabetic(int count) {
    return RandomStringUtils.randomAlphabetic(count);
}

From source file:com.yolodata.tbana.hadoop.mapred.splunk.SplunkConfTest.java

private String anyString() {
    return RandomStringUtils.randomAlphabetic(5);
}

From source file:com.tesora.dve.common.TestDataGenerator.java

public TestDataGenerator(ColumnSet columns) {
    this.columns = columns;
    generatedRows = new ArrayList<ResultRow>();
    generator = new Random(1); // we don't actually want the data to be random
    baseString = RandomStringUtils.randomAlphabetic(1000);
}

From source file:com.google.cloud.bigtable.dataflow.AbstractCloudBigtableTableDoFnTest.java

@Test
public void testLogRetriesExhaustedWithDetailsException() {
    // Make sure that the logging doesn't have any exceptions. The details can be manually verified.
    // TODO: add a mock logger to confirm that the logging is correct.
    Logger log = LoggerFactory.getLogger(getClass());
    List<Throwable> exceptions = new ArrayList<>();
    List<Row> actions = new ArrayList<>();
    List<String> hostnameAndPort = new ArrayList<>();
    for (int i = 0; i < 5; i++) {
        exceptions.add(Status.CANCELLED.asException());
        actions.add(new Get(RandomStringUtils.randomAlphabetic(8).getBytes()));
        hostnameAndPort.add("");
    }//ww w  .  j a v a2  s .c  o  m
    AbstractCloudBigtableTableDoFn.logRetriesExhaustedWithDetailsException(log, null,
            new RetriesExhaustedWithDetailsException(exceptions, actions, hostnameAndPort));
}

From source file:net.shopxx.service.impl.CouponCodeServiceImpl.java

public CouponCode generate(Coupon coupon, Member member) {
    Assert.notNull(coupon);//w w w. j a  va2  s  .com

    CouponCode couponCode = new CouponCode();
    couponCode.setCode(coupon.getPrefix()
            + DigestUtils.md5Hex(UUID.randomUUID() + RandomStringUtils.randomAlphabetic(30)).toUpperCase());
    couponCode.setIsUsed(false);
    couponCode.setCoupon(coupon);
    couponCode.setMember(member);
    return super.save(couponCode);
}

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

/**
 * Copy byte array to file in temporary directory
 *
 * @param barray byte array//  w w w. j  a v  a 2  s. c  o  m
 * @param dir Directory where the temporary file is created
 * @param ext Extension of temporary file
 * @return Temporary file
 */
public static File copyByteArrayToTempFileInDir(byte[] barray, String dir, String ext) {
    String filename = System.currentTimeMillis() + RandomStringUtils.randomAlphabetic(5) + ext;
    if (!dir.endsWith("/")) {
        dir += "/";
    }
    FileOutputStream fos = null;
    File tmpFile = null;
    try {
        tmpFile = new File(dir + filename);
        fos = new FileOutputStream(tmpFile);
        org.apache.commons.io.IOUtils.write(barray, fos);
        fos.flush();
        fos.close();
    } catch (FileNotFoundException ex) {
        logger.error("Temporary file not available.", ex);
    } catch (IOException ex) {
        logger.error("I/O Error", ex);
    } finally {
        if (fos != null) {
            try {
                fos.close();
            } catch (IOException _) {
                // ignore
            }
        }
    }
    return tmpFile;
}