use of com.cubrid.cubridmanager.core.common.task.CommonUpdateTask 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.common.task.CommonUpdateTask in project cubrid-manager by CUBRID.
the class CheckDatabaseDialog method buttonPressed.
/**
* When press button in button bar,call this method
*
* @param buttonId the button id
*/
protected void buttonPressed(int buttonId) {
if (buttonId == IDialogConstants.OK_ID) {
if (!verify()) {
return;
}
CommonUpdateTask task = new CommonUpdateTask(CommonTaskName.CHECK_DATABASE_TASK_NAME, database.getServer().getServerInfo(), CommonSendMsg.getCheckDbSendMsg());
task.setDbName(database.getName());
task.setRepairDb(repairButton.getSelection() ? YesNoType.Y : YesNoType.N);
String serverName = database.getServer().getName();
String dbName = database.getName();
jobName = Messages.msgCheckDbRearName + " - " + dbName + "@" + serverName;
TaskJobExecutor taskExec = new CommonTaskJobExec(this);
taskExec.addTask(task);
JobFamily jobFamily = new JobFamily();
jobFamily.setServerName(serverName);
jobFamily.setDbName(dbName);
taskExec.schedule(jobName, jobFamily, true, Job.SHORT);
return;
}
super.buttonPressed(buttonId);
}
use of com.cubrid.cubridmanager.core.common.task.CommonUpdateTask in project cubrid-manager by CUBRID.
the class CompactDatabaseDialog method buttonPressed.
/**
* When press button in button bar,call this method
*
* @param buttonId the button id
*/
protected void buttonPressed(int buttonId) {
if (buttonId == IDialogConstants.OK_ID) {
if (!verify()) {
return;
}
if (CommonUITool.openConfirmBox(parentComp.getShell(), Messages.msgCompactConfirm)) {
CommonUpdateTask task = new CommonUpdateTask(CommonTaskName.COMPACT_DATABASE_TASK_NANE, database.getServer().getServerInfo(), CommonSendMsg.getCompactDbSendMsg());
task.setDbName(database.getName());
if (verboseBtn != null) {
task.setVerbose(verboseBtn.getSelection() ? YesNoType.Y : YesNoType.N);
}
String serverName = database.getServer().getName();
String dbName = database.getName();
jobName = Messages.msgCompactDbRearJobName + " - " + dbName + "@" + serverName;
TaskJobExecutor taskExec = new CommonTaskJobExec(this);
taskExec.addTask(task);
JobFamily jobFamily = new JobFamily();
jobFamily.setServerName(serverName);
jobFamily.setDbName(dbName);
taskExec.schedule(jobName, jobFamily, true, Job.SHORT);
return;
} else {
return;
}
}
super.buttonPressed(buttonId);
}
use of com.cubrid.cubridmanager.core.common.task.CommonUpdateTask in project cubrid-manager by CUBRID.
the class OptimizeDialog method buttonPressed.
/**
* When button press,call it
*
* @param buttonId the button id
*/
protected void buttonPressed(int buttonId) {
if (buttonId == IDialogConstants.OK_ID) {
if (verify()) {
CommonUpdateTask task = new CommonUpdateTask(CommonTaskName.OPTIMIZE_DATABASE_TASK_NAME, database.getServer().getServerInfo(), CommonSendMsg.getOptimizeDbSendMsg(), database.getDatabaseInfo().getCharSet());
task.setDbName(database.getName());
task.setClassName((className.getSelectionIndex() <= 0) ? "" : className.getText());
exec(IDialogConstants.OK_ID, task, false, getShell());
}
return;
}
super.buttonPressed(buttonId);
}
use of com.cubrid.cubridmanager.core.common.task.CommonUpdateTask in project cubrid-manager by CUBRID.
the class CheckDbTaskTest method testNotExistDb.
@SuppressWarnings("static-access")
public void testNotExistDb() {
if (StringUtil.isEqual(SystemParameter.getParameterValue("useMockTest"), "n"))
return;
System.out.println("<database.checkdb.002.req.txt>");
CommonUpdateTask task = new CommonUpdateTask(CommonTaskName.CHECK_DATABASE_TASK_NAME, ServerManager.getInstance().getServer(host, monport, userName), CommonSendMsg.getCommonDatabaseSendMsg());
task.setDbName("notexistdb");
task.execute();
task.fillSet(new ArrayList<String>(), new String[] { "1", "2" });
assertFalse(task.isSuccess());
assertEquals(task.getErrorMsg(), "Database \"notexistdb\" is unknown, or the file \"databases.txt\" cannot be accessed.");
}
Aggregations