use of com.cubrid.cubridmanager.core.common.socket.TreeNode in project cubrid-manager by CUBRID.
the class GetReplAgentStatusTaskTest method testReceive.
public void testReceive() throws Exception {
if (StringUtil.isEqual(SystemParameter.getParameterValue("useMockTest"), "y"))
return;
//test correct case
String filepath = this.getFilePathInPlugin("/com/cubrid/cubridmanager/core/replication/task/test.message/GetReplAgentStatus_receive");
String msg = Tool.getFileContent(filepath);
GetReplAgentStatusTask task = new GetReplAgentStatusTask(serverInfo);
//test isActive is true
TreeNode node = MessageUtil.parseResponse(msg);
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());
}
use of com.cubrid.cubridmanager.core.common.socket.TreeNode in project cubrid-manager by CUBRID.
the class GetReplParmetersTaskTest 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/GetReplicationParam_receive");
String msg = Tool.getFileContent(filepath);
TreeNode node = MessageUtil.parseResponse(msg);
GetReplicationParamTask task = new GetReplicationParamTask(serverInfo);
task.setResponse(node);
ReplicationParamInfo paramInfo = task.getReplicationParams();
assertEquals(paramInfo.getParamValue(ReplicationParamConstants.PERF_POLL_INTERVAL), "30");
assertEquals(paramInfo.getParamValue(ReplicationParamConstants.FOR_RECOVERY), "Y");
//exception case1
task.setResponse(null);
assertTrue(task.getReplicationParams() == null);
//exception case2
task.setResponse(node);
task.setErrorMsg("has error");
assertTrue(task.getReplicationParams() == null);
}
use of com.cubrid.cubridmanager.core.common.socket.TreeNode in project cubrid-manager by CUBRID.
the class ChangeMasterDbTaskTest 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/ChangeMasterDb_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 ChangeReplTablesTaskTest 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/ChangeReplTables_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 GetDatabasesParameterTask method getConfParameters.
/**
* Get databases.txt config parameters
*
* @return
*/
public List<Map<String, String>> getConfParameters() {
TreeNode response = getResponse();
if (response == null || (this.getErrorMsg() != null && getErrorMsg().trim().length() > 0)) {
return null;
}
List<Map<String, String>> confMapList = new ArrayList<Map<String, String>>();
for (int i = 0; i < response.childrenSize(); i++) {
TreeNode node = response.getChildren().get(i);
if (node != null && node.getValue("open").equals("conflist")) {
buildConf(confMapList, node);
}
}
return confMapList;
}
Aggregations