Search in sources :

Example 81 with Post

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

the class OperationPostTest method verifyCreatedPosts.

@Test
public void verifyCreatedPosts() {
    List<Post> posts = getPostsOfTopics(driver, new Topic("First Test Topic"), new Topic("Second Test Topic"), new Topic("Third Test Topic"), new Topic("Fourth Test Topic"));
    assertEquals(14, posts.size());
    Date today = new Date();
    Post secondTestPost = posts.get(0);
    Date createdDate1 = secondTestPost.getCreateDate();
    assertFalse(createdDate1.after(today));
    assertEquals(0, secondTestPost.getEditCount());
    assertNull(secondTestPost.getEditDate());
    assertEquals("Second Test Topic", secondTestPost.getMessage().getSubject());
    assertEquals("Second Test Body", secondTestPost.getMessage().getText());
    assertEquals("root", secondTestPost.getPoster().getUserId());
    assertEquals("Second Test Topic", secondTestPost.getTopic().getSubject());
    assertEquals("First Test Forum", secondTestPost.getTopic().getForum().getName());
    assertEquals("First Test Category", secondTestPost.getTopic().getForum().getCategory().getTitle());
    Post nextFifthTestPost = posts.get(1);
    Date createdNextFifthTestPostDate = nextFifthTestPost.getCreateDate();
    assertFalse(createdNextFifthTestPostDate.after(today));
    assertFalse(createdDate1.after(createdNextFifthTestPostDate));
    assertEquals(0, nextFifthTestPost.getEditCount());
    assertNull(nextFifthTestPost.getEditDate());
    assertEquals(RE + "Second Test Topic", nextFifthTestPost.getMessage().getSubject());
    assertEquals("Fifth Test with Truncation over 25 characters Post", nextFifthTestPost.getMessage().getText());
    assertEquals("root", nextFifthTestPost.getPoster().getUserId());
    assertEquals("Second Test Topic", nextFifthTestPost.getTopic().getSubject());
    assertEquals("First Test Forum", nextFifthTestPost.getTopic().getForum().getName());
    assertEquals("First Test Category", nextFifthTestPost.getTopic().getForum().getCategory().getTitle());
    Post nextSixthTestPost = posts.get(2);
    Date createdNextSixthTestPostDate = nextSixthTestPost.getCreateDate();
    assertFalse(createdNextSixthTestPostDate.after(today));
    assertFalse(createdNextFifthTestPostDate.after(createdNextSixthTestPostDate));
    assertEquals(0, nextSixthTestPost.getEditCount());
    assertNull(nextSixthTestPost.getEditDate());
    assertEquals(RE + "Second Test Topic", nextSixthTestPost.getMessage().getSubject());
    assertEquals("Sixth Test Post", nextSixthTestPost.getMessage().getText());
    assertEquals("root", nextSixthTestPost.getPoster().getUserId());
    assertEquals("Second Test Topic", nextSixthTestPost.getTopic().getSubject());
    assertEquals("First Test Forum", nextSixthTestPost.getTopic().getForum().getName());
    assertEquals("First Test Category", nextSixthTestPost.getTopic().getForum().getCategory().getTitle());
    Post nextSeventhTestPost = posts.get(3);
    Date createdNextSeventhTestPostDate = nextSeventhTestPost.getCreateDate();
    assertFalse(createdNextSeventhTestPostDate.after(today));
    assertFalse(createdNextSixthTestPostDate.after(createdNextSeventhTestPostDate));
    assertEquals(0, nextSeventhTestPost.getEditCount());
    assertNull(nextSeventhTestPost.getEditDate());
    assertEquals(RE + "Second Test Topic", nextSeventhTestPost.getMessage().getSubject());
    assertEquals("Seventh Test Post", nextSeventhTestPost.getMessage().getText());
    assertEquals("root", nextSeventhTestPost.getPoster().getUserId());
    assertEquals("Second Test Topic", nextSeventhTestPost.getTopic().getSubject());
    assertEquals("First Test Forum", nextSeventhTestPost.getTopic().getForum().getName());
    assertEquals("First Test Category", nextSeventhTestPost.getTopic().getForum().getCategory().getTitle());
    Post firstTestPost = posts.get(4);
    Date createdDate2 = firstTestPost.getCreateDate();
    assertFalse(createdDate2.after(today));
    assertFalse(createdDate1.before(createdDate2));
    assertEquals(0, firstTestPost.getEditCount());
    assertNull(firstTestPost.getEditDate());
    assertEquals("First Test Topic", firstTestPost.getMessage().getSubject());
    assertEquals("First Test Body", firstTestPost.getMessage().getText());
    assertEquals("root", firstTestPost.getPoster().getUserId());
    assertEquals("First Test Topic", firstTestPost.getTopic().getSubject());
    assertEquals("First Test Forum", firstTestPost.getTopic().getForum().getName());
    assertEquals("First Test Category", firstTestPost.getTopic().getForum().getCategory().getTitle());
    Post nextFirstTestPost = posts.get(5);
    Date createdNextFirstTestPostDate = nextFirstTestPost.getCreateDate();
    assertFalse(createdNextFirstTestPostDate.after(today));
    assertFalse(createdDate2.after(createdNextFirstTestPostDate));
    assertEquals(0, nextFirstTestPost.getEditCount());
    assertNull(nextFirstTestPost.getEditDate());
    assertEquals(RE + "First Test Topic", nextFirstTestPost.getMessage().getSubject());
    assertEquals("First Test Post", nextFirstTestPost.getMessage().getText());
    assertEquals("root", nextFirstTestPost.getPoster().getUserId());
    assertEquals("First Test Topic", nextFirstTestPost.getTopic().getSubject());
    assertEquals("First Test Forum", nextFirstTestPost.getTopic().getForum().getName());
    assertEquals("First Test Category", nextFirstTestPost.getTopic().getForum().getCategory().getTitle());
    Post nextSecondTestPost = posts.get(6);
    Date createdNextSecondTestPostDate = nextSecondTestPost.getCreateDate();
    assertFalse(createdNextSecondTestPostDate.after(today));
    assertFalse(createdNextFirstTestPostDate.after(createdNextSecondTestPostDate));
    assertEquals(0, nextSecondTestPost.getEditCount());
    assertNull(nextSecondTestPost.getEditDate());
    assertEquals(RE + "First Test Topic", nextSecondTestPost.getMessage().getSubject());
    assertEquals("Second Test Post", nextSecondTestPost.getMessage().getText());
    assertEquals("root", nextSecondTestPost.getPoster().getUserId());
    assertEquals("First Test Topic", nextSecondTestPost.getTopic().getSubject());
    assertEquals("First Test Forum", nextSecondTestPost.getTopic().getForum().getName());
    assertEquals("First Test Category", nextSecondTestPost.getTopic().getForum().getCategory().getTitle());
    Post nextThirdTestPost = posts.get(7);
    Date createdNextThirdTestPostDate = nextThirdTestPost.getCreateDate();
    assertFalse(createdNextThirdTestPostDate.after(today));
    assertFalse(createdNextSecondTestPostDate.after(createdNextThirdTestPostDate));
    assertEquals(0, nextThirdTestPost.getEditCount());
    assertNull(nextThirdTestPost.getEditDate());
    assertEquals(RE + "First Test Topic", nextThirdTestPost.getMessage().getSubject());
    assertEquals("Third Test Post", nextThirdTestPost.getMessage().getText());
    assertEquals("root", nextThirdTestPost.getPoster().getUserId());
    assertEquals("First Test Topic", nextThirdTestPost.getTopic().getSubject());
    assertEquals("First Test Forum", nextThirdTestPost.getTopic().getForum().getName());
    assertEquals("First Test Category", nextThirdTestPost.getTopic().getForum().getCategory().getTitle());
    Post nextFourthTestPost = posts.get(8);
    Date createdNextFourthTestPostDate = nextFourthTestPost.getCreateDate();
    assertFalse(createdNextFourthTestPostDate.after(today));
    assertFalse(createdNextThirdTestPostDate.after(createdNextFourthTestPostDate));
    assertEquals(0, nextFourthTestPost.getEditCount());
    assertNull(nextFourthTestPost.getEditDate());
    assertEquals(RE + "First Test Topic", nextFourthTestPost.getMessage().getSubject());
    assertEquals("Fourth Test Post", nextFourthTestPost.getMessage().getText());
    assertEquals("root", nextFourthTestPost.getPoster().getUserId());
    assertEquals("First Test Topic", nextFourthTestPost.getTopic().getSubject());
    assertEquals("First Test Forum", nextFourthTestPost.getTopic().getForum().getName());
    assertEquals("First Test Category", nextFourthTestPost.getTopic().getForum().getCategory().getTitle());
    Post thirdTestPost = posts.get(9);
    Date createdDate3 = thirdTestPost.getCreateDate();
    assertFalse(createdDate3.after(today));
    assertFalse(createdDate2.after(createdDate3));
    assertEquals(0, thirdTestPost.getEditCount());
    assertNull(thirdTestPost.getEditDate());
    assertEquals("Third Test Topic", thirdTestPost.getMessage().getSubject());
    assertEquals("Third Test Body", thirdTestPost.getMessage().getText());
    assertEquals("root", thirdTestPost.getPoster().getUserId());
    assertEquals("Third Test Topic", thirdTestPost.getTopic().getSubject());
    assertEquals("Second Test Forum", thirdTestPost.getTopic().getForum().getName());
    assertEquals("First Test Category", thirdTestPost.getTopic().getForum().getCategory().getTitle());
    Post nextEightTestPost = posts.get(10);
    Date createdNextEightTestPostDate = nextEightTestPost.getCreateDate();
    assertFalse(createdNextEightTestPostDate.after(today));
    assertFalse(createdDate3.after(createdNextEightTestPostDate));
    assertEquals(0, nextEightTestPost.getEditCount());
    assertNull(nextEightTestPost.getEditDate());
    assertEquals(RE + "Third Test Topic", nextEightTestPost.getMessage().getSubject());
    assertEquals("Eight Test Post", nextEightTestPost.getMessage().getText());
    assertEquals("root", nextEightTestPost.getPoster().getUserId());
    assertEquals("Third Test Topic", nextEightTestPost.getTopic().getSubject());
    assertEquals("Second Test Forum", nextEightTestPost.getTopic().getForum().getName());
    assertEquals("First Test Category", nextEightTestPost.getTopic().getForum().getCategory().getTitle());
    Post nextNinthTestPost = posts.get(11);
    Date createdNextNinthTestPostDate = nextNinthTestPost.getCreateDate();
    assertFalse(createdNextNinthTestPostDate.after(today));
    assertFalse(createdNextEightTestPostDate.after(createdNextNinthTestPostDate));
    assertEquals(0, nextNinthTestPost.getEditCount());
    assertNull(nextNinthTestPost.getEditDate());
    assertEquals(RE + "Third Test Topic", nextNinthTestPost.getMessage().getSubject());
    assertEquals("Ninth Test Post", nextNinthTestPost.getMessage().getText());
    assertEquals("root", nextNinthTestPost.getPoster().getUserId());
    assertEquals("Third Test Topic", nextNinthTestPost.getTopic().getSubject());
    assertEquals("Second Test Forum", nextNinthTestPost.getTopic().getForum().getName());
    assertEquals("First Test Category", nextNinthTestPost.getTopic().getForum().getCategory().getTitle());
    Post fourthTestPost = posts.get(12);
    Date createdDate4 = fourthTestPost.getCreateDate();
    assertFalse(createdDate4.after(today));
    assertFalse(createdDate3.after(createdDate4));
    assertEquals(0, fourthTestPost.getEditCount());
    assertNull(fourthTestPost.getEditDate());
    assertEquals("Fourth Test Topic", fourthTestPost.getMessage().getSubject());
    assertEquals("Fourth Test Body", fourthTestPost.getMessage().getText());
    assertEquals("root", fourthTestPost.getPoster().getUserId());
    assertEquals("Fourth Test Topic", fourthTestPost.getTopic().getSubject());
    assertEquals("Second Test Forum", fourthTestPost.getTopic().getForum().getName());
    assertEquals("First Test Category", fourthTestPost.getTopic().getForum().getCategory().getTitle());
    Post nextTenTestPost = posts.get(13);
    Date createdNextTenTestPostDate = nextTenTestPost.getCreateDate();
    assertFalse(createdNextTenTestPostDate.after(today));
    assertFalse(createdDate4.after(createdNextTenTestPostDate));
    assertEquals(0, nextTenTestPost.getEditCount());
    assertNull(nextTenTestPost.getEditDate());
    assertEquals(RE + "Fourth Test Topic", nextTenTestPost.getMessage().getSubject());
    assertEquals("Ten Test Post", nextTenTestPost.getMessage().getText());
    assertEquals("root", nextTenTestPost.getPoster().getUserId());
    assertEquals("Fourth Test Topic", nextTenTestPost.getTopic().getSubject());
    assertEquals("Second Test Forum", nextTenTestPost.getTopic().getForum().getName());
    assertEquals("First Test Category", nextTenTestPost.getTopic().getForum().getCategory().getTitle());
}
Also used : RemovePost.removePost(it.vige.rubia.selenium.forum.action.RemovePost.removePost) VerifyTopic.getPosterLastPost(it.vige.rubia.selenium.forum.action.VerifyTopic.getPosterLastPost) CreatePost.createPost(it.vige.rubia.selenium.forum.action.CreatePost.createPost) Post(it.vige.rubia.model.Post) 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) Test(org.junit.Test)

