use of org.pentaho.di.repository.UserInfo in project pentaho-kettle by pentaho.
the class UIRepositoryDirectoryTest method testRefresh.
@Test
public void testRefresh() throws Exception {
RepositoryDirectory root = new RepositoryDirectory();
LongObjectId rootObjectId = new LongObjectId(0L);
root.setObjectId(rootObjectId);
RepositoryDirectory dir = new RepositoryDirectory();
dir.setObjectId(new LongObjectId(1L));
root.addSubdirectory(dir);
RepositoryExtended repo = mock(RepositoryExtended.class);
UserInfo userInfo = new UserInfo();
userInfo.setAdmin(true);
Mockito.when(repo.getUserInfo()).thenReturn(userInfo);
RepositoryDirectory rd = Mockito.mock(RepositoryDirectory.class);
Mockito.when(rd.findDirectory(Mockito.eq(rootObjectId))).thenReturn(Mockito.mock(RepositoryDirectory.class));
Mockito.when(repo.loadRepositoryDirectoryTree("/", "*.ktr|*.kjb", -1, true, true, true)).thenReturn(rd);
UIRepositoryDirectory uiDir = new UIRepositoryDirectory(root, null, repo);
uiDir.refresh();
Mockito.verify(repo).loadRepositoryDirectoryTree("/", "*.ktr|*.kjb", -1, true, true, true);
}
use of org.pentaho.di.repository.UserInfo in project pentaho-kettle by pentaho.
the class UserRoleDelegateTest method createUser_CreatesSuccessfully_WhenNameIsUnique.
@Test
public void createUser_CreatesSuccessfully_WhenNameIsUnique() throws Exception {
final String name = "user";
delegate.createUser(new UserInfo(name));
verify(roleWebService).createUser(any(ProxyPentahoUser.class));
}
use of org.pentaho.di.repository.UserInfo in project pentaho-kettle by pentaho.
the class UserRoleHelperTest method mockSecurityManager.
private static IRoleSupportSecurityManager mockSecurityManager(final boolean eeUsers) throws KettleException {
IRoleSupportSecurityManager manager = mock(IRoleSupportSecurityManager.class);
when(manager.constructUser()).thenAnswer(new Answer<IUser>() {
@Override
public IUser answer(InvocationOnMock invocation) throws Throwable {
return eeUsers ? new EEUserInfo() : new UserInfo();
}
});
when(manager.constructRole()).thenAnswer(new Answer<IRole>() {
@Override
public IRole answer(InvocationOnMock invocation) throws Throwable {
return new EERoleInfo();
}
});
return manager;
}
use of org.pentaho.di.repository.UserInfo in project pentaho-kettle by pentaho.
the class RepositoryExplorerDialog method newUser.
public void newUser() {
UserDialog ud = new UserDialog(shell, SWT.NONE, rep, new UserInfo());
IUser ui = ud.open();
if (ui != null) {
/**
*************************
* Removed by sboden as the user dialog already saves the id on pressing ok. Related defect #4228 on javaforge.
*
* // See if this user already exists... long uid = rep.getUserID(ui.getLogin()); if (uid<=0) { ui.saveRep(rep); }
* else { MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
* mb.setMessage(BaseMessages.getString(PKG, "RepositoryExplorerDialog.User.New.AlreadyExists.Message"));
* mb.setText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.User.New.AlreadyExists.Title")); mb.open(); }
***************************
*/
// Refresh tree...
refreshTree();
}
}
Aggregations