use of io.jans.as.common.model.common.User in project jans by JanssenProject.
the class UserServiceTest method getUser_nullUserId_user.
@Test
private void getUser_nullUserId_user() {
User user = userService.getUser(null, null);
assertNull(user);
}
use of io.jans.as.common.model.common.User in project jans by JanssenProject.
the class UserServiceTest method getUserByAttributes_validAttributeNamesSize2NoIsSpanner_user.
@Test
private void getUserByAttributes_validAttributeNamesSize2NoIsSpanner_user() {
String userId = "123";
String baseDn = "baseDn";
String[] attributeNames = { "attribute1", "attribute2" };
String attributeValue = "value1";
when(dataSourceTypeService.isSpanner(anyString())).thenReturn(false);
when(persistenceEntryManager.findEntries(anyString(), any(), any(), any(), anyInt())).thenReturn(getListBasicOneUser(userId, baseDn));
User resultUser = userService.getUserByAttributes(attributeValue, attributeNames, true, null);
assertNotNull(resultUser);
}
use of io.jans.as.common.model.common.User in project jans by JanssenProject.
the class UserServiceTest method addUser_noEmptyPersonCustomObject_user.
@Test
private void addUser_noEmptyPersonCustomObject_user() {
User user = getBasicUser("123", "dn123");
doNothing().when(persistenceEntryManager).persist(any());
when(persistenceEntryManager.find(anyString(), any(), any())).thenReturn(user);
when(inumService.generatePeopleInum()).thenReturn(UUID.randomUUID().toString());
userService.setReturnTestListPersonCustomObjectClassList(true);
User resultUser = userService.addUser(user, true);
assertNotNull(resultUser);
assertNotNull(resultUser.getUserId());
assertNotNull(user.getAttribute("jansStatus"));
assertNotNull(user.getAttribute("inum"));
assertEquals(user.getAttribute("jansStatus"), GluuStatus.ACTIVE.getValue());
assertTrue(resultUser.getCustomObjectClasses().length == 2);
assertTrue(resultUser.getCustomObjectClasses()[0].equals(user.getCustomObjectClasses()[0]));
}
use of io.jans.as.common.model.common.User in project jans by JanssenProject.
the class UserServiceTest method getUserByAttribute_validAttributeValueAttributeName_user.
@Test
private void getUserByAttribute_validAttributeValueAttributeName_user() {
String userId = "123";
String baseDn = "baseDn";
String attributeName = "attribute1";
String attributeValue = "value1";
when(persistenceEntryManager.findEntries(anyString(), any(), any(), anyInt())).thenReturn(getListBasicOneUser(userId, baseDn));
User resultUser = userService.getUserByAttribute(attributeName, attributeValue);
assertNotNull(resultUser);
}
use of io.jans.as.common.model.common.User in project jans by JanssenProject.
the class UserServiceTest method getUser_isSpannerPeopleBaseDn_user.
@Test
private void getUser_isSpannerPeopleBaseDn_user() {
String userId = "123";
String baseDn = "dn123";
when(dataSourceTypeService.isSpanner(anyString())).thenReturn(true);
when(persistenceEntryManager.findEntries(anyString(), any(), any(), any())).thenReturn(getListBasicOneUser(userId, baseDn));
User user = userService.getUser(userId, null);
assertNotNull(user);
assertEquals(user.getUserId(), userId);
assertEquals(user.getBaseDn(), baseDn);
}
Aggregations