Search in sources :

Example 61 with Forum

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

the class PreferencesTest method scenary1.

public void scenary1() {
    Category firstTestCategory = new Category("First Test Category");
    Category secondTestCategory = new Category("Second Test Category");
    goTo(driver);
    PreferenceController submitCriteria = new PreferenceController();
    submitCriteria.setAlwaysAddSignature(true);
    submitCriteria.setAlwaysAllowHtml(true);
    submitCriteria.setNotifyOnReply(true);
    submitCriteria.setPostOrder("descending");
    submitCriteria.setPostsPerTopic(25);
    submitCriteria.setSignature("My New Signature");
    submitCriteria.setSummaryMode(BLOCK_TOPICS_MODE_HOT_TOPICS);
    submitCriteria.setSummaryTopicDays(2);
    submitCriteria.setSummaryTopicLimit(3);
    submitCriteria.setSummaryTopicReplies(4);
    submitCriteria.setTopicsPerForum(5);
    submit(driver, submitCriteria);
    List<Topic> summaryTopics = viewSummary(driver);
    int sizeSummaryTopics = viewSize(driver);
    Topic summaryTopicDetail = getDetail(driver, "Ninteen Test Topic");
    assertTrue(summaryTopics != null);
    assertEquals(1, summaryTopics.size());
    assertEquals(1, sizeSummaryTopics);
    assertEquals("Ninteen Test Topic", summaryTopics.get(0).getSubject());
    assertEquals("Ninteen Test Topic", summaryTopicDetail.getSubject());
    Topic newTopic = new Topic(new Forum("Third Test Forum", "Third Test Description", new Category("Second Test Category")), "Thirtytwo Test Topic", asList(new Post[] { new Post("Thirtytwo Test Body") }), NORMAL, null);
    String message = createTopic(driver, newTopic);
    assertTrue(message.equals("Thirtytwo Test Topic"));
    List<Forum> forums = getForumsOfCategories(driver, firstTestCategory, secondTestCategory);
    Date today = new Date();
    List<Topic> topics = getTopicsOfForums(driver, forums.toArray(new Forum[0]));
    assertTrue(topics != null);
    assertEquals(19, topics.size());
    assertEquals("Ninteen Test Topic", topics.get(0).getSubject());
    assertEquals("root", topics.get(0).getPoster().getUserId());
    assertEquals(32, topics.get(0).getReplies());
    assertEquals(98, topics.get(0).getViewCount());
    assertTrue(topics.get(0).getLastPostDate().compareTo(today) < 0);
    assertEquals(25, topics.get(0).getPosts().size());
    assertTrue(topics.get(0).getPosts().get(0).getMessage().getSubject().startsWith(RE + "Ninteen Test Topic"));
    assertEquals("<ul><li>Ninteen35</li><li>Test Body</li></ul>", topics.get(0).getPosts().get(0).getMessage().getText());
    assertTrue(topics.get(0).getPosts().get(0).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(0).getPosts().get(0).getPoster().getUserId());
    assertTrue(topics.get(0).getPosts().get(1).getMessage().getSubject().startsWith(RE + "Ninteen Test Topic"));
    assertEquals("<ul><li>Ninteen34</li><li>Test Body</li></ul>", topics.get(0).getPosts().get(1).getMessage().getText());
    assertTrue(topics.get(0).getPosts().get(1).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(0).getPosts().get(1).getPoster().getUserId());
    assertTrue(topics.get(0).getPosts().get(2).getMessage().getSubject().startsWith(RE + "Ninteen Test Topic"));
    assertEquals("<ul><li>Ninteen33</li><li>Test Body</li></ul>", topics.get(0).getPosts().get(2).getMessage().getText());
    assertTrue(topics.get(0).getPosts().get(2).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(0).getPosts().get(2).getPoster().getUserId());
    assertTrue(topics.get(0).getPosts().get(3).getMessage().getSubject().startsWith(RE + "Ninteen Test Topic"));
    assertEquals("<ul><li>Ninteen32</li><li>Test Body</li></ul>", topics.get(0).getPosts().get(3).getMessage().getText());
    assertTrue(topics.get(0).getPosts().get(3).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(0).getPosts().get(3).getPoster().getUserId());
    assertTrue(topics.get(0).getPosts().get(4).getMessage().getSubject().startsWith(RE + "Ninteen Test Topic"));
    assertEquals("<ul><li>Ninteen31</li><li>Test Body</li></ul>", topics.get(0).getPosts().get(4).getMessage().getText());
    assertTrue(topics.get(0).getPosts().get(4).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(0).getPosts().get(4).getPoster().getUserId());
    assertTrue(topics.get(0).getPosts().get(5).getMessage().getSubject().startsWith(RE + "Ninteen Test Topic"));
    assertEquals("<ul><li>Ninteen30</li><li>Test Body</li></ul>", topics.get(0).getPosts().get(5).getMessage().getText());
    assertTrue(topics.get(0).getPosts().get(5).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(0).getPosts().get(5).getPoster().getUserId());
    assertTrue(topics.get(0).getPosts().get(6).getMessage().getSubject().startsWith(RE + "Ninteen Test Topic"));
    assertEquals("<ul><li>Ninteen29</li><li>Test Body</li></ul>", topics.get(0).getPosts().get(6).getMessage().getText());
    assertTrue(topics.get(0).getPosts().get(6).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(0).getPosts().get(6).getPoster().getUserId());
    assertTrue(topics.get(0).getPosts().get(7).getMessage().getSubject().startsWith(RE + "Ninteen Test Topic"));
    assertEquals("<ul><li>Ninteen28</li><li>Test Body</li></ul>", topics.get(0).getPosts().get(7).getMessage().getText());
    assertTrue(topics.get(0).getPosts().get(7).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(0).getPosts().get(7).getPoster().getUserId());
    assertTrue(topics.get(0).getPosts().get(8).getMessage().getSubject().startsWith(RE + "Ninteen Test Topic"));
    assertEquals("<ul><li>Ninteen27</li><li>Test Body</li></ul>", topics.get(0).getPosts().get(8).getMessage().getText());
    assertTrue(topics.get(0).getPosts().get(8).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(0).getPosts().get(8).getPoster().getUserId());
    assertTrue(topics.get(0).getPosts().get(9).getMessage().getSubject().startsWith(RE + "Ninteen Test Topic"));
    assertEquals("<ul><li>Ninteen26</li><li>Test Body</li></ul>", topics.get(0).getPosts().get(9).getMessage().getText());
    assertTrue(topics.get(0).getPosts().get(9).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(0).getPosts().get(9).getPoster().getUserId());
    assertTrue(topics.get(0).getPosts().get(10).getMessage().getSubject().startsWith(RE + "Ninteen Test Topic"));
    assertEquals("<ul><li>Ninteen25</li><li>Test Body</li></ul>", topics.get(0).getPosts().get(10).getMessage().getText());
    assertTrue(topics.get(0).getPosts().get(10).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(0).getPosts().get(10).getPoster().getUserId());
    assertTrue(topics.get(0).getPosts().get(11).getMessage().getSubject().startsWith(RE + "Ninteen Test Topic"));
    assertEquals("<ul><li>Ninteen24</li><li>Test Body</li></ul>", topics.get(0).getPosts().get(11).getMessage().getText());
    assertTrue(topics.get(0).getPosts().get(11).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(0).getPosts().get(11).getPoster().getUserId());
    assertTrue(topics.get(0).getPosts().get(12).getMessage().getSubject().startsWith(RE + "Ninteen Test Topic"));
    assertEquals("<ul><li>Ninteen23</li><li>Test Body</li></ul>", topics.get(0).getPosts().get(12).getMessage().getText());
    assertTrue(topics.get(0).getPosts().get(12).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(0).getPosts().get(12).getPoster().getUserId());
    assertTrue(topics.get(0).getPosts().get(13).getMessage().getSubject().startsWith(RE + "Ninteen Test Topic"));
    assertEquals("<ul><li>Ninteen22</li><li>Test Body</li></ul>", topics.get(0).getPosts().get(13).getMessage().getText());
    assertTrue(topics.get(0).getPosts().get(13).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(0).getPosts().get(13).getPoster().getUserId());
    assertTrue(topics.get(0).getPosts().get(14).getMessage().getSubject().startsWith(RE + "Ninteen Test Topic"));
    assertEquals("<ul><li>Ninteen21</li><li>Test Body</li></ul>", topics.get(0).getPosts().get(14).getMessage().getText());
    assertTrue(topics.get(0).getPosts().get(14).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(0).getPosts().get(14).getPoster().getUserId());
    assertTrue(topics.get(0).getPosts().get(15).getMessage().getSubject().startsWith(RE + "Ninteen Test Topic"));
    assertEquals("<ul><li>Ninteen20</li><li>Test Body</li></ul>", topics.get(0).getPosts().get(15).getMessage().getText());
    assertTrue(topics.get(0).getPosts().get(15).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(0).getPosts().get(15).getPoster().getUserId());
    assertTrue(topics.get(0).getPosts().get(16).getMessage().getSubject().startsWith(RE + "Ninteen Test Topic"));
    assertEquals("<ul><li>Ninteen19</li><li>Test Body</li></ul>", topics.get(0).getPosts().get(16).getMessage().getText());
    assertTrue(topics.get(0).getPosts().get(16).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(0).getPosts().get(16).getPoster().getUserId());
    assertTrue(topics.get(0).getPosts().get(17).getMessage().getSubject().startsWith(RE + "Ninteen Test Topic"));
    assertEquals("<ul><li>Ninteen18</li><li>Test Body</li></ul>", topics.get(0).getPosts().get(17).getMessage().getText());
    assertTrue(topics.get(0).getPosts().get(17).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(0).getPosts().get(17).getPoster().getUserId());
    assertTrue(topics.get(0).getPosts().get(18).getMessage().getSubject().startsWith(RE + "Ninteen Test Topic"));
    assertEquals("<ul><li>Ninteen17</li><li>Test Body</li></ul>", topics.get(0).getPosts().get(18).getMessage().getText());
    assertTrue(topics.get(0).getPosts().get(18).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(0).getPosts().get(18).getPoster().getUserId());
    assertTrue(topics.get(0).getPosts().get(19).getMessage().getSubject().startsWith(RE + "Ninteen Test Topic"));
    assertEquals("<ul><li>Ninteen16</li><li>Test Body</li></ul>", topics.get(0).getPosts().get(19).getMessage().getText());
    assertTrue(topics.get(0).getPosts().get(19).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(0).getPosts().get(19).getPoster().getUserId());
    assertTrue(topics.get(0).getPosts().get(20).getMessage().getSubject().startsWith(RE + "Ninteen Test Topic"));
    assertEquals("<ul><li>Ninteen15</li><li>Test Body</li></ul>", topics.get(0).getPosts().get(20).getMessage().getText());
    assertTrue(topics.get(0).getPosts().get(20).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(0).getPosts().get(20).getPoster().getUserId());
    assertTrue(topics.get(0).getPosts().get(21).getMessage().getSubject().startsWith(RE + "Ninteen Test Topic"));
    assertEquals("<ul><li>Ninteen14</li><li>Test Body</li></ul>", topics.get(0).getPosts().get(21).getMessage().getText());
    assertTrue(topics.get(0).getPosts().get(21).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(0).getPosts().get(21).getPoster().getUserId());
    assertTrue(topics.get(0).getPosts().get(22).getMessage().getSubject().startsWith(RE + "Ninteen Test Topic"));
    assertEquals("<ul><li>Ninteen13</li><li>Test Body</li></ul>", topics.get(0).getPosts().get(22).getMessage().getText());
    assertTrue(topics.get(0).getPosts().get(22).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(0).getPosts().get(22).getPoster().getUserId());
    assertTrue(topics.get(0).getPosts().get(23).getMessage().getSubject().startsWith(RE + "Ninteen Test Topic"));
    assertEquals("<ul><li>Ninteen12</li><li>Test Body</li></ul>", topics.get(0).getPosts().get(23).getMessage().getText());
    assertTrue(topics.get(0).getPosts().get(23).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(0).getPosts().get(23).getPoster().getUserId());
    assertTrue(topics.get(0).getPosts().get(24).getMessage().getSubject().startsWith(RE + "Ninteen Test Topic"));
    assertEquals("<ul><li>Ninteen11</li><li>Test Body</li></ul>", topics.get(0).getPosts().get(24).getMessage().getText());
    assertTrue(topics.get(0).getPosts().get(24).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(0).getPosts().get(24).getPoster().getUserId());
    assertEquals("Eighteen Test Topic", topics.get(1).getSubject());
    assertEquals("root", topics.get(1).getPoster().getUserId());
    assertEquals(0, topics.get(1).getReplies());
    assertEquals(0, topics.get(1).getViewCount());
    assertTrue(topics.get(1).getLastPostDate().compareTo(today) < 0);
    assertEquals(1, topics.get(1).getPosts().size());
    assertTrue(topics.get(1).getPosts().get(0).getMessage().getSubject().startsWith("Eighteen Test Topic"));
    assertTrue(topics.get(1).getPosts().get(0).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(1).getPosts().get(0).getPoster().getUserId());
    assertEquals("Seventeen Test Topic", topics.get(2).getSubject());
    assertEquals("root", topics.get(2).getPoster().getUserId());
    assertEquals(0, topics.get(2).getReplies());
    assertEquals(0, topics.get(2).getViewCount());
    assertTrue(topics.get(2).getLastPostDate().compareTo(today) < 0);
    assertEquals(1, topics.get(2).getPosts().size());
    assertTrue(topics.get(2).getPosts().get(0).getMessage().getSubject().startsWith("Seventeen Test Topic"));
    assertTrue(topics.get(2).getPosts().get(0).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(2).getPosts().get(0).getPoster().getUserId());
    assertEquals("Sixteen Test Topic", topics.get(3).getSubject());
    assertEquals("root", topics.get(3).getPoster().getUserId());
    assertEquals(0, topics.get(3).getReplies());
    assertEquals(0, topics.get(3).getViewCount());
    assertTrue(topics.get(3).getLastPostDate().compareTo(today) < 0);
    assertEquals(1, topics.get(3).getPosts().size());
    assertTrue(topics.get(3).getPosts().get(0).getMessage().getSubject().startsWith("Sixteen Test Topic"));
    assertTrue(topics.get(3).getPosts().get(0).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(3).getPosts().get(0).getPoster().getUserId());
    assertEquals("Fifteen Test Topic", topics.get(4).getSubject());
    assertEquals("root", topics.get(4).getPoster().getUserId());
    assertEquals(0, topics.get(4).getReplies());
    assertEquals(0, topics.get(4).getViewCount());
    assertTrue(topics.get(4).getLastPostDate().compareTo(today) < 0);
    assertEquals(1, topics.get(4).getPosts().size());
    assertTrue(topics.get(4).getPosts().get(0).getMessage().getSubject().startsWith("Fifteen Test Topic"));
    assertTrue(topics.get(4).getPosts().get(0).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(4).getPosts().get(0).getPoster().getUserId());
    assertEquals("Fourteen Test Topic", topics.get(5).getSubject());
    assertEquals("root", topics.get(5).getPoster().getUserId());
    assertEquals(0, topics.get(5).getReplies());
    assertEquals(0, topics.get(5).getViewCount());
    assertTrue(topics.get(5).getLastPostDate().compareTo(today) < 0);
    assertEquals(1, topics.get(5).getPosts().size());
    assertTrue(topics.get(5).getPosts().get(0).getMessage().getSubject().startsWith("Fourteen Test Topic"));
    assertTrue(topics.get(5).getPosts().get(0).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(5).getPosts().get(0).getPoster().getUserId());
    assertEquals("Thirteen Test Topic", topics.get(6).getSubject());
    assertEquals("root", topics.get(6).getPoster().getUserId());
    assertEquals(0, topics.get(6).getReplies());
    assertEquals(0, topics.get(6).getViewCount());
    assertTrue(topics.get(6).getLastPostDate().compareTo(today) < 0);
    assertEquals(1, topics.get(6).getPosts().size());
    assertTrue(topics.get(6).getPosts().get(0).getMessage().getSubject().startsWith("Thirteen Test Topic"));
    assertTrue(topics.get(6).getPosts().get(0).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(6).getPosts().get(0).getPoster().getUserId());
    assertEquals("Twelve Test Topic", topics.get(7).getSubject());
    assertEquals("root", topics.get(7).getPoster().getUserId());
    assertEquals(0, topics.get(7).getReplies());
    assertEquals(0, topics.get(7).getViewCount());
    assertTrue(topics.get(7).getLastPostDate().compareTo(today) < 0);
    assertEquals(1, topics.get(7).getPosts().size());
    assertTrue(topics.get(7).getPosts().get(0).getMessage().getSubject().startsWith("Twelve Test Topic"));
    assertTrue(topics.get(7).getPosts().get(0).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(7).getPosts().get(0).getPoster().getUserId());
    assertEquals("Eleven Test Topic", topics.get(8).getSubject());
    assertEquals("root", topics.get(8).getPoster().getUserId());
    assertEquals(0, topics.get(8).getReplies());
    assertEquals(0, topics.get(8).getViewCount());
    assertTrue(topics.get(8).getLastPostDate().compareTo(today) < 0);
    assertEquals(1, topics.get(8).getPosts().size());
    assertTrue(topics.get(8).getPosts().get(0).getMessage().getSubject().startsWith("Eleven Test Topic"));
    assertTrue(topics.get(8).getPosts().get(0).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(8).getPosts().get(0).getPoster().getUserId());
    assertEquals("Ten Test Topic", topics.get(9).getSubject());
    assertEquals("root", topics.get(9).getPoster().getUserId());
    assertEquals(0, topics.get(9).getReplies());
    assertEquals(0, topics.get(9).getViewCount());
    assertTrue(topics.get(9).getLastPostDate().compareTo(today) < 0);
    assertEquals(1, topics.get(9).getPosts().size());
    assertTrue(topics.get(9).getPosts().get(0).getMessage().getSubject().startsWith("Ten Test Topic"));
    assertTrue(topics.get(9).getPosts().get(0).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(9).getPosts().get(0).getPoster().getUserId());
    assertEquals("Second Test Topic", topics.get(10).getSubject());
    assertEquals("root", topics.get(10).getPoster().getUserId());
    assertEquals(0, topics.get(10).getReplies());
    assertEquals(0, topics.get(10).getViewCount());
    assertTrue(topics.get(10).getLastPostDate().compareTo(today) < 0);
    assertEquals(1, topics.get(10).getPosts().size());
    assertTrue(topics.get(10).getPosts().get(0).getMessage().getSubject().startsWith("Second Test Topic"));
    assertTrue(topics.get(10).getPosts().get(0).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(10).getPosts().get(0).getPoster().getUserId());
    assertEquals("Thirtyone Test Topic", topics.get(11).getSubject());
    assertEquals("root", topics.get(11).getPoster().getUserId());
    assertEquals(0, topics.get(11).getReplies());
    assertEquals(0, topics.get(11).getViewCount());
    assertTrue(topics.get(11).getLastPostDate().compareTo(today) < 0);
    assertEquals(1, topics.get(11).getPosts().size());
    assertTrue(topics.get(11).getPosts().get(0).getMessage().getSubject().startsWith("Thirtyone Test Topic"));
    assertTrue(topics.get(11).getPosts().get(0).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(11).getPosts().get(0).getPoster().getUserId());
    assertEquals("Thirty Test Topic", topics.get(12).getSubject());
    assertEquals("root", topics.get(12).getPoster().getUserId());
    assertEquals(0, topics.get(12).getReplies());
    assertEquals(0, topics.get(12).getViewCount());
    assertTrue(topics.get(12).getLastPostDate().compareTo(today) < 0);
    assertEquals(1, topics.get(12).getPosts().size());
    assertTrue(topics.get(12).getPosts().get(0).getMessage().getSubject().startsWith("Thirty Test Topic"));
    assertTrue(topics.get(12).getPosts().get(0).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(12).getPosts().get(0).getPoster().getUserId());
    assertEquals("Twentynine Test Topic", topics.get(13).getSubject());
    assertEquals("root", topics.get(13).getPoster().getUserId());
    assertEquals(0, topics.get(13).getReplies());
    assertEquals(0, topics.get(13).getViewCount());
    assertTrue(topics.get(13).getLastPostDate().compareTo(today) < 0);
    assertEquals(1, topics.get(13).getPosts().size());
    assertTrue(topics.get(13).getPosts().get(0).getMessage().getSubject().startsWith("Twentynine Test Topic"));
    assertTrue(topics.get(13).getPosts().get(0).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(13).getPosts().get(0).getPoster().getUserId());
    assertEquals("Twentyeight Test Topic", topics.get(14).getSubject());
    assertEquals("root", topics.get(14).getPoster().getUserId());
    assertEquals(0, topics.get(14).getReplies());
    assertEquals(0, topics.get(14).getViewCount());
    assertTrue(topics.get(14).getLastPostDate().compareTo(today) < 0);
    assertEquals(1, topics.get(14).getPosts().size());
    assertTrue(topics.get(14).getPosts().get(0).getMessage().getSubject().startsWith("Twentyeight Test Topic"));
    assertTrue(topics.get(14).getPosts().get(0).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(14).getPosts().get(0).getPoster().getUserId());
    assertEquals("Twentyseven Test Topic", topics.get(15).getSubject());
    assertEquals("root", topics.get(15).getPoster().getUserId());
    assertEquals(0, topics.get(15).getReplies());
    assertEquals(0, topics.get(15).getViewCount());
    assertTrue(topics.get(15).getLastPostDate().compareTo(today) < 0);
    assertEquals(1, topics.get(15).getPosts().size());
    assertTrue(topics.get(15).getPosts().get(0).getMessage().getSubject().startsWith("Twentyseven Test Topic"));
    assertTrue(topics.get(15).getPosts().get(0).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(15).getPosts().get(0).getPoster().getUserId());
    assertEquals("Third Test Topic", topics.get(16).getSubject());
    assertEquals("root", topics.get(16).getPoster().getUserId());
    assertEquals(0, topics.get(16).getReplies());
    assertEquals(0, topics.get(16).getViewCount());
    assertTrue(topics.get(16).getLastPostDate().compareTo(today) < 0);
    assertEquals(1, topics.get(16).getPosts().size());
    assertTrue(topics.get(16).getPosts().get(0).getMessage().getSubject().startsWith("Third Test Topic"));
    assertTrue(topics.get(16).getPosts().get(0).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(16).getPosts().get(0).getPoster().getUserId());
    assertEquals("Fourth Test Topic", topics.get(17).getSubject());
    assertEquals("root", topics.get(17).getPoster().getUserId());
    assertEquals(0, topics.get(17).getReplies());
    assertEquals(0, topics.get(17).getViewCount());
    assertTrue(topics.get(17).getLastPostDate().compareTo(today) < 0);
    assertEquals(1, topics.get(17).getPosts().size());
    assertTrue(topics.get(17).getPosts().get(0).getMessage().getSubject().startsWith("Fourth Test Topic"));
    assertTrue(topics.get(17).getPosts().get(0).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(17).getPosts().get(0).getPoster().getUserId());
    assertEquals("Thirtytwo Test Topic", topics.get(18).getSubject());
    assertEquals("root", topics.get(18).getPoster().getUserId());
    assertEquals(0, topics.get(18).getReplies());
    assertEquals(0, topics.get(18).getViewCount());
    assertTrue(topics.get(18).getLastPostDate().compareTo(today) < 0);
    assertEquals(1, topics.get(18).getPosts().size());
    assertTrue(topics.get(18).getPosts().get(0).getMessage().getSubject().startsWith("Thirtytwo Test Topic"));
    assertTrue(topics.get(18).getPosts().get(0).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(18).getPosts().get(0).getPoster().getUserId());
    message = removeTopic(driver, new Topic(new Forum("Third Test Forum", "Third Test Description", new Category("Second Test Category")), "Thirtytwo Test Topic", asList(new Post[] { new Post("Thirtytwo Test Body") }), NORMAL, null));
    assertTrue(message.equals(OK));
}
Also used : CreateCategory.createCategory(it.vige.rubia.selenium.adminpanel.action.CreateCategory.createCategory) RemoveCategory.removeCategory(it.vige.rubia.selenium.adminpanel.action.RemoveCategory.removeCategory) Category(it.vige.rubia.model.Category) Post(it.vige.rubia.model.Post) PreferenceController(it.vige.rubia.ui.action.PreferenceController) RemoveTopic.removeTopic(it.vige.rubia.selenium.forum.action.RemoveTopic.removeTopic) CreateTopic.createTopic(it.vige.rubia.selenium.forum.action.CreateTopic.createTopic) Topic(it.vige.rubia.model.Topic) Date(java.util.Date) Forum(it.vige.rubia.model.Forum) CreateForum.createForum(it.vige.rubia.selenium.adminpanel.action.CreateForum.createForum)

