Search in sources :

Example 6 with CommonUpdateTask

use of com.cubrid.cubridmanager.core.common.task.CommonUpdateTask in project cubrid-manager by CUBRID.

the class CompactDbTaskTest method testInActiveDb.

public void testInActiveDb() {
    if (StringUtil.isEqual(SystemParameter.getParameterValue("useMockTest"), "n"))
        return;
    System.out.println("<database.compactdb.002.req.txt>");
    CommonUpdateTask task = new CommonUpdateTask(CommonTaskName.COMPACT_DATABASE_TASK_NANE, ServerManager.getInstance().getServer(host, monport, userName), CommonSendMsg.getCompactDbSendMsg());
    task.setDbName("inactivedb");
    //task.execute();
    assertTrue(task.isSuccess());
    assertNull(task.getErrorMsg());
}
Also used : CommonUpdateTask(com.cubrid.cubridmanager.core.common.task.CommonUpdateTask)

Example 7 with CommonUpdateTask

use of com.cubrid.cubridmanager.core.common.task.CommonUpdateTask in project cubrid-manager by CUBRID.

the class CopyAndDeleteTaskTest method testCopyDataBase.

public void testCopyDataBase() {
    // task:copydb
    // token:8ec1ab8a91333c78403a39727783958b5f3f25c536c9d92f88b7d31a95a5fadf7926f07dd201b6aa
    // srcdbname:aaa
    // destdbname:dss
    // destdbpath:C:\CUBRID\databases\dss
    // exvolpath:C:\CUBRID\databases\dss
    // logpath:C:\CUBRID\databases\
    // overwrite:n
    // move:n
    // advanced:on
    // open:volume
    // C|/CUBRID/databases/aaa/aaa:C|\CUBRID\databases\dss/dss
    // C|/CUBRID/databases/aaa/aaa_x001:C|\CUBRID\databases\dss/dss_x001
    // C|/CUBRID/databases/aaa/aaa_x002:C|\CUBRID\databases\dss/dss_x002
    // close:volume
    final GetDatabaseListTask getDatabaseListTask = new GetDatabaseListTask(serverInfo);
    getDatabaseListTask.execute();
    List<DatabaseInfo> databaseInfoList = getDatabaseListTask.loadDatabaseInfo();
    DatabaseInfo databaseInfo = null;
    for (DatabaseInfo bean : databaseInfoList) {
        if (bean.getRunningType() == DbRunningType.STANDALONE) {
            databaseInfo = bean;
            break;
        }
    }
    boolean stopDb = false;
    if (databaseInfo == null) {
        stopDb = true;
        databaseInfo = databaseInfoList.get(0);
        CommonUpdateTask stopTask = new CommonUpdateTask(CommonTaskName.STOP_DB_TASK_NAME, serverInfo, CommonSendMsg.getCommonDatabaseSendMsg());
        stopTask.setDbName(databaseInfo.getDbName());
        //stopTask.execute();
        assertEquals(null, stopTask.getErrorMsg());
    }
    // check dir
    CheckDirTask checkDirTask = new CheckDirTask(serverInfo);
    checkDirTask.setDirectory(new String[] { serverPath + getPathSeparator() + "databases" + getPathSeparator() + newdbname });
    //checkDirTask.execute();
    assertEquals(null, checkDirTask.getErrorMsg());
    /*		if (checkDirTask.getNoExistDirectory() != null && checkDirTask.getNoExistDirectory().length > 0) {

		}*/
    CopyDbTask task = new CopyDbTask(serverInfo);
    task.setSrcdbname(databaseInfo.getDbName());
    task.setDestdbname(newdbname);
    task.setDestdbpath(serverPath + getPathSeparator() + "databases" + getPathSeparator() + newdbname);
    task.setExvolpath(serverPath + getPathSeparator() + "databases" + getPathSeparator() + newdbname);
    task.setLogpath(serverPath + getPathSeparator() + "databases" + getPathSeparator() + newdbname);
    task.setOverwrite(YesNoType.N);
    task.setMove(YesNoType.N);
    task.setAdvanced(OnOffType.OFF);
    //task.execute();
    System.out.println("getErrorMsg:" + task.getErrorMsg());
    assertEquals(null, task.getErrorMsg());
    if (stopDb) {
        CommonUpdateTask startTask = new CommonUpdateTask(CommonTaskName.START_DB_TASK_NAME, serverInfo, CommonSendMsg.getCommonDatabaseSendMsg());
        startTask.setDbName(databaseInfo.getDbName());
        //startTask.execute();
        assertEquals(null, startTask.getErrorMsg());
    }
}
Also used : DatabaseInfo(com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo) CommonUpdateTask(com.cubrid.cubridmanager.core.common.task.CommonUpdateTask)

Example 8 with CommonUpdateTask

use of com.cubrid.cubridmanager.core.common.task.CommonUpdateTask in project cubrid-manager by CUBRID.

the class CopyAndDeleteTaskTest method testDeleteDataBase.

public void testDeleteDataBase() {
    CommonUpdateTask task = new CommonUpdateTask(CommonTaskName.DELETE_DATABASE_TASK_NAME, serverInfo, CommonSendMsg.getDeletedbSendMsg());
    // task:deletedb
    // token:8ec1ab8a91333c787d7a795ca45264bae103ddfeface7072c47a07a0b1f66f6f7926f07dd201b6aa
    // dbname:demodb
    // delbackup:y
    task.setDbName(newdbname);
    task.setDelbackup(YesNoType.Y);
    //task.execute();
    System.out.println(task.getErrorMsg());
    assertEquals(null, task.getErrorMsg());
}
Also used : CommonUpdateTask(com.cubrid.cubridmanager.core.common.task.CommonUpdateTask)

Example 9 with CommonUpdateTask

use of com.cubrid.cubridmanager.core.common.task.CommonUpdateTask in project cubrid-manager by CUBRID.

the class DeleteDbTaskTest method testDeleteExistDb.

public void testDeleteExistDb() {
    if (StringUtil.isEqual(SystemParameter.getParameterValue("useMockTest"), "n"))
        return;
    System.out.println("<database.deletedb.003.req.txt>");
    CommonUpdateTask task = new CommonUpdateTask(CommonTaskName.DELETE_DATABASE_TASK_NAME, serverInfo, CommonSendMsg.getDeletedbSendMsg());
    task.setDbName("existdb");
    task.setDelbackup(YesNoType.Y);
    task.execute();
    assertTrue(task.isSuccess());
    assertNull(task.getErrorMsg());
}
Also used : CommonUpdateTask(com.cubrid.cubridmanager.core.common.task.CommonUpdateTask)

Example 10 with CommonUpdateTask

use of com.cubrid.cubridmanager.core.common.task.CommonUpdateTask in project cubrid-manager by CUBRID.

the class OptimizeTaskTest method testSpecificTable.

public void testSpecificTable() {
    if (StringUtil.isEqual(SystemParameter.getParameterValue("useMockTest"), "n"))
        return;
    System.out.println("<database.optimizedb.001.req.txt>");
    CommonUpdateTask task = new CommonUpdateTask(CommonTaskName.OPTIMIZE_DATABASE_TASK_NAME, serverInfo, CommonSendMsg.getOptimizeDbSendMsg());
    task.setDbName("demodb");
    task.setClassName("code");
    task.execute();
    assertTrue(task.isSuccess());
    assertNull(task.getErrorMsg());
}
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