List of usage examples for org.apache.commons.lang RandomStringUtils randomNumeric
public static String randomNumeric(int count)
Creates a random string whose length is the number of characters specified.
Characters will be chosen from the set of numeric characters.
From source file:org.jboss.pnc.rest.utils.mock.BpmMock.java
private ProcessInstance startProcessMock(String processName, Map params) { Integer taskId = (Integer) params.get("taskId"); MilestoneReleaseRest milestoneRest;// w ww. j a v a 2s.com try { MilestoneReleaseParameters processParameters = JsonUtils .fromJson((String) params.get("processParameters"), MilestoneReleaseParameters.class); milestoneRest = processParameters.getBrewPush(); } catch (IOException e) { throw new RuntimeException("failed to read brew push milestone rest from json", e); } String callbackId = RandomStringUtils.randomNumeric(12); pushes.add(new Push(milestoneRest.getMilestoneId(), taskId, callbackId)); return new ProcessInstanceMock(); }
From source file:org.kaaproject.kaa.server.appenders.flume.appender.FlumeAvroEventBuilderTest.java
@Before public void init() throws IOException { appToken = RandomStringUtils.randomNumeric(15); profileDto = new EndpointProfileDataDto("1", UUID.randomUUID().toString(), 1, "", 1, ""); List<LogEvent> list = generateEvents(); eventPack = generateEventPack(list); }
From source file:org.kaaproject.kaa.server.common.dao.service.ApplicationServiceImpl.java
@Override public ApplicationDto saveApp(ApplicationDto applicationDto) { ApplicationDto appDto = null;/*from www . j a v a 2s . c o m*/ if (isValidSqlObject(applicationDto)) { if (isBlank(applicationDto.getName())) { throw new IncorrectParameterException("Can't save/update application with null name"); } Application checkApplication = applicationDao.findByNameAndTenantId(applicationDto.getName(), applicationDto.getTenantId()); if (checkApplication != null && !Objects.equals(checkApplication.getStringId(), applicationDto.getId())) { throw new IncorrectParameterException("Can't save application with same name within one tenant"); } if (isBlank(applicationDto.getCredentialsServiceName())) { applicationDto.setCredentialsServiceName(DEFAULT_CREDENTIALS_SERVICE_NAME); } if (isNotBlank(applicationDto.getId())) { LOG.debug("Update application with id [{}]", applicationDto.getId()); return getDto(applicationDao.save(new Application(applicationDto))); } String appToken = RandomStringUtils.randomNumeric(Constants.APP_TOKEN_SIZE); applicationDto.setApplicationToken(appToken); Application application = new Application(applicationDto); appDto = getDto(applicationDao.save(application)); if (appDto != null) { String appId = appDto.getId(); List<User> users = userDao.findByTenantIdAndAuthority(appDto.getTenantId(), KaaAuthorityDto.TENANT_ADMIN.name()); String createdUsername = null; if (!users.isEmpty()) { createdUsername = users.get(0).getUsername(); } LOG.debug("Saved application with id [{}]", appId); EndpointGroupDto groupDto = createDefaultGroup(appId, createdUsername); if (groupDto != null) { String groupId = groupDto.getId(); LOG.debug("Saved endpoint group with id [{}]", groupId); EndpointProfileSchemaDto profileSchema = createDefaultProfileSchema(appId, createdUsername); ConfigurationDto configuration = createDefaultConfigurationWithSchema(appId, groupId, createdUsername); if (profileSchema == null || configuration == null) { LOG.warn("Got error during creation application. Deleted application with id [{}]", appId); removeCascadeApplication(appId); } LOG.debug("Creating default server profile schema"); createDefaultServerProfileSchema(appId, createdUsername); LOG.debug("Creating default notification schema"); createDefaultNotificationSchema(appId, createdUsername); LOG.debug("Creating default log schema"); createDefaultLogSchema(appId, createdUsername); } else { LOG.warn("Cant save default group for application with id [{}]", appId); removeCascadeApplication(appId); } } LOG.debug("Inserted new application with"); } return appDto; }
From source file:org.kaaproject.kaa.server.common.dao.service.UserVerifierServiceImpl.java
@Override public UserVerifierDto saveUserVerifier(UserVerifierDto userVerifierDto) { LOG.debug("Save user verifier [{}]", userVerifierDto); UserVerifierDto saved = null;//www .j a v a 2 s .com if (userVerifierDto != null) { if (isBlank(userVerifierDto.getId())) { userVerifierDto.setCreatedTime(System.currentTimeMillis()); String verifierToken = RandomStringUtils.randomNumeric(Constants.USER_VERIFIER_TOKEN_SIZE); userVerifierDto.setVerifierToken(verifierToken); } saved = getDto(userVerifierDao.save(new UserVerifier(userVerifierDto))); } return saved; }
From source file:org.kaaproject.kaa.server.control.cli.ControlServerCliIT.java
/** * Edits/Creates the tenant from cli./*from w w w .j a va 2 s.c o m*/ * * @param cli the control cli client * @param tenantId the tenant id (if null new tenant will be created) * @param createOut create output file with object id * @return the tenantId * @throws UnsupportedEncodingException the unsupported encoding exception */ private String editTenantCli(ControlApiCliThriftClient cli, String tenantId, String tenantName, boolean createOut) throws UnsupportedEncodingException { cliOut.reset(); boolean create = strIsEmpty(tenantId); tenantName = tenantName + "_" + RandomStringUtils.randomNumeric(14); String cmdLine = (create ? "create" : "edit") + "Tenant -n " + tenantName + (create ? "" : (" -i " + tenantId)); if (createOut) { cmdLine += " -o dummy.out"; } int result = cli.processLine(cmdLine); Assert.assertEquals(result, 0); String output = cliOut.toString("UTF-8"); if (create) { String id = output.trim().substring("Created new tenant with id: ".length()).trim(); return id; } else if (tenantId.equals(FAKE_SQL_ID)) { Assert.assertTrue(output.trim().startsWith("Tenant with id " + FAKE_SQL_ID + " not found!")); return tenantId; } else { Assert.assertTrue(output.trim().startsWith("Tenant updated.")); return tenantId; } }
From source file:org.kaaproject.kaa.server.control.cli.ControlServerCliIT.java
/** * Edits/Creates the endpoint group from cli. * * @param cli the control cli client/*from w w w . java2s .c om*/ * @param endpointGroupId the endpoint group id (if null new endpoint group will be created) * @param applicationId the application Ids * @param createOut create output file with object id * @return the endpointGroupId * @throws UnsupportedEncodingException the unsupported encoding exception */ private String editEndpointGroupCli(ControlApiCliThriftClient cli, String endpointGroupId, String applicationId, String applicationName, String tenantName, String weight, boolean createOut) throws UnsupportedEncodingException { cliOut.reset(); boolean create = strIsEmpty(endpointGroupId); int result = -1; if (create) { if (strIsEmpty(applicationId)) { applicationId = editApplicationCli(cli, null, applicationId, null, tenantName, false); cliOut.reset(); } String cmdLine = "createEndpointGroup -n testEndpointGroup" + RandomStringUtils.randomNumeric(4) + " -a " + applicationId + " -w " + weight; if (createOut) { cmdLine += " -o dummy.out"; } result = cli.processLine(cmdLine); } else { result = cli.processLine("editEndpointGroup -n testEndpointGroup" + RandomStringUtils.randomNumeric(4) + " -i " + endpointGroupId + " -w " + weight); } Assert.assertEquals(result, 0); String output = cliOut.toString("UTF-8"); if (create) { String id = output.trim().substring("Created new Endpoint Group with id: ".length()).trim(); return id; } else if (endpointGroupId.equals(FAKE_SQL_ID)) { Assert.assertTrue(output.trim().startsWith("Endpoint Group with id " + FAKE_SQL_ID + " not found!")); return endpointGroupId; } else { Assert.assertTrue(output.trim().startsWith("Endpoint Group updated.")); return endpointGroupId; } }
From source file:org.kuali.rice.krad.labs.kitchensink.UifComponentsTestForm.java
public UifComponentsTestForm() { super();//w w w .ja va2 s . c om uiTestObject = new UITestObject("Foo", "FooBar", "FooBear", "FooRacket"); sourceCodeField = "<bean parent=\"Uif-PrimaryActionButton\" p:actionLabel=\"Save\" p:methodToCall=\"performSave\">\n" + "  <property name=\"actionImage\">\n" + "    <bean parent=\"Uif-Image\"\n" + "      p:source=\"@{#ConfigProperties['krad.externalizable.images.url']}searchicon.png\"\n" + "      p:actionImageLocation=\"RIGHT\"/>\n" + "  </property>\n" + "</bean>"; list1.add(new UITestObject("5", "6", "7", "8", new UITestObject("1", "1", "1", "1"))); UITestObject obj1 = new UITestObject("1", "2", "3", "4", new UITestObject("1", "1", "1", "1")); obj1.setStringList(null); list1.add(obj1); UITestObject obj2 = new UITestObject("9", "10", "11", "12", new UITestObject("1", "1", "1", "1")); obj2.setStringList(new ArrayList<String>()); list1.add(obj2); list1.add(new UITestObject("13", "14", "15", "16", new UITestObject("1", "1", "1", "1"))); list1.add(new UITestObject("17", "18", "19", "20", new UITestObject("1", "1", "1", "1"))); list1.add(new UITestObject("5", "6", "7", "8", new UITestObject("1", "1", "1", "1"))); list1.add(new UITestObject("1", "2", "3", "4", new UITestObject("1", "1", "1", "1"))); list1.add(new UITestObject("9", "10", "11", "12", new UITestObject("1", "1", "1", "1"))); list1.add(new UITestObject("13", "14", "15", "16", new UITestObject("1", "1", "1", "1"))); list1.add(new UITestObject("213", "143", "151", "126", new UITestObject("1", "1", "1", "1"))); list1.add(new UITestObject("133", "144", "155", "156", new UITestObject("1", "1", "1", "1"))); list2.add(new UITestObject("A", "B", "C", "D")); list2.add(new UITestObject("1", "2", "3", "4")); list2.add(new UITestObject("W", "X", "Y", "Z")); list2.add(new UITestObject("a", "b", "c", "d")); list2.add(new UITestObject("a", "s", "d", "f")); list3.add(new UITestObject("A", "B", "C", "D")); list3.get(0).getSubList().add(new UITestObject("A", "B", "C", "D")); list3.get(0).getSubList().add(new UITestObject("1", "2", "3", "4")); list3.get(0).getSubList().add(new UITestObject("W", "X", "Y", "Z")); list3.add(new UITestObject("1", "2", "3", "4")); list3.get(1).getSubList().add(new UITestObject("A", "B", "C", "D")); list3.get(1).getSubList().add(new UITestObject("1", "2", "3", "4")); list3.add(new UITestObject("W", "X", "Y", "Z")); list3.get(2).getSubList().add(new UITestObject("W", "X", "Y", "Z")); list4.add(new UITestObject("A", "B", "C", "D")); list4.get(0).getSubList().add(new UITestObject("1", "B", "C", "D", new UITestObject("1", "1", "1", "1"))); list4.get(0).getSubList().add(new UITestObject("2", "2", "3", "4", new UITestObject("1", "1", "1", "1"))); list4.get(0).getSubList().add(new UITestObject("3", "X", "Y", "Z", new UITestObject("1", "1", "1", "1"))); list4.add(new UITestObject("1", "2", "3", "4")); list4.get(1).getSubList() .add(new UITestObject("4", "b", "C", "D", new UITestObject("$50.00", "1", "1", "1"))); /*list4.get(1).getSubList().add(new UITestObject("5", "s", "D", "F", new UITestObject("1","1","1","1")));*/ //triple nesting list5.add(new UITestObject("a", "a", "a", "a")); list5.get(0).getSubList().add(new UITestObject("A", "B", "C", "D")); list5.get(0).getSubList().get(0).getSubList().add(new UITestObject("a3", "3", "3", "3")); list5.get(0).getSubList().get(0).getSubList().add(new UITestObject("a3", "3", "3", "3")); list5.get(0).getSubList().add(new UITestObject("1", "2", "3", "4")); list5.get(0).getSubList().get(1).getSubList().add(new UITestObject("b3", "3", "3", "3")); list5.get(0).getSubList().get(1).getSubList().add(new UITestObject("b3", "3", "3", "3")); list5.get(0).getSubList().get(1).getSubList().add(new UITestObject("b3", "3", "3", "3")); list5.add(new UITestObject("b", "b", "b", "b")); list5.get(1).getSubList().add(new UITestObject("a", "b", "C", "D")); list5.get(1).getSubList().get(0).getSubList().add(new UITestObject("a23", "3", "3", "3")); list5.get(1).getSubList().get(0).getSubList().add(new UITestObject("a23", "3", "3", "3")); list5.get(1).getSubList().add(new UITestObject("a", "s", "D", "F")); list5.get(1).getSubList().get(1).getSubList().add(new UITestObject("b23", "3", "3", "3")); list5.get(1).getSubList().get(1).getSubList().add(new UITestObject("b23", "3", "3", "3")); groupedList1.add(new UITestObject("A", "100", "200", "300")); groupedList1.add(new UITestObject("A", "101", "200", "300")); groupedList1.add(new UITestObject("A", "102", "200", "300")); groupedList1.add(new UITestObject("A", "103", "200", "300")); groupedList1.add(new UITestObject("A", "104", "200", "300")); groupedList1.add(new UITestObject("B", "100", "200", "300")); groupedList1.add(new UITestObject("B", "101", "200", "300")); groupedList1.add(new UITestObject("B", "102", "200", "300")); groupedList1.add(new UITestObject("C", "100", "200", "300")); groupedList1.add(new UITestObject("C", "101", "200", "300")); groupedList1.add(new UITestObject("C", "102", "200", "300")); groupedList1.add(new UITestObject("C", "103", "200", "300")); groupedList1.add(new UITestObject("D", "100", "200", "300")); groupedList1.add(new UITestObject("D", "101", "200", "300")); groupedList1.add(new UITestObject("D", "102", "200", "300")); groupedList1.add(new UITestObject("D", "103", "200", "300")); groupedList1.add(new UITestObject("D", "100", "200", "300")); groupedList1.add(new UITestObject("D", "101", "200", "300")); groupedList1.add(new UITestObject("D", "102", "200", "300")); groupedList1.add(new UITestObject("D", "103", "200", "300")); groupedList1.add(new UITestObject("D", "100", "200", "300")); groupedList1.add(new UITestObject("D", "101", "200", "300")); groupedList1.add(new UITestObject("D", "102", "200", "300")); groupedList1.add(new UITestObject("D", "103", "200", "300")); groupedList1.add(new UITestObject("D", "100", "200", "300")); groupedList1.add(new UITestObject("D", "101", "200", "300")); groupedList1.add(new UITestObject("D", "102", "200", "300")); groupedList1.add(new UITestObject("D", "103", "200", "300")); groupedList1.add(new UITestObject("D", "100", "200", "300")); groupedList1.add(new UITestObject("D", "101", "200", "300")); groupedList1.add(new UITestObject("D", "102", "200", "300")); groupedList1.add(new UITestObject("D", "103", "200", "300")); groupedList1.add(new UITestObject("D", "100", "200", "300")); groupedList1.add(new UITestObject("D", "101", "200", "300")); groupedList1.add(new UITestObject("D", "102", "200", "300")); groupedList1.add(new UITestObject("D", "103", "200", "300")); groupedList2.addAll(groupedList1); groupedList3.addAll(groupedList1); doubleGroupedList.add(new UITestObject("Fall", "2001", "AAA123", "2")); doubleGroupedList.add(new UITestObject("Fall", "2001", "BBB123", "3")); doubleGroupedList.add(new UITestObject("Fall", "2001", "CCC123", "4")); doubleGroupedList.add(new UITestObject("Fall", "2001", "DDD123", "3")); doubleGroupedList.add(new UITestObject("Fall", "2002", "AAA123", "3")); doubleGroupedList.add(new UITestObject("Fall", "2002", "BBB123", "2")); doubleGroupedList.add(new UITestObject("Fall", "2002", "CCC123", "3")); doubleGroupedList.add(new UITestObject("Fall", "2003", "AAA123", "3")); doubleGroupedList.add(new UITestObject("Fall", "2003", "CCC123", "3")); doubleGroupedList.add(new UITestObject("Spring", "2001", "AAA123", "3")); doubleGroupedList.add(new UITestObject("Spring", "2001", "BBB123", "3")); doubleGroupedList.add(new UITestObject("Spring", "2001", "CCC123", "3")); doubleGroupedList.add(new UITestObject("Spring", "2002", "AAA123", "4")); doubleGroupedList.add(new UITestObject("Spring", "2002", "BBB123", "4")); doubleGroupedList.add(new UITestObject("Spring", "2002", "CCC123", "2")); doubleGroupedList.add(new UITestObject("Spring", "2003", "AAA123", "4")); doubleGroupedList.add(new UITestObject("Spring", "2003", "BBB123", "3")); doubleGroupedList.add(new UITestObject("Spring", "2003", "CCC123", "3")); doubleGroupedList.add(new UITestObject("Spring", "2003", "DDD123", "2")); for (int i = 0; i < 100; i++) { UITestObject newObj = new UITestObject(RandomStringUtils.randomAlphanumeric(6), RandomStringUtils.randomAlphanumeric(6), "a" + i % 10, RandomStringUtils.randomNumeric(1)); if (i % 2 == 0) { newObj.setBfield(true); } list6.add(newObj); } { // scope for name hiding purposes Node<String, String> item1 = new Node<String, String>("Item 1", "Item 1"); item1.addChild(new Node<String, String>("SubItem A", "SubItem A")); item1.addChild(new Node<String, String>("SubItem B", "SubItem B")); Node<String, String> item2 = new Node<String, String>("Item 2", "Item 2"); item2.addChild(new Node<String, String>("SubItem A", "SubItem A")); Node<String, String> sub2B = new Node<String, String>("SubItem B", "SubItem B"); sub2B.addChild(new Node<String, String>("Item B-1", "Item B-1")); sub2B.addChild(new Node<String, String>("Item B-2", "Item B-2")); sub2B.addChild(new Node<String, String>("Item B-3", "Item B-3")); item2.addChild(sub2B); item2.addChild(new Node<String, String>("SubItem C", "SubItem C")); Node<String, String> item3 = new Node<String, String>("Item 3", "Item 3"); item3.addChild(new Node<String, String>("SubItem A", "SubItem A")); item3.addChild(new Node<String, String>("SubItem B", "SubItem B")); item3.addChild(new Node<String, String>("SubItem C", "SubItem C")); item3.addChild(new Node<String, String>("SubItem D", "SubItem D")); Node<String, String> root = new Node<String, String>("Root", "Root"); root.addChild(item1); root.addChild(item2); root.addChild(item3); tree1.setRootElement(root); } { // scope for name hiding purposes Node<UITestObject, String> item1 = new Node<UITestObject, String>( new UITestObject("1-A", "1-B", "1-C", "1-D"), "Item 1"); item1.addChild(new Node<UITestObject, String>(new UITestObject("1SA-A", "1SA-B", "1SA-C", "1SA-D"), "SubItem A")); item1.addChild(new Node<UITestObject, String>(new UITestObject("1SB-A", "1SB-B", "1SB-C", "1SB-D"), "SubItem B")); Node<UITestObject, String> item2 = new Node<UITestObject, String>( new UITestObject("2-A", "2-B", "2-C", "2-D"), "Item 2"); item2.addChild( new Node<UITestObject, String>(new UITestObject("SA-a", "SA-b", "SA-c", "SA-d"), "SubItem A")); Node<UITestObject, String> sub2B = new Node<UITestObject, String>( new UITestObject("SB-a", "SB-b", "SB-c", "SB-d"), "SubItem B"); sub2B.addChild(new Node<UITestObject, String>(new UITestObject("AA", "BB", "CC", "DD"), "Item B-1")); sub2B.addChild(new Node<UITestObject, String>(new UITestObject("Aa", "Bb", "Cc", "Dd"), "Item B-2")); sub2B.addChild(new Node<UITestObject, String>(new UITestObject("aA", "bB", "cC", "dD"), "Item B-3")); item2.addChild(sub2B); item2.addChild( new Node<UITestObject, String>(new UITestObject("SC-a", "SC-b", "SC-c", "SC-d"), "SubItem C")); Node<UITestObject, String> item3 = new Node<UITestObject, String>( new UITestObject("3-A", "3-B", "3-C", "3-D"), "Item 3"); item3.addChild(new Node<UITestObject, String>(new UITestObject("A", "B", "C", "D"), "SubItem A")); item3.addChild(new Node<UITestObject, String>(new UITestObject("1", "2", "3", "4"), "SubItem B")); item3.addChild(new Node<UITestObject, String>(new UITestObject("w", "x", "y", "z"), "SubItem C")); item3.addChild(new Node<UITestObject, String>(new UITestObject("!", "@", "#", "$"), "SubItem D")); Node<UITestObject, String> root = new Node<UITestObject, String>( new UITestObject("foo", "bar", "baz", "roo"), "Root"); root.addChild(item1); root.addChild(item2); root.addChild(item3); tree2.setRootElement(root); } remoteFieldValuesMap = new HashMap<String, Object>(); remoteFieldValuesMap.put("remoteField1", "Apple"); remoteFieldValuesMap.put("remoteField2", "Banana"); remoteFieldValuesMap.put("remoteField3", true); remoteFieldValuesMap.put("remoteField4", "Fruit"); remoteFieldValuesMap2 = new HashMap<String, Object>(); remoteFieldValuesMap2.put("remoteField1", "Apple"); remoteFieldValuesMap2.put("remoteField2", "Banana"); remoteFieldValuesMap2.put("remoteField3", true); remoteFieldValuesMap2.put("remoteField4", "Fruit"); field88 = "Fruits"; field91 = "Read only value"; field92 = "Value 92"; field131 = new Integer(0); DateFormat dateFormat = SimpleDateFormat.getDateInstance(SimpleDateFormat.SHORT); dateList = new ArrayList<Date>(); try { dateList.add(dateFormat.parse("01/01/1990")); dateList.add(dateFormat.parse("10/31/2001")); dateList.add(dateFormat.parse("11/05/2005")); dateList.add(dateFormat.parse("02/13/2011")); } catch (Exception e) { } labsRoleMember = new LabsRoleMember(); }
From source file:org.kuali.rice.krad.labs.transaction.TransactionModel.java
public TransactionModel() { this.id = RandomStringUtils.randomAlphanumeric(4); this.accountId = RandomStringUtils.randomAlphanumeric(4); this.transactionDisplayType = "type" + RandomStringUtils.randomNumeric(2); }
From source file:org.kuali.rice.krad.service.DocumentServiceTest.java
/** * Test getting notes via getNotes, which will call getNoteService().getByRemoteObjectId * * @throws Exception for any test issues *//*from ww w. jav a 2 s .co m*/ @Test public void testGetNotes() throws Exception { AccountRequestDocument2 accountDoc2 = (AccountRequestDocument2) KRADServiceLocatorWeb.getDocumentService() .getNewDocument("AccountRequest2"); String remoteObjectId = "remoteObjectId" + RandomStringUtils.randomNumeric(5); String noteText = "i like notes"; WorkflowDocument workflowDocument = WorkflowDocumentFactory.createDocument("admin", "AccountRequest2"); DocumentHeader documentHeader = new DocumentHeader(); documentHeader.setWorkflowDocument(workflowDocument); documentHeader.setDocumentNumber(workflowDocument.getDocumentId()); documentHeader.setObjectId(remoteObjectId); accountDoc2.setDocumentHeader(documentHeader); Note note = new Note(); note.setAuthorUniversalIdentifier("superLongNameUsersFromWorkflow"); note.setNotePostedTimestamp(CoreApiServiceLocator.getDateTimeService().getCurrentTimestamp()); note.setNoteText(noteText); note.setRemoteObjectIdentifier(remoteObjectId); note.setNoteTypeCode(NoteType.BUSINESS_OBJECT.getCode()); try { KRADServiceLocator.getNoteService().save(note); } catch (Exception e) { fail("Saving a note should not fail"); } Note note2 = new Note(); note2.setAuthorUniversalIdentifier("admin"); note2.setNotePostedTimestamp(CoreApiServiceLocator.getDateTimeService().getCurrentTimestamp()); note2.setNoteText(noteText); note2.setRemoteObjectIdentifier(remoteObjectId); note2.setNoteTypeCode(NoteType.BUSINESS_OBJECT.getCode()); try { KRADServiceLocator.getNoteService().save(note2); } catch (Exception e) { fail("Saving a note should not fail"); } List<Note> notes = accountDoc2.getNotes(); assertTrue("Size of the notes list should be 2", notes.size() == 2); assertFalse("List is immutable but it should be mutable.", Collections.unmodifiableList(notes).getClass().isInstance(notes)); for (Note note1 : notes) { assertNotNull("document was null", note1); assertTrue(note1.getNoteText().equalsIgnoreCase(noteText)); } }
From source file:org.kuali.rice.testtools.selenium.WebDriverLegacyITBase.java
protected void testAddingBrownGroup() throws Exception { selectFrameIframePortlet();//from w ww . j a va2 s .co m waitAndCreateNew(); String docId = waitForDocId(); String random = RandomStringUtils.randomNumeric(4); String organizationDocumentNumber = "ORD" + random; String groupDescription = "GD" + random; String groupName = "BrownGroup " + AutomatedFunctionalTestUtils.createUniqueDtsPlusTwoRandomChars(); String nameSpace = "KR-IDM"; String today = getDateToday(); Calendar nextYearCal = Calendar.getInstance(); nextYearCal.add(Calendar.YEAR, 1); SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy"); String nextYear = sdf.format(nextYearCal.getTime()); //Enter details for BrownGroup. waitAndTypeByName("document.documentHeader.documentDescription", "Adding Brown Group"); waitAndTypeByName("document.documentHeader.explanation", "I want to add Brown Group to test KIM"); waitAndTypeByName("document.documentHeader.organizationDocumentNumber", organizationDocumentNumber); selectOptionByName("document.groupNamespace", nameSpace); waitAndTypeByName("document.groupName", groupName); waitAndTypeByName("document.groupDescription", groupDescription); checkByName("document.active"); waitAndClickByXpath(SAVE_XPATH_2); waitForTextPresent("Document was successfully saved."); }