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:edu.sampleu.main.AgendaEditorActiveInactiveCheckAft.java

protected void testAgendaEditorActiveInactiveCheck() throws Exception {
    String uniqueText = RandomStringUtils.randomAlphabetic(9).toUpperCase();
    String uniqueRuleText = RandomStringUtils.randomAlphabetic(9).toUpperCase();

    //Add Inactive & Verify
    selectFrameIframePortlet();//from  w w w  . j a v a2s. c  om
    waitAndClickByXpath("//a[contains(text(),'Create New')]");
    selectFrameIframePortlet();
    selectByName("document.newMaintainableObject.dataObject.namespace", "Kuali Rules Test");
    waitAndTypeByName("document.newMaintainableObject.dataObject.agenda.name", uniqueText + "Inactive");
    waitAndTypeByName("document.newMaintainableObject.dataObject.contextName", "Context1");
    waitAndClickByName("document.newMaintainableObject.dataObject.agenda.active");
    copyRuleFromExisting(uniqueText);
    selectFrameIframePortlet();
    waitAndClickByXpath("//button[contains(text(),'Submit')]");
    waitAndClickConfirmSubmitOk();
    waitForTextPresent("Document was successfully submitted.");
    selectParentWindow();
    waitAndClickMainMenu();
    selectFrameIframePortlet();
    navigate();
    selectFrameIframePortlet();
    waitAndTypeByName("lookupCriteria[name]", uniqueText + "Inactive");
    waitAndClickByXpath("//input[@name='lookupCriteria[active]' and @value='N']");
    waitAndClickButtonByExactText("Search");
    waitForTextPresent(uniqueText + "Inactive");

    // Add Active & Verify
    waitAndClickByXpath("//a[contains(text(),'Create New')]");
    selectFrameIframePortlet();
    selectByName("document.newMaintainableObject.dataObject.namespace", "Kuali Rules Test");
    waitAndTypeByName("document.newMaintainableObject.dataObject.agenda.name", uniqueText + "Active");
    waitAndTypeByName("document.newMaintainableObject.dataObject.contextName", "Context1");
    copyRuleFromExisting(uniqueRuleText);
    selectFrameIframePortlet();
    waitAndClickByXpath("//button[contains(text(),'Submit')]");
    waitAndClickConfirmSubmitOk();
    waitForTextPresent("Document was successfully submitted.");
    selectParentWindow();
    waitAndClickMainMenu();
    selectFrameIframePortlet();
    navigate();
    selectFrameIframePortlet();
    waitAndTypeByName("lookupCriteria[name]", uniqueText + "Active");
    waitAndClickByXpath("//input[@name='lookupCriteria[active]' and @value='Y']");
    waitAndClickButtonByExactText("Search");
    waitForTextPresent(uniqueText + "Active");

    //Verify Both
    waitAndClickButtonByExactText("Clear Values");
    waitAndTypeByName("lookupCriteria[name]", uniqueText + "Active");
    waitAndClickByXpath("//input[@name='lookupCriteria[active]' and @value='']");
    waitAndClickButtonByExactText("Search");
    waitForTextPresent(uniqueText + "Active");
    waitAndClickButtonByExactText("Clear Values");
    waitAndTypeByName("lookupCriteria[name]", uniqueText + "Inactive");
    waitAndClickByXpath("//input[@name='lookupCriteria[active]' and @value='']");
    waitAndClickButtonByExactText("Search");
    waitForTextPresent(uniqueText + "Inactive");
}

From source file:net.nelz.simplesm.aop.UpdateMultiCacheAdviceTest.java

@Test
public void testGetCacheKeys() throws Exception {
    final int size = 10;
    final List<Object> sources = new ArrayList<Object>();
    for (int ix = 0; ix < size; ix++) {
        sources.add(RandomStringUtils.randomAlphanumeric(3 + ix));
    }//from w  ww .ja v a  2s  .  c om

    final String namespace = RandomStringUtils.randomAlphabetic(20);
    final AnnotationData annotationData = new AnnotationData();
    annotationData.setNamespace(namespace);
    final List<String> results = cut.getCacheKeys(sources, annotationData);

    assertEquals(size, results.size());
    for (int ix = 0; ix < size; ix++) {
        final String result = results.get(ix);
        assertTrue(result.indexOf(namespace) != -1);
        final String source = (String) sources.get(ix);
        assertTrue(result.indexOf(source) != -1);
    }
}

From source file:com.ironiacorp.statistics.r.AbstractRClient.java

/**
 * @param ob//from  w  w w .java2 s .c o  m
 * @return
 */
