use of com.cubrid.cubridmanager.core.common.socket.TreeNode in project cubrid-manager by CUBRID.
the class GetBrokerConfParameterTask method getConfContents.
/**
* Get cubrid_broker.conf parameters
*
* @return List<String> The map that stored configure parameters
*/
public List<String> getConfContents() {
String[] confData = null;
List<String> confContents = new ArrayList<String>();
TreeNode response = getResponse();
if (response == null || hasNotErrorMsg()) {
return null;
}
for (int i = 0; i < response.childrenSize(); i++) {
TreeNode node = response.getChildren().get(i);
if (node != null && node.getValue("open").equals("conflist")) {
confData = node.getValues("confdata");
}
}
if (confData != null) {
for (String line : confData) {
confContents.add(line);
}
}
return confContents;
}
use of com.cubrid.cubridmanager.core.common.socket.TreeNode in project cubrid-manager by CUBRID.
the class GetBrokerStatusInfosTask method getResultModel.
/**
* Show the result of the database space information
*
* @return T
*/
public T getResultModel() {
TreeNode node = (TreeNode) getResponse();
setFieldValue(node, result);
return result;
}
use of com.cubrid.cubridmanager.core.common.socket.TreeNode in project cubrid-manager by CUBRID.
the class GetTransferProgressTaskTest 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/GetTransferProgress_receive");
String msg = Tool.getFileContent(filepath);
//case 1
TreeNode node = MessageUtil.parseResponse(msg);
GetTransferProgressTask task = new GetTransferProgressTask(serverInfo);
task.setResponse(node);
TransFileProgressInfo progressInfo = task.getProgressInfo();
assertEquals(progressInfo.getTransferStatus(), "success");
assertEquals(progressInfo.getTransferNote(), "none");
assertEquals(progressInfo.getSourceDir(), "/tmp");
assertEquals(progressInfo.getDestHost(), "192.168.1.220");
assertEquals(progressInfo.getDestDir(), "/home/biaozhang/new_build_cubrid32/databases/target_dir");
assertEquals(progressInfo.getFileNum(), "2");
Map<String, String> map = progressInfo.getFileProgressMap();
assertEquals(map.get("biaodb_src_bk0v000"), "100%");
assertEquals(map.get("biaodb_src_bkvinf"), "100%");
//case 2
String msg1 = msg.replaceFirst("transfer_status:success", "transfer_status:failure");
msg1 = msg1.replaceFirst("transfer_note:none", "transfer_note:sorry");
node = MessageUtil.parseResponse(msg1);
task.setResponse(node);
progressInfo = task.getProgressInfo();
assertEquals(progressInfo.getTransferStatus(), "failure");
assertEquals(progressInfo.getTransferNote(), "sorry");
//case 3
String msg2 = msg.replaceFirst("transfer_status:success", "transfer_status:transfering");
node = MessageUtil.parseResponse(msg2);
task.setResponse(node);
progressInfo = task.getProgressInfo();
assertEquals(progressInfo.getTransferStatus(), "transfering");
//case 4
msg = msg.replaceFirst("open:progress_file_list", "open:aa");
node = MessageUtil.parseResponse(msg);
task.setResponse(node);
task.getProgressInfo();
msg = msg.replaceFirst("open:aa", "");
msg = msg.replaceFirst("close:progress_file_list", "");
node = MessageUtil.parseResponse(msg);
task.setResponse(node);
task.getProgressInfo();
//exception case1
task.setResponse(null);
assertTrue(task.getProgressInfo() == null);
//exception case2
task.setResponse(node);
task.setErrorMsg("has error");
assertTrue(task.getProgressInfo() == null);
}
use of com.cubrid.cubridmanager.core.common.socket.TreeNode in project cubrid-manager by CUBRID.
the class SetReplicationParamTaskTest 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/SetReplicationParam_receive");
String msg = Tool.getFileContent(filepath);
TreeNode node = MessageUtil.parseResponse(msg);
SetReplicationParamTask task = new SetReplicationParamTask(serverInfo);
task.setResponse(node);
// compare
assertTrue(task.isSuccess());
//test exception case 1
task.setResponse(null);
assertFalse(task.isSuccess());
}
use of com.cubrid.cubridmanager.core.common.socket.TreeNode in project cubrid-manager by CUBRID.
the class StartReplicationAgentTaskTest method testStartReplAgentReceive.
public void testStartReplAgentReceive() throws Exception {
if (StringUtil.isEqual(SystemParameter.getParameterValue("useMockTest"), "y"))
return;
String filepath = this.getFilePathInPlugin("/com/cubrid/cubridmanager/core/replication/task/test.message/StartReplAgent_receive");
String msg = Tool.getFileContent(filepath);
TreeNode node = MessageUtil.parseResponse(msg);
//compare
assertEquals("success", node.getValue("status"));
}
Aggregations