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.b2international.index.SortIndexTest.java

@Test
public void sortStringField() throws Exception {
    final TreeSet<String> orderedItems = newTreeSet();
    final Map<String, Data> documents = newHashMap();

    for (int i = 0; i < NUM_DOCS; i++) {
        String item = null;//from  ww  w .j  a  v a  2s .  co m
        while (item == null || orderedItems.contains(item)) {
            item = RandomStringUtils.randomAlphabetic(10);
        }
        orderedItems.add(item);

        final Data data = new Data();
        data.setField1(item);
        documents.put(Integer.toString(i), data);
    }

    indexDocuments(documents);

    final Query<Data> ascendingQuery = Query.select(Data.class).where(Expressions.matchAll()).limit(NUM_DOCS)
            .sortBy(SortBy.field("field1", Order.ASC)).build();

    checkDocumentOrder(ascendingQuery, data -> data.getField1(), orderedItems, String.class);

    final Query<Data> descendingQuery = Query.select(Data.class).where(Expressions.matchAll()).limit(NUM_DOCS)
            .sortBy(SortBy.field("field1", Order.DESC)).build();

    checkDocumentOrder(descendingQuery, data -> data.getField1(), orderedItems.descendingSet(), String.class);
}

From source file:edu.samplu.admin.test.ConfigParameterTypeCreateNewAbstractSmokeTestBase.java

public void testConfigParameterTypeCreateNew() throws Exception {
    selectFrameIframePortlet();/*from w ww  . j  av a 2 s. c  om*/
    waitAndClickByXpath(CREATE_NEW_XPATH);
    waitAndTypeByName("document.documentHeader.documentDescription",
            "Test description of parameter type create "
                    + ITUtil.createUniqueDtsPlusTwoRandomCharsNot9Digits());
    waitAndTypeByName("document.newMaintainableObject.code", RandomStringUtils.randomAlphabetic(5));
    waitAndTypeByName("document.newMaintainableObject.name",
            "Test1ParmTypeCode" + ITUtil.createUniqueDtsPlusTwoRandomChars());
    waitAndClickByName("methodToCall.route");
    checkForDocError();
    waitAndClickByName("methodToCall.close");
    waitAndClickByName("methodToCall.processAnswer.button1");
}

From source file:edu.sampleu.admin.workflow.DocumentOperationAft.java

protected void testCreateDocument() throws Exception {
    waitForPageToLoad();/*from w  w w. j ava  2s  .c  o m*/
    waitAndClickAdministration();
    waitAndClickByLinkText("Document Type");
    selectFrameIframePortlet();
    waitAndClickByXpath("//a[@title='Create a new record']");
    selectFrameIframePortlet();
    String randomString = RandomStringUtils.randomAlphabetic(9).toUpperCase();
    documentId = getTextByXpath("//table[@summary='document header: general information']/tbody/tr/td");
    waitAndTypeByName("document.documentHeader.documentDescription", randomString);
    waitAndTypeByName("document.newMaintainableObject.name", randomString);
    waitAndTypeByName("document.newMaintainableObject.label", "Label " + randomString);
    waitAndClickByName("methodToCall.route");
    waitForTextPresent("Document was successfully submitted.");
    selectParentWindow();
    waitAndClickAdministration();
    acceptAlertIfPresent();
    waitForPageToLoad();
    waitAndClickByLinkText("Document Operation");
}

From source file:com.linkedin.paldb.impl.GenerateTestData.java

public static String[] generateStringData(int count, int letters) {
    String[] res = new String[count];
    for (int i = 0; i < count; i++) {
        res[i] = RandomStringUtils.randomAlphabetic(letters);
    }/*  w  w w. ja v  a  2s  .  c o m*/
    return res;
}

From source file:edu.sampleu.main.ContextLookUpAftBase.java

public void testContextCopy(JiraAwareFailable failable) throws Exception {
    waitAndClickSearchByText();/*w  w w. ja va 2  s .  c  o m*/
    waitAndClickLinkContainingText("copy");
    String randomNumber = RandomStringUtils.randomAlphabetic(4);
    waitAndTypeByName("document.newMaintainableObject.dataObject.id", "Context " + randomNumber);
    clearTextByName("document.newMaintainableObject.dataObject.name");
    waitAndTypeByName("document.newMaintainableObject.dataObject.name", "Context name" + randomNumber);
    clearTextByName("document.newMaintainableObject.dataObject.description");
    waitAndTypeByName("document.newMaintainableObject.dataObject.description", "Context desc" + randomNumber);
    waitAndClickButtonByText("Submit");
    waitAndClickConfirmSubmitOk();
    waitForProgressLoading(WebDriverUtils.configuredImplicityWait() * 10);
    waitForTextPresent("Document was successfully submitted.");
    passed();
}

