Package com.saasovation.collaboration.domain.model.forum

Examples of com.saasovation.collaboration.domain.model.forum.Discussion


        Forum forum = this.forumAggregate();

        DomainRegistry.forumRepository().save(forum);

        Discussion discussion = this.discussionAggregate(forum);

        assertFalse(discussion.isClosed());

        DomainRegistry.discussionRepository().save(discussion);

        discussionApplicationService
            .closeDiscussion(
                    discussion.tenant().id(),
                    discussion.discussionId().id());

        Discussion closedDiscussion =
                DomainRegistry
                    .discussionRepository()
                    .discussionOfId(
                            discussion.tenant(),
                            discussion.discussionId());

        assertNotNull(closedDiscussion);
        assertTrue(closedDiscussion.isClosed());
    }
View Full Code Here


        Forum forum = this.forumAggregate();

        DomainRegistry.forumRepository().save(forum);

        Discussion discussion = this.discussionAggregate(forum);

        DomainRegistry.discussionRepository().save(discussion);

        DiscussionCommandResult result = new DiscussionCommandResult() {
            @Override
            public void resultingDiscussionId(String aDiscussionId) {
                discussionId = aDiscussionId;
            }
            @Override
            public void resultingPostId(String aPostId) {
                postId = aPostId;
            }
            @Override
            public void resultingInReplyToPostId(String aReplyToPostId) {
                throw new UnsupportedOperationException("Should not be reached.");
            }
        };

        discussionApplicationService
            .postToDiscussion(
                    discussion.tenant().id(),
                    discussion.discussionId().id(),
                    "authorId1",
                    "Post Test",
                    "Post test text...",
                    result);

        Post post =
                DomainRegistry
                    .postRepository()
                    .postOfId(
                            discussion.tenant(),
                            new PostId(postId));

        assertNotNull(discussionId);
        assertNotNull(post);
        assertEquals("authorId1", post.author().identity());
View Full Code Here

        Forum forum = this.forumAggregate();

        DomainRegistry.forumRepository().save(forum);

        Discussion discussion = this.discussionAggregate(forum);

        DomainRegistry.discussionRepository().save(discussion);

        DiscussionCommandResult result = new DiscussionCommandResult() {
            @Override
            public void resultingDiscussionId(String aDiscussionId) {
                discussionId = aDiscussionId;
            }
            @Override
            public void resultingPostId(String aPostId) {
                postId = aPostId;
            }
            @Override
            public void resultingInReplyToPostId(String aReplyToPostId) {
                inReplyToPostId = aReplyToPostId;
            }
        };

        discussionApplicationService
            .postToDiscussion(
                    discussion.tenant().id(),
                    discussion.discussionId().id(),
                    "authorId1",
                    "Post Test",
                    "Post test text...",
                    result);

        discussionApplicationService
            .postToDiscussionInReplyTo(
                discussion.tenant().id(),
                discussion.discussionId().id(),
                postId,
                "authorId2",
                "Post In Reply To Test",
                "Post test text in reply to...",
                result);

        Post postedInReplyTo =
                DomainRegistry
                    .postRepository()
                    .postOfId(
                            discussion.tenant(),
                            new PostId(postId));

        assertNotNull(discussionId);
        assertNotNull(inReplyToPostId);
        assertNotNull(postedInReplyTo);
View Full Code Here

        Forum forum = this.forumAggregate();

        DomainRegistry.forumRepository().save(forum);

        Discussion discussion = this.discussionAggregate(forum);

        discussion.close();

        assertTrue(discussion.isClosed());

        DomainRegistry.discussionRepository().save(discussion);

        discussionApplicationService
            .reopenDiscussion(
                    discussion.tenant().id(),
                    discussion.discussionId().id());

        Discussion openDiscussion =
                DomainRegistry
                    .discussionRepository()
                    .discussionOfId(
                            discussion.tenant(),
                            discussion.discussionId());

        assertNotNull(openDiscussion);
        assertFalse(openDiscussion.isClosed());
    }
View Full Code Here

    public void testDiscussionDataOfId() throws Exception {

        Forum forum = this.forumAggregate();
        DomainRegistry.forumRepository().save(forum);

        Discussion discussion = this.discussionAggregate(forum);
        DomainRegistry.discussionRepository().save(discussion);

        DiscussionData discussionData =
                discussionQueryService.discussionDataOfId(
                        discussion.tenant().id(), discussion.discussionId().id());

        assertNotNull(discussionData);
        assertEquals(discussion.discussionId().id(), discussionData.getDiscussionId());
        assertEquals(discussion.forumId().id(), discussionData.getForumId());
        assertEquals(discussion.tenant().id(), discussionData.getTenantId());
        assertEquals(discussion.author().emailAddress(), discussionData.getAuthorEmailAddress());
        assertEquals(discussion.author().identity(), discussionData.getAuthorIdentity());
        assertEquals(discussion.author().name(), discussionData.getAuthorName());
        assertEquals(discussion.subject(), discussionData.getSubject());
        assertEquals(discussion.exclusiveOwner(), discussionData.getExclusiveOwner());
        assertEquals(discussion.isClosed(), discussionData.isClosed());
    }
