當前位置: 首頁>>代碼示例>>Java>>正文


Java RandomStringUtils.randomAlphabetic方法代碼示例

本文整理匯總了Java中org.apache.commons.lang3.RandomStringUtils.randomAlphabetic方法的典型用法代碼示例。如果您正苦於以下問題:Java RandomStringUtils.randomAlphabetic方法的具體用法?Java RandomStringUtils.randomAlphabetic怎麽用?Java RandomStringUtils.randomAlphabetic使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.commons.lang3.RandomStringUtils的用法示例。


在下文中一共展示了RandomStringUtils.randomAlphabetic方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: BaseBinaryCipherExecutor

import org.apache.commons.lang3.RandomStringUtils; //導入方法依賴的package包/類
/**
 * Instantiates a new cryptic ticket cipher executor.
 *
 * @param encryptionSecretKey the encryption secret key
 * @param signingSecretKey    the signing key
 * @param signingKeySize      the signing key size
 * @param encryptionKeySize   the encryption key size
 */
public BaseBinaryCipherExecutor(final String encryptionSecretKey,
                                final String signingSecretKey,
                                final int signingKeySize,
                                final int encryptionKeySize) {

    String signingKeyToUse = signingSecretKey;
    if (StringUtils.isBlank(signingKeyToUse)) {
        LOGGER.warn("Secret key for signing is not defined. CAS will attempt to auto-generate the signing key");
        signingKeyToUse = generateOctetJsonWebKeyOfSize(signingKeySize);
        LOGGER.warn("Generated signing key [{}] of size [{}]. The generated key MUST be added to CAS settings.",
                signingKeyToUse, signingKeySize);
    }
    setSigningKey(signingKeyToUse);

    if (StringUtils.isBlank(encryptionSecretKey)) {
        LOGGER.warn("No encryption key is defined. CAS will attempt to auto-generate keys");
        this.encryptionSecretKey = RandomStringUtils.randomAlphabetic(encryptionKeySize);
        LOGGER.warn("Generated encryption key [{}] of size [{}]. The generated key MUST be added to CAS settings.",
                this.encryptionSecretKey, encryptionKeySize);
    } else {
        this.encryptionSecretKey = encryptionSecretKey;
    }
}
 
開發者ID:mrluo735,項目名稱:cas-5.1.0,代碼行數:32,代碼來源:BaseBinaryCipherExecutor.java

示例2: create

import org.apache.commons.lang3.RandomStringUtils; //導入方法依賴的package包/類
@Override
public synchronized IDevice create(_MatrixID user, String name) { // FIXME use RWLock
    String id;
    do {
        id = RandomStringUtils.randomAlphabetic(12);
    } while (devById.containsKey(id));

    String token;
    do {
        token = RandomStringUtils.randomAlphanumeric(128);
    } while (devByToken.containsKey(token));

    IDevice dev = new Device(id, token, name, user);
    devById.put(id, dev);
    devByToken.put(token, dev);

    log.info("Created new device {} for user {}", id, user.getId());

    return dev;
}
 
開發者ID:kamax-io,項目名稱:mxhsd,代碼行數:21,代碼來源:DeviceManager.java

示例3: generateRandomPostFrom

import org.apache.commons.lang3.RandomStringUtils; //導入方法依賴的package包/類
public Post generateRandomPostFrom(Post post) {
    Post _post = new Post();
    _post.setUrl(post.getUrl());
    _post.setDomain(post.getDomain());
    _post.setUser(post.getUser());
    _post.setContent(post.getContent());
    _post.setStatus(PostStatus.PUBLIC);

    String title = "";

    for (int j = 0; j < 10; j++) {
        title += " " + RandomStringUtils.randomAlphabetic((int) (Math.random() * 10) + 1);
    }
    _post.setTitle(title);

    return _post;
}
 
開發者ID:ugouku,項目名稱:shoucang,代碼行數:18,代碼來源:RandomPost.java

示例4: getProfileByRoleKey

import org.apache.commons.lang3.RandomStringUtils; //導入方法依賴的package包/類
@Test
@Transactional
public void getProfileByRoleKey() throws Exception {
    String userKey = RandomStringUtils.randomAlphabetic(5);
    int databaseSizeBeforeCreate = profileService.findAllByUserKey(userKey).size();

    profile.setUserKey(userKey);
    profileService.saveAndFlush(profile);

    // Get the profile by users key
    List<Profile> profiles = profileService.findAllByUserKey(userKey);
    assertThat(profiles).hasSize(databaseSizeBeforeCreate + 1);
    Profile testProfile = profiles.get(profiles.size() - 1);
    assertThat(testProfile.getUserKey()).isEqualTo(userKey);
}
 
