use of org.pentaho.platform.api.engine.security.userroledao.UncategorizedUserRoleDaoException in project pentaho-platform by pentaho.
the class UserRoleDaoResourceTest method testDeleteUserUncategorizedUserRoleDaoException.
@Test
public void testDeleteUserUncategorizedUserRoleDaoException() {
String users = "user1\tuser2\tuser3\t";
doThrow(new UncategorizedUserRoleDaoException("expectedTestException")).when(userRoleService).deleteUsers(anyString());
try {
Response response = userRoleResource.deleteUsers(users);
} catch (WebApplicationException e) {
assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), e.getResponse().getStatus());
}
}
use of org.pentaho.platform.api.engine.security.userroledao.UncategorizedUserRoleDaoException in project pentaho-platform by pentaho.
the class UserRoleDaoResourceTest method testDeleteRoleUncategorizedUserRoleDaoException.
@Test
public void testDeleteRoleUncategorizedUserRoleDaoException() {
String roles = "role1\trole2";
doThrow(new UncategorizedUserRoleDaoException("expectedTestException")).when(userRoleService).deleteRoles(anyString());
try {
userRoleResource.deleteRoles(roles);
} catch (WebApplicationException e) {
assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), e.getResponse().getStatus());
}
}
use of org.pentaho.platform.api.engine.security.userroledao.UncategorizedUserRoleDaoException in project pentaho-platform by pentaho.
the class UserRoleDaoResourceTest method testRemoveRolesFromUserUncategorizedUserRoleDaoException.
@Test
public void testRemoveRolesFromUserUncategorizedUserRoleDaoException() {
String user = "testUser1";
String roles = "testRole1";
doThrow(new UncategorizedUserRoleDaoException("expectedTestException")).when(userRoleService).removeRolesFromUser(anyString(), anyString());
try {
userRoleResource.removeRolesFromUser(user, roles);
} catch (WebApplicationException e) {
assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), e.getResponse().getStatus());
assertNotNull(e.getResponse().getEntity());
}
}
use of org.pentaho.platform.api.engine.security.userroledao.UncategorizedUserRoleDaoException in project pentaho-platform by pentaho.
the class UserRoleDaoResourceTest method testAssignRoleToUserUncategorizedUserRoleDaoException.
@Test
public void testAssignRoleToUserUncategorizedUserRoleDaoException() {
String user = "testUser1";
String roles = "testRole1";
doThrow(new UncategorizedUserRoleDaoException("expectedTestException")).when(userRoleService).assignRolesToUser(anyString(), anyString());
try {
userRoleResource.assignRolesToUser(user, roles);
} catch (WebApplicationException e) {
assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), e.getResponse().getStatus());
}
}
use of org.pentaho.platform.api.engine.security.userroledao.UncategorizedUserRoleDaoException in project pentaho-platform by pentaho.
the class UserRoleDaoServiceTest method testDeleteUsersUncategorizedUserRoleDaoException.
@Test(expected = UncategorizedUserRoleDaoException.class)
public void testDeleteUsersUncategorizedUserRoleDaoException() {
String users = "admin\tsuzy\t";
setupMockSessionUser(SESSION_USER_NAME, true);
IPentahoUser user = mock(IPentahoUser.class);
IUserRoleDao roleDao = mock(IUserRoleDao.class);
when(roleDao.getUser(any(ITenant.class), anyString())).thenThrow(new UncategorizedUserRoleDaoException("expectedTestException"));
PentahoSystem.registerObject(roleDao);
userRoleService.deleteUsers(users);
}
Aggregations