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:com.adobe.acs.commons.http.impl.HttpClientFactoryImplTest.java
@Before public void setup() throws Exception { config = new HashMap<String, Object>(); username = RandomStringUtils.randomAlphabetic(5); password = RandomStringUtils.randomAlphabetic(6); final String authHeaderValue = Base64.encodeBase64String((username + ":" + password).getBytes()); config.put("hostname", "localhost"); config.put("port", mockServerRule.getPort().intValue()); mockServerClient.when(request().withMethod("GET").withPath("/anon")) .respond(response().withStatusCode(200).withBody("OK")); mockServerClient.when(request().withMethod("GET").withPath("/anonJson")) .respond(response().withStatusCode(200).withBody("{ 'foo' : 'bar' }")); mockServerClient.when(request().withMethod("GET").withPath("/auth").withHeader("Authorization", "Basic " + authHeaderValue)).respond(response().withStatusCode(200).withBody("OK")); impl = new HttpClientFactoryImpl(); PrivateAccessor.setField(impl, "httpClientBuilderFactory", new HttpClientBuilderFactory() { @Override/*from w w w. j av a 2s. c o m*/ public HttpClientBuilder newBuilder() { return HttpClients.custom(); } }); }
From source file:edu.sampleu.main.TermMaintenanceNewAft.java
protected void createNewEnterDetails() throws InterruptedException { selectFrameIframePortlet();/*from w w w . jav a2 s.c o m*/ waitAndClickLinkContainingText("Create New"); String randomCode = RandomStringUtils.randomAlphabetic(9).toUpperCase(); waitAndTypeByName("document.newMaintainableObject.dataObject.description", "New Term " + randomCode); waitAndTypeByName("document.newMaintainableObject.dataObject.specificationId", "T1000"); fireEvent("document.newMaintainableObject.dataObject.specificationId", "blur"); waitForProgressLoading(); waitForTextPresent("campusSize"); waitForTextPresent("java.lang.Integer"); waitForElementPresentByXpath( "//label[contains(text(),'Specification Description')]/span[contains(text(),'Size in # of students of the campus')]"); waitAndTypeByName("document.newMaintainableObject.dataObject.parametersMap[Campus Code]", "FakeCampus" + randomCode); waitAndClickByXpath("//button[contains(text(),'Submit')]"); waitAndClickConfirmSubmitOk(); waitForProgressLoading(); waitForTextPresent("Document was successfully submitted.", WebDriverUtils.configuredImplicityWait() * 2); waitForTextPresent("FakeCampus" + randomCode); }
From source file:com.gs.collections.impl.jmh.domain.Positions.java
public Position createPosition() { String accountName = this.stringPool.put(RandomStringUtils.randomNumeric(5)); String category = this.stringPool.put(RandomStringUtils.randomAlphabetic(1).toUpperCase()); String productName = this.stringPool.put(RandomStringUtils.randomNumeric(3)); Account account = this.accountPool.put(new Account(accountName)); Product product = this.productPool.put(new Product(productName, category, DOUBLES.nextDouble())); return new Position(account, product, INTS.nextInt()); }
From source file:edu.samplu.admin.test.ConfigComponentCreateNewAbstractSmokeTestBase.java
public void testConfigComponentCreateNew() throws Exception { selectFrameIframePortlet();/*from w w w. jav a 2 s . c o m*/ waitAndClickByXpath(CREATE_NEW_XPATH); String fourLetters = RandomStringUtils.randomAlphabetic(4); waitAndTypeByName("document.documentHeader.documentDescription", "Test description of Component create new"); selectByName("document.newMaintainableObject.namespaceCode", "KR-WKFLW - Workflow"); waitAndTypeByName("document.newMaintainableObject.code", "Test1" + fourLetters); waitAndTypeByName("document.newMaintainableObject.name", "Test1ComponentCode" + fourLetters); waitAndClickByName("methodToCall.route"); checkForDocError(); waitAndClickByName("methodToCall.close"); waitAndClickByName("methodToCall.processAnswer.button1"); }
From source file:net.shopxx.plugin.qqLogin.QqLoginPlugin.java
@Override public Map<String, Object> getParameterMap(HttpServletRequest request) { PluginConfig pluginConfig = getPluginConfig(); String state = DigestUtils.md5Hex(UUID.randomUUID() + RandomStringUtils.randomAlphabetic(30)); request.getSession().setAttribute(STATE_ATTRIBUTE_NAME, state); Map<String, Object> parameterMap = new HashMap<String, Object>(); parameterMap.put("response_type", "code"); parameterMap.put("client_id", pluginConfig.getAttribute("oauthKey")); parameterMap.put("redirect_uri", getNotifyUrl()); parameterMap.put("state", state); return parameterMap; }
From source file:com.bloatit.framework.webprocessor.components.advanced.showdown.MarkdownEditor.java
public String getInputId() { if (inputBlock.getInputElement() == null) { inputBlock.getInputElement().setId("blmdedit-" + RandomStringUtils.randomAlphabetic(4)); }//from w w w . ja v a 2 s . co m return inputBlock.getInputElement().getId(); }
From source file:edu.sampleu.kim.api.location.LocationCountryAftBase.java
@Override protected void createNewEnterDetails() throws InterruptedException { waitAndTypeByName("document.documentHeader.documentDescription", getDescriptionUnique()); jiraAwareTypeByName("document.newMaintainableObject.code", RandomStringUtils.randomAlphabetic(2)); jiraAwareTypeByName("document.newMaintainableObject.name", "name" + uniqueString); }
From source file:edu.sampleu.admin.ConfigParameterTypeAftBase.java
@Override protected void createNewEnterDetails() throws InterruptedException { waitAndTypeByName("document.documentHeader.documentDescription", getDescriptionUnique()); jiraAwareTypeByName("document.newMaintainableObject.code", RandomStringUtils.randomAlphabetic(6)); jiraAwareTypeByName("document.newMaintainableObject.name", "name" + uniqueString); }
From source file:hr.fer.zemris.vhdllab.dao.impl.NamedEntityDaoTest.java
/** * Name is too long./*w w w . java 2s . c o m*/ */ @Test(expected = InvalidStateException.class) public void nameTooLong() { entity.setName(RandomStringUtils.randomAlphabetic(256)); dao.persist(entity); }
From source file:com.adobe.acs.commons.wcm.impl.FileImporterTest.java
@Before public void setup() throws Exception { provider = RepositoryProvider.instance(); importer.activate(Collections.<String, Object>emptyMap()); testFile = new File("src/test/resources/emailTemplate.txt"); when(mimeTypeService.getMimeType("emailTemplate.txt")).thenReturn("text/plain"); session = provider.getRepository().loginAdministrative(null); folder = session.getRootNode().addNode(RandomStringUtils.randomAlphabetic(10), JcrConstants.NT_FOLDER); session.save();/* ww w. j av a 2s . c om*/ }