Example 82 with Post

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

the class ViewAtomLink method getPage.

public static Forum getPage(WebDriver driver, Forum forum) {
    VerifyForum.goTo(driver, forum);
    goTo(driver);
    Forum result = new Forum();
    result.setName(driver.findElement(id(FEED_TITLE_TEXT)).getText().split(": ")[1]);
    result.setCategory(new Category(driver.findElement(id(FEED_SUBTITLE_TEXT)).getText().split(" in category ")[1]));
    Map<String, Topic> topics = new HashMap<String, Topic>();
    int entriesSize = driver.findElements(className(ENTRY_LINK)).size();
    DateFormat dateFormat = new SimpleDateFormat("d MMM yyyy, HH:mm");
    for (int i = 0; i < entriesSize; i++) {
        WebElement entry = driver.findElements(className(ENTRY_LINK)).get(i);
        String[] entryText = entry.getText().split(BY);
        String lastUpdated = entry.findElement(className(LAST_UPDATED)).getText();
        String topicTitle = entryText[0].replace(RE, "");
        Topic topic = topics.get(topicTitle);
        if (topic == null) {
            topic = new Topic(topicTitle);
            topics.put(topicTitle, topic);
        }
        Post post = new Post(entry.findElement(className(FEED_ENTRY_CONTENT)).getText());
        post.setPoster(new Poster(entryText[1].split("\n")[0]));
        try {
            post.setCreateDate(dateFormat.parse(lastUpdated));
        } catch (ParseException e) {
        }
        post.getMessage().setSubject(entryText[0]);
        topic.getPosts().add(post);
        WebElement entryLink = driver.findElement(linkText(entry.getText().split("\n")[0]));
        entryLink.click();
        List<Attachment> attachments = getAttachmentsOfCurrentPostInPage(driver, post);
        post.setAttachments(attachments);
        if (topic.getPoll() == null) {
            Poll poll = getPollOfCurrentTopic(driver);
            topic.setPoll(poll);
        }
        VerifyForum.goTo(driver, forum);
        goTo(driver);
    }
    result.setTopics(new ArrayList<Topic>(topics.values()));
    returnToHome(driver);
    return result;
}
Also used : Category(it.vige.rubia.model.Category) HashMap(java.util.HashMap) Post(it.vige.rubia.model.Post) Attachment(it.vige.rubia.model.Attachment) WebElement(org.openqa.selenium.WebElement) Forum(it.vige.rubia.model.Forum) VerifyForum(it.vige.rubia.selenium.forum.action.VerifyForum) SimpleDateFormat(java.text.SimpleDateFormat) DateFormat(java.text.DateFormat) Poster(it.vige.rubia.model.Poster) Poll(it.vige.rubia.model.Poll) ParseException(java.text.ParseException) VerifyTopic(it.vige.rubia.selenium.forum.action.VerifyTopic) Topic(it.vige.rubia.model.Topic) VerifyPoll.getPollOfCurrentTopic(it.vige.rubia.selenium.forum.action.VerifyPoll.getPollOfCurrentTopic) SimpleDateFormat(java.text.SimpleDateFormat)

