List of usage examples for org.apache.commons.lang RandomStringUtils randomAlphabetic
public static String randomAlphabetic(int count)
Creates a random string whose length is the number of characters specified.
Characters will be chosen from the set of alphabetic characters.
From source file:edu.sampleu.admin.config.namespace.pending.PendingBase.java
protected void fillInNamespaceOverview(String descBase, String codeNameBase, String nameBase, String appId) throws Exception { selectFrameIframePortlet();//from w w w . j a va2 s. c o m waitAndCreateNew(); waitAndTypeByName(DOCUMENT_DESCRIPTION_NAME, descBase + " " + AutomatedFunctionalTestUtils.createUniqueDtsPlusTwoRandomCharsNot9Digits()); String randomFour = RandomStringUtils.randomAlphabetic(4).toLowerCase(); waitAndTypeByName(DOCUMENT_CODE_NAME, codeNameBase + randomFour); waitAndTypeByName(DOCUMENT_NAME, nameBase + randomFour); waitAndTypeByName(DOCUMENT_APPLICATIONID_NAME, appId); }
From source file:com.haulmont.cuba.gui.dynamicattributes.FilteringLookupAction.java
protected Element createConditionXmlElement() { Element conditionElement = DocumentHelper.createDocument().addElement("c"); conditionElement.addAttribute("name", RandomStringUtils.randomAlphabetic(10)); conditionElement.addAttribute("width", "1"); conditionElement.addAttribute("type", "CUSTOM"); conditionElement.addAttribute("locCaption", messages.getMainMessage("dynamicAttributes.filter.conditionName")); return conditionElement; }
From source file:gobblin.data.management.copy.writer.FileAwareInputStreamDataWriterTest.java
@Test public void testWriteWithEncryption() throws Exception { byte[] streamString = "testEncryptedContents".getBytes("UTF-8"); byte[] expectedContents = new byte[streamString.length]; for (int i = 0; i < streamString.length; i++) { expectedContents[i] = (byte) ((streamString[i] + 1) % 256); }//from w w w . j ava2 s . c o m FileStatus status = fs.getFileStatus(testTempPath); OwnerAndPermission ownerAndPermission = new OwnerAndPermission(status.getOwner(), status.getGroup(), new FsPermission(FsAction.ALL, FsAction.ALL, FsAction.ALL)); CopyableFile cf = CopyableFileUtils.getTestCopyableFile(ownerAndPermission); CopyableDatasetMetadata metadata = new CopyableDatasetMetadata( new TestCopyableDataset(new Path("/source"))); WorkUnitState state = TestUtils.createTestWorkUnitState(); state.setProp(ConfigurationKeys.WRITER_STAGING_DIR, new Path(testTempPath, "staging").toString()); state.setProp(ConfigurationKeys.WRITER_OUTPUT_DIR, new Path(testTempPath, "output").toString()); state.setProp(ConfigurationKeys.WRITER_FILE_PATH, RandomStringUtils.randomAlphabetic(5)); state.setProp("writer.encrypt." + EncryptionConfigParser.ENCRYPTION_ALGORITHM_KEY, "insecure_shift"); CopySource.serializeCopyEntity(state, cf); CopySource.serializeCopyableDataset(state, metadata); FileAwareInputStreamDataWriter dataWriter = new FileAwareInputStreamDataWriter(state, 1, 0); FileAwareInputStream fileAwareInputStream = new FileAwareInputStream(cf, StreamUtils.convertStream(new ByteArrayInputStream(streamString))); dataWriter.write(fileAwareInputStream); dataWriter.commit(); Path writtenFilePath = new Path(new Path(state.getProp(ConfigurationKeys.WRITER_OUTPUT_DIR), cf.getDatasetAndPartition(metadata).identifier()), cf.getDestination()); Assert.assertTrue(writtenFilePath.getName().endsWith("insecure_shift"), "Expected encryption name to be appended to destination"); Assert.assertEquals(IOUtils.toByteArray(new FileInputStream(writtenFilePath.toString())), expectedContents); }
From source file:de.hybris.platform.flexiblesearch.performance.LimitStatementPerformanceTest.java
private void createTestObjects(final int count) { final StringBuilder builder = new StringBuilder("INSERT Title;code;name\n"); for (int i = 0; i <= count; i++) { builder.append(";").append(RandomStringUtils.randomAlphabetic(3) + i); builder.append(";\n"); }/*from w w w . j a v a 2 s . c om*/ final ImpExResource mediaRes = new StreamBasedImpExResource( new ByteArrayInputStream(builder.toString().getBytes()), CSVConstants.HYBRIS_ENCODING); final ImportConfig config = new ImportConfig(); config.setScript(mediaRes); importService.importData(config); }
From source file:fr.univlorraine.ecandidat.controllers.DemoController.java
/** * @return une liste de peopleLdap anonyme pour la recherche Ldap *//*from ww w . j a v a 2 s.c o m*/ public List<PeopleLdap> findListIndividuLdapDemo() { List<PeopleLdap> liste = new ArrayList<PeopleLdap>(); for (int i = 0; i < 6; i++) { String login = RandomStringUtils.randomAlphabetic(8).toLowerCase() + RandomStringUtils.randomNumeric(1); PeopleLdap people = new PeopleLdap(login, "displayName-" + login, "sn-" + login, "cn-" + login, "mail-" + login, null, "M.", "givenName-" + login); liste.add(people); } return liste; }
From source file:com.gs.collections.impl.parallel.SerialParallelPerformanceTest.java
public MutableList<String> generateWordsList(int count) { FastList<String> words = FastList.newList(); Interval.oneTo(count).forEach((int each) -> words.add(RandomStringUtils.randomAlphabetic(2))); return words; }
From source file:com.google.code.ssm.test.dao.TestDAOImpl.java
@Override @ReadThroughMultiCache(namespace = CacheConst.DELTA, expiration = 1000) public List<String> getRandomStrings(@ParameterValueKeyProvider final List<Long> keys) { try {/*from www .j a v a 2s . c o m*/ Thread.sleep(500); } catch (InterruptedException ex) { } final String series = RandomStringUtils.randomAlphabetic(6); final List<String> results = new ArrayList<String>(keys.size()); for (final Long key : keys) { results.add(series + "-" + key.toString() + "-" + RandomStringUtils.randomAlphanumeric(25 + RandomUtils.nextInt(30))); } return results; }
From source file:com.gs.collections.impl.parallel.SerialParallelPerformanceTest.java
public MutableSet<String> generateWordsSet(int count) { UnifiedSet<String> words = UnifiedSet.newSet(); while (words.size() < count) { words.add(RandomStringUtils.randomAlphabetic(5)); }/* w w w.j a va 2 s. c o m*/ return words; }
From source file:com.kixeye.chassis.bootstrap.ConfigurationBuilderTest.java
@Test public void buildConfigurationInAws() { String az = "testaz"; String instanceId = RandomStringUtils.randomAlphabetic(10); String region = Regions.DEFAULT_REGION.getName(); ServerInstanceContext serverInstanceContext = EasyMock.createMock(ServerInstanceContext.class); EasyMock.expect(serverInstanceContext.getAvailabilityZone()).andReturn(az); EasyMock.expect(serverInstanceContext.getInstanceId()).andReturn(instanceId); EasyMock.expect(serverInstanceContext.getRegion()).andReturn(region); EasyMock.expect(serverInstanceContext.getPrivateIp()).andReturn("127.0.0.1"); EasyMock.expect(serverInstanceContext.getPublicIp()).andReturn(null); EasyMock.replay(serverInstanceContext); Configuration configuration = configurationBuilder.withServerInstanceContext(serverInstanceContext).build(); Assert.assertEquals(az,/* w w w . j av a2s. co m*/ configuration.getString(BootstrapConfigKeys.AWS_INSTANCE_AVAILABILITY_ZONE.getPropertyName())); Assert.assertEquals(instanceId, configuration.getString(BootstrapConfigKeys.AWS_INSTANCE_ID.getPropertyName())); Assert.assertEquals(region, configuration.getString(BootstrapConfigKeys.AWS_INSTANCE_REGION.getPropertyName())); Assert.assertEquals("127.0.0.1", configuration.getString(BootstrapConfigKeys.AWS_INSTANCE_PRIVATE_IP.getPropertyName())); Assert.assertEquals(null, configuration.getString(BootstrapConfigKeys.AWS_INSTANCE_PUBLIC_IP.getPropertyName())); EasyMock.verify(serverInstanceContext); }
From source file:com.haulmont.restapi.service.filter.RestFilterParserTest.java
@Test public void testInOperator() throws Exception { new StrictExpectations() { {/* w w w . j a v a2 s . co m*/ 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); }