Example 62 with Forum

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

the class PreferencesTest method scenary4.

public void scenary4() {
    Category firstTestCategory = new Category("First Test Category");
    Category secondTestCategory = new Category("Second Test Category");
    goTo(driver);
    PreferenceController submitCriteria = new PreferenceController();
    submitCriteria.setPostOrder("descending");
    submitCriteria.setPostsPerTopic(10);
    submitCriteria.setSummaryTopicDays(1);
    submitCriteria.setDateFormat("d-MM-yyyy HH:mm");
    submit(driver, submitCriteria);
    List<Topic> summaryTopics = viewSummary(driver);
    int sizeSummaryTopics = viewSize(driver);
    Topic summaryTopicDetail = getDetail(driver, "Fourth Test Topic");
    assertTrue(summaryTopics != null);
    assertEquals(6, summaryTopics.size());
    assertEquals(6, sizeSummaryTopics);
    assertEquals("Fourth Test Topic", summaryTopics.get(0).getSubject());
    assertEquals("Fourth Test Topic", summaryTopicDetail.getSubject());
    Topic newTopic = new Topic(new Forum("Third Test Forum", "Third Test Description", new Category("Second Test Category")), "Thirtytwo Test Topic", asList(new Post[] { new Post("Thirtytwo Test Body") }), NORMAL, null);
    String message = createTopic(driver, newTopic);
    assertTrue(message.equals("Thirtytwo Test Topic"));
    List<Forum> forums = getForumsOfCategories(driver, firstTestCategory, secondTestCategory);
    Date today = new Date();
    List<Topic> topics = getTopicsOfForums(driver, forums.toArray(new Forum[0]));
    assertTrue(topics != null);
    assertEquals(24, topics.size());
    assertEquals("Ninteen Test Topic", topics.get(0).getSubject());
    assertEquals("root", topics.get(0).getPoster().getUserId());
    assertEquals(32, topics.get(0).getReplies());
    assertEquals(106, topics.get(0).getViewCount());
    assertTrue(topics.get(0).getLastPostDate().compareTo(today) < 0);
    assertEquals(10, topics.get(0).getPosts().size());
    assertTrue(topics.get(0).getPosts().get(0).getMessage().getSubject().startsWith(RE + "Ninteen Test Topic"));
    assertEquals("<ul><li>Ninteen35</li><li>Test Body</li></ul>", topics.get(0).getPosts().get(0).getMessage().getText());
    assertTrue(topics.get(0).getPosts().get(0).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(0).getPosts().get(0).getPoster().getUserId());
    assertTrue(topics.get(0).getPosts().get(1).getMessage().getSubject().startsWith(RE + "Ninteen Test Topic"));
    assertEquals("<ul><li>Ninteen34</li><li>Test Body</li></ul>", topics.get(0).getPosts().get(1).getMessage().getText());
    assertTrue(topics.get(0).getPosts().get(1).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(0).getPosts().get(1).getPoster().getUserId());
    assertTrue(topics.get(0).getPosts().get(2).getMessage().getSubject().startsWith(RE + "Ninteen Test Topic"));
    assertEquals("<ul><li>Ninteen33</li><li>Test Body</li></ul>", topics.get(0).getPosts().get(2).getMessage().getText());
    assertTrue(topics.get(0).getPosts().get(2).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(0).getPosts().get(2).getPoster().getUserId());
    assertTrue(topics.get(0).getPosts().get(3).getMessage().getSubject().startsWith(RE + "Ninteen Test Topic"));
    assertEquals("<ul><li>Ninteen32</li><li>Test Body</li></ul>", topics.get(0).getPosts().get(3).getMessage().getText());
    assertTrue(topics.get(0).getPosts().get(3).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(0).getPosts().get(3).getPoster().getUserId());
    assertTrue(topics.get(0).getPosts().get(4).getMessage().getSubject().startsWith(RE + "Ninteen Test Topic"));
    assertEquals("<ul><li>Ninteen31</li><li>Test Body</li></ul>", topics.get(0).getPosts().get(4).getMessage().getText());
    assertTrue(topics.get(0).getPosts().get(4).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(0).getPosts().get(4).getPoster().getUserId());
    assertTrue(topics.get(0).getPosts().get(5).getMessage().getSubject().startsWith(RE + "Ninteen Test Topic"));
    assertEquals("<ul><li>Ninteen30</li><li>Test Body</li></ul>", topics.get(0).getPosts().get(5).getMessage().getText());
    assertTrue(topics.get(0).getPosts().get(5).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(0).getPosts().get(5).getPoster().getUserId());
    assertTrue(topics.get(0).getPosts().get(6).getMessage().getSubject().startsWith(RE + "Ninteen Test Topic"));
    assertEquals("<ul><li>Ninteen29</li><li>Test Body</li></ul>", topics.get(0).getPosts().get(6).getMessage().getText());
    assertTrue(topics.get(0).getPosts().get(6).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(0).getPosts().get(6).getPoster().getUserId());
    assertTrue(topics.get(0).getPosts().get(7).getMessage().getSubject().startsWith(RE + "Ninteen Test Topic"));
    assertEquals("<ul><li>Ninteen28</li><li>Test Body</li></ul>", topics.get(0).getPosts().get(7).getMessage().getText());
    assertTrue(topics.get(0).getPosts().get(7).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(0).getPosts().get(7).getPoster().getUserId());
    assertTrue(topics.get(0).getPosts().get(8).getMessage().getSubject().startsWith(RE + "Ninteen Test Topic"));
    assertEquals("<ul><li>Ninteen27</li><li>Test Body</li></ul>", topics.get(0).getPosts().get(8).getMessage().getText());
    assertTrue(topics.get(0).getPosts().get(8).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(0).getPosts().get(8).getPoster().getUserId());
    assertTrue(topics.get(0).getPosts().get(9).getMessage().getSubject().startsWith(RE + "Ninteen Test Topic"));
    assertEquals("<ul><li>Ninteen26</li><li>Test Body</li></ul>", topics.get(0).getPosts().get(9).getMessage().getText());
    assertTrue(topics.get(0).getPosts().get(9).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(0).getPosts().get(9).getPoster().getUserId());
    assertEquals("Eighteen Test Topic", topics.get(1).getSubject());
    assertEquals("root", topics.get(1).getPoster().getUserId());
    assertEquals(0, topics.get(1).getReplies());
    assertEquals(6, topics.get(1).getViewCount());
    assertTrue(topics.get(1).getLastPostDate().compareTo(today) < 0);
    assertEquals(1, topics.get(1).getPosts().size());
    assertTrue(topics.get(1).getPosts().get(0).getMessage().getSubject().startsWith("Eighteen Test Topic"));
    assertTrue(topics.get(1).getPosts().get(0).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(1).getPosts().get(0).getPoster().getUserId());
    assertEquals("Seventeen Test Topic", topics.get(2).getSubject());
    assertEquals("root", topics.get(2).getPoster().getUserId());
    assertEquals(0, topics.get(2).getReplies());
    assertEquals(6, topics.get(2).getViewCount());
    assertTrue(topics.get(2).getLastPostDate().compareTo(today) < 0);
    assertEquals(1, topics.get(2).getPosts().size());
    assertTrue(topics.get(2).getPosts().get(0).getMessage().getSubject().startsWith("Seventeen Test Topic"));
    assertTrue(topics.get(2).getPosts().get(0).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(2).getPosts().get(0).getPoster().getUserId());
    assertEquals("Sixteen Test Topic", topics.get(3).getSubject());
    assertEquals("root", topics.get(3).getPoster().getUserId());
    assertEquals(0, topics.get(3).getReplies());
    assertEquals(6, topics.get(3).getViewCount());
    assertTrue(topics.get(3).getLastPostDate().compareTo(today) < 0);
    assertEquals(1, topics.get(3).getPosts().size());
    assertTrue(topics.get(3).getPosts().get(0).getMessage().getSubject().startsWith("Sixteen Test Topic"));
    assertTrue(topics.get(3).getPosts().get(0).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(3).getPosts().get(0).getPoster().getUserId());
    assertEquals("Fifteen Test Topic", topics.get(4).getSubject());
    assertEquals("root", topics.get(4).getPoster().getUserId());
    assertEquals(0, topics.get(4).getReplies());
    assertEquals(6, topics.get(4).getViewCount());
    assertTrue(topics.get(4).getLastPostDate().compareTo(today) < 0);
    assertEquals(1, topics.get(4).getPosts().size());
    assertTrue(topics.get(4).getPosts().get(0).getMessage().getSubject().startsWith("Fifteen Test Topic"));
    assertTrue(topics.get(4).getPosts().get(0).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(4).getPosts().get(0).getPoster().getUserId());
    assertEquals("Fourteen Test Topic", topics.get(5).getSubject());
    assertEquals("root", topics.get(5).getPoster().getUserId());
    assertEquals(0, topics.get(5).getReplies());
    assertEquals(6, topics.get(5).getViewCount());
    assertTrue(topics.get(5).getLastPostDate().compareTo(today) < 0);
    assertEquals(1, topics.get(5).getPosts().size());
    assertTrue(topics.get(5).getPosts().get(0).getMessage().getSubject().startsWith("Fourteen Test Topic"));
    assertTrue(topics.get(5).getPosts().get(0).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(5).getPosts().get(0).getPoster().getUserId());
    assertEquals("Thirteen Test Topic", topics.get(6).getSubject());
    assertEquals("root", topics.get(6).getPoster().getUserId());
    assertEquals(0, topics.get(6).getReplies());
    assertEquals(6, topics.get(6).getViewCount());
    assertTrue(topics.get(6).getLastPostDate().compareTo(today) < 0);
    assertEquals(1, topics.get(6).getPosts().size());
    assertTrue(topics.get(6).getPosts().get(0).getMessage().getSubject().startsWith("Thirteen Test Topic"));
    assertTrue(topics.get(6).getPosts().get(0).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(6).getPosts().get(0).getPoster().getUserId());
    assertEquals("Twelve Test Topic", topics.get(7).getSubject());
    assertEquals("root", topics.get(7).getPoster().getUserId());
    assertEquals(0, topics.get(7).getReplies());
    assertEquals(6, topics.get(7).getViewCount());
    assertTrue(topics.get(7).getLastPostDate().compareTo(today) < 0);
    assertEquals(1, topics.get(7).getPosts().size());
    assertTrue(topics.get(7).getPosts().get(0).getMessage().getSubject().startsWith("Twelve Test Topic"));
    assertTrue(topics.get(7).getPosts().get(0).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(7).getPosts().get(0).getPoster().getUserId());
    assertEquals("Eleven Test Topic", topics.get(8).getSubject());
    assertEquals("root", topics.get(8).getPoster().getUserId());
    assertEquals(0, topics.get(8).getReplies());
    assertEquals(6, topics.get(8).getViewCount());
    assertTrue(topics.get(8).getLastPostDate().compareTo(today) < 0);
    assertEquals(1, topics.get(8).getPosts().size());
    assertTrue(topics.get(8).getPosts().get(0).getMessage().getSubject().startsWith("Eleven Test Topic"));
    assertTrue(topics.get(8).getPosts().get(0).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(8).getPosts().get(0).getPoster().getUserId());
    assertEquals("Ten Test Topic", topics.get(9).getSubject());
    assertEquals("root", topics.get(9).getPoster().getUserId());
    assertEquals(0, topics.get(9).getReplies());
    assertEquals(6, topics.get(9).getViewCount());
    assertTrue(topics.get(9).getLastPostDate().compareTo(today) < 0);
    assertEquals(1, topics.get(9).getPosts().size());
    assertTrue(topics.get(9).getPosts().get(0).getMessage().getSubject().startsWith("Ten Test Topic"));
    assertTrue(topics.get(9).getPosts().get(0).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(9).getPosts().get(0).getPoster().getUserId());
    assertEquals("Second Test Topic", topics.get(10).getSubject());
    assertEquals("root", topics.get(10).getPoster().getUserId());
    assertEquals(0, topics.get(10).getReplies());
    assertEquals(6, topics.get(10).getViewCount());
    assertTrue(topics.get(10).getLastPostDate().compareTo(today) < 0);
    assertEquals(1, topics.get(10).getPosts().size());
    assertTrue(topics.get(10).getPosts().get(0).getMessage().getSubject().startsWith("Second Test Topic"));
    assertTrue(topics.get(10).getPosts().get(0).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(10).getPosts().get(0).getPoster().getUserId());
    assertEquals("Thirtyone Test Topic", topics.get(11).getSubject());
    assertEquals("root", topics.get(11).getPoster().getUserId());
    assertEquals(0, topics.get(11).getReplies());
    assertEquals(6, topics.get(11).getViewCount());
    assertTrue(topics.get(11).getLastPostDate().compareTo(today) < 0);
    assertEquals(1, topics.get(11).getPosts().size());
    assertTrue(topics.get(11).getPosts().get(0).getMessage().getSubject().startsWith("Thirtyone Test Topic"));
    assertTrue(topics.get(11).getPosts().get(0).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(11).getPosts().get(0).getPoster().getUserId());
    assertEquals("Thirty Test Topic", topics.get(12).getSubject());
    assertEquals("root", topics.get(12).getPoster().getUserId());
    assertEquals(0, topics.get(12).getReplies());
    assertEquals(6, topics.get(12).getViewCount());
    assertTrue(topics.get(12).getLastPostDate().compareTo(today) < 0);
    assertEquals(topics.get(12).getPosts().size(), 1);
    assertTrue(topics.get(12).getPosts().get(0).getMessage().getSubject().startsWith("Thirty Test Topic"));
    assertTrue(topics.get(12).getPosts().get(0).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(12).getPosts().get(0).getPoster().getUserId());
    assertEquals("Twentynine Test Topic", topics.get(13).getSubject());
    assertEquals("root", topics.get(13).getPoster().getUserId());
    assertEquals(0, topics.get(13).getReplies());
    assertEquals(6, topics.get(13).getViewCount());
    assertTrue(topics.get(13).getLastPostDate().compareTo(today) < 0);
    assertEquals(1, topics.get(13).getPosts().size());
    assertTrue(topics.get(13).getPosts().get(0).getMessage().getSubject().startsWith("Twentynine Test Topic"));
    assertTrue(topics.get(13).getPosts().get(0).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(13).getPosts().get(0).getPoster().getUserId());
    assertEquals("Twentyeight Test Topic", topics.get(14).getSubject());
    assertEquals("root", topics.get(14).getPoster().getUserId());
    assertEquals(0, topics.get(14).getReplies());
    assertEquals(6, topics.get(14).getViewCount());
    assertTrue(topics.get(14).getLastPostDate().compareTo(today) < 0);
    assertEquals(1, topics.get(14).getPosts().size());
    assertTrue(topics.get(14).getPosts().get(0).getMessage().getSubject().startsWith("Twentyeight Test Topic"));
    assertTrue(topics.get(14).getPosts().get(0).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(14).getPosts().get(0).getPoster().getUserId());
    assertEquals("Twentyseven Test Topic", topics.get(15).getSubject());
    assertEquals("root", topics.get(15).getPoster().getUserId());
    assertEquals(0, topics.get(15).getReplies());
    assertEquals(6, topics.get(15).getViewCount());
    assertTrue(topics.get(15).getLastPostDate().compareTo(today) < 0);
    assertEquals(1, topics.get(15).getPosts().size());
    assertTrue(topics.get(15).getPosts().get(0).getMessage().getSubject().startsWith("Twentyseven Test Topic"));
    assertTrue(topics.get(15).getPosts().get(0).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(15).getPosts().get(0).getPoster().getUserId());
    assertEquals("Twentysix Test Topic", topics.get(16).getSubject());
    assertEquals("root", topics.get(16).getPoster().getUserId());
    assertEquals(0, topics.get(16).getReplies());
    assertEquals(4, topics.get(16).getViewCount());
    assertTrue(topics.get(16).getLastPostDate().compareTo(today) < 0);
    assertEquals(1, topics.get(16).getPosts().size());
    assertTrue(topics.get(16).getPosts().get(0).getMessage().getSubject().startsWith("Twentysix Test Topic"));
    assertTrue(topics.get(16).getPosts().get(0).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(16).getPosts().get(0).getPoster().getUserId());
    assertEquals("Twentyfive Test Topic", topics.get(17).getSubject());
    assertEquals("root", topics.get(17).getPoster().getUserId());
    assertEquals(0, topics.get(17).getReplies());
    assertEquals(4, topics.get(17).getViewCount());
    assertTrue(topics.get(17).getLastPostDate().compareTo(today) < 0);
    assertEquals(1, topics.get(17).getPosts().size());
    assertTrue(topics.get(17).getPosts().get(0).getMessage().getSubject().startsWith("Twentyfive Test Topic"));
    assertTrue(topics.get(17).getPosts().get(0).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(17).getPosts().get(0).getPoster().getUserId());
    assertEquals("Twentyfour Test Topic", topics.get(18).getSubject());
    assertEquals("root", topics.get(18).getPoster().getUserId());
    assertEquals(0, topics.get(18).getReplies());
    assertEquals(4, topics.get(18).getViewCount());
    assertTrue(topics.get(18).getLastPostDate().compareTo(today) < 0);
    assertEquals(1, topics.get(18).getPosts().size());
    assertTrue(topics.get(18).getPosts().get(0).getMessage().getSubject().startsWith("Twentyfour Test Topic"));
    assertTrue(topics.get(18).getPosts().get(0).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(18).getPosts().get(0).getPoster().getUserId());
    assertEquals("Twentythree Test Topic", topics.get(19).getSubject());
    assertEquals("root", topics.get(19).getPoster().getUserId());
    assertEquals(0, topics.get(19).getReplies());
    assertEquals(4, topics.get(19).getViewCount());
    assertTrue(topics.get(19).getLastPostDate().compareTo(today) < 0);
    assertEquals(1, topics.get(19).getPosts().size());
    assertTrue(topics.get(19).getPosts().get(0).getMessage().getSubject().startsWith("Twentythree Test Topic"));
    assertTrue(topics.get(19).getPosts().get(0).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(19).getPosts().get(0).getPoster().getUserId());
    assertEquals("Twentytwo Test Topic", topics.get(20).getSubject());
    assertEquals("root", topics.get(20).getPoster().getUserId());
    assertEquals(0, topics.get(20).getReplies());
    assertEquals(4, topics.get(20).getViewCount());
    assertTrue(topics.get(20).getLastPostDate().compareTo(today) < 0);
    assertEquals(1, topics.get(20).getPosts().size());
    assertTrue(topics.get(20).getPosts().get(0).getMessage().getSubject().startsWith("Twentytwo Test Topic"));
    assertTrue(topics.get(20).getPosts().get(0).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(20).getPosts().get(0).getPoster().getUserId());
    assertEquals("Third Test Topic", topics.get(21).getSubject());
    assertEquals("root", topics.get(21).getPoster().getUserId());
    assertEquals(0, topics.get(21).getReplies());
    assertEquals(6, topics.get(21).getViewCount());
    assertTrue(topics.get(21).getLastPostDate().compareTo(today) < 0);
    assertEquals(1, topics.get(21).getPosts().size());
    assertTrue(topics.get(21).getPosts().get(0).getMessage().getSubject().startsWith("Third Test Topic"));
    assertTrue(topics.get(21).getPosts().get(0).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(21).getPosts().get(0).getPoster().getUserId());
    assertEquals("Fourth Test Topic", topics.get(22).getSubject());
    assertEquals("root", topics.get(22).getPoster().getUserId());
    assertEquals(0, topics.get(22).getReplies());
    assertEquals(10, topics.get(22).getViewCount());
    assertTrue(topics.get(22).getLastPostDate().compareTo(today) < 0);
    assertEquals(1, topics.get(22).getPosts().size());
    assertTrue(topics.get(22).getPosts().get(0).getMessage().getSubject().startsWith("Fourth Test Topic"));
    assertTrue(topics.get(22).getPosts().get(0).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(22).getPosts().get(0).getPoster().getUserId());
    assertEquals("Thirtytwo Test Topic", topics.get(23).getSubject());
    assertEquals("root", topics.get(23).getPoster().getUserId());
    assertEquals(0, topics.get(23).getReplies());
    assertEquals(0, topics.get(23).getViewCount());
    assertTrue(topics.get(23).getLastPostDate().compareTo(today) < 0);
    assertEquals(1, topics.get(23).getPosts().size());
    assertTrue(topics.get(23).getPosts().get(0).getMessage().getSubject().startsWith("Thirtytwo Test Topic"));
    assertTrue(topics.get(23).getPosts().get(0).getCreateDate().compareTo(today) < 0);
    assertEquals("root", topics.get(23).getPosts().get(0).getPoster().getUserId());
    message = removeTopic(driver, new Topic(new Forum("Third Test Forum", "Third Test Description", new Category("Second Test Category")), "Thirtytwo Test Topic", asList(new Post[] { new Post("Thirtytwo Test Body") }), NORMAL, null));
    assertTrue(message.equals(OK));
}
Also used : CreateCategory.createCategory(it.vige.rubia.selenium.adminpanel.action.CreateCategory.createCategory) RemoveCategory.removeCategory(it.vige.rubia.selenium.adminpanel.action.RemoveCategory.removeCategory) Category(it.vige.rubia.model.Category) Post(it.vige.rubia.model.Post) PreferenceController(it.vige.rubia.ui.action.PreferenceController) RemoveTopic.removeTopic(it.vige.rubia.selenium.forum.action.RemoveTopic.removeTopic) CreateTopic.createTopic(it.vige.rubia.selenium.forum.action.CreateTopic.createTopic) Topic(it.vige.rubia.model.Topic) Date(java.util.Date) Forum(it.vige.rubia.model.Forum) CreateForum.createForum(it.vige.rubia.selenium.adminpanel.action.CreateForum.createForum)

