Search in sources :

Example 16 with Topic

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

the class ModerateForumTest method move.

@Test
public void move() {
    Forum forum = new Forum("First Test Forum");
    forum.setTopics(asList(new Topic[] { new Topic("Second Test Topic") }));
    goToModerate(driver, forum);
    String message = moveForum(driver, CONFIRM, null, null);
    assertTrue(message.equals(NOT_SELECTED_MESSAGE));
    message = moveForum(driver, CANCEL, forum, null);
    assertTrue(message.equals(""));
    message = moveForum(driver, CONFIRM, forum, null);
    assertTrue(message.equals(NOT_SELECTED_MESSAGE));
    message = moveForum(driver, CONFIRM, forum, null);
    assertTrue(message.equals(NO_DEST_FORUM_MESSAGE));
    message = moveForum(driver, CONFIRM, forum, null);
    assertTrue(message.equals(NOT_SELECTED_MESSAGE));
    Forum destForum = new Forum("Second Test Forum");
    message = moveForum(driver, CONFIRM, forum, destForum);
    assertTrue(message.equals(MOVED_FORUM_MESSAGE));
    goToModerate(driver, destForum);
    destForum.setTopics(asList(new Topic[] { new Topic("Second Test Topic") }));
    Topic verifiedTopic = verifyTopic(driver, destForum.getTopics().get(0));
    assertNotNull(verifiedTopic);
    assertEquals("Second Test Topic", verifiedTopic.getSubject());
    assertEquals("root", verifiedTopic.getPoster().getUserId());
    assertEquals(1, verifiedTopic.getPosts().size());
    assertEquals("Second Test Topic", verifiedTopic.getPosts().get(0).getMessage().getSubject());
    assertEquals("Second Test Body", verifiedTopic.getPosts().get(0).getMessage().getText());
    assertEquals("Second Test Question", verifiedTopic.getPoll().getTitle());
    goToModerate(driver, destForum);
    message = moveForum(driver, CONFIRM, destForum, forum);
    assertTrue(message.equals(MOVED_FORUM_MESSAGE));
    goToModerate(driver, forum);
    verifiedTopic = verifyTopic(driver, forum.getTopics().get(0));
    assertNotNull(verifiedTopic);
    assertEquals("Second Test Topic", verifiedTopic.getSubject());
    assertEquals("root", verifiedTopic.getPoster().getUserId());
    assertEquals(1, verifiedTopic.getPosts().size());
    assertEquals("Second Test Topic", verifiedTopic.getPosts().get(0).getMessage().getSubject());
    assertEquals("Second Test Body", verifiedTopic.getPosts().get(0).getMessage().getText());
    assertEquals("Second Test Question", verifiedTopic.getPoll().getTitle());
}
Also used : CreateTopic.createTopic(it.vige.rubia.selenium.forum.action.CreateTopic.createTopic) Topic(it.vige.rubia.model.Topic) VerifyTopic.verifyTopic(it.vige.rubia.selenium.moderate.action.VerifyTopic.verifyTopic) Forum(it.vige.rubia.model.Forum) LockForum.lockForum(it.vige.rubia.selenium.moderate.action.LockForum.lockForum) MoveForum.moveForum(it.vige.rubia.selenium.moderate.action.MoveForum.moveForum) CreateForum.createForum(it.vige.rubia.selenium.adminpanel.action.CreateForum.createForum) RemoveForum.removeForum(it.vige.rubia.selenium.moderate.action.RemoveForum.removeForum) LockForum.unlockForum(it.vige.rubia.selenium.moderate.action.LockForum.unlockForum) Test(org.junit.Test)

Example 17 with Topic

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

the class SearchPostTest method stop.

