use of com.cubrid.cubridmanager.core.common.socket.TreeNode in project cubrid-manager by CUBRID.
the class GetBackupVolInfoTaskTest method testReceive.
public void testReceive() throws Exception {
if (StringUtil.isEqual(SystemParameter.getParameterValue("useMockTest"), "y"))
return;
//case 1
String filepath = this.getFilePathInPlugin("/com/cubrid/cubridmanager/core/cubrid/database/task/test.message/getbackupvolinfo_receive");
String msg = Tool.getFileContent(filepath);
TreeNode node = MessageUtil.parseResponse(msg);
GetBackupVolInfoTask task = new GetBackupVolInfoTask(serverInfo);
task.setResponse(node);
assertTrue(task.getDbBackupVolInfo().length() > 0);
//exception case1
task.setResponse(null);
assertTrue(task.getDbBackupVolInfo() == null);
//exception case2
task.setResponse(node);
task.setErrorMsg("has error");
assertTrue(task.getDbBackupVolInfo() == null);
}
use of com.cubrid.cubridmanager.core.common.socket.TreeNode in project cubrid-manager by CUBRID.
the class GetDbUnloadInfoTaskTest method testReceive.
public void testReceive() throws Exception {
if (StringUtil.isEqual(SystemParameter.getParameterValue("useMockTest"), "y"))
return;
//case 1
String filepath = this.getFilePathInPlugin("/com/cubrid/cubridmanager/core/cubrid/database/task/test.message/getunloaddbinfo_receive");
String msg = Tool.getFileContent(filepath);
TreeNode node = MessageUtil.parseResponse(msg);
GetDbUnloadInfoTask task = new GetDbUnloadInfoTask(serverInfo);
task.setResponse(node);
List<DbUnloadInfo> list = task.getDbUnloadInfoList();
assertTrue(list.size() == 1);
assertEquals(list.get(0).getDbName(), "demodb");
assertTrue(list.get(0).getIndexDateList().size() == 2);
assertTrue(list.get(0).getIndexPathList().size() == 2);
assertTrue(list.get(0).getSchemaDateList().size() == 2);
assertTrue(list.get(0).getSchemaPathList().size() == 2);
assertTrue(list.get(0).getObjectDateList().size() == 2);
assertTrue(list.get(0).getObjectPathList().size() == 2);
assertTrue(list.get(0).getTriggerDateList().size() == 2);
assertTrue(list.get(0).getTriggerPathList().size() == 2);
//exception case
//exception case1
task.setResponse(null);
assertTrue(task.getDbUnloadInfoList() == null);
//exception case2
task.setResponse(node);
task.setErrorMsg("has error");
assertTrue(task.getDbUnloadInfoList() == null);
filepath = this.getFilePathInPlugin("/com/cubrid/cubridmanager/core/cubrid/database/task/test.message/getunloaddbinfo_receive2");
msg = Tool.getFileContent(filepath);
node = MessageUtil.parseResponse(msg);
GetDbUnloadInfoTask task2 = new GetDbUnloadInfoTask(serverInfo);
task2.setResponse(node);
task2.getDbUnloadInfoList();
filepath = this.getFilePathInPlugin("/com/cubrid/cubridmanager/core/cubrid/database/task/test.message/getunloaddbinfo_receive2");
msg = Tool.getFileContent(filepath);
node = MessageUtil.parseResponse(msg);
GetDbUnloadInfoTask task3 = new GetDbUnloadInfoTask(serverInfo);
task3.setResponse(node);
task3.getDbUnloadInfoList();
}
use of com.cubrid.cubridmanager.core.common.socket.TreeNode in project cubrid-manager by CUBRID.
the class LoadDbTaskTest method testReceive.
public void testReceive() throws Exception {
if (StringUtil.isEqual(SystemParameter.getParameterValue("useMockTest"), "y"))
return;
//case 1
String filepath = this.getFilePathInPlugin("/com/cubrid/cubridmanager/core/cubrid/database/task/test.message/loaddb_receive");
String msg = Tool.getFileContent(filepath);
TreeNode node = MessageUtil.parseResponse(msg);
LoadDbTask task = new LoadDbTask(serverInfo);
task.setResponse(node);
assertTrue(task.getLoadResult().length > 0);
//exception case1
task.setResponse(null);
assertTrue(task.getLoadResult() == null);
//exception case2
task.setResponse(node);
task.setErrorMsg("has error");
assertTrue(task.getLoadResult() == null);
}
use of com.cubrid.cubridmanager.core.common.socket.TreeNode in project cubrid-manager by CUBRID.
the class UnloadDatabaseTaskTest method testReceive.
public void testReceive() throws Exception {
if (StringUtil.isEqual(SystemParameter.getParameterValue("useMockTest"), "y"))
return;
//case 1
String filepath = this.getFilePathInPlugin("/com/cubrid/cubridmanager/core/cubrid/database/task/test.message/unloaddb_receive");
String msg = Tool.getFileContent(filepath);
TreeNode node = MessageUtil.parseResponse(msg);
UnloadDatabaseTask task = new UnloadDatabaseTask(serverInfo);
task.setResponse(node);
List<String> list = task.getUnloadDbResult();
assertTrue(list.size() == 3);
//exception case1
task.setResponse(null);
assertTrue(task.getUnloadDbResult() == null);
//exception case2
task.setResponse(node);
task.setErrorMsg("has error");
assertTrue(task.getUnloadDbResult() == null);
task.setUnloadType("both");
task.setUnloadType("schema");
task.setUnloadType("object");
task.setUnloadType("aaa");
task.setErrorMsg("err");
task.getUnloadDbResult();
}
use of com.cubrid.cubridmanager.core.common.socket.TreeNode in project cubrid-manager by CUBRID.
the class GetBackupPlanListTaskTest method testRealEnv.
public void testRealEnv() {
if (StringUtil.isEqual(SystemParameter.getParameterValue("useMockTest"), "y"))
return;
boolean isSucce = this.addBackupPlan("eee");
isSucce = isSucce && this.addBackupPlan("fff");
if (isSucce) {
GetBackupPlanListTask task = new GetBackupPlanListTask(serverInfo);
task.setDbName(testDbName);
task.execute();
assertTrue(task.getBackupPlanInfoList().size() >= 2);
this.deleteBackupPlan("eee");
this.deleteBackupPlan("fff");
task.setResponse(new TreeNode());
task.getBackupPlanInfoList();
task.setErrorMsg("err");
task.getBackupPlanInfoList();
}
}
Aggregations