Package com.saasovation.identityaccess.domain.model.identity

Examples of com.saasovation.identityaccess.domain.model.identity.User


        assertEquals("123 Pine Street", changedUser.person().contactInformation().postalAddress().streetAddress());
        assertEquals("Loveland", changedUser.person().contactInformation().postalAddress().city());
    }

    public void testChangeUserPrimaryTelephone() throws Exception {
        User user = this.userAggregate();
        DomainRegistry.userRepository().add(user);

        ApplicationServiceRegistry
            .identityApplicationService()
            .changeUserPrimaryTelephone(
                    new ChangePrimaryTelephoneCommand(
                            user.tenantId().id(),
                            user.username(),
                            "777-555-1211"));

        User changedUser =
                DomainRegistry
                    .userRepository()
                    .userWithUsername(
                            user.tenantId(),
                            user.username());

        assertNotNull(changedUser);
        assertEquals("777-555-1211", changedUser.person().contactInformation().primaryTelephone().number());
    }
View Full Code Here


        assertNotNull(changedUser);
        assertEquals("777-555-1211", changedUser.person().contactInformation().primaryTelephone().number());
    }

    public void testChangeUserSecondaryTelephone() throws Exception {
        User user = this.userAggregate();
        DomainRegistry.userRepository().add(user);

        ApplicationServiceRegistry
            .identityApplicationService()
            .changeUserSecondaryTelephone(
                    new ChangeSecondaryTelephoneCommand(
                            user.tenantId().id(),
                            user.username(),
                            "777-555-1212"));

        User changedUser =
                DomainRegistry
                    .userRepository()
                    .userWithUsername(
                            user.tenantId(),
                            user.username());

        assertNotNull(changedUser);
        assertEquals("777-555-1212", changedUser.person().contactInformation().secondaryTelephone().number());
    }
View Full Code Here

        assertNotNull(changedUser);
        assertEquals("777-555-1212", changedUser.person().contactInformation().secondaryTelephone().number());
    }

    public void testChangeUserPassword() throws Exception {
        User user = this.userAggregate();
        DomainRegistry.userRepository().add(user);

        ApplicationServiceRegistry
            .identityApplicationService()
            .changeUserPassword(
                    new ChangeUserPasswordCommand(
                            user.tenantId().id(),
                            user.username(),
                            FIXTURE_PASSWORD,
                            "THIS.IS.JOE'S.NEW.PASSWORD"));

        UserDescriptor userDescriptor =
                ApplicationServiceRegistry
                    .identityApplicationService()
                    .authenticateUser(new AuthenticateUserCommand(
                            user.tenantId().id(),
                            user.username(),
                            "THIS.IS.JOE'S.NEW.PASSWORD"));

        assertNotNull(userDescriptor);
        assertEquals(user.username(), userDescriptor.username());
    }
View Full Code Here

        assertNotNull(userDescriptor);
        assertEquals(user.username(), userDescriptor.username());
    }

    public void testChangeUserPersonalName() throws Exception {
        User user = this.userAggregate();
        DomainRegistry.userRepository().add(user);

        ApplicationServiceRegistry
            .identityApplicationService()
            .changeUserPersonalName(
                    new ChangeUserPersonalNameCommand(
                            user.tenantId().id(),
                            user.username(),
                            "World",
                            "Peace"));

        User changedUser =
                DomainRegistry
                    .userRepository()
                    .userWithUsername(
                            user.tenantId(),
                            user.username());

        assertNotNull(changedUser);
        assertEquals("World Peace", changedUser.person().name().asFormattedName());
    }
