Search in sources :

Example 6 with SearchCriteria

use of it.vige.rubia.search.SearchCriteria in project rubia-forums by flashboss.

the class SearchPostTest method verifyPostProfileFromTopicPageButton.

@Test
public void verifyPostProfileFromTopicPageButton() {
    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);
    Post post = posts.get(3);
    Poster poster = getPosterFromButton(driver, post);
    assertTrue(poster != null);
    assertEquals("root", poster.getUserId());
    assertTrue(poster.getPostCount() >= 6);
}
Also used : ViewPagePostSearch.searchPost(it.vige.rubia.selenium.search.action.ViewPagePostSearch.searchPost) Post(it.vige.rubia.model.Post) Poster(it.vige.rubia.model.Poster) SearchCriteria(it.vige.rubia.search.SearchCriteria) Test(org.junit.Test)

Example 7 with SearchCriteria

use of it.vige.rubia.search.SearchCriteria in project rubia-forums by flashboss.

the class SearchPostTest method verifyPostProfileFromTopicPage.

@Test
public void verifyPostProfileFromTopicPage() {
    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);
    Post post = posts.get(2);
    Poster poster = getPosterFromLink(driver, post);
    assertTrue(poster != null);
    assertEquals("root", poster.getUserId());
    assertTrue(poster.getPostCount() >= 6);
}
Also used : ViewPagePostSearch.searchPost(it.vige.rubia.selenium.search.action.ViewPagePostSearch.searchPost) Post(it.vige.rubia.model.Post) Poster(it.vige.rubia.model.Poster) SearchCriteria(it.vige.rubia.search.SearchCriteria) Test(org.junit.Test)

Example 8 with SearchCriteria

use of it.vige.rubia.search.SearchCriteria in project rubia-forums by flashboss.

the class SearchPostTest method searchPostsWithReset.

@Test
public void searchPostsWithReset() {
    goTo(driver);
    SearchCriteria searchTopicCriteria = new SearchCriteria();
    searchTopicCriteria.setAuthor(null);
    searchTopicCriteria.setCategory(null);
    searchTopicCriteria.setDisplayAs(POSTS.name());
    searchTopicCriteria.setForum(null);
    searchTopicCriteria.setKeywords("First");
    searchTopicCriteria.setPageNumber(0);
    searchTopicCriteria.setPageSize(0);
    searchTopicCriteria.setSearching(null);
    searchTopicCriteria.setSortBy(null);
    searchTopicCriteria.setSortOrder(null);
    searchTopicCriteria.setTimePeriod(null);
    reset(driver, searchTopicCriteria);
    List<Post> posts = getPosts(driver, searchTopicCriteria);
    assertTrue(posts == null);
}
Also used : ViewPagePostSearch.searchPost(it.vige.rubia.selenium.search.action.ViewPagePostSearch.searchPost) Post(it.vige.rubia.model.Post) SearchCriteria(it.vige.rubia.search.SearchCriteria) Test(org.junit.Test)

Example 9 with SearchCriteria

use of it.vige.rubia.search.SearchCriteria in project rubia-forums by flashboss.

the class Search method search.

public String search() throws Exception {
    int currentPage = 0;
    SearchCriteria criteria = getSearchCriteria();
    criteria.setPageSize(userPreferences.getPostsPerTopic());
    criteria.setPageNumber(currentPage);
    if (criteria.getDisplayAs().equals(POSTS.name())) {
        ResultPage<Post> resultPage = forumsSearchModule.findPosts(criteria);
        viewSearch.setPosts(resultPage.getPage());
        viewSearch.setPostsDataModel(new ListDataModel<Post>(viewSearch.getPosts()));
        if (viewSearch.getPosts() != null && viewSearch.getPosts().isEmpty()) {
            viewSearch.setPosts(null);
            viewSearch.setPostsDataModel(null);
        }
        return "posts";
    } else {
        ResultPage<Topic> resultPage = forumsSearchModule.findTopics(criteria);
        viewSearch.setTopics(resultPage.getPage());
        viewSearch.setTopicsDataModel(new ListDataModel<Topic>(viewSearch.getTopics()));
        if (viewSearch.getTopics() == null || viewSearch.getTopics().isEmpty()) {
            viewSearch.setTopics(null);
            viewSearch.setTopicsDataModel(null);
        } else {
            viewSearch.setTopicLastPosts(forumsModule.findLastPostsOfTopics(viewSearch.getTopics()));
        }
        return "topics";
    }
}
Also used : Post(it.vige.rubia.model.Post) Topic(it.vige.rubia.model.Topic) SearchCriteria(it.vige.rubia.search.SearchCriteria)

Example 10 with SearchCriteria

use of it.vige.rubia.search.SearchCriteria in project rubia-forums by flashboss.

the class SearchTopicTest method searchTopicsNoResults.

@Test
public void searchTopicsNoResults() {
    goTo(driver);
    SearchCriteria searchForumCriteria = new SearchCriteria();
    searchForumCriteria.setAuthor(null);
    searchForumCriteria.setCategory(null);
    searchForumCriteria.setDisplayAs(TOPICS.name());
    searchForumCriteria.setForum(null);
    searchForumCriteria.setKeywords("Firstaaaaa");
    searchForumCriteria.setPageNumber(0);
    searchForumCriteria.setPageSize(0);
    searchForumCriteria.setSearching(null);
    searchForumCriteria.setSortBy(null);
    searchForumCriteria.setSortOrder(null);
    searchForumCriteria.setTimePeriod(null);
    List<Topic> topics = searchTopic(driver, searchForumCriteria);
    assertTrue(topics == null);
}
Also used : RemoveTopic.removeTopic(it.vige.rubia.selenium.forum.action.RemoveTopic.removeTopic) ViewPageTopicSearch.searchTopic(it.vige.rubia.selenium.search.action.ViewPageTopicSearch.searchTopic) CreateTopic.createTopic(it.vige.rubia.selenium.forum.action.CreateTopic.createTopic) Topic(it.vige.rubia.model.Topic) ViewPageTopicSearch.getTopic(it.vige.rubia.selenium.search.action.ViewPageTopicSearch.getTopic) SearchCriteria(it.vige.rubia.search.SearchCriteria) Test(org.junit.Test)

Aggregations

SearchCriteria (it.vige.rubia.search.SearchCriteria)14 Test (org.junit.Test)13 Post (it.vige.rubia.model.Post)8 Topic (it.vige.rubia.model.Topic)8 CreateTopic.createTopic (it.vige.rubia.selenium.forum.action.CreateTopic.createTopic)7 RemoveTopic.removeTopic (it.vige.rubia.selenium.forum.action.RemoveTopic.removeTopic)7 ViewPageTopicSearch.getTopic (it.vige.rubia.selenium.search.action.ViewPageTopicSearch.getTopic)7 ViewPageTopicSearch.searchTopic (it.vige.rubia.selenium.search.action.ViewPageTopicSearch.searchTopic)7 ViewPagePostSearch.searchPost (it.vige.rubia.selenium.search.action.ViewPagePostSearch.searchPost)6 Poster (it.vige.rubia.model.Poster)4 ViewPageTopicSearch.getPoster (it.vige.rubia.selenium.search.action.ViewPageTopicSearch.getPoster)2 Date (java.util.Date)2 ResourceBundle (java.util.ResourceBundle)2 ViewPageTopicSearch.getPosterLastPost (it.vige.rubia.selenium.search.action.ViewPageTopicSearch.getPosterLastPost)1