public DBUserInfoImpl(boolean activate) { String propertiesLocation = System.getProperty("jbpm.user.info.properties"); config = readProperties(propertiesLocation, DEFAULT_PROPERTIES_NAME); init(); }
@Test public void testGetEmailForEntity() { DBUserInfoImpl userInfo = new DBUserInfoImpl(props); String email = userInfo.getEmailForEntity(JOHN); Assertions.assertThat(email).isEqualTo("john@jbpm.org"); }
@Test public void testGetDisplayName() { DBUserInfoImpl userInfo = new DBUserInfoImpl(props); String displayName = userInfo.getDisplayName(JOHN); Assertions.assertThat(displayName).isEqualTo("John Doe"); }
@Test public void testHasEmail() { DBUserInfoImpl userInfo = new DBUserInfoImpl(props); boolean hasEmail = userInfo.hasEmail(PM); Assertions.assertThat(hasEmail).isTrue(); }
@Test public void testGetLanguageForEntity() { DBUserInfoImpl userInfo = new DBUserInfoImpl(props); String lang = userInfo.getLanguageForEntity(JOHN); Assertions.assertThat(lang).isEqualTo("en-UK"); }
@Test public void testGetEntityForEmail() { DBUserInfoImpl userInfo = new DBUserInfoImpl(props); String id = userInfo.getEntityForEmail("john@jbpm.org"); Assertions.assertThat(id).isEqualTo(JOHN.getId()); } }
@Test public void testGetMembersForGroup() { DBUserInfoImpl userInfo = new DBUserInfoImpl(props); Iterator<OrganizationalEntity> members = userInfo.getMembersForGroup(PM); Assertions.assertThat(members.hasNext()).isTrue(); User user = (User) members.next(); Assertions.assertThat(user.getId()).isEqualTo(JOHN.getId()); }
public static UserInfo getUserInfo() { UserInfo userInfo = new DefaultUserInfo(true); if ("ldap".equalsIgnoreCase(USER_INFO_IMPL)) { userInfo = new LDAPUserInfoImpl(true); } else if ("db".equalsIgnoreCase(USER_INFO_IMPL)) { userInfo = new DBUserInfoImpl(true); } else if ("props".equalsIgnoreCase(USER_INFO_IMPL)) { userInfo = new PropertyUserInfoImpl(true); } else if ("custom".equalsIgnoreCase(USER_INFO_IMPL)) { try { userInfo = (UserInfo) Class.forName(CUSTOM_USER_INFO_IMPL).newInstance(); } catch (Exception e) { throw new RuntimeException("Unable to create instance of custom user info impl", e); } } return userInfo; } }
String email = getEmailForEntity(group); if (email != null) { return true;
public DBUserInfoImpl(Properties config) { this.config = config; init(); }
public static UserInfo getUserInfo() { UserInfo userInfo = new DefaultUserInfo(true); if ("ldap".equalsIgnoreCase(USER_INFO_IMPL)) { userInfo = new LDAPUserInfoImpl(true); } else if ("db".equalsIgnoreCase(USER_INFO_IMPL)) { userInfo = new DBUserInfoImpl(true); } else if ("props".equalsIgnoreCase(USER_INFO_IMPL)) { userInfo = new PropertyUserInfoImpl(true); } else if ("custom".equalsIgnoreCase(USER_INFO_IMPL)) { try { userInfo = (UserInfo) Class.forName(CUSTOM_USER_INFO_IMPL).newInstance(); } catch (Exception e) { throw new RuntimeException("Unable to create instance of custom user info impl", e); } } return userInfo; } }