Search in sources :

Example 1 with CommonUpdateTask

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());
}
Also used : DbUserInfo(com.cubrid.cubridmanager.core.cubrid.user.model.DbUserInfo) UpdateAddUserTask(com.cubrid.cubridmanager.core.cubrid.user.task.UpdateAddUserTask) CommonQueryTask(com.cubrid.cubridmanager.core.common.task.CommonQueryTask) DbUserInfoList(com.cubrid.cubridmanager.core.cubrid.user.model.DbUserInfoList) UserSendObj(com.cubrid.cubridmanager.core.cubrid.database.model.UserSendObj) CommonUpdateTask(com.cubrid.cubridmanager.core.common.task.CommonUpdateTask)

Example 2 with CommonUpdateTask

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);
}
Also used : TaskJobExecutor(com.cubrid.common.ui.spi.progress.TaskJobExecutor) CommonTaskJobExec(com.cubrid.common.ui.spi.progress.CommonTaskJobExec) CommonUpdateTask(com.cubrid.cubridmanager.core.common.task.CommonUpdateTask) JobFamily(com.cubrid.common.ui.spi.progress.JobFamily)

Example 3 with CommonUpdateTask

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);
}
Also used : TaskJobExecutor(com.cubrid.common.ui.spi.progress.TaskJobExecutor) CommonTaskJobExec(com.cubrid.common.ui.spi.progress.CommonTaskJobExec) CommonUpdateTask(com.cubrid.cubridmanager.core.common.task.CommonUpdateTask) JobFamily(com.cubrid.common.ui.spi.progress.JobFamily)

Example 4 with CommonUpdateTask

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);
}
Also used : CommonUpdateTask(com.cubrid.cubridmanager.core.common.task.CommonUpdateTask)

Example 5 with CommonUpdateTask

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.");
}
Also used : CommonUpdateTask(com.cubrid.cubridmanager.core.common.task.CommonUpdateTask)

Aggregations

CommonUpdateTask (com.cubrid.cubridmanager.core.common.task.CommonUpdateTask)40 ITask (com.cubrid.common.core.task.ITask)9 ServerInfo (com.cubrid.cubridmanager.core.common.model.ServerInfo)7 GetDatabaseListTask (com.cubrid.cubridmanager.core.cubrid.database.task.GetDatabaseListTask)7 Display (org.eclipse.swt.widgets.Display)7 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)6 ExecTaskWithProgress (com.cubrid.common.ui.spi.progress.ExecTaskWithProgress)5 JobFamily (com.cubrid.common.ui.spi.progress.JobFamily)5 TaskExecutor (com.cubrid.common.ui.spi.progress.TaskExecutor)5 GetCubridConfParameterTask (com.cubrid.cubridmanager.core.common.task.GetCubridConfParameterTask)5 MonitoringTask (com.cubrid.cubridmanager.core.common.task.MonitoringTask)5 SetCubridConfParameterTask (com.cubrid.cubridmanager.core.common.task.SetCubridConfParameterTask)5 DatabaseInfo (com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo)5 CubridDatabase (com.cubrid.common.ui.spi.model.CubridDatabase)4 ISchemaNode (com.cubrid.common.ui.spi.model.ISchemaNode)4 GetReplServerStatusTask (com.cubrid.cubridmanager.core.replication.task.GetReplServerStatusTask)4 StopReplServerTask (com.cubrid.cubridmanager.core.replication.task.StopReplServerTask)4 CubridNodeChangedEvent (com.cubrid.common.ui.spi.event.CubridNodeChangedEvent)3 TaskJobExecutor (com.cubrid.common.ui.spi.progress.TaskJobExecutor)3 MonitorDashboardPreference (com.cubrid.cubridmanager.ui.mondashboard.preference.MonitorDashboardPreference)3