public static String variableIdentityNumber(Object ob) {
    return Integer.toString(Math.abs(ob.hashCode() + 1)) + RandomStringUtils.randomAlphabetic(6);
}

From source file:com.tera.gsaion.itest.model.playerbasic.PlayerCommonDataCreateUnit.java

public PlayerCommonData createRandomCommonData(int accountId, PlayerRace race) {
    String name = RandomStringUtils.randomAlphabetic(10);
    PlayerGender gender = Rnd.nextBoolean() ? PlayerGender.MALE : PlayerGender.FEMALE;
    PlayerClass playerClass = Rnd.nextBoolean() ? AionPlayerClass.MAGE : AionPlayerClass.SCOUT;
    return createNewCommonData(accountId, name, gender, race, playerClass);
}

From source file:com.adobe.acs.commons.social.linkedin.LinkedInApi20Test.java

@Test
public void testAuthorizationWithScopes() {
    String state = RandomStringUtils.randomAlphabetic(10);
    String key = RandomStringUtils.randomAlphabetic(10);
    String secret = RandomStringUtils.randomAlphabetic(10);
    LinkedInApi20 api = new LinkedInApi20(state);

    OAuthService service = new ServiceBuilder().provider(api).apiKey(key).apiSecret(secret)
            .callback("http://localhost:4502/linkedin").scope("r_basicprofile,r_emailaddress").build();

    String expected = "https://www.linkedin.com/uas/oauth2/authorization?response_type=code&client_id=" + key
            + "&state=" + state + "&redirect_uri=" + OAuthEncoder.encode("http://localhost:4502/linkedin")
            + "&scope=" + "r_basicprofile%2Cr_emailaddress";

    assertEquals(expected, service.getAuthorizationUrl(null));
}

From source file:integration.report.ListIdentifiersIT.java

@Test
public void testListPremisEventIdentifiers() throws Exception {
    createEntity(TestUtil.createTestEntity(RandomStringUtils.randomAlphabetic(16)));
    HttpResponse resp = getOAIPMHResponse(VerbType.LIST_IDENTIFIERS.value(), null, "premis-event-v2", null,
            null, null);/*from   ww  w  .ja  va 2s.c om*/
    assertEquals(200, resp.getStatusLine().getStatusCode());
    OAIPMHtype oaipmh = ((JAXBElement<OAIPMHtype>) this.unmarshaller.unmarshal(resp.getEntity().getContent()))
            .getValue();
    assertEquals(0, oaipmh.getError().size());
    assertNotNull(oaipmh.getRequest());
    assertEquals(VerbType.LIST_IDENTIFIERS.value(), oaipmh.getRequest().getVerb().value());
    assertTrue(oaipmh.getListIdentifiers().getHeader().size() > 0);
}

From source file:io.sidecar.event.ReadingTest.java

@Test(description = "Key can be exactly 40 characters")
public void keyMaxSize() {
    new Reading(RandomStringUtils.randomAlphabetic(40), nowUtc(), 0.99);
}

From source file:io.fabric8.maven.core.util.ConfigsTest.java

@Test
public void getStringValueTest() {
    String test = RandomStringUtils.randomAlphabetic(10);
    assertEquals(test, Configs.asString(test));
}

From source file:datatest.TestMongoConfig.java

@Test
public void testUpdate() {
    String value;//from   w  w  w. j a v a  2  s  .c  o  m

    //Insert new document
    mongoOps.save(document);

    //Set a new random value to att1
    do {
        value = RandomStringUtils.randomAlphabetic(20);
    } while (value.equals(document.getAtt1()));
    document.setAtt1(value);

    //Update document
    mongoOps.save(document);

    //Retrieve document
    TestDocument outDocument = mongoOps.findById(document.getId(), TestDocument.class);

    //Check not null
    assertNotNull(outDocument);

    //Check value
    assertEquals(value, outDocument.getAtt1());
}

From source file:de.hybris.platform.media.storage.impl.LocalFileMediaStorageCleanerTest.java

private void fillStorageWithTestFiles() {
    createStorageFolder();/*from w w  w.  java2 s  .c  om*/

    for (int i = 0; i < 10; i++) {
        final String fileName = RandomStringUtils.randomAlphabetic(5);
        final File file = new File(tempStorage, fileName + ".mediaTestFile");
        try {
            file.createNewFile();
        } catch (final IOException e) {
            LOG.error("Cannot create test file:  " + file.getName() + ", path: " + file.getAbsolutePath()
                    + " (reason: " + e.getMessage() + ")", e);
        }
    }
}