use of org.simbasecurity.core.domain.UserEntity in project simba-os by cegeka.
the class CreateEIDUserCommandTest method execute_UpdateExistingUser.
@Test
public void execute_UpdateExistingUser() throws Exception {
User user = new UserEntity(INSZ);
when(chainContextMock.getSAMLUser()).thenReturn(samlUser);
when(userServiceMock.findByName(INSZ)).thenReturn(user);
State state = createEIDUserCommand.execute(chainContextMock);
assertEquals(State.CONTINUE, state);
verify(chainContextMock).setUserPrincipal(INSZ);
assertEquals(INSZ, user.getUserName());
assertEquals(FIRSTNAME, user.getFirstName());
assertEquals(LASTNAME, user.getName());
assertEquals(Language.fromISO639Code(NL), user.getLanguage());
}
use of org.simbasecurity.core.domain.UserEntity in project simba-os by cegeka.
the class RuleDatabaseRepositoryTest method setUp.
@Before
public void setUp() {
UserEntity user = new UserEntity(USER_NAME);
RoleEntity role = new RoleEntity(ROLE_NAME);
policy = new PolicyEntity(POLICY_NAME);
resourceRuleEntity = new ResourceRuleEntity(RESOURCE_RULE_NAME);
resourceRuleEntity.setResourceName(RESOURCE_NAME);
urlRuleEntity = new URLRuleEntity("urlrule");
persistAndRefresh(user, role, policy, resourceRuleEntity, urlRuleEntity);
policy.addRule(resourceRuleEntity);
policy.addRule(urlRuleEntity);
role.addPolicy(policy);
user.addRole(role);
}
use of org.simbasecurity.core.domain.UserEntity in project simba-os by cegeka.
the class GroupDatabaseRepositoryTest method find.
@Test
public void find() {
UserEntity user = new UserEntity("Jan");
user.addGroup(group);
persistAndRefresh(user);
Collection<Group> result = groupDatabaseRepository.find(user);
assertThat(result).containsOnly(group);
}
Aggregations