開發者ID:xm-online,項目名稱:xm-ms-dashboard,代碼行數:16,代碼來源:ProfileResourceIntTest.java

示例5: getDefaultProfileByRoleKey

import org.apache.commons.lang3.RandomStringUtils; //導入方法依賴的package包/類
@Test
@Transactional
public void getDefaultProfileByRoleKey() throws Exception {
    String randRoleKey = RandomStringUtils.randomAlphabetic(5);
    int databaseSizeBeforeCreate = defaultProfileService.findAllByRoleKey(randRoleKey).size();

    defaultProfile.setRoleKey(randRoleKey);
    defaultProfileService.saveAndFlush(defaultProfile);

    // Get the defaultProfile by roleKey
    List<DefaultProfile> defaultProfiles = defaultProfileService.findAllByRoleKey(randRoleKey);
    assertThat(defaultProfiles).hasSize(databaseSizeBeforeCreate + 1);
    DefaultProfile testDefaultProfile = defaultProfiles.get(defaultProfiles.size() - 1);
    assertThat(testDefaultProfile.getRoleKey()).isEqualTo(randRoleKey);
}
 
開發者ID:xm-online,項目名稱:xm-ms-dashboard,代碼行數:16,代碼來源:DefaultProfileResourceIntTest.java

示例6: sendTokenNotification

import org.apache.commons.lang3.RandomStringUtils; //導入方法依賴的package包/類
@Override
public TokenStoreEntity sendTokenNotification(TokenStoreType type, UserEntity user) {
	String token = RandomStringUtils.randomAlphabetic(24);
	TokenStoreEntity tokenStoreEntity = new TokenStoreEntity()
		.setToken(token)
		.setUser(user)
		.setType(type)
		.setExpiryDate(DateTime.now().plusDays(15).toDate());
	sendEmail(tokenStoreEntity, user);
	return tokenStoreRepository.save(tokenStoreEntity);
}
 
開發者ID:codenergic,項目名稱:theskeleton,代碼行數:12,代碼來源:TokenStoreServiceImpl.java

示例7: saveCache

import org.apache.commons.lang3.RandomStringUtils; //導入方法依賴的package包/類
public String saveCache(String bid, String format) {
    if (TextUtils.isEmpty(bid)) {
        return null;
    }

    String cacheId = "Prebid_" + RandomStringUtils.randomAlphabetic(8) + "_" + String.valueOf(System.currentTimeMillis());

    if ("html".equals(format)) {
        saveCacheForWeb(cacheId, bid);
    } else if ("demand_sdk".equals(format)) {
        saveCacheForSDK(cacheId, bid);
    }
    return cacheId;
}
 
開發者ID:prebid,項目名稱:prebid-mobile-android,代碼行數:15,代碼來源:CacheManager.java

示例8: getSemivalidSchemeHostPortPathPatternURIMalIntent

import org.apache.commons.lang3.RandomStringUtils; //導入方法依賴的package包/類
public static MalIntent getSemivalidSchemeHostPortPathPatternURIMalIntent(IntentDataInfo datafield) {

        MalIntent mal = new MalIntent(datafield);
        String scheme = datafield.scheme;

        String host = datafield.host;
        host = host.replace("*", RandomStringUtils.randomAlphanumeric(10));

        String pathPattern = datafield.pathPattern;
        String semivalidPathPattern;

        if (pathPattern.contains(".*") || pathPattern.contains("*")) {
            semivalidPathPattern = pathPattern.replace(".*", RandomStringUtils.randomAlphabetic(10));
            semivalidPathPattern = semivalidPathPattern.replace("*", RandomStringUtils.randomAlphanumeric(10));

            if (pathPattern.charAt(0) == '/') {
                mal.setData(Uri.parse(scheme + "://" + host + semivalidPathPattern));
            }
            mal.setData(Uri.parse(scheme + "://" + host + "/" + semivalidPathPattern));
        } else {
            semivalidPathPattern = RandomStringUtils.randomAlphabetic(10);
            if (pathPattern.equals("") || pathPattern.charAt(0) == '/') {
                mal.setData(Uri.parse(scheme + "://" + host + semivalidPathPattern));
            }
            mal.setData(Uri.parse(scheme + "://" + host + "/" + semivalidPathPattern));

        }


        return mal;
    }
 
