Search in sources :

Example 6 with UIEERepositoryUser

use of org.pentaho.di.ui.repository.pur.repositoryexplorer.model.UIEERepositoryUser in project pentaho-kettle by pentaho.

the class UIEESecurityTest method testAddUser.

@Test
public void testAddUser() throws Exception {
    try {
        security.setSelectedDeck(ObjectRecipient.Type.USER);
        UIEERepositoryUser userToAdd = new UIEERepositoryUser(new EEUserInfo());
        userToAdd.setName("newuser");
        userToAdd.setPassword("newpassword");
        userToAdd.setDescription("new description");
        Set<IUIRole> rolesToAssign = new HashSet<IUIRole>();
        rolesToAssign.add(new UIRepositoryRole(ctoRole));
        rolesToAssign.add(new UIRepositoryRole(isRole));
        rolesToAssign.add(new UIRepositoryRole(adminRole));
        rolesToAssign.add(new UIRepositoryRole(authenticatedRole));
        userToAdd.setRoles(rolesToAssign);
        security.addUser(userToAdd);
        assertEquals(security.getSelectedUser(), userToAdd);
        assertEquals(security.getSelectedDeck(), ObjectRecipient.Type.USER);
        assertEquals(security.getUserList().size(), 5);
    } catch (Exception e) {
        Assert.fail();
    }
}
Also used : UIEERepositoryUser(org.pentaho.di.ui.repository.pur.repositoryexplorer.model.UIEERepositoryUser) UIRepositoryRole(org.pentaho.di.ui.repository.pur.repositoryexplorer.model.UIRepositoryRole) EEUserInfo(org.pentaho.di.repository.pur.model.EEUserInfo) IUIRole(org.pentaho.di.ui.repository.pur.repositoryexplorer.IUIRole) HashSet(java.util.HashSet) Test(org.junit.Test)

Aggregations

UIEERepositoryUser (org.pentaho.di.ui.repository.pur.repositoryexplorer.model.UIEERepositoryUser)6 Test (org.junit.Test)5 HashSet (java.util.HashSet)4 IUIRole (org.pentaho.di.ui.repository.pur.repositoryexplorer.IUIRole)4 UIRepositoryRole (org.pentaho.di.ui.repository.pur.repositoryexplorer.model.UIRepositoryRole)4 EEUserInfo (org.pentaho.di.repository.pur.model.EEUserInfo)3 IUIUser (org.pentaho.di.ui.repository.repositoryexplorer.model.IUIUser)3 ArrayList (java.util.ArrayList)2 UserInfo (org.pentaho.di.repository.UserInfo)2 UISecurityRole (org.pentaho.di.ui.repository.pur.repositoryexplorer.model.UISecurityRole)2 UIRepositoryUser (org.pentaho.di.ui.repository.repositoryexplorer.model.UIRepositoryUser)2 IUIEEUser (org.pentaho.di.ui.repository.pur.repositoryexplorer.IUIEEUser)1