Package com.saasovation.agilepm.domain.model.team

Examples of com.saasovation.agilepm.domain.model.team.TeamMember


        super();
    }


    public void testSave() throws Exception {
        TeamMember teamMember =
                new TeamMember(
                        new TenantId("12345"),
                        "jdoe",
                        "John",
                        "Doe",
                        "jdoe@saasovation.com",
                        new Date());

        LevelDBUnitOfWork.start(this.database);
        teamMemberRepository.save(teamMember);
        LevelDBUnitOfWork.current().commit();

        TeamMember savedTeamMember =
                teamMemberRepository.teamMemberOfIdentity(
                        teamMember.tenantId(),
                        teamMember.username());

        assertNotNull(savedTeamMember);
        assertEquals(teamMember.tenantId(), savedTeamMember.tenantId());
        assertEquals(teamMember.username(), savedTeamMember.username());
        assertEquals(teamMember.firstName(), savedTeamMember.firstName());
        assertEquals(teamMember.lastName(), savedTeamMember.lastName());
        assertEquals(teamMember.emailAddress(), savedTeamMember.emailAddress());

        Collection<TeamMember> savedTeamMembers =
                this.teamMemberRepository.allTeamMembersOfTenant(teamMember.tenantId());

        assertFalse(savedTeamMembers.isEmpty());
View Full Code Here


        assertFalse(savedTeamMembers.isEmpty());
        assertEquals(1, savedTeamMembers.size());
    }

    public void testRemove() {
        TeamMember teamMember1 =
                new TeamMember(
                        new TenantId("12345"),
                        "jdoe",
                        "John",
                        "Doe",
                        "jdoe@saasovation.com",
                        new Date());

        TeamMember teamMember2 =
                new TeamMember(
                        new TenantId("12345"),
                        "zdoe",
                        "Zoe",
                        "Doe",
                        "zoe@saasovation.com",
                        new Date());

        LevelDBUnitOfWork.start(this.database);
        teamMemberRepository.save(teamMember1);
        teamMemberRepository.save(teamMember2);
        LevelDBUnitOfWork.current().commit();

        LevelDBUnitOfWork.start(this.database);
        teamMemberRepository.remove(teamMember1);
        LevelDBUnitOfWork.current().commit();

        TenantId tenantId = teamMember2.tenantId();

        Collection<TeamMember> savedTeamMembers = teamMemberRepository.allTeamMembersOfTenant(tenantId);
        assertFalse(savedTeamMembers.isEmpty());
        assertEquals(1, savedTeamMembers.size());
        assertEquals(teamMember2.username(), savedTeamMembers.iterator().next().username());

        LevelDBUnitOfWork.start(this.database);
        teamMemberRepository.remove(teamMember2);
        LevelDBUnitOfWork.current().commit();
View Full Code Here

        savedTeamMembers = teamMemberRepository.allTeamMembersOfTenant(tenantId);
        assertTrue(savedTeamMembers.isEmpty());
    }

    public void testSaveAllRemoveAll() throws Exception {
        TeamMember teamMember1 =
                new TeamMember(
                        new TenantId("12345"),
                        "jdoe",
                        "John",
                        "Doe",
                        "jdoe@saasovation.com",
                        new Date());

        TeamMember teamMember2 =
                new TeamMember(
                        new TenantId("12345"),
                        "zdoe",
                        "Zoe",
                        "Doe",
                        "zoe@saasovation.com",
                        new Date());

        TeamMember teamMember3 =
                new TeamMember(
                        new TenantId("12345"),
                        "jsmith",
                        "John",
                        "Smith",
                        "jsmith@saasovation.com",
View Full Code Here

    }

    public void testConcurrentTransactions() throws Exception {
        final List<Integer> orderOfCommits = new ArrayList<Integer>();

        TeamMember teamMember1 =
                new TeamMember(
                        new TenantId("12345"),
                        "jdoe",
                        "John",
                        "Doe",
                        "jdoe@saasovation.com",
                        new Date());

        LevelDBUnitOfWork.start(database);
        teamMemberRepository.save(teamMember1);

        new Thread() {
           @Override
           public void run() {
               TeamMember teamMember2 =
                       new TeamMember(
                               new TenantId("12345"),
                               "zdoe",
                               "Zoe",
                               "Doe",
                               "zoe@saasovation.com",
View Full Code Here

        TenantId tenantId = new TenantId(aCommand.getTenantId());

        ApplicationServiceLifeCycle.begin();

        try {
            TeamMember teamMember =
                    this.teamMemberRepository.teamMemberOfIdentity(
                            tenantId,
                            aCommand.getUsername());

            if (teamMember != null) {
                teamMember.enable(aCommand.getOccurredOn());
            } else {
                teamMember =
                        new TeamMember(
                                tenantId,
                                aCommand.getUsername(),
                                aCommand.getFirstName(),
                                aCommand.getLastName(),
                                aCommand.getEmailAddress(),
View Full Code Here

                        aCommand.getOccurredOn());

                this.productOwnerRepository().save(productOwner);
            }

            TeamMember teamMember =
                    this.teamMemberRepository.teamMemberOfIdentity(
                            tenantId,
                            aCommand.getUsername());

            if (teamMember != null) {
                teamMember
                    .changeEmailAddress(
                            aCommand.getEmailAddress(),
                            aCommand.getOccurredOn());

                this.teamMemberRepository().save(teamMember);
View Full Code Here

                            aCommand.getOccurredOn());

                this.productOwnerRepository().save(productOwner);
            }

            TeamMember teamMember =
                    this.teamMemberRepository.teamMemberOfIdentity(
                            tenantId,
                            aCommand.getUsername());

            if (teamMember != null) {
                teamMember
                    .changeName(
                            aCommand.getFirstName(),
                            aCommand.getLastName(),
                            aCommand.getOccurredOn());
View Full Code Here

        TenantId tenantId = new TenantId(aCommand.getTenantId());

        ApplicationServiceLifeCycle.begin();

        try {
            TeamMember teamMember =
                    this.teamMemberRepository.teamMemberOfIdentity(
                            tenantId,
                            aCommand.getUsername());

            if (teamMember != null) {
                teamMember.disable(aCommand.getOccurredOn());

                this.teamMemberRepository().save(teamMember);
            }

            ApplicationServiceLifeCycle.success();
View Full Code Here

        LevelDBUnitOfWork uow = LevelDBUnitOfWork.readOnly(this.database());

        List<Object> keys = uow.readKeys(teamMembersOfTenant);

        for (Object teamMemberId : keys) {
            TeamMember teamMember = uow.readObject(teamMemberId.toString().getBytes(), TeamMember.class);

            if (teamMember != null) {
                teamMembers.add(teamMember);
            }
        }
View Full Code Here

    @Override
    public TeamMember teamMemberOfIdentity(TenantId aTenantId, String aUsername) {
        LevelDBKey primaryKey = new LevelDBKey(PRIMARY, aTenantId.id(), aUsername);

        TeamMember teamMember =
                LevelDBUnitOfWork.readOnly(this.database())
                    .readObject(primaryKey.key().getBytes(), TeamMember.class);

        return teamMember;
    }
View Full Code Here

TOP

Related Classes of com.saasovation.agilepm.domain.model.team.TeamMember

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.