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:datatest.TestMongoConfig.java

@Before
public void setUp() {
    //Create new document
    document = new TestDocument();
    //Set random values
    document.setAtt1(RandomStringUtils.randomAlphabetic(20));
    document.setAtt2(RandomStringUtils.randomAlphabetic(20));
}

From source file:com.redhat.rhn.frontend.xmlrpc.packages.provider.test.PackagesProviderHandlerTest.java

public void testListKeys() throws Exception {
    String name = RandomStringUtils.randomAlphabetic(5);
    admin.addPermanentRole(RoleFactory.SAT_ADMIN);
    PackageProvider prov = new PackageProvider();
    prov.setName(name);/*from  w  ww .j av a  2 s.  c o m*/

    PackageFactory.save(prov);

    assertTrue(handler.listKeys(admin, name).isEmpty());

    String keyStr = RandomStringUtils.randomAlphabetic(5);
    PackageKey key = new PackageKey();
    key.setKey(keyStr);
    key.setType(PackageFactory.PACKAGE_KEY_TYPE_GPG);
    prov.addKey(key);

    assertFalse(handler.listKeys(admin, name).isEmpty());

}

From source file:com.linkedin.pinot.tools.data.generator.StringGenerator.java

@Override
public void init() {
    final Set<String> uniqueStrings = new HashSet<String>();
    for (int i = 0; i < cardinality; i++) {
        while (!uniqueStrings.add(RandomStringUtils.randomAlphabetic(lengthOfEachString))) {
            uniqueStrings.add(RandomStringUtils.randomAlphabetic(lengthOfEachString));
        }//from w w w.  ja va 2 s. c  om
    }
    vals = new ArrayList<String>(uniqueStrings);
}

From source file:io.sidecar.notification.NotificationRuleTest.java

@Test(description = "Notification rule key can't be over 40 characters", expectedExceptions = IllegalArgumentException.class)
public void keyCantExceed40Chars() {
    completeBuilder.key(RandomStringUtils.randomAlphabetic(41)).build();
}

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

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

    final Map<String, String> primaryKeyMap;

    primaryKeyMap = new HashMap<>();
    primaryKeyMap.put(INTEGRATION_KEY, INTEGRATION_KEY_VALUE + "-" + uniqueString);
    primaryKeyMap.put(SKU, SKU_VALUE + "-" + uniqueString);

    return primaryKeyMap;
}

From source file:com.jslsolucoes.tagria.doc.repository.impl.PessoaRepositoryImpl.java

public PessoaRepositoryImpl() {
    pessoas = new ArrayList<Pessoa>();
    for (int i = 1; i <= 10; i++) {
        Pessoa pessoa = new Pessoa();
        pessoa.setNome(RandomStringUtils.randomAlphabetic(10));
        pessoa.setDataNascimento(Calendar.getInstance().getTime());
        pessoa.setGostaChocolate((i % 2 == 0 ? 1 : 0));
        pessoa.setCpf(RandomStringUtils.randomNumeric(11));
        pessoa.setCep(RandomStringUtils.randomNumeric(8));
        pessoa.setId(Long.valueOf(i));
        pessoas.add(pessoa);// www. jav  a 2s  .  c o  m
    }

}

From source file:com.falcon.orca.data.generators.impl.StringGenerator.java

@Override
public String next() {
    if (StringUtils.isBlank(characters)) {
        if (letters && numbers) {
            return RandomStringUtils.randomAlphanumeric(length);
        } else {/*from  w ww. ja  va 2 s .  c  o  m*/
            if (letters) {
                return RandomStringUtils.randomAlphabetic(length);
            } else if (numbers) {
                return RandomStringUtils.randomAlphanumeric(length);
            }
        }
    } else {
        return RandomStringUtils.random(length, 0, characters.length(), letters, numbers,
                characters.toCharArray());
    }
    return "";
}

From source file:com.haulmont.cuba.gui.components.filter.descriptor.DynamicAttributesConditionCreator.java

public DynamicAttributesConditionCreator(String filterComponentName, CollectionDatasource datasource,
        String propertyPath) {/*from  w  w  w  .  java2s.  co m*/
    super(RandomStringUtils.randomAlphabetic(10), filterComponentName, datasource);
    this.propertyPath = propertyPath;
    Messages messages = AppBeans.get(Messages.NAME);
    locCaption = messages.getMainMessage("filter.dynamicAttributeConditionCreator");
    showImmediately = true;
}

From source file:com.xceptance.xlt.common.util.bsh.ParamInterpreterRandom.java

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

From source file:net.sf.ipsedixit.core.impl.DefaultDataProvider.java

/**
 * {@inheritDoc}/*from w  w  w.jav a2s  . c  om*/
 */
public String randomString(StringType stringType, int length) {
    if (stringType == StringType.ALPHANUMERIC) {
        return RandomStringUtils.randomAlphanumeric(length);
    } else if (stringType == StringType.ALPHA) {
        return RandomStringUtils.randomAlphabetic(length);
    } else if (stringType == StringType.NUMERIC) {
        return RandomStringUtils.randomNumeric(length);
    }
    return RandomStringUtils.randomAscii(length);
}