Example 83 with Post

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

the class OperationAttachmentTest method stop.

@AfterClass
public static void stop() {
    Post post = new Post(new Topic(new Forum("First Test Forum"), "First Test Topic"), "First Test Body", asList(new Attachment("first", "First Test File"), new Attachment("second", "Second Test File"), new Attachment("third", "Third Test File")));
    String message = removeAttachments(driver, post);
    assertTrue(message.equals(OK));
    message = removePost(driver, post);
    assertTrue(message.equals(OK));
    post = new Post(new Topic(new Forum("First Test Forum"), "Second Test Topic"), "Second Test Body", asList(new Attachment("first", "First Test File"), new Attachment("second", "Second Test File"), new Attachment("third", "Third Test File")));
    message = removeAttachments(driver, post);
    assertTrue(message.equals(OK));
    message = removePost(driver, post);
    post = new Post(new Topic(new Forum("Second Test Forum"), "Third Test Topic"), "Third Test Body", asList(new Attachment("first", "First Test File"), new Attachment("second", "Second Test File"), new Attachment("third", "Third Test File")));
    message = removeAttachments(driver, post);
    assertTrue(message.equals(OK));
    message = removePost(driver, post);
    post = new Post(new Topic(new Forum("Second Test Forum"), "Fourth Test Topic"), "Fourth Test Body", asList(new Attachment("fourth", "Fourth Test File"), new Attachment("fifth", "Fifth Test with Truncation over 25 characters File"), new Attachment("sixth", "Sixth Test File")));
    message = removeAttachments(driver, post);
    assertTrue(message.equals(OK));
    message = removePost(driver, post);
    post = new Post(new Topic(new Forum("First Test Forum"), "First Test Topic"), "First Test Post", asList(new Attachment[] { new Attachment("first", "First Test File"), new Attachment("second", "Second Test File"), new Attachment("third", "Third Test File") }));
    message = removeAttachments(driver, post);
    assertTrue(message.equals(OK));
    post.getTopic().setSubject(RE + "First Test Topic");
    message = removePost(driver, post);
    assertTrue(message.equals(OK));
    post = new Post(new Topic(new Forum("First Test Forum"), RE + "First Test Topic"), "Second Test Post", asList(new Attachment[] { new Attachment("first", "First Test File"), new Attachment("second", "Second Test File"), new Attachment("third", "Third Test File") }));
    message = removeAttachments(driver, post);
    assertTrue(message.equals(OK));
    message = removePost(driver, post);
    assertTrue(message.equals(OK));
    post = new Post(new Topic(new Forum("Second Test Forum"), "Fourth Test Topic"), "Third Test Post", asList(new Attachment[] { new Attachment("seventh", "Seventh Test File"), new Attachment("eight", "Eight Test File"), new Attachment("ninth", "Ninth Test File") }));
    message = removeAttachments(driver, post);
    assertTrue(message.equals(OK));
    post.getTopic().setSubject(RE + "Fourth Test Topic");
    message = removePost(driver, post);
    assertTrue(message.equals(OK));
    post = new Post(new Topic(new Forum("Second Test Forum"), RE + "Fourth Test Topic"), "Fourth Test Post", asList(new Attachment[] { new Attachment("ten", "Ten Test File"), new Attachment("eleven", "Eleven Test File"), new Attachment("twelve", "Twelve Test File") }));
    message = removeAttachments(driver, post);
    assertTrue(message.equals(OK));
    message = removePost(driver, post);
    assertTrue(message.equals(OK));
    post = new Post(new Topic(new Forum("Second Test Forum"), RE + "Fourth Test Topic"), "Fifth Test with Truncation over 25 characters Post", asList(new Attachment[] { new Attachment("thirteen", "Thirteen Test File"), new Attachment("fourteen", "Fourteen Test File"), new Attachment("fifteen", "Fifteen Test File") }));
    message = removeAttachments(driver, post);
    assertTrue(message.equals(OK));
    message = removePost(driver, post);
    assertTrue(message.equals(OK));
    post = new Post(new Topic(new Forum("Second Test Forum"), RE + "Fourth Test Topic"), "Sixth Test Post", asList(new Attachment[] { new Attachment("sixteen", "Sixteen Test File"), new Attachment("seventeen", "Seventeen Test File"), new Attachment("eighteen", "Eighteen Test File") }));
    message = removeAttachments(driver, post);
    assertTrue(message.equals(OK));
    message = removePost(driver, post);
    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 = removeCategory(driver, new Category("First Test Category"), AdminPanelCategoryTest.SELECT_CATEGORY_TYPE);
    assertTrue(message.equals(REMOVED_CATEGORY_0_MESSAGE));
    message = removeCategory(driver, new Category("Second Test Category"), AdminPanelCategoryTest.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) RemovePost.removePost(it.vige.rubia.selenium.forum.action.RemovePost.removePost) VerifyAttachment.getAttachmentsOfCurrentPost(it.vige.rubia.selenium.forum.action.VerifyAttachment.getAttachmentsOfCurrentPost) CreatePost.createPost(it.vige.rubia.selenium.forum.action.CreatePost.createPost) Post(it.vige.rubia.model.Post) Attachment(it.vige.rubia.model.Attachment) CreateTopic.createTopic(it.vige.rubia.selenium.forum.action.CreateTopic.createTopic) Topic(it.vige.rubia.model.Topic) 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 84 with Post

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

the class OperationAttachmentTest method verifyRemoveAllAttachments.

@Test
public void verifyRemoveAllAttachments() {
    Post post = new Post(new Topic(new Forum("Second Test Forum"), "Fourth Test Topic"), "Third Test Post", asList(new Attachment("newseventh", "New Seventh Test File"), new Attachment("neweight", "New Eight Test File"), new Attachment("newninth", "New Ninth Test File")));
    goTo(driver, post);
    addAttachments(driver, post);
    removeAllAttachments(driver, post);
    List<Attachment> attachments = getAttachmentsOfCurrentPost(driver, post);
    assertEquals(0, attachments.size());
    post = new Post(new Topic(new Forum("Second Test Forum"), "Fourth Test Topic"), "Third Test Post", asList(new Attachment("seventh", "Seventh Test File"), new Attachment("eight", "Eight Test File"), new Attachment("ninth", "Ninth Test File")));
    goTo(driver, post);
    addAttachmentsAndSave(driver, post);
    attachments = getAttachmentsOfCurrentPost(driver, post);
    assertEquals(3, attachments.size());
}
Also used : RemovePost.removePost(it.vige.rubia.selenium.forum.action.RemovePost.removePost) VerifyAttachment.getAttachmentsOfCurrentPost(it.vige.rubia.selenium.forum.action.VerifyAttachment.getAttachmentsOfCurrentPost) CreatePost.createPost(it.vige.rubia.selenium.forum.action.CreatePost.createPost) Post(it.vige.rubia.model.Post) Attachment(it.vige.rubia.model.Attachment) CreateTopic.createTopic(it.vige.rubia.selenium.forum.action.CreateTopic.createTopic) Topic(it.vige.rubia.model.Topic) 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) AdminPanelCategoryTest(it.vige.rubia.selenium.adminpanel.test.AdminPanelCategoryTest) Test(org.junit.Test)

