use of it.vige.rubia.model.Poster in project rubia-forums by flashboss.
the class VerifyProfile method verifyProfile.
public static Poster verifyProfile(WebDriver driver, String userId) {
Poster poster = new Poster(userId);
WebElement postCount = driver.findElement(className(POST_COUNT)).findElement(xpath("tbody/tr[3]/td[2]"));
int count = new Integer(postCount.getText().trim());
for (int i = 0; i < count; i++) poster.incrementPostCount();
return poster;
}
use of it.vige.rubia.model.Poster in project rubia-forums by flashboss.
the class VerifyPost method getPostsOfCurrentTopic.
public static List<Post> getPostsOfCurrentTopic(WebDriver driver) {
List<WebElement> postComponents = driver.findElements(className(BODY_OUTPUT_TEXT));
int postComponentsSize = postComponents.size();
List<Post> posts = new ArrayList<Post>();
for (int i = 0; i < postComponentsSize; i++) {
Post post = new Post();
WebElement postComponent = driver.findElements(className(BODY_OUTPUT_TEXT)).get(i);
String body = postComponent.findElement(xpath("p")).getText();
String post_subject = postComponent.findElement(xpath(POST_SUBJECT_OUTPUT_TEXT)).getText().split(POST_SUBJECT_TEXT)[1];
String createDateStr = postComponent.findElement(xpath(CREATE_DATE_OUTPUT_TEXT)).getText().split(CREATE_DATE_TEXT)[1];
Date createDate = null;
try {
createDate = dateFormat.parse(createDateStr);
} catch (ParseException e) {
log.error(e);
}
Message message = new Message();
message.setSubject(post_subject);
message.setText(body);
post.setMessage(message);
post.setCreateDate(createDate);
WebElement topicEl = driver.findElement(TOPIC_TEMPLATE_LINK.getValue());
Topic topic = new Topic(topicEl.getText());
post.setTopic(topic);
WebElement forumEl = driver.findElement(FORUM_TEMPLATE_LINK.getValue());
topic.setForum(new Forum(forumEl.getText()));
post.setAttachments(getAttachmentsOfCurrentPostInPage(driver, post));
addParents(driver, post);
Poster poster = new Poster();
postComponent = driver.findElements(className(BODY_OUTPUT_TEXT)).get(i);
poster.setUserId(postComponent.findElement(xpath(USER_LINK)).getText());
post.setPoster(poster);
posts.add(post);
}
return posts;
}
use of it.vige.rubia.model.Poster in project rubia-forums by flashboss.
the class VerifyPost method getPosterFromLink.
public static Poster getPosterFromLink(WebDriver driver, Post post) {
WebElement profileLink = driver.findElements(className(FORUM_TABLE)).get(1).findElement(xpath("tbody/tr/td/p[contains(text(),'" + post.getMessage().getText() + "')]")).findElement(xpath("../../../tr/td/a"));
String userId = profileLink.getText();
profileLink.click();
Poster poster = verifyProfile(driver, userId);
return poster;
}
use of it.vige.rubia.model.Poster in project rubia-forums by flashboss.
the class VerifyPost method getPosterFromButton.
public static Poster getPosterFromButton(WebDriver driver, Post post) {
WebElement profileLink = driver.findElements(className(FORUM_TABLE)).get(1).findElement(xpath("tbody/tr/td/p[contains(text(),'" + post.getMessage().getText() + "')]")).findElement(xpath("../../../tr/td"));
String userId = profileLink.getText();
WebElement button = driver.findElements(className(FORUM_TABLE)).get(1).findElement(xpath("tbody/tr/td/p[contains(text(),'" + post.getMessage().getText() + "')]")).findElement(xpath("../../../tr[3]/td[2]/ul/li/a"));
button.click();
Poster poster = verifyProfile(driver, userId);
return poster;
}
use of it.vige.rubia.model.Poster in project rubia-forums by flashboss.
the class ReplyTopic method startQuote.
/**
* @return the navigation state of the application
*/
@SecureActionForum
@Interceptors(AuthorizationListener.class)
public String startQuote() {
String navState = start();
try {
String p = getParameter(p_postId);
if (p != null && p.trim().length() > 0) {
postId = parseInt(p);
}
// setup the quote information
Post post = forumsModule.findPostById(postId);
Poster poster = getPoster(forumsModule, userModule);
String userName = userModule.findUserById(poster.getUserId()).getUserName();
message = userName + "<" + QUOTE + ">" + post.getMessage().getText() + "</" + QUOTE + "></br>";
} catch (Exception e) {
handleException(e);
}
return navState;
}
Aggregations