@AfterClass
public static void stop() {
    Topic topic = new Topic(new Forum("First Test Forum"), "First Test Topic", asList(new Post[] { new Post("First Test Body") }));
    String message = unregisterTopic(driver, topic);
    assertTrue(message.equals(OK));
    message = removeTopic(driver, topic);
    assertTrue(message.equals(OK));
    topic = new Topic(new Forum("First Test Forum"), "Second Test Topic", asList(new Post[] { new Post("Second Test Body") }));
    message = unregisterTopic(driver, topic);
    assertTrue(message.equals(OK));
    message = removeTopic(driver, topic);
    assertTrue(message.equals(OK));
    topic = new Topic(new Forum("Second Test Forum"), "Third Test Topic", asList(new Post[] { new Post("Third Test Body") }));
    message = unregisterTopic(driver, topic);
    assertTrue(message.equals(OK));
    message = removeTopic(driver, topic);
    assertTrue(message.equals(OK));
    topic = new Topic(new Forum("Second Test Forum"), "Fourth Test Topic", asList(new Post[] { new Post("Fourth Test Body") }));
    message = viewAllTopicsRemoveTopic(driver, topic);
    assertTrue(message.equals(OK));
    message = removeTopic(driver, topic);
    assertTrue(message.equals(OK));
    topic = new Topic(new Forum("Third Test Forum"), "Fifth Test with Truncation over 25 characters Topic", asList(new Post[] { new Post("Fifth Test with Truncation over 25 characters Body") }));
    message = viewAllTopicsRemoveTopic(driver, topic);
    assertTrue(message.equals(OK));
    message = removeTopic(driver, topic);
    assertTrue(message.equals(OK));
    topic = new Topic(new Forum("Third Test Forum"), "Sixth Test Topic", asList(new Post[] { new Post("Sixth Test Body") }));
    message = removeTopic(driver, topic);
    assertTrue(message.equals(OK));
    message = removeForum(driver, new Forum("First Test Forum"), "Second Test Forum");
    assertTrue(message.equals(REMOVED_FORUM_0_MESSAGE));
    message = removeForum(driver, new Forum("Second Test Forum"), SELECT_FORUM_TYPE);
    assertTrue(message.equals(REMOVED_FORUM_1_MESSAGE));
    message = removeForum(driver, new Forum("Third Test Forum"), SELECT_FORUM_TYPE);
    assertTrue(message.equals(REMOVED_FORUM_2_MESSAGE));
    message = removeCategory(driver, new Category("First Test Category"), SELECT_CATEGORY_TYPE);
    assertTrue(message.equals(REMOVED_CATEGORY_0_MESSAGE));
    message = removeCategory(driver, new Category("Second Test Category"), SELECT_CATEGORY_TYPE);
    assertTrue(message.equals(REMOVED_CATEGORY_1_MESSAGE));
}
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) ViewPagePostSearch.searchPost(it.vige.rubia.selenium.search.action.ViewPagePostSearch.searchPost) Post(it.vige.rubia.model.Post) RemoveTopic.removeTopic(it.vige.rubia.selenium.forum.action.RemoveTopic.removeTopic) ViewAllTopicsRemoveTopic.viewAllTopicsRemoveTopic(it.vige.rubia.selenium.myforums.action.ViewAllTopicsRemoveTopic.viewAllTopicsRemoveTopic) CreateTopic.createTopic(it.vige.rubia.selenium.forum.action.CreateTopic.createTopic) Topic(it.vige.rubia.model.Topic) SubscriptionTopic.registerTopic(it.vige.rubia.selenium.forum.action.SubscriptionTopic.registerTopic) SubscriptionTopic.unregisterTopic(it.vige.rubia.selenium.forum.action.SubscriptionTopic.unregisterTopic) Forum(it.vige.rubia.model.Forum) RemoveForum.removeForum(it.vige.rubia.selenium.adminpanel.action.RemoveForum.removeForum) CreateForum.createForum(it.vige.rubia.selenium.adminpanel.action.CreateForum.createForum) AfterClass(org.junit.AfterClass)

Example 18 with Topic

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

the class OperationPollTest method verifyUpdatePoll.

