Search in sources :

Example 16 with Message

use of it.vige.rubia.model.Message in project rubia-forums by flashboss.

the class ViewRSSLink method getPage.

public static Topic getPage(WebDriver driver, Topic topic) {
    VerifyTopic.goTo(driver, topic);
    goTo(driver);
    Topic result = new Topic();
    result.setSubject(driver.findElement(id(FEED_TITLE_TEXT)).getText().split(": ")[1]);
    String[] splittedText = driver.findElement(id(FEED_SUBTITLE_TEXT)).getText().split(" in topic | in forum | in category ");
    result.setForum(new Forum(splittedText[2]));
    result.getForum().setCategory(new Category(splittedText[3]));
    List<Post> posts = new ArrayList<Post>();
    List<WebElement> entries = driver.findElements(className(ENTRY_LINK));
    DateFormat dateFormat = new SimpleDateFormat("d MMM yyyy, HH:mm");
    for (WebElement entry : entries) {
        String[] entryText = entry.getText().split(BY);
        String lastUpdated = entry.findElement(className(LAST_UPDATED)).getText();
        Post post = new Post(entryText[0]);
        post.setPoster(new Poster(entryText[1].split("\n")[0]));
        try {
            post.setCreateDate(dateFormat.parse(lastUpdated));
        } catch (ParseException e) {
        }
        post.setMessage(new Message(entry.findElement(className(FEED_ENTRY_CONTENT)).getText()));
        post.getMessage().setSubject(entryText[0]);
        posts.add(post);
    }
    result.setPosts(posts);
    returnToHome(driver);
    return result;
}
Also used : Category(it.vige.rubia.model.Category) Message(it.vige.rubia.model.Message) Post(it.vige.rubia.model.Post) ArrayList(java.util.ArrayList) WebElement(org.openqa.selenium.WebElement) Forum(it.vige.rubia.model.Forum) VerifyForum(it.vige.rubia.selenium.forum.action.VerifyForum) SimpleDateFormat(java.text.SimpleDateFormat) DateFormat(java.text.DateFormat) Poster(it.vige.rubia.model.Poster) ParseException(java.text.ParseException) VerifyTopic(it.vige.rubia.selenium.forum.action.VerifyTopic) Topic(it.vige.rubia.model.Topic) SimpleDateFormat(java.text.SimpleDateFormat)

Aggregations

Message (it.vige.rubia.model.Message)16 Post (it.vige.rubia.model.Post)14 Poster (it.vige.rubia.model.Poster)11 Topic (it.vige.rubia.model.Topic)9 Forum (it.vige.rubia.model.Forum)7 ParseException (java.text.ParseException)6 Date (java.util.Date)6 Test (org.junit.Test)6 ViewAllForumsSelectPost (it.vige.rubia.selenium.myforums.action.ViewAllForumsSelectPost)4 WebElement (org.openqa.selenium.WebElement)4 PortalUtil.createMessage (it.vige.rubia.PortalUtil.createMessage)3 SecureActionForum (it.vige.rubia.auth.SecureActionForum)3 Category (it.vige.rubia.model.Category)3 Poll (it.vige.rubia.model.Poll)3 CreateTopic.createTopic (it.vige.rubia.selenium.forum.action.CreateTopic.createTopic)3 RemoveTopic.removeTopic (it.vige.rubia.selenium.forum.action.RemoveTopic.removeTopic)3 VerifyTopic (it.vige.rubia.selenium.forum.action.VerifyTopic)3 JSFUtil.handleException (it.vige.rubia.ui.JSFUtil.handleException)3 ArrayList (java.util.ArrayList)3 PortalUtil.createPoll (it.vige.rubia.PortalUtil.createPoll)2