当前位置: 首页>>代码示例>>Java>>正文


Java RandomStringUtils.randomAlphanumeric方法代码示例

本文整理汇总了Java中org.apache.commons.lang3.RandomStringUtils.randomAlphanumeric方法的典型用法代码示例。如果您正苦于以下问题:Java RandomStringUtils.randomAlphanumeric方法的具体用法?Java RandomStringUtils.randomAlphanumeric怎么用?Java RandomStringUtils.randomAlphanumeric使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.lang3.RandomStringUtils的用法示例。


在下文中一共展示了RandomStringUtils.randomAlphanumeric方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getSemivalidSchemeHostPortPathURIMalIntent

import org.apache.commons.lang3.RandomStringUtils; //导入方法依赖的package包/类
public static MalIntent getSemivalidSchemeHostPortPathURIMalIntent(IntentDataInfo datafield) {

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

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

        String port = datafield.port;
        String path = datafield.path;
        String semiValidPath;

        if (path.charAt(0) == '/')
            semiValidPath = path + "/" + RandomStringUtils.randomAlphanumeric(10);
        else
            semiValidPath = "/" + path + "/" + RandomStringUtils.randomAlphanumeric(10);

        mal.setData(Uri.parse(scheme + "://" + host + ":" + port + semiValidPath));
        return mal;
    }
 
开发者ID:lmartire,项目名称:DoApp,代码行数:21,代码来源:GenericPathPortURIGenerator.java

示例2: getSemivalidSchemeHostPortPathPrefixURIMalIntent

import org.apache.commons.lang3.RandomStringUtils; //导入方法依赖的package包/类
public static MalIntent getSemivalidSchemeHostPortPathPrefixURIMalIntent(IntentDataInfo datafield) {

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

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

        String port = datafield.port;
        String pathPrefix = datafield.pathPrefix;
        String semivalidPathPrefix;
        if (pathPrefix.charAt(pathPrefix.length() - 1) != '/')
            semivalidPathPrefix = pathPrefix + "/" + RandomStringUtils.randomAlphanumeric(10);
        else
            semivalidPathPrefix = pathPrefix + RandomStringUtils.randomAlphanumeric(10);

        mal.setData(Uri.parse(scheme + "://" + host + ":" + port + semivalidPathPrefix));
        return mal;
    }
 
开发者ID:lmartire,项目名称:DoApp,代码行数:20,代码来源:GenericPathPrefixPortURIGenerator.java

示例3: downloadFile

import org.apache.commons.lang3.RandomStringUtils; //导入方法依赖的package包/类
private File downloadFile(HttpResponse response) {
    File dir = new File("downloadedFiles");
    if (!dir.exists()) {
        dir.mkdir();
    }
    File outputFile = new File("downloadedFiles/temp" + RandomStringUtils.randomAlphanumeric(3));
    try {

        IOUtils.copyLarge(response.getEntity().getContent(), new FileOutputStream(outputFile));
        return outputFile;
    } catch (Exception e) {
        throw new RuntimeException(e);
    } finally {
        request.releaseConnection();
    }
}
 
开发者ID:orshachar,项目名称:known-issue,代码行数:17,代码来源:ExecutableMethodBuilder.java

示例4: shouldNotBeAbleToCreateAnAccountIfTheUsernameIsAlreadyInUse

import org.apache.commons.lang3.RandomStringUtils; //导入方法依赖的package包/类
@Test
public void shouldNotBeAbleToCreateAnAccountIfTheUsernameIsAlreadyInUse() {
	String username = RandomStringUtils.randomAlphanumeric(15);

	account().withUsername(username).save();
	onCreate(account().withUsername(username).build()).rejected().withError("ACC-0003", "This account username is already in use.", ResourceConflictException.class);
}
 
开发者ID:PatternFM,项目名称:tokamak,代码行数:8,代码来源:AccountValidationTest.java

示例5: getSemivalidSchemeHostPortURIMalIntent

import org.apache.commons.lang3.RandomStringUtils; //导入方法依赖的package包/类
public static MalIntent getSemivalidSchemeHostPortURIMalIntent(IntentDataInfo datafield){

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

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

        String semivalidPort = datafield.port+"/"+RandomStringUtils.randomAlphanumeric(10);
        mal.setData(Uri.parse(scheme+ "://" + host + ":" + semivalidPort ));
        return mal;
    }
 
开发者ID:lmartire,项目名称:DoApp,代码行数:13,代码来源:GenericPortURIGenerator.java

示例6: randomErrorInfo

import org.apache.commons.lang3.RandomStringUtils; //导入方法依赖的package包/类
private static ErrorResponseDto.ErrorInfoDto randomErrorInfo() {
    String randomString = RandomStringUtils.randomAlphanumeric(5);
    return ErrorResponseDto.ErrorInfoDto.builder()
            .title("test title " + randomString)
            .detail("test detail " + randomString)
            .source("test source " + randomString)
            .build();
}
 
开发者ID:amvnetworks,项目名称:amv-access-api-poc,代码行数:9,代码来源:ErrorResponseDtoObjectMother.java

示例7: testConfigLoadedWithJsonFile

import org.apache.commons.lang3.RandomStringUtils; //导入方法依赖的package包/类
@Test
public void testConfigLoadedWithJsonFile() throws Exception {
    String filePath = "test.json";
    String expectedMessage = RandomStringUtils.randomAlphanumeric(12);

    putFileInEtcd(filePath, String.format("{\"message\":\"%s\"}", expectedMessage));
    testConfigLoaded(filePath, expectedMessage);
}
 
