use of com.cubrid.cubridmanager.core.common.socket.TreeNode in project cubrid-manager by CUBRID.
the class GetExecuteCasRunnerContentResultTask method getContent.
/**
* get result from the response.
*
* @return GetExecuteCasRunnerResultInfo
*/
public GetExecuteCasRunnerResultInfo getContent() {
TreeNode response = getResponse();
if (response == null || (this.getErrorMsg() != null && getErrorMsg().trim().length() > 0)) {
return null;
}
GetExecuteCasRunnerResultInfo getExecuteCasRunnerResultInfo = new GetExecuteCasRunnerResultInfo();
String queryResultFile = response.getValue("query_result_file");
String queryResultFileNum = response.getValue("query_result_file_num");
getExecuteCasRunnerResultInfo.setQueryResultFile(queryResultFile);
getExecuteCasRunnerResultInfo.setQueryResultFileNum(queryResultFileNum);
if (response != null && response.getValue("result_list") != null && response.getValue("result_list").equals("start")) {
String[] results = response.getValues("result");
for (int j = 0; j < results.length; j++) {
String str = results[j];
if (str != null && str.trim().length() > 0) {
getExecuteCasRunnerResultInfo.addResult(str);
}
}
}
return getExecuteCasRunnerResultInfo;
}
use of com.cubrid.cubridmanager.core.common.socket.TreeNode in project cubrid-manager by CUBRID.
the class CheckDistributorDbTask method isDistributorDb.
/**
*
* Get whether this db is distributor db
*
* @return <code>true</code>if it is distributor database;<code>false</code>
* otherwise
*/
public boolean isDistributorDb() {
TreeNode response = getResponse();
if (response == null || (this.getErrorMsg() != null && getErrorMsg().trim().length() > 0)) {
return false;
}
String str = response.getValue("is_distdb");
if (str != null && str.equalsIgnoreCase("Y")) {
return true;
}
return false;
}
use of com.cubrid.cubridmanager.core.common.socket.TreeNode in project cubrid-manager by CUBRID.
the class CreateSlaveDbTaskTest 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/CreateSlaveDb_receive");
String msg = Tool.getFileContent(filepath);
TreeNode node = MessageUtil.parseResponse(msg);
//compare
assertEquals("success", node.getValue("status"));
}
use of com.cubrid.cubridmanager.core.common.socket.TreeNode in project cubrid-manager by CUBRID.
the class GetReplPerformanceTaskTest 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/replication/task/test.message/GetReplPerformance_receive");
String msg = Tool.getFileContent(filepath);
TreeNode node = MessageUtil.parseResponse(msg);
GetReplPerformanceTask task = new GetReplPerformanceTask(serverInfo);
task.setResponse(node);
List<Map<String, String>> list = task.loadPerformanceData();
assertTrue(list.size() == 1);
//case 2
msg = msg.replaceAll("line:.*\n", "");
node = MessageUtil.parseResponse(msg);
task.setResponse(node);
list = task.loadPerformanceData();
assertTrue(list.size() == 0);
//case 3
msg = msg.replaceAll("open:log", "open:aa");
node = MessageUtil.parseResponse(msg);
task.setResponse(node);
task.loadPerformanceData();
msg = msg.replaceAll("open:aa", "");
msg = msg.replaceAll("close:log", "");
node = MessageUtil.parseResponse(msg);
task.setResponse(node);
task.loadPerformanceData();
//test exception case 1
task.setResponse(null);
assertTrue(task.loadPerformanceData() == null);
//test exception case 2
task.setResponse(node);
task.setErrorMsg("has error");
assertTrue(task.loadPerformanceData() == null);
}
use of com.cubrid.cubridmanager.core.common.socket.TreeNode in project cubrid-manager by CUBRID.
the class GetReplServerStatusTaskTest 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/GetReplServerStatus_receive");
String msg = Tool.getFileContent(filepath);
TreeNode node = MessageUtil.parseResponse(msg);
GetReplServerStatusTask task = new GetReplServerStatusTask(serverInfo);
//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());
msg = msg.replaceFirst("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());
}
Aggregations