From source file:com.kixeye.chassis.bootstrap.app.AppIntegrationTest.java

@Before
public void before() throws Exception {
    System.setProperty(APP_VERSION_KEY.getPropertyName(), VERSION);

    TestUtils.resetArchaius();/*from w w w  .  jav  a 2  s  . c  o m*/
    environment = RandomStringUtils.randomAlphabetic(10);
}

From source file:edu.sampleu.kim.api.location.LocationCampusBlanketAppAftBase.java

protected void testLocationCampusBlanketApprove() throws Exception {
    selectFrameIframePortlet();/*from  www .  j  av  a 2  s .c om*/
    waitAndCreateNew();
    String docId = waitForDocId();
    String twoLetters = RandomStringUtils.randomAlphabetic(2);
    waitAndTypeByName("document.documentHeader.documentDescription", "Validation Test Campus " + twoLetters);
    assertBlanketApproveButtonsPresent();
    waitAndTypeByName("document.newMaintainableObject.code", RandomStringUtils.randomAlphabetic(2));
    waitAndTypeByName("document.newMaintainableObject.name",
            "Validation Test Campus" + AutomatedFunctionalTestUtils.createUniqueDtsPlusTwoRandomChars());
    waitAndTypeByName("document.newMaintainableObject.shortName", "VTC " + twoLetters);
    selectByName("document.newMaintainableObject.campusTypeCode", "B - BOTH");
    blanketApproveTest(docId);
}

From source file:edu.sampleu.admin.ConfigComponentLookUpAndCopyAftBase.java

public void testConfigComponentLookUpAndCopy() throws Exception {
    selectFrameIframePortlet();/*from   w  w w. j  a va  2 s  . c o  m*/
    waitAndClickSearchSecond();
    waitAndClickByLinkText("copy");
    String fourLetters = RandomStringUtils.randomAlphabetic(4);
    waitAndTypeByName("document.documentHeader.documentDescription", "Test description of Component copy "
            + AutomatedFunctionalTestUtils.createUniqueDtsPlusTwoRandomCharsNot9Digits());
    selectByName("document.newMaintainableObject.namespaceCode", "KR-WKFLW - Workflow");
    waitAndTypeByName("document.newMaintainableObject.code", "ActionList2" + fourLetters);
    waitAndTypeByName("document.newMaintainableObject.name", fourLetters);
    waitAndTypeByName("document.newMaintainableObject.name", "Action List 2 " + fourLetters);
    waitAndClickByName("methodToCall.route");
    checkForDocError();
    waitAndClickByName("methodToCall.close");
    //         waitAndClickByName("methodToCall.processAnswer.button1");
}

From source file:gobblin.writer.jdbc.JdbcBufferedInserterTestBase.java

private JdbcEntryData createJdbcEntry(Collection<String> colNames, int colSize) {
    List<JdbcEntryDatum> datumList = new ArrayList<>();
    for (String colName : colNames) {
        JdbcEntryDatum datum = new JdbcEntryDatum(colName, RandomStringUtils.randomAlphabetic(colSize));
        datumList.add(datum);/*  w ww  . ja  va  2s  . c  om*/
    }
    return new JdbcEntryData(datumList);
}

From source file:com.comcast.viper.flume2storm.connection.KryoNetConnectionParametersTest.java

/**
 * Test {@link KryoNetConnectionParameters} with a full configuration
 * /*from   ww  w.j a  v a 2  s .c o m*/
 * @throws F2SConfigurationException
 *           If the configuration is invalid
 */
@Test
public void testFromConfiguration() throws F2SConfigurationException {
    String hostname = RandomStringUtils.randomAlphabetic(10);
    int port = TestUtils.getRandomPositiveInt(65000);
    int objectBufferSize = TestUtils.getRandomPositiveInt(100000);
    int writeBufferSize = TestUtils.getRandomPositiveInt(100000);
    Configuration config = new BaseConfiguration();
    config.addProperty(KryoNetConnectionParameters.ADDRESS, hostname);
    config.addProperty(KryoNetConnectionParameters.PORT, port);
    config.addProperty(KryoNetConnectionParameters.OBJECT_BUFFER_SZ, objectBufferSize);
    config.addProperty(KryoNetConnectionParameters.WRITE_BUFFER_SZ, writeBufferSize);
    KryoNetConnectionParameters params = KryoNetConnectionParameters.from(config);
    Assert.assertEquals(hostname, params.getAddress());
    Assert.assertEquals(port, params.getPort());
    Assert.assertEquals(objectBufferSize, params.getObjectBufferSize());
    Assert.assertEquals(writeBufferSize, params.getWriteBufferSize());
}