Example 85 with Post

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

the class ModerateTopicTest method setUp.

@BeforeClass
public static void setUp() {
    driver.get(HOME_URL);
    String message = createCategory(driver, new Category("First Test Category"));
    assertTrue(message.equals(CREATED_CATEGORY_1_MESSAGE));
    message = createCategory(driver, new Category("Second Test Category"));
    assertTrue(message.equals(CREATED_CATEGORY_2_MESSAGE));
    message = createForum(driver, new Forum("First Test Forum", "First Test Description", new Category("First Test Category")));
    assertTrue(message.equals(CREATED_FORUM_0_MESSAGE));
    message = createTopic(driver, new Topic(new Forum("First Test Forum"), "First Test Topic", asList(new Post[] { new Post("First Test Body", asList(new Attachment("first", "First Test File"), new Attachment("second", "Second Test File"), new Attachment("third", "Third Test File"))), new Post("Ninteen Test Body"), new Post("Twenty Test Body"), new Post("Twentyone Test Body"), new Post("Twentytwo Test Body"), new Post("Twentythree Test Body"), new Post("Twentyfour Test Body") }), NORMAL, new Poll("First Test Question", asList(new PollOption[] { new PollOption("First Test Answer"), new PollOption("Second Test Answer") }), 4)));
    assertTrue(message.equals("First Test Topic"));
    message = createTopic(driver, new Topic(new Forum("First Test Forum"), "Second Test Topic", asList(new Post[] { new Post("Second Test Body", asList(new Attachment("first", "First Test File"), new Attachment("second", "Second Test File"), new Attachment("third", "Third Test File"))), new Post("Twentyfive Test Body"), new Post("Twentysix Test Body"), new Post("Twentyseven Test Body"), new Post("Twentyeight Test Body"), new Post("Twentynine Test Body"), new Post("Thirty Test Body") }), IMPORTANT, new Poll("Second Test Question", asList(new PollOption[] { new PollOption("Third Test Answer"), new PollOption("Fourth Test Answer") }), 8)));
    assertTrue(message.equals("Second Test Topic"));
    message = createForum(driver, new Forum("Second Test Forum", "Second Test Description", new Category("First Test Category")));
    assertTrue(message.equals(CREATED_FORUM_1_MESSAGE));
    message = createTopic(driver, new Topic(new Forum("Second Test Forum"), "Third Test Topic", asList(new Post[] { new Post("Third Test Body", asList(new Attachment("first", "First Test File"), new Attachment("second", "Second Test File"), new Attachment("third", "Third Test File"))), new Post("Thirtyone Test Body"), new Post("Thirtytwo Test Body"), new Post("Thirtythree Test Body"), new Post("Thirtyfour Test Body"), new Post("Thirtyfive Test Body"), new Post("Thirtysix Test Body") }), ADVICE, new Poll("Third Test Question", asList(new PollOption[] { new PollOption("Fifth Test with Truncation over 25 characters Answer"), new PollOption("Sixth Test Answer") }), 9)));
    assertTrue(message.equals("Third Test Topic"));
    message = createTopic(driver, new Topic(new Forum("Second Test Forum"), "Fourth Test Topic", asList(new Post[] { new Post("Fourth Test Body", asList(new Attachment("fourth", "Fourth Test File"), new Attachment("fifth", "Fifth Test with Truncation over 25 characters File"), new Attachment("sixth", "Sixth Test File"))), new Post("Thirtyseven Test Body"), new Post("Thirtyeight Test Body"), new Post("Thirtynine Test Body"), new Post("Fourty Test Body"), new Post("Fourtyone Test Body"), new Post("Fourtytwo Test Body") }), IMPORTANT, new Poll("Fourth Test Question", asList(new PollOption[] { new PollOption("Seventh Test Answer"), new PollOption("Eight Test Answer") }), 0)));
    assertTrue(message.equals("Fourth Test Topic"));
    message = createForum(driver, new Forum("Third Test Forum", "Third Test Description", new Category("Second Test Category")));
    assertTrue(message.equals(CREATED_FORUM_2_MESSAGE));
    message = createTopic(driver, 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", asList(new Attachment("seventh", "Seventh Test File"), new Attachment("eight", "Eight Test File"), new Attachment("ninth", "Ninth Test File"))), new Post("Fourtythree Test Body"), new Post("Fourtyfour Test Body"), new Post("Fourtyfive Test Body"), new Post("Fourtysix Test Body"), new Post("Fourtyseven Test Body"), new Post("Fourtyeight Test Body") }), IMPORTANT, new Poll("Third Test Question", asList(new PollOption[] { new PollOption("Seventh Test Answer"), new PollOption("Eight Test Answer") }), 8)));
    assertTrue(message.equals("Fifth Test with Truncation over 25 characters Topic"));
    message = createTopic(driver, new Topic(new Forum("Third Test Forum"), "Sixth Test Topic", asList(new Post[] { new Post("Sixth Test Body", asList(new Attachment("ten", "Ten Test File"), new Attachment("eleven", "Eleven Test File"), new Attachment("twelve", "Twelve Test File"))), new Post("Fourtynine Test Body"), new Post("Fifty Test Body"), new Post("Fiftyone Test Body"), new Post("Fiftytwo Test Body"), new Post("Fiftythree Test Body"), new Post("Fiftyfour Test Body") }), IMPORTANT, new Poll("Fourth Test Question", asList(new PollOption[] { new PollOption("Ninth Test Answer"), new PollOption("Ten Test Answer") }), 8)));
    assertTrue(message.equals("Sixth Test Topic"));
}
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) CreatePost.createPost(it.vige.rubia.selenium.forum.action.CreatePost.createPost) Post(it.vige.rubia.model.Post) Poll(it.vige.rubia.model.Poll) Attachment(it.vige.rubia.model.Attachment) PollOption(it.vige.rubia.model.PollOption) MoveTopic.moveTopic(it.vige.rubia.selenium.moderate.action.MoveTopic.moveTopic) RemoveTopic.removeTopic(it.vige.rubia.selenium.moderate.action.RemoveTopic.removeTopic) CreateTopic.createTopic(it.vige.rubia.selenium.forum.action.CreateTopic.createTopic) Topic(it.vige.rubia.model.Topic) LockTopic.lockTopic(it.vige.rubia.selenium.moderate.action.LockTopic.lockTopic) 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) BeforeClass(org.junit.BeforeClass)