@Test
public void verifyUpdatePoll() {
    Topic topic = new Topic(new Forum("Second Test Forum"), "Fourth Test Topic");
    goTo(driver, topic);
    Poll pollToUpdate = getPollOfCurrentTopic(driver);
    pollToUpdate.setTitle("Second Test Question");
    pollToUpdate = updatePoll(driver, pollToUpdate);
    pollToUpdate.getOptions().get(0).setQuestion("Third Test Answer");
    pollToUpdate.getOptions().get(1).setQuestion("Fourth Test Answer");
    Poll updatedPoll = updateOptions(driver, pollToUpdate);
    assertEquals("Second Test Question", updatedPoll.getTitle());
    assertEquals(0, updatedPoll.getVotesSum());
    List<PollOption> options = updatedPoll.getOptions();
    assertEquals("Third Test Answer", options.get(0).getQuestion());
    assertEquals("Fourth Test Answer", options.get(1).getQuestion());
    assertEquals(0, options.get(0).getVotes());
    assertEquals(0, options.get(1).getVotes());
    assertEquals(2, options.size());
    pollToUpdate.setTitle("Fourth Test Question");
    updatePoll(driver, pollToUpdate);
    pollToUpdate.getOptions().get(0).setQuestion("Seventh Test Answer");
    pollToUpdate.getOptions().get(1).setQuestion("Eight Test Answer");
    updatedPoll = updateOptions(driver, pollToUpdate);
    assertEquals("Fourth Test Question", updatedPoll.getTitle());
    assertEquals(0, updatedPoll.getVotesSum());
    options = updatedPoll.getOptions();
    assertEquals("Seventh Test Answer", options.get(0).getQuestion());
    assertEquals("Eight Test Answer", options.get(1).getQuestion());
    assertEquals(0, options.get(0).getVotes());
    assertEquals(0, options.get(1).getVotes());
    assertEquals(2, options.size());
}
Also used : UpdatePoll.updatePoll(it.vige.rubia.selenium.forum.action.UpdatePoll.updatePoll) Poll(it.vige.rubia.model.Poll) RemovePoll.removePoll(it.vige.rubia.selenium.forum.action.RemovePoll.removePoll) CreatePoll.addPoll(it.vige.rubia.selenium.forum.action.CreatePoll.addPoll) PollOption(it.vige.rubia.model.PollOption) 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) VerifyPoll.getPollOfCurrentTopic(it.vige.rubia.selenium.forum.action.VerifyPoll.getPollOfCurrentTopic) Forum(it.vige.rubia.model.Forum) RemoveForum.removeForum(it.vige.rubia.selenium.adminpanel.action.RemoveForum.removeForum) CreateForum.createForum(it.vige.rubia.selenium.adminpanel.action.CreateForum.createForum) Test(org.junit.Test)

Example 19 with Topic

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

the class OperationPollTest method verifyCreatedPolls.

