Search in sources :

Example 6 with UserRoleWebService

use of org.pentaho.platform.security.userroledao.ws.UserRoleWebService in project pentaho-platform by pentaho.

the class UserRoleWebServiceBase method testCreateDuplicateUser.

@Test
public void testCreateDuplicateUser() throws UserRoleException {
    UserRoleDaoMock userRoleDao = Mockito.mock(UserRoleDaoMock.class);
    Mockito.doThrow(new AlreadyExistsException("That user name already exists.")).when(userRoleDao).createUser(Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any());
    UserRoleWebService userRoleWebService = new UserRoleWebService() {

        @Override
        protected IUserRoleDao getDao() throws UserRoleException {
            return userRoleDao;
        }
    };
    ProxyPentahoUser proxyPentahoUser = new ProxyPentahoUser();
    proxyPentahoUser.setName("test");
    proxyPentahoUser.setEnabled(true);
    proxyPentahoUser.setPassword("test");
    proxyPentahoUser.setDescription("testing");
    try {
        userRoleWebService.createUser(proxyPentahoUser);
        Assert.fail();
    } catch (AlreadyExistsException e) {
        Assert.assertEquals(0, e.getStackTrace().length);
    }
}
Also used : AlreadyExistsException(org.pentaho.platform.api.engine.security.userroledao.AlreadyExistsException) ProxyPentahoUser(org.pentaho.platform.security.userroledao.ws.ProxyPentahoUser) UserRoleWebService(org.pentaho.platform.security.userroledao.ws.UserRoleWebService) IUserRoleWebService(org.pentaho.platform.security.userroledao.ws.IUserRoleWebService) Test(org.junit.Test)

Aggregations

IUserRoleWebService (org.pentaho.platform.security.userroledao.ws.IUserRoleWebService)6 UserRoleWebService (org.pentaho.platform.security.userroledao.ws.UserRoleWebService)6 Test (org.junit.Test)4 URL (java.net.URL)2 QName (javax.xml.namespace.QName)2 Service (javax.xml.ws.Service)2 AlreadyExistsException (org.pentaho.platform.api.engine.security.userroledao.AlreadyExistsException)2 ProxyPentahoRole (org.pentaho.platform.security.userroledao.ws.ProxyPentahoRole)2 ProxyPentahoUser (org.pentaho.platform.security.userroledao.ws.ProxyPentahoUser)2 UserRoleException (org.pentaho.platform.security.userroledao.ws.UserRoleException)2 Before (org.junit.Before)1 UserRoleSecurityInfo (org.pentaho.platform.security.userroledao.ws.UserRoleSecurityInfo)1