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


Java RandomStringUtils.randomAlphabetic方法代码示例

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


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

示例1: initKdc

import org.apache.commons.lang.RandomStringUtils; //导入方法依赖的package包/类
@BeforeClass
public static void initKdc() throws Exception {
  baseDir = new File(System.getProperty("test.build.dir", "target/test-dir"),
    SaslDataTransferTestCase.class.getSimpleName());
  FileUtil.fullyDelete(baseDir);
  assertTrue(baseDir.mkdirs());

  Properties kdcConf = MiniKdc.createConf();
  kdc = new MiniKdc(kdcConf, baseDir);
  kdc.start();

  String userName = RandomStringUtils.randomAlphabetic(8);
  File userKeytabFile = new File(baseDir, userName + ".keytab");
  userKeyTab = userKeytabFile.getAbsolutePath();
  kdc.createPrincipal(userKeytabFile, userName + "/localhost");
  userPrincipal = userName + "/[email protected]" + kdc.getRealm();

  String superUserName = "hdfs";
  File hdfsKeytabFile = new File(baseDir, superUserName + ".keytab");
  hdfsKeytab = hdfsKeytabFile.getAbsolutePath();
  kdc.createPrincipal(hdfsKeytabFile, superUserName + "/localhost", "HTTP/localhost");
  hdfsPrincipal = superUserName + "/[email protected]" + kdc.getRealm();
  spnegoPrincipal = "HTTP/[email protected]" + kdc.getRealm();
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:25,代码来源:SaslDataTransferTestCase.java

示例2: testParseSimpleFilter

import org.apache.commons.lang.RandomStringUtils; //导入方法依赖的package包/类
@Test
public void testParseSimpleFilter() throws Exception {
    new StrictExpectations() {{
        RandomStringUtils.randomAlphabetic(anyInt); result = "stringParamName";
        RandomStringUtils.randomAlphabetic(anyInt); result = "intParamName";
        RandomStringUtils.randomAlphabetic(anyInt); result = "booleanParamName";
    }};

    String data = readDataFromFile("data/restFilter1.json");
    MetaClass metaClass = metadata.getClass("test$TestEntity");
    RestFilterParseResult parseResult = restFilterParser.parse(data, metaClass);

    String expectedJpqlWhere = "({E}.stringField <> :stringParamName and " +
            "{E}.intField > :intParamName and " +
            "{E}.booleanField = :booleanParamName)";
    assertEquals(expectedJpqlWhere, parseResult.getJpqlWhere());

    Map<String, Object> queryParameters = parseResult.getQueryParameters();

    assertEquals("stringValue", queryParameters.get("stringParamName"));
    assertEquals(100, queryParameters.get("intParamName"));
    assertEquals(true, queryParameters.get("booleanParamName"));
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:24,代码来源:RestFilterParserTest.java

示例3: testEntityCondition

import org.apache.commons.lang.RandomStringUtils; //导入方法依赖的package包/类
@Test
public void testEntityCondition() throws Exception {
    new StrictExpectations() {{
        RandomStringUtils.randomAlphabetic(anyInt); result = "paramName1";
    }};

    String data = readDataFromFile("data/restFilter2.json");
    MetaClass metaClass = metadata.getClass("test$TestEntity");
    RestFilterParseResult parseResult = restFilterParser.parse(data, metaClass);

    String expectedJpqlWhere = "({E}.linkedTestEntity.id = :paramName1)";
    assertEquals(expectedJpqlWhere, parseResult.getJpqlWhere());

    Map<String, Object> queryParameters = parseResult.getQueryParameters();
    assertEquals(UUID.fromString("2de6a78f-7bef-89a7-eb5e-b725582f23af"), queryParameters.get("paramName1"));
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:17,代码来源:RestFilterParserTest.java

示例4: testOrGroup

import org.apache.commons.lang.RandomStringUtils; //导入方法依赖的package包/类
@Test
public void testOrGroup() throws Exception {
    new StrictExpectations() {{
        RandomStringUtils.randomAlphabetic(anyInt); result = "stringParamName";
        RandomStringUtils.randomAlphabetic(anyInt); result = "intParamName";
        RandomStringUtils.randomAlphabetic(anyInt); result = "booleanParamName";
    }};

    String data = readDataFromFile("data/restFilter3.json");
    MetaClass metaClass = metadata.getClass("test$TestEntity");
    RestFilterParseResult parseResult = restFilterParser.parse(data, metaClass);

    String expectedJpqlWhere = "(({E}.stringField <> :stringParamName or " +
            "{E}.intField > :intParamName) and " +
            "{E}.booleanField = :booleanParamName)";
    assertEquals(expectedJpqlWhere, parseResult.getJpqlWhere());

    Map<String, Object> queryParameters = parseResult.getQueryParameters();

    assertEquals("stringValue", queryParameters.get("stringParamName"));
    assertEquals(100, queryParameters.get("intParamName"));
    assertEquals(true, queryParameters.get("booleanParamName"));
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:24,代码来源:RestFilterParserTest.java

示例5: testEnumCondition

import org.apache.commons.lang.RandomStringUtils; //导入方法依赖的package包/类
@Test
public void testEnumCondition() throws Exception {
    new StrictExpectations() {{
        RandomStringUtils.randomAlphabetic(anyInt); result = "paramName1";
    }};

    String data = readDataFromFile("data/restFilter4.json");
    MetaClass metaClass = metadata.getClass("test$TestEntity");
    RestFilterParseResult parseResult = restFilterParser.parse(data, metaClass);

    String expectedJpqlWhere = "({E}.enumField = :paramName1)";
    assertEquals(expectedJpqlWhere, parseResult.getJpqlWhere());

    Map<String, Object> queryParameters = parseResult.getQueryParameters();

    assertEquals(TestEnum.ENUM_VALUE_1, queryParameters.get("paramName1"));
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:18,代码来源:RestFilterParserTest.java

示例6: testInOperator

import org.apache.commons.lang.RandomStringUtils; //导入方法依赖的package包/类
@Test
public void testInOperator() throws Exception {
    new StrictExpectations() {{
        RandomStringUtils.randomAlphabetic(anyInt); result = "paramName1";
    }};

    String data = readDataFromFile("data/restFilter5.json");
    MetaClass metaClass = metadata.getClass("test$TestEntity");
    RestFilterParseResult parseResult = restFilterParser.parse(data, metaClass);

    String expectedJpqlWhere = "({E}.intField in :paramName1)";
    assertEquals(expectedJpqlWhere, parseResult.getJpqlWhere());

    Map<String, Object> queryParameters = parseResult.getQueryParameters();

    List<Integer> param1Value = (List<Integer>) queryParameters.get("paramName1");
    assertEquals(Arrays.asList(1, 2, 3), param1Value);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:19,代码来源:RestFilterParserTest.java

示例7: testStartsWithOperator

import org.apache.commons.lang.RandomStringUtils; //导入方法依赖的package包/类
@Test
public void testStartsWithOperator() throws Exception {
    new StrictExpectations() {{
        RandomStringUtils.randomAlphabetic(anyInt); result = "paramName1";
    }};

    String data = readDataFromFile("data/restFilter6.json");
    MetaClass metaClass = metadata.getClass("test$TestEntity");
    RestFilterParseResult parseResult = restFilterParser.parse(data, metaClass);

    String expectedJpqlWhere = "({E}.stringField like :paramName1)";
    assertEquals(expectedJpqlWhere, parseResult.getJpqlWhere());

    Map<String, Object> queryParameters = parseResult.getQueryParameters();
    assertEquals("(?i)AAA%", queryParameters.get("paramName1"));
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:17,代码来源:RestFilterParserTest.java

示例8: getManyToManyCondition

import org.apache.commons.lang.RandomStringUtils; //导入方法依赖的package包/类
@Nullable
protected AbstractCondition getManyToManyCondition(List<Object> parentIds, CollectionDatasource datasource,
                                                   String filterComponentName, String relatedPrimaryKey, MetaDataDescriptor descriptor) {
    MetaClass metaClass = descriptor.getMetaClass();
    String parentPrimaryKey = metadataTools.getPrimaryKeyName(metaClass);
    CustomCondition customCondition = getParentEntitiesCondition(parentIds, parentPrimaryKey, datasource,
            filterComponentName, metaClass);

    String parentEntityAlias = RandomStringUtils.randomAlphabetic(6);
    String entityAlias = RandomStringUtils.randomAlphabetic(6);
    String select = String.format("select %s.%s from %s %s ", entityAlias, relatedPrimaryKey, metaClass, parentEntityAlias);

    String joinWhere = String.format("join %s.%s %s where %s.%s in :%s", parentEntityAlias, descriptor.getMetaProperty().getName(),
            entityAlias, parentEntityAlias, parentPrimaryKey, customCondition.getParam().getName());

    String whereString = String.format("{E}.%s in (%s)", relatedPrimaryKey, select + joinWhere);
    customCondition.setWhere(whereString);

    return customCondition;
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:21,代码来源:RelatedEntitiesBean.java

示例9: getManyToOneCondition

import org.apache.commons.lang.RandomStringUtils; //导入方法依赖的package包/类
@Nullable
protected AbstractCondition getManyToOneCondition(List<Object> parentIds, CollectionDatasource datasource,
                                                  String filterComponentName, String relatedPrimaryKey, MetaDataDescriptor descriptor) {
    MetaClass metaClass = descriptor.getMetaClass();
    String parentPrimaryKey = metadataTools.getPrimaryKeyName(metaClass);
    CustomCondition customCondition = getParentEntitiesCondition(parentIds, parentPrimaryKey, datasource, filterComponentName, metaClass);

    String entityAlias = RandomStringUtils.randomAlphabetic(6);
    String subQuery = String.format("select %s.%s.%s from %s %s where %s.%s in :%s", entityAlias,
            descriptor.getMetaProperty().getName(), relatedPrimaryKey, metaClass.getName(), entityAlias,
            entityAlias, parentPrimaryKey, customCondition.getParam().getName());

    String whereString = String.format("{E}.%s in (%s)", relatedPrimaryKey, subQuery);
    customCondition.setWhere(whereString);

    return customCondition;
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:18,代码来源:RelatedEntitiesBean.java

示例10: generateSetFilter

import org.apache.commons.lang.RandomStringUtils; //导入方法依赖的package包/类
public static String generateSetFilter(Set ids, String entityClass, String componentId, String entityAlias) {
    Document document = DocumentHelper.createDocument();
    Element root = DocumentHelper.createElement("filter");
    Element or = root.addElement("and");

    Element condition = or.addElement("c");
    condition.addAttribute("name", "set");
    condition.addAttribute("inExpr", "true");
    condition.addAttribute("hidden", "true");
    condition.addAttribute("locCaption", "Set filter");
    condition.addAttribute("entityAlias", entityAlias);
    condition.addAttribute("class", entityClass);
    condition.addAttribute("type", ConditionType.CUSTOM.name());

    String listOfId = createIdsString(ids);
    String randomName = RandomStringUtils.randomAlphabetic(10);
    condition.addText(entityAlias + ".id in :component$" + componentId + "." + randomName);

    Element param = condition.addElement("param");
    param.addAttribute("name", "component$" + componentId + "." + randomName);
    param.addText(listOfId);

    document.add(root);
    return Dom4j.writeDocument(document, true);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:26,代码来源:UserSetHelper.java

示例11: findUnusedTopic

import org.apache.commons.lang.RandomStringUtils; //导入方法依赖的package包/类
public String findUnusedTopic() {
  String newTopic = null;
  boolean topicFound = false;
  while (!topicFound) {
    newTopic = RandomStringUtils.randomAlphabetic(8);
    if (!usedTopics.contains(newTopic)) {
      usedTopics.add(newTopic);
      topicFound = true;
    }
  }
  return newTopic;
}
 
开发者ID:moueimei,项目名称:flume-release-1.7.0,代码行数:13,代码来源:TestKafkaSource.java

示例12: randomHeaders

import org.apache.commons.lang.RandomStringUtils; //导入方法依赖的package包/类
private static Header[] randomHeaders(final int maxNum, final int maxLen) {
	int n = RNG.nextInt(maxNum) + 1;
	Header[] ret = new Header[n];
	for (int i = 0; i < n; i++) {
		String name = "Random-" + RandomStringUtils.randomAlphabetic(RNG.nextInt(maxLen) + 1);
		String value = RandomStringUtils.randomAscii(RNG.nextInt(maxLen) + 1);
		ret[i] = new BasicHeader(name, value);
	}
	return ret;
}
 
开发者ID:LAW-Unimi,项目名称:BUbiNG,代码行数:11,代码来源:RandomTestMocks.java

示例13: DynamicAttributesCondition

import org.apache.commons.lang.RandomStringUtils; //导入方法依赖的package包/类
public DynamicAttributesCondition(AbstractConditionDescriptor descriptor, String entityAlias, String propertyPath) {
    super(descriptor);
    this.entityAlias = entityAlias;
    this.name = RandomStringUtils.randomAlphabetic(10);
    Messages messages = AppBeans.get(Messages.class);
    this.locCaption = messages.getMainMessage("newDynamicAttributeCondition");
    this.propertyPath = propertyPath;
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:9,代码来源:DynamicAttributesCondition.java

示例14: CustomConditionCreator

import org.apache.commons.lang.RandomStringUtils; //导入方法依赖的package包/类
public CustomConditionCreator(String filterComponentName, CollectionDatasource datasource) {
    super(RandomStringUtils.randomAlphabetic(10), filterComponentName, datasource);

    Messages messages = AppBeans.get(Messages.NAME);
    this.locCaption = messages.getMainMessage("filter.customCondition.new");
    showImmediately = true;
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:8,代码来源:CustomConditionCreator.java

示例15: DynamicAttributesConditionCreator

import org.apache.commons.lang.RandomStringUtils; //导入方法依赖的package包/类
public DynamicAttributesConditionCreator(String filterComponentName, CollectionDatasource datasource, String propertyPath) {
    super(RandomStringUtils.randomAlphabetic(10), filterComponentName, datasource);
    this.propertyPath = propertyPath;
    Messages messages = AppBeans.get(Messages.NAME);
    locCaption = messages.getMainMessage("filter.dynamicAttributeConditionCreator");
    showImmediately = true;
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:8,代码来源:DynamicAttributesConditionCreator.java


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