Aggregations

Post (it.vige.rubia.model.Post)98 Topic (it.vige.rubia.model.Topic)62 Forum (it.vige.rubia.model.Forum)52 CreateTopic.createTopic (it.vige.rubia.selenium.forum.action.CreateTopic.createTopic)43 CreateForum.createForum (it.vige.rubia.selenium.adminpanel.action.CreateForum.createForum)38 Category (it.vige.rubia.model.Category)34 RemoveTopic.removeTopic (it.vige.rubia.selenium.forum.action.RemoveTopic.removeTopic)32 RemoveForum.removeForum (it.vige.rubia.selenium.adminpanel.action.RemoveForum.removeForum)31 CreateCategory.createCategory (it.vige.rubia.selenium.adminpanel.action.CreateCategory.createCategory)28 RemoveCategory.removeCategory (it.vige.rubia.selenium.adminpanel.action.RemoveCategory.removeCategory)28 Attachment (it.vige.rubia.model.Attachment)25 Test (org.junit.Test)25 Poll (it.vige.rubia.model.Poll)21 Poster (it.vige.rubia.model.Poster)20 PollOption (it.vige.rubia.model.PollOption)19 CreatePost.createPost (it.vige.rubia.selenium.forum.action.CreatePost.createPost)17 Message (it.vige.rubia.model.Message)14 Date (java.util.Date)14 BeforeClass (org.junit.BeforeClass)12 WebElement (org.openqa.selenium.WebElement)12