当前位置: 首页>>代码示例>>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;未经允许,请勿转载。