開發者ID:lmartire,項目名稱:DoApp,代碼行數:32,代碼來源:GenericPathPatternURIGenerator.java

示例9: process

import org.apache.commons.lang3.RandomStringUtils; //導入方法依賴的package包/類
@Override
public Object process(AnnotationInfo ctx, Object value) throws Exception {
    if (!ctx.isAnnotationPresent(Min.class)
            && !ctx.isAnnotationPresent(Max.class)) {
        return value;
    }
    long minValue = 1;
    if (ctx.isAnnotationPresent(Min.class)) {
        minValue = ctx.getAnnotation(Min.class).value();
    }
    long maxValue = 50;
    if (ctx.isAnnotationPresent(Max.class)) {
        maxValue = ctx.getAnnotation(Max.class).value();
    }
    if (Number.class.isAssignableFrom(value.getClass())) {
        return range(String.valueOf(minValue), String.valueOf(maxValue), value.getClass());
    } else if (value instanceof String) {
        String strVal = (String) value;
        if (strVal.length() < minValue) {
            strVal += RandomStringUtils.randomAlphabetic((int) minValue - strVal.length());
        } else if (strVal.length() > maxValue) {
            strVal = strVal.substring(0, (int) maxValue);
        }
        return strVal;
    }
    return value;
}
 
開發者ID:randomito,項目名稱:randomito-all,代碼行數:28,代碼來源:MinMaxAnnotationPostProcessor.java

示例10: generate

import org.apache.commons.lang3.RandomStringUtils; //導入方法依賴的package包/類
@Override
public Object generate(DefaultContext ctx) throws Exception {
    return RandomStringUtils.randomAlphabetic(150);
}
 
開發者ID:randomito,項目名稱:randomito-all,代碼行數:5,代碼來源:StringGenerator.java

示例11: BufferedObjective

import org.apache.commons.lang3.RandomStringUtils; //導入方法依賴的package包/類
public BufferedObjective(Scoreboard scoreboard) {
    this.scoreboard = scoreboard;
    this.title = RandomStringUtils.randomAlphabetic(4);
    this.current = scoreboard.registerNewObjective("buffered", "dummy");
}
 
開發者ID:funkemunky,項目名稱:HCFCore,代碼行數:6,代碼來源:BufferedObjective.java

示例12: BufferedObjective

import org.apache.commons.lang3.RandomStringUtils; //導入方法依賴的package包/類
public BufferedObjective(Scoreboard scoreboard) {
	this.scoreboard = scoreboard;
	this.title = RandomStringUtils.randomAlphabetic(4);
	this.current = scoreboard.registerNewObjective("buffered", "dummy");
}
 
開發者ID:ijoeleoli,項目名稱:ZorahPractice,代碼行數:6,代碼來源:BufferedObjective.java

示例13: randomString

import org.apache.commons.lang3.RandomStringUtils; //導入方法依賴的package包/類
public static String randomString() {
    return RandomStringUtils.randomAlphabetic(10);
}
 
開發者ID:allure-framework,項目名稱:allure-java,代碼行數:4,代碼來源:TestData.java

示例14: randomCompanyName

import org.apache.commons.lang3.RandomStringUtils; //導入方法依賴的package包/類
private static String randomCompanyName() {
    return RandomStringUtils.randomAlphabetic(10);
}
 
開發者ID:dizitart,項目名稱:nitrite-database,代碼行數:4,代碼來源:DataGenerator.java

示例15: createStream

import org.apache.commons.lang3.RandomStringUtils; //導入方法依賴的package包/類
public StreamId createStream(final String streamParamName) {
	final String defaultStreamName = RandomStringUtils.randomAlphabetic(20);
	StreamId streamId = flinkPravegaParams.createStreamFromParam(streamParamName, scope + "/" + defaultStreamName);
	log.info("Created stream: {} with scope: {}", streamId.getName(), streamId.getScope());
	return streamId;
}
 
開發者ID:pravega,項目名稱:nautilus-samples,代碼行數:7,代碼來源:StreamUtils.java


注:本文中的org.apache.commons.lang3.RandomStringUtils.randomAlphabetic方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。