Example 63 with Forum

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

the class VerifyAttachment method addParents.

private static void addParents(WebDriver driver, Attachment attachment) {
    Post post = new Post();
    Message message = new Message();
    message.setSubject(driver.findElement(POST_TEMPLATE_LINK.getValue()).getText());
    post.setMessage(message);
    Topic topic = new Topic();
    topic.setSubject(driver.findElement(TOPIC_TEMPLATE_LINK.getValue()).getText());
    post.setTopic(topic);
    Forum forum = new Forum();
    forum.setName(driver.findElement(FORUM_TEMPLATE_LINK.getValue()).getText());
    topic.setForum(forum);
    Category category = new Category();
    category.setTitle(driver.findElement(CATEGORY_TEMPLATE_LINK.getValue()).getText());
    forum.setCategory(category);
    attachment.setPost(post);
}
Also used : Category(it.vige.rubia.model.Category) Message(it.vige.rubia.model.Message) Post(it.vige.rubia.model.Post) Topic(it.vige.rubia.model.Topic) Forum(it.vige.rubia.model.Forum)

Example 64 with Forum

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

the class VerifyForum method getForum.

public static Forum getForum(WebDriver driver) {
    Forum forum = new Forum();
    WebElement forumNameComponent = driver.findElement(className(FORUM_NAME));
    String forumNameText = forumNameComponent.getText();
    addParents(driver, forum);
    forum.setName(forumNameText);
    return forum;
}
Also used : WebElement(org.openqa.selenium.WebElement) Forum(it.vige.rubia.model.Forum)