View Full Code Here

    public void testDiscussionIdOfExclusiveOwner() throws Exception {

        Forum forum = this.forumAggregate();
        DomainRegistry.forumRepository().save(forum);

        Discussion discussion = this.discussionAggregate(forum);
        DomainRegistry.discussionRepository().save(discussion);

        String discussionId =
                discussionQueryService.discussionIdOfExclusiveOwner(
                        discussion.tenant().id(), discussion.exclusiveOwner());

        assertNotNull(discussionId);
        assertEquals(discussion.discussionId().id(), discussionId);
    }
View Full Code Here

    public void testDiscussionPostsDataOfId() throws Exception {

        Forum forum = this.forumAggregate();
        DomainRegistry.forumRepository().save(forum);

        Discussion discussion = this.discussionAggregate(forum);
        DomainRegistry.discussionRepository().save(discussion);


        Post[] posts = this.postAggregates(discussion);

        for (Post post : posts) {
            DomainRegistry.postRepository().save(post);
        }

        DiscussionPostsData discussionPostsData =
                discussionQueryService.discussionPostsDataOfId(
                        discussion.tenant().id(), discussion.discussionId().id());

        assertNotNull(discussionPostsData);
        assertEquals(discussion.discussionId().id(), discussionPostsData.getDiscussionId());
        assertEquals(discussion.forumId().id(), discussionPostsData.getForumId());
        assertEquals(discussion.tenant().id(), discussionPostsData.getTenantId());
        assertEquals(discussion.author().emailAddress(), discussionPostsData.getAuthorEmailAddress());
        assertEquals(discussion.author().identity(), discussionPostsData.getAuthorIdentity());
        assertEquals(discussion.author().name(), discussionPostsData.getAuthorName());
        assertEquals(discussion.subject(), discussionPostsData.getSubject());
        assertEquals(discussion.exclusiveOwner(), discussionPostsData.getExclusiveOwner());
        assertEquals(discussion.isClosed(), discussionPostsData.isClosed());

        assertNotNull(discussionPostsData.getPosts());
        assertFalse(discussionPostsData.getPosts().isEmpty());
        assertEquals(posts.length, discussionPostsData.getPosts().size());
View Full Code Here

        assertEquals(forum.moderator().identity(), newlyStartedForum.moderator().identity());
        assertEquals(forum.subject(), newlyStartedForum.subject());
        assertEquals(forum.description(), newlyStartedForum.description());
        assertEquals(exclusiveOwner, newlyStartedForum.exclusiveOwner());

        Discussion newlyStartedDiscussion =
                DomainRegistry
                    .discussionRepository()
                    .discussionOfId(forum.tenant(), new DiscussionId(this.discussionId));

        assertNotNull(newlyStartedDiscussion);
        assertEquals("authorId1", newlyStartedDiscussion.author().identity());
        assertEquals("Discussion Subject", newlyStartedDiscussion.subject());
    }
View Full Code Here

        return new Calendar[] { calendar1, calendar2, calendar3 };
    }

    protected Discussion discussionAggregate(Forum aForum) {

        Discussion discussion = aForum.startDiscussionFor(
                DomainRegistry.forumIdentityService(),
                new Author("jdoe", "John Doe", "jdoe@saasovation.com"),
                "All About DDD",
                UUID.randomUUID().toString().toUpperCase());
View Full Code Here

        return discussion;
    }

    protected Discussion[] discussionAggregates(Forum aForum) {

        Discussion discussion1 = aForum.startDiscussionFor(
                DomainRegistry.forumIdentityService(),
                new Author("jdoe", "John Doe", "jdoe@saasovation.com"),
                "All About DDD",
                UUID.randomUUID().toString().toUpperCase());

        Discussion discussion2 = aForum.startDiscussionFor(
                DomainRegistry.forumIdentityService(),
                new Author("zoe", "Zoe Doe", "zoe@saasovation.com"),
                "I Already Know That, Too",
                UUID.randomUUID().toString().toUpperCase());

        Discussion discussion3 = aForum.startDiscussionFor(
                DomainRegistry.forumIdentityService(),
                new Author("joe", "Joe Smith", "joe@saasovation.com"),
                "I've Forgotten More Than Zoe Knows",
                UUID.randomUUID().toString().toUpperCase());
View Full Code Here

TOP

Related Classes of com.saasovation.collaboration.domain.model.forum.Discussion

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.