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.github.pmerienne.trident.state.cassandra.CassandraSparseMatrixStateTest.java

@Before
public void setup() {
    this.state = new CassandraSparseMatrixState<TestValue>(RandomStringUtils.randomAlphabetic(6), serializer,
            dao.getSparseMatrixQueryTemplate());
}

From source file:com.github.pmerienne.trident.state.cassandra.CassandraSetMultiMapStateTest.java

@Before
public void setup() {
    this.state = new CassandraSetMultiMapState<String, TestValue>(RandomStringUtils.randomAlphabetic(6),
            serializer, dao.getSetMultiMapQueryTemplate());
}

From source file:com.github.pmerienne.trident.state.cassandra.CassandraSetStateTest.java

@Before
public void setup() {
    this.state = new CassandraSetState<TestValue>(RandomStringUtils.randomAlphabetic(6), serializer,
            dao.getSetQueryTemplate());/*  ww w .  jav  a 2s. co  m*/
}

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

@Test(description = "Key can't be over 40 characters", expectedExceptions = IllegalArgumentException.class)
public void keyCantExceed40Chars() {
    new Reading(RandomStringUtils.randomAlphabetic(41), nowUtc(), 0.99);
}

From source file:com.magnet.mmx.server.plugin.mmxmgmt.db.UserDAOImplTest.java

private static void generateRandomUserData() throws Exception {
    for (int i = 0; i < TOTAL_USERS; i++) {
        TestUserDao.UserEntity ue = new TestUserDao.UserEntity();
        ue.setEmail(/*from  w  ww. j  a  v  a 2 s.  com*/
                RandomStringUtils.randomAlphabetic(5) + "@" + RandomStringUtils.randomAlphabetic(8) + ".com");
        ue.setName(RandomStringUtils.randomAlphabetic(5) + " " + RandomStringUtils.randomAlphabetic(5));
        ue.setPlainPassword(RandomStringUtils.randomAlphabetic(10));
        ue.setEncryptedPassword(RandomStringUtils.randomAlphabetic(80));
        ue.setCreationDate(StringUtils.dateToMillis(new Date()));
        ue.setModificationDate(StringUtils.dateToMillis(new Date()));
        ue.setUsername(USER_PREFIX + "_" + RandomStringUtils.randomAlphabetic(10));
        userList.add(ue);
        DBTestUtil.getTestUserDao().persist(ue);
    }
}

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

protected List<JdbcEntryData> createJdbcEntries(int colNums, int colSize, int entryCount) {
    Set<String> colNames = new HashSet<>();
    while (colNames.size() < colNums) {
        String colName = RandomStringUtils.randomAlphabetic(colSize);
        if (colNames.contains(colName)) {
            continue;
        }/*from w  ww  .  j  a  va2 s  .  c om*/
        colNames.add(colName);
    }

    List<JdbcEntryData> result = new ArrayList<>();
    for (int i = 0; i < entryCount; i++) {
        result.add(createJdbcEntry(colNames, colSize));
    }
    return result;
}

From source file:net.shopxx.interceptor.TokenInterceptor.java

@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
        throws Exception {
    String token = WebUtils.getCookie(request, TOKEN_COOKIE_NAME);
    if (StringUtils.equalsIgnoreCase(request.getMethod(), "POST")) {
        if (StringUtils.isNotEmpty(token)) {
            String requestType = request.getHeader("X-Requested-With");
            if (StringUtils.equalsIgnoreCase(requestType, "XMLHttpRequest")) {
                if (StringUtils.equals(token, request.getHeader(TOKEN_PARAMETER_NAME))) {
                    return true;
                } else {
                    response.addHeader("tokenStatus", "accessDenied");
                }/*from  ww  w.ja v a2 s  .  c  o m*/
            } else {
                if (StringUtils.equals(token, request.getParameter(TOKEN_PARAMETER_NAME))) {
                    return true;
                }
            }
        } else {
            WebUtils.addCookie(request, response, TOKEN_COOKIE_NAME,
                    DigestUtils.md5Hex(UUID.randomUUID() + RandomStringUtils.randomAlphabetic(30)));
        }
        response.sendError(HttpServletResponse.SC_FORBIDDEN, ERROR_MESSAGE);
        return false;
    } else {
        if (StringUtils.isEmpty(token)) {
            token = DigestUtils.md5Hex(UUID.randomUUID() + RandomStringUtils.randomAlphabetic(30));
            WebUtils.addCookie(request, response, TOKEN_COOKIE_NAME, token);
        }
        request.setAttribute(TOKEN_ATTRIBUTE_NAME, token);
        return true;
    }
}

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

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

    PackageFactory.save(prov);

    List list = handler.list(admin);
    assertContains(list, prov);

}

From source file:com.github.pmerienne.trident.state.cassandra.CassandraMapMultiMapStateTest.java

@Before
public void setup() {
    this.state = new CassandraMapMultiMapState<String, String, TestValue>(RandomStringUtils.randomAlphabetic(6),
            subKeySerializer, serializer, dao.getMapMultiMapQueryTemplate());
}

From source file:com.github.pmerienne.trident.state.cassandra.CassandraMapStateTest.java

@Before
public void setup() {
    this.state = new CassandraMapState<Long>(RandomStringUtils.randomAlphabetic(6), serializer, jsonSerializer,
            dao.getMapQueryTemplate());//  w  w w. ja  v  a 2  s .  c o m
}