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

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


        EventStreamId eventId = new EventStreamId(aTenant.id(), aForumId.id());

        EventStream eventStream = this.eventStore().eventStreamSince(eventId);

        Forum forum = new Forum(eventStream.events(), eventStream.version());

        return forum;
    }
View Full Code Here


        assertTrue(forum.isClosed());
    }

    public void testReopenForum() throws Exception {

        Forum forum = this.forumAggregate();

        forum.close();

        assertTrue(forum.isClosed());

        DomainRegistry.forumRepository().save(forum);

        forumApplicationService.reopenForum(forum.tenant().id(), forum.forumId().id());

        forum = DomainRegistry
                    .forumRepository()
                    .forumOfId(
                            forum.tenant(),
                            forum.forumId());

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

        assertFalse(forum.isClosed());
    }

    public void testStartForum() throws Exception {

        Forum forum = this.forumAggregate();

        ForumCommandResult result = new ForumCommandResult() {
            @Override
            public void resultingForumId(String aForumId) {
                forumId = aForumId;
            }
            @Override
            public void resultingDiscussionId(String aDiscussionId) {
                throw new UnsupportedOperationException("Should not be reached.");
            }
        };

        forumApplicationService.startForum(
                forum.tenant().id(),
                forum.creator().identity(),
                forum.moderator().identity(),
                forum.subject(),
                forum.description(),
                result);

        assertNotNull(this.forumId);

        Forum newlyStartedForum =
                DomainRegistry
                    .forumRepository()
                    .forumOfId(forum.tenant(), new ForumId(this.forumId));

        assertNotNull(newlyStartedForum);
        assertEquals(forum.tenant(), newlyStartedForum.tenant());
        assertEquals(this.forumId, newlyStartedForum.forumId().id());
        assertEquals(forum.creator().identity(), newlyStartedForum.creator().identity());
        assertEquals(forum.moderator().identity(), newlyStartedForum.moderator().identity());
        assertEquals(forum.subject(), newlyStartedForum.subject());
        assertEquals(forum.description(), newlyStartedForum.description());
    }
View Full Code Here

        assertEquals(forum.description(), newlyStartedForum.description());
    }

    public void testStartExclusiveForum() throws Exception {

        Forum forum = this.forumAggregate();

        ForumCommandResult result = new ForumCommandResult() {
            @Override
            public void resultingForumId(String aForumId) {
                forumId = aForumId;
            }
            @Override
            public void resultingDiscussionId(String aDiscussionId) {
                throw new UnsupportedOperationException("Should not be reached.");
            }
        };

        String exclusiveOwner = UUID.randomUUID().toString().toUpperCase();

        forumApplicationService.startExclusiveForum(
                forum.tenant().id(),
                exclusiveOwner,
                forum.creator().identity(),
                forum.moderator().identity(),
                forum.subject(),
                forum.description(),
                result);

        assertNotNull(this.forumId);

        Forum newlyStartedForum =
                DomainRegistry
                    .forumRepository()
                    .forumOfId(forum.tenant(), new ForumId(this.forumId));

        assertNotNull(newlyStartedForum);
        assertEquals(forum.tenant(), newlyStartedForum.tenant());
        assertEquals(this.forumId, newlyStartedForum.forumId().id());
        assertEquals(forum.creator().identity(), newlyStartedForum.creator().identity());
        assertEquals(forum.moderator().identity(), newlyStartedForum.moderator().identity());
        assertEquals(forum.subject(), newlyStartedForum.subject());
        assertEquals(forum.description(), newlyStartedForum.description());
        assertEquals(exclusiveOwner, newlyStartedForum.exclusiveOwner());
    }
View Full Code Here

        assertEquals(exclusiveOwner, newlyStartedForum.exclusiveOwner());
    }

    public void testStartExclusiveForumWithDiscussion() throws Exception {

        Forum forum = this.forumAggregate();

        ForumCommandResult result = new ForumCommandResult() {
            @Override
            public void resultingForumId(String aForumId) {
                forumId = aForumId;
            }
            @Override
            public void resultingDiscussionId(String aDiscussionId) {
                discussionId = aDiscussionId;
            }
        };

        String exclusiveOwner = UUID.randomUUID().toString().toUpperCase();

        forumApplicationService.startExclusiveForumWithDiscussion(
                forum.tenant().id(),
                exclusiveOwner,
                forum.creator().identity(),
                forum.moderator().identity(),
                "authorId1",
                forum.subject(),
                forum.description(),
                "Discussion Subject",
                result);

        assertNotNull(this.forumId);
        assertNotNull(this.discussionId);

        Forum newlyStartedForum =
                DomainRegistry
                    .forumRepository()
                    .forumOfId(forum.tenant(), new ForumId(this.forumId));

        assertNotNull(newlyStartedForum);
        assertEquals(forum.tenant(), newlyStartedForum.tenant());
        assertEquals(this.forumId, newlyStartedForum.forumId().id());
        assertEquals(forum.creator().identity(), newlyStartedForum.creator().identity());
        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));
View Full Code Here

    public void testModeratePost() throws Exception {

        Tenant tenant = new Tenant("01234567");

        Forum forum =
            new Forum(
                    tenant,
                    DomainRegistry.forumRepository().nextIdentity(),
                    collaboratorService.creatorFrom(tenant, "jdoe"),
                    collaboratorService.moderatorFrom(tenant, "jdoe"),
                    "A Forum",
                    "A forum description.",
                    null);

        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);

        postApplicationService
            .moderatePost(
                discussion.tenant().id(),
                forum.forumId().id(),
                postId,
                forum.moderator().identity(),
                "Post Moderated Subject Test",
                "Post moderated text test...");

        Post post =
                DomainRegistry
View Full Code Here

            String aForumId,
            String aModeratorId) {

        Tenant tenant = new Tenant(aTenantId);

        Forum forum =
                this.forumRepository()
                    .forumOfId(
                            tenant,
                            new ForumId(aForumId));

        Moderator moderator =
                this.collaboratorService().moderatorFrom(tenant, aModeratorId);

        forum.assignModerator(moderator);

        this.forumRepository().save(forum);
    }
View Full Code Here

            String aForumId,
            String aDescription) {

        Tenant tenant = new Tenant(aTenantId);

        Forum forum =
                this.forumRepository()
                    .forumOfId(
                            tenant,
                            new ForumId(aForumId));

        forum.changeDescription(aDescription);

        this.forumRepository().save(forum);
    }
View Full Code Here

            String aForumId,
            String aSubject) {

        Tenant tenant = new Tenant(aTenantId);

        Forum forum =
                this.forumRepository()
                    .forumOfId(
                            tenant,
                            new ForumId(aForumId));

        forum.changeSubject(aSubject);

        this.forumRepository().save(forum);
    }
View Full Code Here

            String aTenantId,
            String aForumId) {

        Tenant tenant = new Tenant(aTenantId);

        Forum forum =
                this.forumRepository()
                    .forumOfId(
                            tenant,
                            new ForumId(aForumId));

        forum.close();

        this.forumRepository().save(forum);
    }
View Full Code Here

TOP

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

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.