@Test
public void verifyCreatedPolls() {
    List<Poll> polls = getPollsOfTopics(driver, new Topic("First Test Topic"), new Topic("Second Test Topic"), new Topic("Third Test Topic"), new Topic("Fourth Test Topic"));
    assertEquals(4, polls.size());
    Poll secondTestPoll = polls.get(0);
    assertEquals("Second Test Question", secondTestPoll.getTitle());
    assertEquals(secondTestPoll.getVotesSum(), 0);
    List<PollOption> options = secondTestPoll.getOptions();
    assertEquals("Third Test Answer", options.get(0).getQuestion());
    assertEquals("Fourth Test Answer", options.get(1).getQuestion());
    assertEquals(0, options.get(0).getVotes());
    assertEquals(0, options.get(1).getVotes());
    assertEquals(2, options.size());
    Poll firstTestPoll = polls.get(1);
    assertEquals("First Test Question", firstTestPoll.getTitle());
    assertEquals(0, firstTestPoll.getVotesSum());
    options = firstTestPoll.getOptions();
    assertEquals("First Test Answer", options.get(0).getQuestion());
    assertEquals("Second Test Answer", options.get(1).getQuestion());
    assertEquals(0, options.get(0).getVotes());
    assertEquals(0, options.get(1).getVotes());
    assertEquals(2, options.size());
    Poll thirdTestPoll = polls.get(2);
    assertEquals("Third Test Question", thirdTestPoll.getTitle());
    assertEquals(0, thirdTestPoll.getVotesSum());
    options = thirdTestPoll.getOptions();
    assertEquals("Fifth Test with Truncation over 25 characters Answer", options.get(0).getQuestion());
    assertEquals("Sixth Test Answer", options.get(1).getQuestion());
    assertEquals(0, options.get(0).getVotes());
    assertEquals(0, options.get(1).getVotes());
    assertEquals(2, options.size());
    Poll fourthTestPoll = polls.get(3);
    assertEquals("Fourth Test Question", fourthTestPoll.getTitle());
    assertEquals(0, fourthTestPoll.getVotesSum());
    options = fourthTestPoll.getOptions();
    assertEquals("Seventh Test Answer", options.get(0).getQuestion());
    assertEquals("Eight Test Answer", options.get(1).getQuestion());
    assertEquals(0, options.get(0).getVotes());
    assertEquals(0, options.get(1).getVotes());
    assertEquals(2, options.size());
}
Also used : UpdatePoll.updatePoll(it.vige.rubia.selenium.forum.action.UpdatePoll.updatePoll) Poll(it.vige.rubia.model.Poll) RemovePoll.removePoll(it.vige.rubia.selenium.forum.action.RemovePoll.removePoll) CreatePoll.addPoll(it.vige.rubia.selenium.forum.action.CreatePoll.addPoll) PollOption(it.vige.rubia.model.PollOption) 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) VerifyPoll.getPollOfCurrentTopic(it.vige.rubia.selenium.forum.action.VerifyPoll.getPollOfCurrentTopic) Test(org.junit.Test)

Example 20 with Topic

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

the class OperationTopicTest method verifyCreatedTopics.