View Full Code Here

        assertNotNull(changedUser);
        assertEquals("World Peace", changedUser.person().name().asFormattedName());
    }

    public void testDefineUserEnablement() throws Exception {
        User user = this.userAggregate();
        DomainRegistry.userRepository().add(user);

        Date now = new Date();
        Date then = new Date(now.getTime() + (60 * 60 * 24 * 365 * 1000));

        ApplicationServiceRegistry
            .identityApplicationService()
            .defineUserEnablement(
                    new DefineUserEnablementCommand(
                            user.tenantId().id(),
                            user.username(),
                            true,
                            now,
                            then));

        User changedUser =
                DomainRegistry
                    .userRepository()
                    .userWithUsername(
                            user.tenantId(),
                            user.username());

        assertNotNull(changedUser);
        assertTrue(changedUser.isEnabled());
    }
View Full Code Here

        DomainRegistry.groupRepository().add(parentGroup);

        Group childGroup = this.group2Aggregate();
        DomainRegistry.groupRepository().add(childGroup);

        User user = this.userAggregate();
        DomainRegistry.userRepository().add(user);

        assertEquals(0, parentGroup.groupMembers().size());
        assertEquals(0, childGroup.groupMembers().size());

        parentGroup.addGroup(childGroup, DomainRegistry.groupMemberService());
        childGroup.addUser(user);

        assertTrue(
                ApplicationServiceRegistry
                    .identityApplicationService()
                    .isGroupMember(
                            parentGroup.tenantId().id(),
                            parentGroup.name(),
                            user.username()));

        assertTrue(
                ApplicationServiceRegistry
                    .identityApplicationService()
                    .isGroupMember(
                            childGroup.tenantId().id(),
                            childGroup.name(),
                            user.username()));
    }
View Full Code Here

        DomainRegistry.groupRepository().add(parentGroup);

        Group childGroup = this.group2Aggregate();
        DomainRegistry.groupRepository().add(childGroup);

        User user = this.userAggregate();
        DomainRegistry.userRepository().add(user);

        parentGroup.addGroup(childGroup, DomainRegistry.groupMemberService());
        childGroup.addUser(user);

        assertEquals(1, parentGroup.groupMembers().size());
        assertEquals(1, childGroup.groupMembers().size());
        assertTrue(parentGroup.isMember(user, DomainRegistry.groupMemberService()));
        assertTrue(childGroup.isMember(user, DomainRegistry.groupMemberService()));

        ApplicationServiceRegistry
            .identityApplicationService()
            .removeUserFromGroup(new RemoveUserFromGroupCommand(
                childGroup.tenantId().id(),
                childGroup.name(),
                user.username()));

        assertEquals(1, parentGroup.groupMembers().size());
        assertEquals(0, childGroup.groupMembers().size());
        assertFalse(parentGroup.isMember(user, DomainRegistry.groupMemberService()));
        assertFalse(childGroup.isMember(user, DomainRegistry.groupMemberService()));
View Full Code Here

        assertNotNull(queriedTenant);
        assertEquals(tenant, queriedTenant);
    }

    public void testQueryUser() throws Exception {
        User user = this.userAggregate();
        DomainRegistry.userRepository().add(user);

        User queriedUser =
                ApplicationServiceRegistry
                    .identityApplicationService()
                    .user(user.tenantId().id(), user.username());

        assertNotNull(user);
View Full Code Here

        assertNotNull(user);
        assertEquals(user, queriedUser);
    }

    public void testQueryUserDescriptor() throws Exception {
        User user = this.userAggregate();
        DomainRegistry.userRepository().add(user);

        UserDescriptor queriedUserDescriptor =
                ApplicationServiceRegistry
                    .identityApplicationService()
                    .userDescriptor(user.tenantId().id(), user.username());

        assertNotNull(user);
        assertEquals(user.userDescriptor(), queriedUserDescriptor);
    }
View Full Code Here

        Tenant tenant = this.tenantAggregate();

        RegistrationInvitation registrationInvitation =
            this.registrationInvitationEntity(tenant);

        User user =
            tenant.registerUser(
                    registrationInvitation.invitationId(),
                    FIXTURE_USERNAME,
                    FIXTURE_PASSWORD,
                    new Enablement(true, null, null),
View Full Code Here

TOP

Related Classes of com.saasovation.identityaccess.domain.model.identity.User

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.