use of com.cubrid.cubridmanager.core.common.socket.TreeNode in project cubrid-manager by CUBRID.
the class ErrorTraceTaskTest method testReceive.
public void testReceive() throws Exception {
if (StringUtil.isEqual(SystemParameter.getParameterValue("useMockTest"), "y"))
return;
String filepath = this.getFilePathInPlugin("/com/cubrid/cubridmanager/core/logs/task/test.message/ErrorTrace_receive");
String msg = Tool.getFileContent(filepath);
TreeNode node = MessageUtil.parseResponse(msg);
ErrorTraceTask task = new ErrorTraceTask(serverInfo);
task.setResponse(node);
//compare
assertTrue(task.getErrorLogs().size() > 0);
task.setErrorMsg("error");
assertNull(task.getErrorLogs());
}
use of com.cubrid.cubridmanager.core.common.socket.TreeNode in project cubrid-manager by CUBRID.
the class GetExecuteCasRunnerContentResultTaskTest method testReceive.
public void testReceive() throws Exception {
if (StringUtil.isEqual(SystemParameter.getParameterValue("useMockTest"), "y"))
return;
String filepath = this.getFilePathInPlugin("/com/cubrid/cubridmanager/core/logs/task/test.message/GetExecuteCasRunnerContentResult_receive");
String msg = Tool.getFileContent(filepath);
TreeNode node = MessageUtil.parseResponse(msg);
GetExecuteCasRunnerContentResultTask task = new GetExecuteCasRunnerContentResultTask(serverInfo);
task.setResponse(node);
task.getContent();
//case 2
msg = msg.replaceFirst("result_list:start", "result_list:start1");
node = MessageUtil.parseResponse(msg);
task.setResponse(node);
task.getContent();
//case 3
msg = msg.replaceFirst("result_list:start1", "");
msg = msg.replaceFirst("result_list:end", "");
node = MessageUtil.parseResponse(msg);
task.setResponse(node);
task.getContent();
//exception case1
task.setResponse(null);
task.getContent();
//exception case2
task.setResponse(node);
task.setErrorMsg("has error");
task.getContent();
//compare
assertEquals("success", node.getValue("status"));
}
use of com.cubrid.cubridmanager.core.common.socket.TreeNode in project cubrid-manager by CUBRID.
the class GetManagerLogListTaskTest method testReceive.
public void testReceive() throws Exception {
if (StringUtil.isEqual(SystemParameter.getParameterValue("useMockTest"), "y"))
return;
String filepath = this.getFilePathInPlugin("/com/cubrid/cubridmanager/core/logs/task/test.message/GetManagerLogList_receive");
String msg = Tool.getFileContent(filepath);
TreeNode node = MessageUtil.parseResponse(msg);
GetManagerLogListTask task = new GetManagerLogListTask(serverInfo);
task.setResponse(node);
task.getLogContent();
//case 2
msg = msg.replaceFirst("open:accesslog", "open:accesslog1");
msg = msg.replaceFirst("open:errorlog", "open:errorlog1");
node = MessageUtil.parseResponse(msg);
task.setResponse(node);
task.getLogContent();
//case 3
msg = msg.replaceFirst("open:accesslog1", "");
msg = msg.replaceFirst("open:errorlog1", "");
msg = msg.replaceFirst("close:accesslog", "");
msg = msg.replaceFirst("close:errorlog", "");
node = MessageUtil.parseResponse(msg);
task.setResponse(node);
task.getLogContent();
//case 4
filepath = this.getFilePathInPlugin("/com/cubrid/cubridmanager/core/logs/task/test.message/GetManagerLogList_receive2");
msg = Tool.getFileContent(filepath);
node = MessageUtil.parseResponse(msg);
GetManagerLogListTask task2 = new GetManagerLogListTask(serverInfo);
task2.setResponse(node);
task2.getLogContent();
//exception case1
task.setResponse(null);
task.getLogContent();
//exception case2
task.setResponse(node);
task.setErrorMsg("has error");
task.getLogContent();
// //test isActive is true
// task.setResponse(node);
// assertTrue(task.isActive());
// //test isActive is false
// msg = msg.replaceFirst("is_active:Y", "is_active:N");
// node = MessageUtil.parseResponse(msg);
// task.setResponse(node);
// assertFalse(task.isActive());
// //test exception case 1
// task.setResponse(null);
// assertFalse(task.isActive());
// //test exception case 2
// task.setResponse(node);
// task.setErrorMsg("has error");
// assertFalse(task.isActive());
//compare
assertEquals("success", node.getValue("status"));
}
use of com.cubrid.cubridmanager.core.common.socket.TreeNode in project cubrid-manager by CUBRID.
the class CheckDistributorDbTaskTest method testReceive.
public void testReceive() throws Exception {
if (StringUtil.isEqual(SystemParameter.getParameterValue("useMockTest"), "y"))
return;
String filepath = this.getFilePathInPlugin("/com/cubrid/cubridmanager/core/replication/task/test.message/CheckDistributorDb_receive");
//case 1
String msg = Tool.getFileContent(filepath);
TreeNode node = MessageUtil.parseResponse(msg);
CheckDistributorDbTask task = new CheckDistributorDbTask(serverInfo);
task.setResponse(node);
assertTrue(task.isDistributorDb());
//case 2
msg = msg.replaceFirst("is_distdb:Y", "is_distdb:N");
node = MessageUtil.parseResponse(msg);
task.setResponse(node);
assertFalse(task.isDistributorDb());
msg = msg.replaceFirst("is_distdb:N", "");
node = MessageUtil.parseResponse(msg);
task.setResponse(node);
assertFalse(task.isDistributorDb());
//exception case1
task.setResponse(null);
assertFalse(task.isDistributorDb());
//exception case2
task.setResponse(node);
task.setErrorMsg("has error");
assertFalse(task.isDistributorDb());
}
use of com.cubrid.cubridmanager.core.common.socket.TreeNode in project cubrid-manager by CUBRID.
the class CreateDistributorTaskTest method testReceive.
public void testReceive() throws Exception {
if (StringUtil.isEqual(SystemParameter.getParameterValue("useMockTest"), "y"))
return;
String filepath = this.getFilePathInPlugin("/com/cubrid/cubridmanager/core/replication/task/test.message/CreateDistributor_receive");
String msg = Tool.getFileContent(filepath);
TreeNode node = MessageUtil.parseResponse(msg);
//compare
assertEquals("success", node.getValue("status"));
}
Aggregations