@Test
public void verifyCreatedTopics() {
    List<Topic> topics = getTopicsOfForums(driver, new Forum("First Test Forum"), new Forum("Second Test Forum"));
    assertEquals(5, topics.size());
    Date today = new Date();
    Topic secondTestTopic = topics.get(0);
    assertEquals("First Test Category", secondTestTopic.getForum().getCategory().getTitle());
    assertEquals("First Test Forum", secondTestTopic.getForum().getName());
    assertTrue(secondTestTopic.getLastPostDate().compareTo(today) < 0);
    assertEquals("Second Test Topic", secondTestTopic.getSubject());
    assertEquals(IMPORTANT, secondTestTopic.getType());
    assertEquals(0, secondTestTopic.getViewCount());
    assertEquals(0, secondTestTopic.getReplies());
    assertEquals("root", secondTestTopic.getPoster().getUserId());
    assertEquals(1, secondTestTopic.getPosts().size());
    Topic firstTestTopic = topics.get(1);
    assertEquals("First Test Category", firstTestTopic.getForum().getCategory().getTitle());
    assertEquals("First Test Forum", firstTestTopic.getForum().getName());
    assertTrue(firstTestTopic.getLastPostDate().compareTo(today) < 0);
    assertEquals("First Test Topic", firstTestTopic.getSubject());
    assertEquals(NORMAL, firstTestTopic.getType());
    assertEquals(0, firstTestTopic.getViewCount());
    assertEquals(0, firstTestTopic.getReplies());
    assertEquals("root", firstTestTopic.getPoster().getUserId());
    assertEquals(1, firstTestTopic.getPosts().size());
    Topic thirdTestTopic = topics.get(2);
    assertEquals("First Test Category", thirdTestTopic.getForum().getCategory().getTitle());
    assertEquals("Second Test Forum", thirdTestTopic.getForum().getName());
    assertTrue(thirdTestTopic.getLastPostDate().compareTo(today) < 0);
    assertEquals("Third Test Topic", thirdTestTopic.getSubject());
    assertEquals(ADVICE, thirdTestTopic.getType());
    assertEquals(0, thirdTestTopic.getViewCount());
    assertEquals(0, thirdTestTopic.getReplies());
    assertEquals("root", thirdTestTopic.getPoster().getUserId());
    assertEquals(1, thirdTestTopic.getPosts().size());
    Topic fifthTestTopic = topics.get(3);
    assertEquals("First Test Category", fifthTestTopic.getForum().getCategory().getTitle());
    assertEquals("Second Test Forum", fifthTestTopic.getForum().getName());
    assertTrue(fifthTestTopic.getLastPostDate().compareTo(today) < 0);
    assertEquals("Fifth Test with Truncation over 25 characters Topic", fifthTestTopic.getSubject());
    assertEquals(IMPORTANT, fifthTestTopic.getType());
    assertEquals(0, fifthTestTopic.getViewCount());
    assertEquals(0, fifthTestTopic.getReplies());
    assertEquals("root", fifthTestTopic.getPoster().getUserId());
    assertEquals(1, fifthTestTopic.getPosts().size());
    Topic fourthTestTopic = topics.get(4);
    assertEquals("First Test Category", fourthTestTopic.getForum().getCategory().getTitle());
    assertEquals("Second Test Forum", fourthTestTopic.getForum().getName());
    assertTrue(fourthTestTopic.getLastPostDate().compareTo(today) < 0);
    assertEquals("Fourth Test Topic", fourthTestTopic.getSubject());
    assertEquals(IMPORTANT, fourthTestTopic.getType());
    assertEquals(0, fourthTestTopic.getViewCount());
    assertEquals(0, fourthTestTopic.getReplies());
    assertEquals("root", fourthTestTopic.getPoster().getUserId());
    assertEquals(1, fourthTestTopic.getPosts().size());
}
Also used : CreateTopic.createTopic(it.vige.rubia.selenium.forum.action.CreateTopic.createTopic) Topic(it.vige.rubia.model.Topic) RemoveTopic.removeTopic(it.vige.rubia.selenium.forum.action.RemoveTopic.removeTopic) Date(java.util.Date) Forum(it.vige.rubia.model.Forum) RemoveForum.removeForum(it.vige.rubia.selenium.adminpanel.action.RemoveForum.removeForum) CreateForum.createForum(it.vige.rubia.selenium.adminpanel.action.CreateForum.createForum) Test(org.junit.Test)

Aggregations

Topic (it.vige.rubia.model.Topic)112 CreateTopic.createTopic (it.vige.rubia.selenium.forum.action.CreateTopic.createTopic)64 Forum (it.vige.rubia.model.Forum)63 Post (it.vige.rubia.model.Post)62 CreateForum.createForum (it.vige.rubia.selenium.adminpanel.action.CreateForum.createForum)49 RemoveTopic.removeTopic (it.vige.rubia.selenium.forum.action.RemoveTopic.removeTopic)48 RemoveForum.removeForum (it.vige.rubia.selenium.adminpanel.action.RemoveForum.removeForum)39 Category (it.vige.rubia.model.Category)36 Test (org.junit.Test)36 CreateCategory.createCategory (it.vige.rubia.selenium.adminpanel.action.CreateCategory.createCategory)30 RemoveCategory.removeCategory (it.vige.rubia.selenium.adminpanel.action.RemoveCategory.removeCategory)30 Poll (it.vige.rubia.model.Poll)25 PollOption (it.vige.rubia.model.PollOption)24 Attachment (it.vige.rubia.model.Attachment)23 Poster (it.vige.rubia.model.Poster)17 CreatePost.createPost (it.vige.rubia.selenium.forum.action.CreatePost.createPost)16 WebElement (org.openqa.selenium.WebElement)16 SecureActionForum (it.vige.rubia.auth.SecureActionForum)14 Date (java.util.Date)14 Interceptors (javax.interceptor.Interceptors)13