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());
}
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());
}
}
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());
}
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());
}
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());
}
Aggregations