Example 65 with Forum

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

the class VerifyPost method addParents.

private static void addParents(WebDriver driver, Post post) {
    Topic topic = new Topic();
    topic.setSubject(driver.findElement(TOPIC_TEMPLATE_LINK.getValue()).getText());
    post.setTopic(topic);
    Forum forum = new Forum();
    forum.setName(driver.findElement(FORUM_TEMPLATE_LINK.getValue()).getText());
    topic.setForum(forum);
    Category category = new Category();
    category.setTitle(driver.findElement(CATEGORY_TEMPLATE_LINK.getValue()).getText());
    forum.setCategory(category);
}
Also used : Category(it.vige.rubia.model.Category) Topic(it.vige.rubia.model.Topic) Forum(it.vige.rubia.model.Forum)

Aggregations

Forum (it.vige.rubia.model.Forum)100 CreateForum.createForum (it.vige.rubia.selenium.adminpanel.action.CreateForum.createForum)65 Topic (it.vige.rubia.model.Topic)63 RemoveForum.removeForum (it.vige.rubia.selenium.adminpanel.action.RemoveForum.removeForum)55 Post (it.vige.rubia.model.Post)52 Category (it.vige.rubia.model.Category)50 CreateTopic.createTopic (it.vige.rubia.selenium.forum.action.CreateTopic.createTopic)49 CreateCategory.createCategory (it.vige.rubia.selenium.adminpanel.action.CreateCategory.createCategory)40 RemoveCategory.removeCategory (it.vige.rubia.selenium.adminpanel.action.RemoveCategory.removeCategory)40 RemoveTopic.removeTopic (it.vige.rubia.selenium.forum.action.RemoveTopic.removeTopic)34 Test (org.junit.Test)33 Poll (it.vige.rubia.model.Poll)23 Attachment (it.vige.rubia.model.Attachment)21 PollOption (it.vige.rubia.model.PollOption)21 SecureActionForum (it.vige.rubia.auth.SecureActionForum)16 CreatePost.createPost (it.vige.rubia.selenium.forum.action.CreatePost.createPost)15 Poster (it.vige.rubia.model.Poster)14 JSFUtil.handleException (it.vige.rubia.ui.JSFUtil.handleException)14 BeforeClass (org.junit.BeforeClass)14 AfterClass (org.junit.AfterClass)13