Search in sources :

Example 1 with UserRoleWebService

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

the class UserRoleWebServiceBase method testCreateBlankUser.

@Test
public void testCreateBlankUser() throws UserRoleException {
    UserRoleWebService userRoleWebService = new UserRoleWebService();
    ProxyPentahoUser proxyPentahoUser = new ProxyPentahoUser();
    try {
        userRoleWebService.createUser(proxyPentahoUser);
        Assert.fail();
    } catch (UserRoleException e) {
        Assert.assertEquals(0, e.getStackTrace().length);
    }
}
Also used : UserRoleException(org.pentaho.platform.security.userroledao.ws.UserRoleException) 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)

Example 2 with UserRoleWebService

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

the class UserRoleEndpointIT method setUp.

@Before
public void setUp() throws Exception {
    try {
        // $NON-NLS-1$
        Endpoint.publish("http://localhost:9891/test", new UserRoleWebService());
    } catch (Throwable th) {
    // ignore
    }
    System.setProperty("com.sun.xml.ws.monitoring.endpoint", "true");
    System.setProperty("com.sun.xml.ws.monitoring.client", "true");
    System.setProperty("com.sun.xml.ws.monitoring.registrationDebug", "FINE");
    System.setProperty("com.sun.xml.ws.monitoring.runtimeDebug", "true");
    Service service = Service.create(new URL("http://localhost:9891/test?wsdl"), new QName("http://www.pentaho.org/ws/1.0", "userRoleService"));
    mockUserAsAdmin(true);
    userRoleWebService = service.getPort(IUserRoleWebService.class);
}
Also used : QName(javax.xml.namespace.QName) UserRoleWebService(org.pentaho.platform.security.userroledao.ws.UserRoleWebService) Service(javax.xml.ws.Service) IUserRoleWebService(org.pentaho.platform.security.userroledao.ws.IUserRoleWebService) IUserRoleWebService(org.pentaho.platform.security.userroledao.ws.IUserRoleWebService) UserRoleWebService(org.pentaho.platform.security.userroledao.ws.UserRoleWebService) IUserRoleWebService(org.pentaho.platform.security.userroledao.ws.IUserRoleWebService) URL(java.net.URL) Before(org.junit.Before)

Example 3 with UserRoleWebService

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

the class UserRoleWebServiceBase method testCreateDuplicateRole.

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

        @Override
        protected IUserRoleDao getDao() throws UserRoleException {
            return userRoleDao;
        }
    };
    ProxyPentahoRole proxyPentahoRole = new ProxyPentahoRole("testrole");
    try {
        userRoleWebService.createRole(proxyPentahoRole);
        Assert.fail();
    } catch (AlreadyExistsException e) {
        Assert.assertEquals(0, e.getStackTrace().length);
    }
}
Also used : AlreadyExistsException(org.pentaho.platform.api.engine.security.userroledao.AlreadyExistsException) ProxyPentahoRole(org.pentaho.platform.security.userroledao.ws.ProxyPentahoRole) UserRoleWebService(org.pentaho.platform.security.userroledao.ws.UserRoleWebService) IUserRoleWebService(org.pentaho.platform.security.userroledao.ws.IUserRoleWebService) Test(org.junit.Test)

Example 4 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)

Example 5 with UserRoleWebService

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

the class UserRoleWebServiceBase method testCreateBlankRole.

@Test
public void testCreateBlankRole() throws UserRoleException {
    UserRoleWebService userRoleWebService = new UserRoleWebService();
    ProxyPentahoRole proxyPentahoRole = new ProxyPentahoRole();
    try {
        userRoleWebService.createRole(proxyPentahoRole);
        Assert.fail();
    } catch (UserRoleException e) {
        Assert.assertEquals(0, e.getStackTrace().length);
    }
}
Also used : ProxyPentahoRole(org.pentaho.platform.security.userroledao.ws.ProxyPentahoRole) UserRoleException(org.pentaho.platform.security.userroledao.ws.UserRoleException) 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