开发者ID:conf4j,项目名称:conf4j,代码行数:9,代码来源:EtcdFileConfigurationSourceTest.java

示例8: processTemplate

import org.apache.commons.lang3.RandomStringUtils; //导入方法依赖的package包/类
public static File processTemplate(File template) throws IOException, TemplateException {
    Configuration config = new Configuration();
    config.setDirectoryForTemplateLoading(template.getParentFile());
    config.setObjectWrapper(new DefaultObjectWrapper());
    config.setDefaultEncoding("UTF-8");
    Template temp = config.getTemplate(template.getName());
    String child = template.getName() + RandomStringUtils.randomAlphanumeric(8);
    File fileOutput = new File(template.getParentFile(), child);
    Writer fileWriter = new FileWriter(fileOutput);
    Map<Object, Object> currentSession = Thucydides.getCurrentSession();
    temp.process(currentSession, fileWriter);
    return fileOutput;
}
 
开发者ID:tapack,项目名称:satisfy,代码行数:14,代码来源:TemplateUtils.java

示例9: testConfigLoadedWithHoconFile

import org.apache.commons.lang3.RandomStringUtils; //导入方法依赖的package包/类
@Test
public void testConfigLoadedWithHoconFile() throws Exception {
    String filePath = "test.conf";
    String expectedMessage = RandomStringUtils.randomAlphanumeric(12);

    putFileInConsul(filePath, String.format("message:%s", expectedMessage));
    testConfigLoaded(filePath, expectedMessage);
}
 
开发者ID:conf4j,项目名称:conf4j,代码行数:9,代码来源:ConsulFileConfigurationSourceTest.java

示例10: exception

import org.apache.commons.lang3.RandomStringUtils; //导入方法依赖的package包/类
@ExceptionHandler(Exception.class)
@ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR)
@ResponseBody
public XAPIErrorInfo exception(final HttpServletRequest request, Exception e) throws Exception {
    final String logMessageReferenceId = RandomStringUtils.randomAlphanumeric(8);
    final XAPIErrorInfo result = new XAPIErrorInfo(HttpStatus.INTERNAL_SERVER_ERROR, request, "Unexpected error [reference ID: " + logMessageReferenceId + "].");
    logger.debug("Unexpected XAPI exception [refId: {}]: {}", logMessageReferenceId, e);
    this.logError(result);
    return result;
}
 
开发者ID:Apereo-Learning-Analytics-Initiative,项目名称:OpenLRW,代码行数:11,代码来源:XAPIExceptionHandlerAdvice.java

示例11: decodingAndEncodingFromAndToHexShouldBeTheSame

import org.apache.commons.lang3.RandomStringUtils; //导入方法依赖的package包/类
@Test
public void decodingAndEncodingFromAndToHexShouldBeTheSame() {
    String value = RandomStringUtils.randomAlphanumeric(1000);

    String valueBase64 = Base64.getEncoder().encodeToString(value.getBytes(Charsets.UTF_8));
    String valueHex = CryptotoolUtils.decodeBase64AsHex(valueBase64);
    String valueBase64Again = CryptotoolUtils.encodeHexAsBase64(valueHex);

    assertThat(valueBase64Again, is(equalTo(valueBase64)));

    String valueAgain = new String(Base64.getDecoder().decode(valueBase64Again.getBytes(Charsets.UTF_8)), Charsets.UTF_8);
    assertThat(valueAgain, is(equalTo(value)));
}
 
开发者ID:amvnetworks,项目名称:amv-highmobility-cryptotool-wrapper,代码行数:14,代码来源:CryptotoolUtilsTest.java

示例12: generateRandomString

import org.apache.commons.lang3.RandomStringUtils; //导入方法依赖的package包/类
private static String generateRandomString() {
    return RandomStringUtils.randomAlphanumeric(20);
}
 
开发者ID:eclipse,项目名称:keti,代码行数:4,代码来源:ExternalResourceAttributeReaderTest.java

示例13: aktorId

import org.apache.commons.lang3.RandomStringUtils; //导入方法依赖的package包/类
protected String aktorId() {
    return RandomStringUtils.randomAlphanumeric(10);
}
 
开发者ID:navikt,项目名称:fo-veilarbjobbsokerkompetanse,代码行数:4,代码来源:IntegrasjonsTest.java

示例14: generatePassword

import org.apache.commons.lang3.RandomStringUtils; //导入方法依赖的package包/类
/**
 * Generate a password.
 *
 * @return the generated password
 */
public static String generatePassword() {
    return RandomStringUtils.randomAlphanumeric(DEF_COUNT);
}
 
开发者ID:xm-online,项目名称:xm-uaa,代码行数:9,代码来源:RandomUtil.java

示例15: generateSeriesData

import org.apache.commons.lang3.RandomStringUtils; //导入方法依赖的package包/类
/**
* Generate a unique series to validate a persistent token, used in the
* authentication remember-me mechanism.
*
* @return the generated series data
*/
public static String generateSeriesData() {
    return RandomStringUtils.randomAlphanumeric(DEF_COUNT);
}
 
开发者ID:Microsoft,项目名称:MTC_Labrat,代码行数:10,代码来源:RandomUtil.java


注:本文中的org.apache.commons.lang3.RandomStringUtils.randomAlphanumeric方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。