Search in sources :

Example 16 with Forum

use of it.vige.rubia.model.Forum 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 17 with Forum

use of it.vige.rubia.model.Forum 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)

Example 18 with Forum

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

the class OperationTopicTest method stop.

@AfterClass
public static void stop() {
    String message = removeTopic(driver, new Topic(new Forum("First Test Forum"), "First Test Topic", asList(new Post[] { new Post("First Test Body") })));
    assertTrue(message.equals(OK));
    message = removeTopic(driver, new Topic(new Forum("Second Test Forum"), "Third Test Topic", asList(new Post[] { new Post("Third Test Body") })));
    assertTrue(message.equals(OK));
    message = removeTopic(driver, new Topic(new Forum("Second Test Forum"), "Fourth Test Topic", asList(new Post[] { new Post("Fourth Test Body") })));
    assertTrue(message.equals(OK));
    message = removeTopic(driver, new Topic(new Forum("Second Test Forum"), "Fifth Test with Truncation over 25 characters Topic", asList(new Post[] { new Post("Fifth Test with Truncation over 25 characters Body") })));
    assertTrue(message.equals(OK));
    message = removeForum(driver, new Forum("First Test Forum"), "Second Test Forum");
    assertTrue(message.equals(REMOVED_FORUM_0_MESSAGE));
    message = removeTopic(driver, new Topic(new Forum("Second Test Forum"), "Second Test Topic", asList(new Post[] { new Post("Second Test Body") })));
    assertTrue(message.equals(OK));
    message = removeForum(driver, new Forum("Second Test Forum"), SELECT_FORUM_TYPE);
    assertTrue(message.equals(REMOVED_FORUM_1_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) Post(it.vige.rubia.model.Post) 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) 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 19 with Forum

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

the class MyForumsForumTest method verifyRegisteredCanceledForums.

@Test
public void verifyRegisteredCanceledForums() {
    Forum forum = new Forum("Fourth Test Forum", "Fourth Test Description", new Category("Second Test Category"));
    String message = registerForum(driver, forum, EMAIL_NO_NOTIFICATION, CANCEL);
    assertTrue(message.equals("Fourth Test Forum"));
    assertTrue(!isRegistered(driver, forum));
}
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) Forum(it.vige.rubia.model.Forum) ViewAllForumsSelectForum(it.vige.rubia.selenium.myforums.action.ViewAllForumsSelectForum) ViewAllForumsUpdateForum.viewAllForumsUpdateForum(it.vige.rubia.selenium.myforums.action.ViewAllForumsUpdateForum.viewAllForumsUpdateForum) ViewAllForumsRemoveForum.viewAllForumsRemoveForum(it.vige.rubia.selenium.myforums.action.ViewAllForumsRemoveForum.viewAllForumsRemoveForum) RemoveForum.removeForum(it.vige.rubia.selenium.adminpanel.action.RemoveForum.removeForum) SubscriptionForum.unregisterForum(it.vige.rubia.selenium.forum.action.SubscriptionForum.unregisterForum) CreateForum.createForum(it.vige.rubia.selenium.adminpanel.action.CreateForum.createForum) ViewAllForumsRemoveForum.viewAllEditForumsRemoveForum(it.vige.rubia.selenium.myforums.action.ViewAllForumsRemoveForum.viewAllEditForumsRemoveForum) SubscriptionForum.registerForum(it.vige.rubia.selenium.forum.action.SubscriptionForum.registerForum) Test(org.junit.Test)

Example 20 with Forum

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

the class MyForumsForumTest method verifyAllForumsForum.

@Test
public void verifyAllForumsForum() {
    Forum forum = new Forum("Third Test Forum", "Third Test Description", new Category("Second Test Category"));
    Forum result = ViewAllForumsSelectForum.selectForum(driver, forum);
    assertTrue(result != null);
    assertEquals(forum.getName(), result.getName());
    assertEquals(0, result.getTopics().size());
    assertEquals(forum.getCategory().getTitle(), result.getCategory().getTitle());
}
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) Forum(it.vige.rubia.model.Forum) ViewAllForumsSelectForum(it.vige.rubia.selenium.myforums.action.ViewAllForumsSelectForum) ViewAllForumsUpdateForum.viewAllForumsUpdateForum(it.vige.rubia.selenium.myforums.action.ViewAllForumsUpdateForum.viewAllForumsUpdateForum) ViewAllForumsRemoveForum.viewAllForumsRemoveForum(it.vige.rubia.selenium.myforums.action.ViewAllForumsRemoveForum.viewAllForumsRemoveForum) RemoveForum.removeForum(it.vige.rubia.selenium.adminpanel.action.RemoveForum.removeForum) SubscriptionForum.unregisterForum(it.vige.rubia.selenium.forum.action.SubscriptionForum.unregisterForum) CreateForum.createForum(it.vige.rubia.selenium.adminpanel.action.CreateForum.createForum) ViewAllForumsRemoveForum.viewAllEditForumsRemoveForum(it.vige.rubia.selenium.myforums.action.ViewAllForumsRemoveForum.viewAllEditForumsRemoveForum) SubscriptionForum.registerForum(it.vige.rubia.selenium.forum.action.SubscriptionForum.registerForum) Test(org.junit.Test)

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