use of it.vige.rubia.search.SearchCriteria in project rubia-forums by flashboss.
the class SearchTopicTest method verifyPostFromTopicPage.
@Test
public void verifyPostFromTopicPage() {
goTo(driver);
SearchCriteria searchForumCriteria = new SearchCriteria();
searchForumCriteria.setAuthor("root");
searchForumCriteria.setCategory(null);
searchForumCriteria.setDisplayAs(TOPICS.name());
searchForumCriteria.setForum(null);
searchForumCriteria.setKeywords("Topic");
searchForumCriteria.setPageNumber(0);
searchForumCriteria.setPageSize(0);
searchForumCriteria.setSearching(null);
searchForumCriteria.setSortBy(null);
searchForumCriteria.setSortOrder(null);
searchForumCriteria.setTimePeriod(null);
List<Topic> topics = searchTopic(driver, searchForumCriteria);
Topic topic = getTopic(driver, topics.get(3));
assertTrue(topic != null);
assertTrue(topic.getPosts() != null);
assertEquals("Fourth Test Topic", topic.getSubject());
assertEquals("root", topic.getPoster().getUserId());
assertEquals(1, topic.getPosts().size());
assertEquals("Fourth Test Topic", topic.getPosts().get(0).getMessage().getSubject());
assertEquals("Fourth Test Body", topic.getPosts().get(0).getMessage().getText());
assertEquals("Fourth Test Question", topic.getPoll().getTitle());
}
use of it.vige.rubia.search.SearchCriteria in project rubia-forums by flashboss.
the class SearchTopicTest method verifyPostFromTopicPageLastPost.
@Test
public void verifyPostFromTopicPageLastPost() {
goTo(driver);
SearchCriteria searchForumCriteria = new SearchCriteria();
searchForumCriteria.setAuthor("root");
searchForumCriteria.setCategory(null);
searchForumCriteria.setDisplayAs(TOPICS.name());
searchForumCriteria.setForum(null);
searchForumCriteria.setKeywords("Topic");
searchForumCriteria.setPageNumber(0);
searchForumCriteria.setPageSize(0);
searchForumCriteria.setSearching(null);
searchForumCriteria.setSortBy(null);
searchForumCriteria.setSortOrder(null);
searchForumCriteria.setTimePeriod(null);
List<Topic> topics = searchTopic(driver, searchForumCriteria);
Poster poster = getPosterLastPost(driver, topics.get(0));
goTo(driver);
topics = searchTopic(driver, searchForumCriteria);
Post post = getLastPostOfCurrentForum(driver, topics.get(0));
assertTrue(post != null);
assertEquals("First Test with a large subject name triing to truncate over the 25 character Topic", post.getMessage().getSubject());
assertTrue(poster != null);
assertEquals("root", poster.getUserId());
assertTrue(poster.getPostCount() >= 4);
}
use of it.vige.rubia.search.SearchCriteria in project rubia-forums by flashboss.
the class SearchTopicTest method searchTopics.
@Test
public void searchTopics() {
goTo(driver);
SearchCriteria searchForumCriteria = new SearchCriteria();
searchForumCriteria.setAuthor("root");
searchForumCriteria.setCategory(null);
searchForumCriteria.setDisplayAs(TOPICS.name());
searchForumCriteria.setForum(null);
searchForumCriteria.setKeywords("Topic");
searchForumCriteria.setPageNumber(0);
searchForumCriteria.setPageSize(0);
searchForumCriteria.setSearching(null);
searchForumCriteria.setSortBy(null);
searchForumCriteria.setSortOrder(null);
searchForumCriteria.setTimePeriod(null);
List<Topic> topics = searchTopic(driver, searchForumCriteria);
Date today = new Date();
assertTrue(topics != null);
assertEquals(4, topics.size());
assertEquals("First Test with a large subject name triing to truncate over the 25 character Topic", topics.get(0).getSubject());
assertEquals("root", topics.get(0).getPoster().getUserId());
assertEquals(0, topics.get(0).getReplies());
assertEquals(1, topics.get(0).getViewCount());
assertTrue(topics.get(0).getLastPostDate().compareTo(today) < 0);
assertEquals(1, topics.get(0).getPosts().size());
assertTrue(topics.get(0).getPosts().get(0).getMessage().getSubject().startsWith("First Test with a large s..."));
assertTrue(topics.get(0).getPosts().get(0).getCreateDate().compareTo(today) < 0);
assertEquals("root", topics.get(0).getPosts().get(0).getPoster().getUserId());
assertEquals("Second 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("Second Test Topic"));
assertTrue(topics.get(1).getPosts().get(0).getCreateDate().compareTo(today) < 0);
assertEquals("root", topics.get(1).getPosts().get(0).getPoster().getUserId());
assertEquals("Third 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("Third Test Topic"));
assertTrue(topics.get(2).getPosts().get(0).getCreateDate().compareTo(today) < 0);
assertEquals("root", topics.get(2).getPosts().get(0).getPoster().getUserId());
assertEquals("Fourth 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("Fourth Test Topic"));
assertTrue(topics.get(3).getPosts().get(0).getCreateDate().compareTo(today) < 0);
assertEquals("root", topics.get(3).getPosts().get(0).getPoster().getUserId());
goTo(driver);
searchForumCriteria.setCategory("First Test Category");
topics = searchTopic(driver, searchForumCriteria);
assertTrue(topics != null);
assertEquals(4, topics.size());
assertEquals("First Test with a large subject name triing to truncate over the 25 character Topic", topics.get(0).getSubject());
assertEquals("root", topics.get(0).getPoster().getUserId());
assertEquals(0, topics.get(0).getReplies());
assertEquals(1, topics.get(0).getViewCount());
assertTrue(topics.get(0).getLastPostDate().compareTo(today) < 0);
assertEquals(1, topics.get(0).getPosts().size());
assertTrue(topics.get(0).getPosts().get(0).getMessage().getSubject().startsWith("First Test with a large s..."));
assertTrue(topics.get(0).getPosts().get(0).getCreateDate().compareTo(today) < 0);
assertEquals("root", topics.get(0).getPosts().get(0).getPoster().getUserId());
assertEquals("Second 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("Second Test Topic"));
assertTrue(topics.get(1).getPosts().get(0).getCreateDate().compareTo(today) < 0);
assertEquals("root", topics.get(1).getPosts().get(0).getPoster().getUserId());
assertEquals("Third 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("Third Test Topic"));
assertTrue(topics.get(2).getPosts().get(0).getCreateDate().compareTo(today) < 0);
assertEquals("root", topics.get(2).getPosts().get(0).getPoster().getUserId());
assertEquals("Fourth 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("Fourth Test Topic"));
assertTrue(topics.get(3).getPosts().get(0).getCreateDate().compareTo(today) < 0);
assertEquals("root", topics.get(3).getPosts().get(0).getPoster().getUserId());
goTo(driver);
searchForumCriteria.setCategory("Second Test Category");
topics = searchTopic(driver, searchForumCriteria);
assertTrue(topics == null);
goTo(driver);
searchForumCriteria.setCategory(null);
searchForumCriteria.setForum("First Test Forum");
topics = searchTopic(driver, searchForumCriteria);
assertTrue(topics != null);
assertEquals(2, topics.size());
assertEquals("First Test with a large subject name triing to truncate over the 25 character Topic", topics.get(0).getSubject());
assertEquals("root", topics.get(0).getPoster().getUserId());
assertEquals(0, topics.get(0).getReplies());
assertEquals(1, topics.get(0).getViewCount());
assertTrue(topics.get(0).getLastPostDate().compareTo(today) < 0);
assertEquals(1, topics.get(0).getPosts().size());
assertTrue(topics.get(0).getPosts().get(0).getMessage().getSubject().startsWith("First Test with a large s..."));
assertTrue(topics.get(0).getPosts().get(0).getCreateDate().compareTo(today) < 0);
assertEquals("root", topics.get(0).getPosts().get(0).getPoster().getUserId());
assertEquals("Second 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("Second Test Topic"));
assertTrue(topics.get(1).getPosts().get(0).getCreateDate().compareTo(today) < 0);
assertEquals("root", topics.get(1).getPosts().get(0).getPoster().getUserId());
goTo(driver);
searchForumCriteria.setForum("Second Test Forum");
topics = searchTopic(driver, searchForumCriteria);
assertEquals(2, topics.size());
assertEquals("Third Test Topic", topics.get(0).getSubject());
assertEquals("root", topics.get(0).getPoster().getUserId());
assertEquals(0, topics.get(0).getReplies());
assertEquals(0, topics.get(0).getViewCount());
assertTrue(topics.get(0).getLastPostDate().compareTo(today) < 0);
assertEquals(1, topics.get(0).getPosts().size());
assertTrue(topics.get(0).getPosts().get(0).getMessage().getSubject().startsWith("Third Test Topic"));
assertTrue(topics.get(0).getPosts().get(0).getCreateDate().compareTo(today) < 0);
assertEquals("root", topics.get(0).getPosts().get(0).getPoster().getUserId());
assertEquals("Fourth 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("Fourth Test Topic"));
assertTrue(topics.get(1).getPosts().get(0).getCreateDate().compareTo(today) < 0);
assertEquals("root", topics.get(1).getPosts().get(0).getPoster().getUserId());
ResourceBundle bundle = getBundle("ResourceJSF");
goTo(driver);
searchForumCriteria.setForum(null);
searchForumCriteria.setTimePeriod(bundle.getString("period_7_Days"));
topics = searchTopic(driver, searchForumCriteria);
assertTrue(topics != null);
assertEquals(4, topics.size());
assertEquals("First Test with a large subject name triing to truncate over the 25 character Topic", topics.get(0).getSubject());
assertEquals("root", topics.get(0).getPoster().getUserId());
assertEquals(0, topics.get(0).getReplies());
assertEquals(1, topics.get(0).getViewCount());
assertTrue(topics.get(0).getLastPostDate().compareTo(today) < 0);
assertEquals(1, topics.get(0).getPosts().size());
assertTrue(topics.get(0).getPosts().get(0).getMessage().getSubject().startsWith("First Test with a large s..."));
assertTrue(topics.get(0).getPosts().get(0).getCreateDate().compareTo(today) < 0);
assertEquals("root", topics.get(0).getPosts().get(0).getPoster().getUserId());
assertEquals("Second 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("Second Test Topic"));
assertTrue(topics.get(1).getPosts().get(0).getCreateDate().compareTo(today) < 0);
assertEquals("root", topics.get(1).getPosts().get(0).getPoster().getUserId());
assertEquals("Third 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("Third Test Topic"));
assertTrue(topics.get(2).getPosts().get(0).getCreateDate().compareTo(today) < 0);
assertEquals("root", topics.get(2).getPosts().get(0).getPoster().getUserId());
assertEquals("Fourth 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("Fourth Test Topic"));
assertTrue(topics.get(3).getPosts().get(0).getCreateDate().compareTo(today) < 0);
assertEquals("root", topics.get(3).getPosts().get(0).getPoster().getUserId());
goTo(driver);
searchForumCriteria.setTimePeriod(null);
searchForumCriteria.setSortBy(bundle.getString("Search_post_subject"));
searchForumCriteria.setSortOrder(ASC.name());
topics = searchTopic(driver, searchForumCriteria);
assertTrue(topics != null);
assertEquals(4, topics.size());
assertEquals("First Test with a large subject name triing to truncate over the 25 character Topic", topics.get(0).getSubject());
assertEquals("root", topics.get(0).getPoster().getUserId());
assertEquals(0, topics.get(0).getReplies());
assertEquals(1, topics.get(0).getViewCount());
assertTrue(topics.get(0).getLastPostDate().compareTo(today) < 0);
assertEquals(1, topics.get(0).getPosts().size());
assertTrue(topics.get(0).getPosts().get(0).getMessage().getSubject().startsWith("First Test with a large s..."));
assertTrue(topics.get(0).getPosts().get(0).getCreateDate().compareTo(today) < 0);
assertEquals("root", topics.get(0).getPosts().get(0).getPoster().getUserId());
assertEquals("Fourth 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("Fourth Test Topic"));
assertTrue(topics.get(1).getPosts().get(0).getCreateDate().compareTo(today) < 0);
assertEquals("root", topics.get(1).getPosts().get(0).getPoster().getUserId());
assertEquals("Second 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("Second Test Topic"));
assertTrue(topics.get(2).getPosts().get(0).getCreateDate().compareTo(today) < 0);
assertEquals("root", topics.get(2).getPosts().get(0).getPoster().getUserId());
assertEquals("Third 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("Third Test Topic"));
assertTrue(topics.get(3).getPosts().get(0).getCreateDate().compareTo(today) < 0);
assertEquals("root", topics.get(3).getPosts().get(0).getPoster().getUserId());
goTo(driver);
searchForumCriteria.setSortOrder(DESC.name());
topics = searchTopic(driver, searchForumCriteria);
assertTrue(topics != null);
assertEquals(4, topics.size());
assertEquals("Third Test Topic", topics.get(0).getSubject());
assertEquals("root", topics.get(0).getPoster().getUserId());
assertEquals(0, topics.get(0).getReplies());
assertEquals(0, topics.get(0).getViewCount());
assertTrue(topics.get(0).getLastPostDate().compareTo(today) < 0);
assertEquals(1, topics.get(0).getPosts().size());
assertTrue(topics.get(0).getPosts().get(0).getMessage().getSubject().startsWith("Third Test Topic"));
assertTrue(topics.get(0).getPosts().get(0).getCreateDate().compareTo(today) < 0);
assertEquals("root", topics.get(0).getPosts().get(0).getPoster().getUserId());
assertEquals("Second 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("Second Test Topic"));
assertTrue(topics.get(1).getPosts().get(0).getCreateDate().compareTo(today) < 0);
assertEquals("root", topics.get(1).getPosts().get(0).getPoster().getUserId());
assertEquals("Fourth 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("Fourth Test Topic"));
assertTrue(topics.get(2).getPosts().get(0).getCreateDate().compareTo(today) < 0);
assertEquals("root", topics.get(2).getPosts().get(0).getPoster().getUserId());
assertEquals("First Test with a large subject name triing to truncate over the 25 character Topic", topics.get(3).getSubject());
assertEquals("root", topics.get(3).getPoster().getUserId());
assertEquals(0, topics.get(3).getReplies());
assertEquals(1, 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("First Test with a large s..."));
assertTrue(topics.get(3).getPosts().get(0).getCreateDate().compareTo(today) < 0);
assertEquals("root", topics.get(3).getPosts().get(0).getPoster().getUserId());
goTo(driver);
searchForumCriteria.setSortBy(null);
searchForumCriteria.setSortOrder(null);
searchForumCriteria.setSearching(MSG.name());
topics = searchTopic(driver, searchForumCriteria);
assertTrue(topics == null);
}
use of it.vige.rubia.search.SearchCriteria in project rubia-forums by flashboss.
the class SearchPostTest method searchPosts.
@Test
public void searchPosts() {
goTo(driver);
SearchCriteria searchTopicCriteria = new SearchCriteria();
searchTopicCriteria.setAuthor("root");
searchTopicCriteria.setCategory(null);
searchTopicCriteria.setDisplayAs(POSTS.name());
searchTopicCriteria.setForum(null);
searchTopicCriteria.setKeywords("Body");
searchTopicCriteria.setPageNumber(0);
searchTopicCriteria.setPageSize(0);
searchTopicCriteria.setSearching(null);
searchTopicCriteria.setSortBy(null);
searchTopicCriteria.setSortOrder(null);
searchTopicCriteria.setTimePeriod(null);
List<Post> posts = searchPost(driver, searchTopicCriteria);
Date today = new Date();
assertTrue(posts != null);
assertEquals(6, posts.size());
assertEquals("root", posts.get(0).getPoster().getUserId());
assertEquals("First Test Topic", posts.get(0).getMessage().getSubject());
assertEquals("First Test Body", posts.get(0).getMessage().getText());
assertTrue(posts.get(0).getCreateDate().compareTo(today) < 0);
assertEquals(3, posts.get(0).getAttachments().size());
assertEquals("root", posts.get(1).getPoster().getUserId());
assertEquals("Second Test Topic", posts.get(1).getMessage().getSubject());
assertEquals("Second Test Body", posts.get(1).getMessage().getText());
assertTrue(posts.get(1).getCreateDate().compareTo(today) < 0);
assertEquals(3, posts.get(1).getAttachments().size());
assertEquals("root", posts.get(2).getPoster().getUserId());
assertEquals("Third Test Topic", posts.get(2).getMessage().getSubject());
assertEquals("Third Test Body", posts.get(2).getMessage().getText());
assertTrue(posts.get(2).getCreateDate().compareTo(today) < 0);
assertEquals(3, posts.get(2).getAttachments().size());
assertEquals("root", posts.get(3).getPoster().getUserId());
assertEquals("Fourth Test Topic", posts.get(3).getMessage().getSubject());
assertEquals("Fourth Test Body", posts.get(3).getMessage().getText());
assertTrue(posts.get(3).getCreateDate().compareTo(today) < 0);
assertEquals(3, posts.get(3).getAttachments().size());
assertEquals("root", posts.get(4).getPoster().getUserId());
assertEquals("Fifth Test with Truncation over 25 characters Topic", posts.get(4).getMessage().getSubject());
assertEquals("Fifth Test with Truncation over 25 characters Body", posts.get(4).getMessage().getText());
assertTrue(posts.get(4).getCreateDate().compareTo(today) < 0);
assertEquals(3, posts.get(4).getAttachments().size());
assertEquals("root", posts.get(5).getPoster().getUserId());
assertEquals("Sixth Test Topic", posts.get(5).getMessage().getSubject());
assertEquals("Sixth Test Body", posts.get(5).getMessage().getText());
assertTrue(posts.get(5).getCreateDate().compareTo(today) < 0);
assertEquals(3, posts.get(5).getAttachments().size());
goTo(driver);
searchTopicCriteria.setCategory("First Test Category");
posts = searchPost(driver, searchTopicCriteria);
assertTrue(posts != null);
assertEquals(4, posts.size());
assertEquals("root", posts.get(0).getPoster().getUserId());
assertEquals("First Test Topic", posts.get(0).getMessage().getSubject());
assertEquals("First Test Body", posts.get(0).getMessage().getText());
assertTrue(posts.get(0).getCreateDate().compareTo(today) < 0);
assertEquals(3, posts.get(0).getAttachments().size());
assertEquals("root", posts.get(1).getPoster().getUserId());
assertEquals("Second Test Topic", posts.get(1).getMessage().getSubject());
assertEquals("Second Test Body", posts.get(1).getMessage().getText());
assertTrue(posts.get(1).getCreateDate().compareTo(today) < 0);
assertEquals(3, posts.get(1).getAttachments().size());
assertEquals("root", posts.get(2).getPoster().getUserId());
assertEquals("Third Test Topic", posts.get(2).getMessage().getSubject());
assertEquals("Third Test Body", posts.get(2).getMessage().getText());
assertTrue(posts.get(2).getCreateDate().compareTo(today) < 0);
assertEquals(3, posts.get(2).getAttachments().size());
assertEquals("root", posts.get(3).getPoster().getUserId());
assertEquals("Fourth Test Topic", posts.get(3).getMessage().getSubject());
assertEquals("Fourth Test Body", posts.get(3).getMessage().getText());
assertTrue(posts.get(3).getCreateDate().compareTo(today) < 0);
assertEquals(3, posts.get(3).getAttachments().size());
goTo(driver);
searchTopicCriteria.setCategory("Second Test Category");
posts = searchPost(driver, searchTopicCriteria);
assertTrue(posts != null);
assertEquals(2, posts.size());
assertEquals("root", posts.get(0).getPoster().getUserId());
assertEquals("Fifth Test with Truncation over 25 characters Topic", posts.get(0).getMessage().getSubject());
assertEquals("Fifth Test with Truncation over 25 characters Body", posts.get(0).getMessage().getText());
assertTrue(posts.get(0).getCreateDate().compareTo(today) < 0);
assertEquals(3, posts.get(0).getAttachments().size());
assertEquals("root", posts.get(1).getPoster().getUserId());
assertEquals("Sixth Test Topic", posts.get(1).getMessage().getSubject());
assertEquals("Sixth Test Body", posts.get(1).getMessage().getText());
assertTrue(posts.get(1).getCreateDate().compareTo(today) < 0);
assertEquals(3, posts.get(1).getAttachments().size());
goTo(driver);
searchTopicCriteria.setCategory(null);
searchTopicCriteria.setForum("First Test Forum");
posts = searchPost(driver, searchTopicCriteria);
assertTrue(posts != null);
assertEquals(2, posts.size());
assertEquals("root", posts.get(0).getPoster().getUserId());
assertEquals("First Test Topic", posts.get(0).getMessage().getSubject());
assertEquals("First Test Body", posts.get(0).getMessage().getText());
assertTrue(posts.get(0).getCreateDate().compareTo(today) < 0);
assertEquals(3, posts.get(0).getAttachments().size());
assertEquals("root", posts.get(1).getPoster().getUserId());
assertEquals("Second Test Topic", posts.get(1).getMessage().getSubject());
assertEquals("Second Test Body", posts.get(1).getMessage().getText());
assertTrue(posts.get(1).getCreateDate().compareTo(today) < 0);
assertEquals(3, posts.get(1).getAttachments().size());
goTo(driver);
searchTopicCriteria.setForum("Second Test Forum");
posts = searchPost(driver, searchTopicCriteria);
assertTrue(posts != null);
assertEquals(2, posts.size());
assertEquals("root", posts.get(0).getPoster().getUserId());
assertEquals("Third Test Topic", posts.get(0).getMessage().getSubject());
assertEquals("Third Test Body", posts.get(0).getMessage().getText());
assertTrue(posts.get(0).getCreateDate().compareTo(today) < 0);
assertEquals(3, posts.get(0).getAttachments().size());
assertEquals("root", posts.get(1).getPoster().getUserId());
assertEquals("Fourth Test Topic", posts.get(1).getMessage().getSubject());
assertEquals("Fourth Test Body", posts.get(1).getMessage().getText());
assertTrue(posts.get(1).getCreateDate().compareTo(today) < 0);
assertEquals(3, posts.get(1).getAttachments().size());
ResourceBundle bundle = getBundle("ResourceJSF");
goTo(driver);
searchTopicCriteria.setForum(null);
searchTopicCriteria.setTimePeriod(bundle.getString("period_7_Days"));
posts = searchPost(driver, searchTopicCriteria);
assertTrue(posts != null);
assertEquals(6, posts.size());
assertEquals("root", posts.get(0).getPoster().getUserId());
assertEquals("First Test Topic", posts.get(0).getMessage().getSubject());
assertEquals("First Test Body", posts.get(0).getMessage().getText());
assertTrue(posts.get(0).getCreateDate().compareTo(today) < 0);
assertEquals(3, posts.get(0).getAttachments().size());
assertEquals("root", posts.get(1).getPoster().getUserId());
assertEquals("Second Test Topic", posts.get(1).getMessage().getSubject());
assertEquals("Second Test Body", posts.get(1).getMessage().getText());
assertTrue(posts.get(1).getCreateDate().compareTo(today) < 0);
assertEquals(3, posts.get(1).getAttachments().size());
assertEquals("root", posts.get(2).getPoster().getUserId());
assertEquals("Third Test Topic", posts.get(2).getMessage().getSubject());
assertEquals("Third Test Body", posts.get(2).getMessage().getText());
assertTrue(posts.get(2).getCreateDate().compareTo(today) < 0);
assertEquals(3, posts.get(2).getAttachments().size());
assertEquals("root", posts.get(3).getPoster().getUserId());
assertEquals("Fourth Test Topic", posts.get(3).getMessage().getSubject());
assertEquals("Fourth Test Body", posts.get(3).getMessage().getText());
assertTrue(posts.get(3).getCreateDate().compareTo(today) < 0);
assertEquals(3, posts.get(3).getAttachments().size());
assertEquals("root", posts.get(4).getPoster().getUserId());
assertEquals("Fifth Test with Truncation over 25 characters Topic", posts.get(4).getMessage().getSubject());
assertEquals("Fifth Test with Truncation over 25 characters Body", posts.get(4).getMessage().getText());
assertTrue(posts.get(4).getCreateDate().compareTo(today) < 0);
assertEquals(3, posts.get(4).getAttachments().size());
assertEquals("root", posts.get(5).getPoster().getUserId());
assertEquals("Sixth Test Topic", posts.get(5).getMessage().getSubject());
assertEquals("Sixth Test Body", posts.get(5).getMessage().getText());
assertTrue(posts.get(5).getCreateDate().compareTo(today) < 0);
assertEquals(3, posts.get(5).getAttachments().size());
goTo(driver);
searchTopicCriteria.setTimePeriod(null);
searchTopicCriteria.setSortBy(bundle.getString("Search_post_subject"));
searchTopicCriteria.setSortOrder(ASC.name());
posts = searchPost(driver, searchTopicCriteria);
assertTrue(posts != null);
assertEquals(6, posts.size());
assertEquals("root", posts.get(0).getPoster().getUserId());
assertEquals("Fifth Test with Truncation over 25 characters Topic", posts.get(0).getMessage().getSubject());
assertEquals("Fifth Test with Truncation over 25 characters Body", posts.get(0).getMessage().getText());
assertTrue(posts.get(0).getCreateDate().compareTo(today) < 0);
assertEquals(3, posts.get(0).getAttachments().size());
assertEquals("root", posts.get(1).getPoster().getUserId());
assertEquals("First Test Topic", posts.get(1).getMessage().getSubject());
assertEquals("First Test Body", posts.get(1).getMessage().getText());
assertTrue(posts.get(1).getCreateDate().compareTo(today) < 0);
assertEquals(3, posts.get(1).getAttachments().size());
assertEquals("root", posts.get(2).getPoster().getUserId());
assertEquals("Fourth Test Topic", posts.get(2).getMessage().getSubject());
assertEquals("Fourth Test Body", posts.get(2).getMessage().getText());
assertTrue(posts.get(2).getCreateDate().compareTo(today) < 0);
assertEquals(3, posts.get(2).getAttachments().size());
assertEquals("root", posts.get(3).getPoster().getUserId());
assertEquals("Second Test Topic", posts.get(3).getMessage().getSubject());
assertEquals("Second Test Body", posts.get(3).getMessage().getText());
assertTrue(posts.get(3).getCreateDate().compareTo(today) < 0);
assertEquals(3, posts.get(3).getAttachments().size());
assertEquals("root", posts.get(4).getPoster().getUserId());
assertEquals("Sixth Test Topic", posts.get(4).getMessage().getSubject());
assertEquals("Sixth Test Body", posts.get(4).getMessage().getText());
assertTrue(posts.get(4).getCreateDate().compareTo(today) < 0);
assertEquals(3, posts.get(4).getAttachments().size());
assertEquals("root", posts.get(5).getPoster().getUserId());
assertEquals("Third Test Topic", posts.get(5).getMessage().getSubject());
assertEquals("Third Test Body", posts.get(5).getMessage().getText());
assertTrue(posts.get(5).getCreateDate().compareTo(today) < 0);
assertEquals(3, posts.get(5).getAttachments().size());
goTo(driver);
searchTopicCriteria.setSortOrder(DESC.name());
posts = searchPost(driver, searchTopicCriteria);
assertTrue(posts != null);
assertEquals(6, posts.size());
assertEquals("root", posts.get(0).getPoster().getUserId());
assertEquals("Third Test Topic", posts.get(0).getMessage().getSubject());
assertEquals("Third Test Body", posts.get(0).getMessage().getText());
assertTrue(posts.get(2).getCreateDate().compareTo(today) < 0);
assertEquals(3, posts.get(0).getAttachments().size());
assertEquals("root", posts.get(1).getPoster().getUserId());
assertEquals("Sixth Test Topic", posts.get(1).getMessage().getSubject());
assertEquals("Sixth Test Body", posts.get(1).getMessage().getText());
assertTrue(posts.get(1).getCreateDate().compareTo(today) < 0);
assertEquals(3, posts.get(1).getAttachments().size());
assertEquals("root", posts.get(2).getPoster().getUserId());
assertEquals("Second Test Topic", posts.get(2).getMessage().getSubject());
assertEquals("Second Test Body", posts.get(2).getMessage().getText());
assertTrue(posts.get(2).getCreateDate().compareTo(today) < 0);
assertEquals(3, posts.get(2).getAttachments().size());
assertEquals("root", posts.get(3).getPoster().getUserId());
assertEquals("Fourth Test Topic", posts.get(3).getMessage().getSubject());
assertEquals("Fourth Test Body", posts.get(3).getMessage().getText());
assertTrue(posts.get(3).getCreateDate().compareTo(today) < 0);
assertEquals(3, posts.get(3).getAttachments().size());
assertEquals("root", posts.get(4).getPoster().getUserId());
assertEquals("First Test Topic", posts.get(4).getMessage().getSubject());
assertEquals("First Test Body", posts.get(4).getMessage().getText());
assertTrue(posts.get(4).getCreateDate().compareTo(today) < 0);
assertEquals(3, posts.get(4).getAttachments().size());
assertEquals("root", posts.get(5).getPoster().getUserId());
assertEquals("Fifth Test with Truncation over 25 characters Topic", posts.get(5).getMessage().getSubject());
assertEquals("Fifth Test with Truncation over 25 characters Body", posts.get(5).getMessage().getText());
assertTrue(posts.get(5).getCreateDate().compareTo(today) < 0);
assertEquals(3, posts.get(5).getAttachments().size());
goTo(driver);
searchTopicCriteria.setSortBy(null);
searchTopicCriteria.setSortOrder(null);
searchTopicCriteria.setSearching(MSG.name());
posts = searchPost(driver, searchTopicCriteria);
assertTrue(posts != null);
assertEquals(6, posts.size());
assertEquals("root", posts.get(0).getPoster().getUserId());
assertEquals("First Test Topic", posts.get(0).getMessage().getSubject());
assertEquals("First Test Body", posts.get(0).getMessage().getText());
assertTrue(posts.get(0).getCreateDate().compareTo(today) < 0);
assertEquals(3, posts.get(0).getAttachments().size());
assertEquals("root", posts.get(1).getPoster().getUserId());
assertEquals("Second Test Topic", posts.get(1).getMessage().getSubject());
assertEquals("Second Test Body", posts.get(1).getMessage().getText());
assertTrue(posts.get(1).getCreateDate().compareTo(today) < 0);
assertEquals(3, posts.get(1).getAttachments().size());
assertEquals("root", posts.get(2).getPoster().getUserId());
assertEquals("Third Test Topic", posts.get(2).getMessage().getSubject());
assertEquals("Third Test Body", posts.get(2).getMessage().getText());
assertTrue(posts.get(2).getCreateDate().compareTo(today) < 0);
assertEquals(3, posts.get(2).getAttachments().size());
assertEquals("root", posts.get(3).getPoster().getUserId());
assertEquals("Fourth Test Topic", posts.get(3).getMessage().getSubject());
assertEquals("Fourth Test Body", posts.get(3).getMessage().getText());
assertTrue(posts.get(3).getCreateDate().compareTo(today) < 0);
assertEquals(3, posts.get(3).getAttachments().size());
assertEquals("root", posts.get(4).getPoster().getUserId());
assertEquals("Fifth Test with Truncation over 25 characters Topic", posts.get(4).getMessage().getSubject());
assertEquals("Fifth Test with Truncation over 25 characters Body", posts.get(4).getMessage().getText());
assertTrue(posts.get(4).getCreateDate().compareTo(today) < 0);
assertEquals(3, posts.get(4).getAttachments().size());
assertEquals("root", posts.get(5).getPoster().getUserId());
assertEquals("Sixth Test Topic", posts.get(5).getMessage().getSubject());
assertEquals("Sixth Test Body", posts.get(5).getMessage().getText());
assertTrue(posts.get(5).getCreateDate().compareTo(today) < 0);
assertEquals(3, posts.get(5).getAttachments().size());
}
use of it.vige.rubia.search.SearchCriteria in project rubia-forums by flashboss.
the class SearchPostTest method searchPostsNoResults.
@Test
public void searchPostsNoResults() {
goTo(driver);
SearchCriteria searchTopicCriteria = new SearchCriteria();
searchTopicCriteria.setAuthor(null);
searchTopicCriteria.setCategory(null);
searchTopicCriteria.setDisplayAs(POSTS.name());
searchTopicCriteria.setForum(null);
searchTopicCriteria.setKeywords("Firstaaaaaa");
searchTopicCriteria.setPageNumber(0);
searchTopicCriteria.setPageSize(0);
searchTopicCriteria.setSearching(null);
searchTopicCriteria.setSortBy(null);
searchTopicCriteria.setSortOrder(null);
searchTopicCriteria.setTimePeriod(null);
List<Post> posts = searchPost(driver, searchTopicCriteria);
assertTrue(posts == null);
}
Aggregations