use of org.apache.atlas.web.dao.UserDao in project incubator-atlas by apache.
the class UserDaoTest method testUserDaowithInValidLogin.
@Test
public void testUserDaowithInValidLogin() {
boolean hadException = false;
Properties userLogins = new Properties();
userLogins.put("admin", "ADMIN::admin123");
userLogins.put("test", "DATA_STEWARD::test123");
UserDao user = new UserDao();
user.setUserLogins(userLogins);
try {
User userBean = user.loadUserByUsername("xyz");
} catch (UsernameNotFoundException uex) {
hadException = true;
}
assertTrue(hadException);
}
use of org.apache.atlas.web.dao.UserDao in project incubator-atlas by apache.
the class UserDaoTest method testUserDaowithValidUserLoginAndPassword.
@Test
public void testUserDaowithValidUserLoginAndPassword() {
Properties userLogins = new Properties();
userLogins.put("admin", "ADMIN::admin123");
UserDao user = new UserDao();
user.setUserLogins(userLogins);
User userBean = user.loadUserByUsername("admin");
assertTrue(userBean.getPassword().equals("admin123"));
Collection<? extends GrantedAuthority> authorities = userBean.getAuthorities();
String role = "";
for (GrantedAuthority gauth : authorities) {
role = gauth.getAuthority();
}
assertTrue("ADMIN".equals(role));
}
Aggregations