use of com.cubrid.cubridmanager.core.cubrid.user.model.DbUserInfoList in project cubrid-manager by CUBRID.
the class GetUserInfoTaskTest method testUpdateMessage.
public void testUpdateMessage() {
// test get user list
final CommonQueryTask<DbUserInfoList> userTask = new CommonQueryTask<DbUserInfoList>(serverInfo930, CommonSendMsg.getCommonDatabaseSendMsg(), new DbUserInfoList());
userTask.setDbName(databaseInfo930.getDbName());
userTask.execute();
assertEquals(null, userTask.getErrorMsg());
assertEquals(true, userTask.getResultModel() != null);
List<DbUserInfo> userListInfo = userTask.getResultModel().getUserList();
String newUserName = getUserName(userListInfo, "a");
// test add user
UpdateAddUserTask task = new UpdateAddUserTask(serverInfo930, true);
UserSendObj userSendObj = new UserSendObj();
userSendObj.setDbname(databaseInfo930.getDbName());
userSendObj.setUsername(newUserName);
userSendObj.setUserpass("123456");
userSendObj.addGroups("public");
task.setUserSendObj(userSendObj);
task.execute();
task.getUserSendObj();
task.isSuccess();
task.setUserName("dba");
task.setDbName(testDbName930);
assertEquals(null, task.getErrorMsg());
// test edit user
task = new UpdateAddUserTask(serverInfo930, false);
userSendObj = new UserSendObj();
userSendObj.setDbname(databaseInfo930.getDbName());
userSendObj.setUsername(newUserName);
userSendObj.setUserpass("223456");
userSendObj.addGroups("public");
task.setUserSendObj(userSendObj);
task.execute();
assertEquals(null, task.getErrorMsg());
// test delete user
CommonUpdateTask commonTask = new CommonUpdateTask(CommonTaskName.DELETE_USER_TASK_NAME, serverInfo930, CommonSendMsg.getDeleteUserMSGItems());
commonTask.setDbName(databaseInfo930.getDbName());
commonTask.setUserName(newUserName);
commonTask.execute();
assertEquals(null, commonTask.getErrorMsg());
}
use of com.cubrid.cubridmanager.core.cubrid.user.model.DbUserInfoList in project cubrid-manager by CUBRID.
the class DatabaseInfoTest method testGetDbUserInfoList.
/**
* Test method for
* {@link com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo#getDbUserInfoList()}
* .
*/
public void testGetDbUserInfoList() {
DbUserInfoList dbUserInfoList = new DbUserInfoList();
bean.setDbUserInfoList(dbUserInfoList);
assertTrue(bean.getDbUserInfoList() != null);
}
use of com.cubrid.cubridmanager.core.cubrid.user.model.DbUserInfoList in project cubrid-manager by CUBRID.
the class DatabaseModelTest method testModelDatabaseInfo.
@SuppressWarnings({ "unchecked", "rawtypes" })
public void testModelDatabaseInfo() {
DatabaseInfo bean = new DatabaseInfo(testDbName, serverInfo);
bean.setDbName("dbName");
assertEquals(bean.getDbName(), "dbName");
bean.setLogined(true);
assertTrue(bean.isLogined());
bean.setDbDir("dbDir");
assertEquals(bean.getDbDir(), "dbDir");
bean.setRunningType(DbRunningType.CS);
assertEquals(bean.getRunningType(), DbRunningType.CS);
DbUserInfoList dbUserInfoList = new DbUserInfoList();
bean.setDbUserInfoList(dbUserInfoList);
assertTrue(bean.getDbUserInfoList() != null);
DbUserInfo dbUserInfo = new DbUserInfo();
bean.addDbUserInfo(dbUserInfo);
bean.removeDbUserInfo(dbUserInfo);
bean.setAuthLoginedDbUserInfo(dbUserInfo);
assertEquals(bean.getAuthLoginedDbUserInfo(), dbUserInfo);
bean.setBrokerPort("brokerPort");
assertEquals(bean.getBrokerPort(), "brokerPort");
bean.setTriggerList(new ArrayList());
assertEquals(bean.getTriggerList() != null, true);
bean.setUserTableInfoList(new ArrayList());
assertEquals(bean.getUserTableInfoList() != null, true);
bean.setUserViewInfoList(new ArrayList());
assertEquals(bean.getUserViewInfoList() != null, true);
bean.setSysTableInfoList(new ArrayList());
assertEquals(bean.getSysTableInfoList() != null, true);
bean.setSysViewInfoList(new ArrayList());
assertEquals(bean.getSysViewInfoList() != null, true);
bean.setPartitionedTableMap(new HashMap());
assertEquals(bean.getPartitionedTableMap() != null, true);
bean.setBackupPlanInfoList(new ArrayList());
assertEquals(bean.getBackupPlanInfoList() != null, true);
bean.setQueryPlanInfoList(new ArrayList());
assertEquals(bean.getQueryPlanInfoList() != null, true);
bean.setDbSpaceInfoList(new DbSpaceInfoList());
assertEquals(bean.getDbSpaceInfoList() != null, true);
bean.setDbUserInfoList(new DbUserInfoList());
assertEquals(bean.getDbUserInfoList() != null, true);
bean.setSpProcedureInfoList(new ArrayList());
assertEquals(bean.getSpProcedureInfoList() != null, true);
bean.setSpFunctionInfoList(new ArrayList());
assertEquals(bean.getSpFunctionInfoList() != null, true);
bean.setSerialInfoList(new ArrayList());
assertEquals(bean.getSerialInfoList() != null, true);
bean.setServerInfo(serverInfo);
assertEquals(bean.getServerInfo() != null, true);
bean.clear();
bean.setLogined(true);
assertEquals(bean.isLogined(), true);
bean.addDbUserInfo(new DbUserInfo());
bean.removeDbUserInfo(new DbUserInfo());
bean.getClassInfoList();
bean.addPartitionedTableList("dbname", null);
bean.addBackupPlanInfo(new BackupPlanInfo());
bean.removeBackupPlanInfo(new BackupPlanInfo());
bean.removeAllBackupPlanInfo();
bean.addQueryPlanInfo(new QueryPlanInfo());
bean.removeQueryPlanInfo(new QueryPlanInfo());
bean.removeAllQueryPlanInfo();
bean.addSpaceInfo(new DbSpaceInfo());
bean.removeSpaceInfo(new DbSpaceInfo());
bean.getSpInfoList();
bean.getSchemaInfo("tableName");
bean.putSchemaInfo(new SchemaInfo());
bean.clearSchemas();
bean.getErrorMessage();
bean.setDbUserInfoList(null);
assertEquals(bean.getDbUserInfoList(), null);
bean.addDbUserInfo(new DbUserInfo());
bean.removeDbUserInfo(new DbUserInfo());
}
use of com.cubrid.cubridmanager.core.cubrid.user.model.DbUserInfoList in project cubrid-manager by CUBRID.
the class GetUserListTaskTest method testGetUserListTask.
public void testGetUserListTask() throws Exception {
GetUserListTask task = new GetUserListTask(databaseInfo);
task.execute();
DbUserInfoList dbUserInfoList = task.getResultModel();
assertNotNull(dbUserInfoList);
Connection connection = null;
try {
connection = JDBCConnectionManager.getConnection(databaseInfo, true);
task = new GetUserListTask(databaseInfo, connection);
task.execute();
List<String> allUsersList = task.getAllDbUserList();
assertNotNull(allUsersList);
} catch (SQLException ex) {
} finally {
QueryUtil.freeQuery(connection);
}
}
use of com.cubrid.cubridmanager.core.cubrid.user.model.DbUserInfoList in project cubrid-manager by CUBRID.
the class CQBDbUsersFolderLoader method load.
/**
*
* Load children object for parent
*
* @param parent the parent node
* @param monitor the IProgressMonitor object
*/
public void load(ICubridNode parent, final IProgressMonitor monitor) {
synchronized (this) {
if (isLoaded()) {
return;
}
CubridDatabase database = ((ISchemaNode) parent).getDatabase();
if (database.getRunningType() == DbRunningType.STANDALONE) {
parent.removeAllChild();
CubridNodeManager.getInstance().fireCubridNodeChanged(new CubridNodeChangedEvent((ICubridNode) parent, CubridNodeChangedEventType.CONTAINER_NODE_REFRESH));
return;
}
DatabaseInfo databaseInfo = database.getDatabaseInfo();
DbUserInfoList dbUserInfoList = new DbUserInfoList();
GetUserListTask task = new GetUserListTask(database.getDatabaseInfo());
parent.removeAllChild();
try {
dbUserInfoList = task.getResultModel();
} catch (Exception e) {
LOGGER.error("load user failed", e);
}
DbUserInfo latestDLoginedbUserInfo = databaseInfo.getAuthLoginedDbUserInfo();
List<DbUserInfo> dbUserList = dbUserInfoList == null ? null : dbUserInfoList.getUserList();
formatUserList(dbUserList);
for (int i = 0; dbUserList != null && dbUserList.size() > i; i++) {
DbUserInfo dbUserInfo = dbUserList.get(i);
if (dbUserInfo.getName().equals(latestDLoginedbUserInfo.getName())) {
dbUserInfo.setDbaAuthority(latestDLoginedbUserInfo.isDbaAuthority());
// databaseInfo.setAuthLoginedDbUserInfo(dbUserInfo);
}
String id = parent.getId() + NODE_SEPARATOR + dbUserInfo.getName();
ICubridNode dbUserInfoNode = new DefaultSchemaNode(id, dbUserInfo.getName(), "icons/navigator/user_item.png");
dbUserInfoNode.setType(NodeType.USER);
dbUserInfoNode.setModelObj(dbUserInfo);
dbUserInfoNode.setContainer(false);
dbUserInfoNode.setEditorId(CQBUserEditor.ID);
parent.addChild(dbUserInfoNode);
}
databaseInfo.setDbUserInfoList(dbUserInfoList);
setLoaded(true);
CubridNodeManager.getInstance().fireCubridNodeChanged(new CubridNodeChangedEvent((ICubridNode) parent, CubridNodeChangedEventType.CONTAINER_NODE_REFRESH));
}
}
Aggregations