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

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


        assertEquals("A changed description.", forum.description());
    }

    public void testChangeForumSubject() throws Exception {

        Forum forum = this.forumAggregate();

        assertFalse("A changed subject.".equals(forum.subject()));

        DomainRegistry.forumRepository().save(forum);

        forumApplicationService
            .changeForumSubject(
                    forum.tenant().id(),
                    forum.forumId().id(),
                    "A changed subject.");

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

        assertNotNull(forum);
        assertEquals("A changed subject.", forum.subject());
    }
View Full Code Here


        assertEquals("A changed subject.", forum.subject());
    }

    public void testCloseForum() throws Exception {

        Forum forum = this.forumAggregate();

        assertFalse(forum.isClosed());

        DomainRegistry.forumRepository().save(forum);

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

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

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

    protected Forum forumAggregate() {

        Tenant tenant = new Tenant("01234567");

        Forum forum =
            new Forum(
                    tenant,
                    DomainRegistry.forumRepository().nextIdentity(),
                    new Creator("jdoe", "John Doe", "jdoe@saasovation.com"),
                    new Moderator("jdoe", "John Doe", "jdoe@saasovation.com"),
                    "John Doe Does DDD",
View Full Code Here

    protected Forum[] forumAggregates() {

        Tenant tenant = new Tenant("01234567");

        Forum forum1 =
            new Forum(
                    tenant,
                    DomainRegistry.forumRepository().nextIdentity(),
                    new Creator("jdoe", "John Doe", "jdoe@saasovation.com"),
                    new Moderator("jdoe", "John Doe", "jdoe@saasovation.com"),
                    "John Doe Does DDD",
                    "A set of discussions about DDD for anonymous developers.",
                    UUID.randomUUID().toString().toUpperCase());

        Forum forum2 =
                new Forum(
                        tenant,
                        DomainRegistry.forumRepository().nextIdentity(),
                        new Creator("zdoe", "Zoe Doe", "zoe@saasovation.com"),
                        new Moderator("zoe", "Zoe Doe", "jdoe@saasovation.com"),
                        "Zoe Doe Knows DDD",
                        "Discussions about how ubiquitous Zoe's knows is.",
                        UUID.randomUUID().toString().toUpperCase());

        Forum forum3 =
                new Forum(
                        tenant,
                        DomainRegistry.forumRepository().nextIdentity(),
                        new Creator("joe", "Joe Smith", "joe@saasovation.com"),
                        new Moderator("joe", "Joe Smith", "joe@saasovation.com"),
                        "Joe Owns DDD",
View Full Code Here

        super();
    }

    public void testAllPostsDataOfDiscussion() 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);
        }

        Collection<PostData> postsData =
                postQueryService.allPostsDataOfDiscussion(
                        forum.tenant().id(),
                        discussion.discussionId().id());

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

        assertEquals(posts.length, postsData.size());
    }

    public void testPostDataOfId() throws Exception {

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

        Discussion discussion = this.discussionAggregate(forum);
        DomainRegistry.discussionRepository().save(discussion);
View Full Code Here

        assertEquals(forums.length, forumsData.size());
    }

    public void testForumDataOfId() throws Exception {

        Forum forum = this.forumAggregate();

        DomainRegistry.forumRepository().save(forum);

        ForumData forumData =
                forumQueryService.forumDataOfId(
                        forum.tenant().id(), forum.forumId().id());

        assertNotNull(forumData);
        assertEquals(forum.forumId().id(), forumData.getForumId());
        assertEquals(forum.tenant().id(), forumData.getTenantId());
        assertEquals(forum.creator().emailAddress(), forumData.getCreatorEmailAddress());
        assertEquals(forum.creator().identity(), forumData.getCreatorIdentity());
        assertEquals(forum.creator().name(), forumData.getCreatorName());
        assertEquals(forum.description(), forumData.getDescription());
        assertEquals(forum.exclusiveOwner(), forumData.getExclusiveOwner());
        assertEquals(forum.isClosed(), forumData.isClosed());
        assertEquals(forum.subject(), forumData.getSubject());
        assertEquals(forum.moderator().emailAddress(), forumData.getModeratorEmailAddress());
        assertEquals(forum.moderator().identity(), forumData.getModeratorIdentity());
        assertEquals(forum.moderator().name(), forumData.getModeratorName());
    }
View Full Code Here

        assertEquals(forum.moderator().name(), forumData.getModeratorName());
    }

    public void testForumDiscussionsDataOfId() throws Exception {

        Forum forum = this.forumAggregate();

        DomainRegistry.forumRepository().save(forum);

        Discussion[] discussions = this.discussionAggregates(forum);

        for (Discussion discussion : discussions) {
            DomainRegistry.discussionRepository().save(discussion);
        }

        ForumDiscussionsData forumDiscussionsData =
                forumQueryService.forumDiscussionsDataOfId(
                        forum.tenant().id(), forum.forumId().id());

        assertNotNull(forumDiscussionsData);
        assertEquals(forum.forumId().id(), forumDiscussionsData.getForumId());
        assertEquals(forum.tenant().id(), forumDiscussionsData.getTenantId());
        assertEquals(forum.creator().emailAddress(), forumDiscussionsData.getCreatorEmailAddress());
        assertEquals(forum.creator().identity(), forumDiscussionsData.getCreatorIdentity());
        assertEquals(forum.creator().name(), forumDiscussionsData.getCreatorName());
        assertEquals(forum.description(), forumDiscussionsData.getDescription());
        assertEquals(forum.exclusiveOwner(), forumDiscussionsData.getExclusiveOwner());
        assertEquals(forum.isClosed(), forumDiscussionsData.isClosed());
        assertEquals(forum.subject(), forumDiscussionsData.getSubject());
        assertEquals(forum.moderator().emailAddress(), forumDiscussionsData.getModeratorEmailAddress());
        assertEquals(forum.moderator().identity(), forumDiscussionsData.getModeratorIdentity());
        assertEquals(forum.moderator().name(), forumDiscussionsData.getModeratorName());

        assertNotNull(forumDiscussionsData.getDiscussions());
        assertFalse(forumDiscussionsData.getDiscussions().isEmpty());
        assertEquals(3, forumDiscussionsData.getDiscussions().size());
    }
View Full Code Here

        assertEquals(3, forumDiscussionsData.getDiscussions().size());
    }

    public void testForumIdOfExclusiveOwner() throws Exception {

        Forum forum = this.forumAggregate();

        DomainRegistry.forumRepository().save(forum);

        String forumId =
                forumQueryService.forumIdOfExclusiveOwner(
                        forum.tenant().id(), forum.exclusiveOwner());

        assertNotNull(forumId);
        assertEquals(forum.forumId().id(), forumId);
    }
View Full Code Here

            String aSubject,
            String aBodyText) {

        Tenant tenant = new Tenant(aTenantId);

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

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

        Post post = this.postRepository().postOfId(tenant, new PostId(aPostId));

        forum.moderatePost(post, moderator, aSubject, aBodyText);

        this.postRepository().save(post);
    }
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.