Search in sources :

Example 61 with TreeNode

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;
}
Also used : TreeNode(com.cubrid.cubridmanager.core.common.socket.TreeNode) ArrayList(java.util.ArrayList)

Example 62 with TreeNode

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;
}
Also used : TreeNode(com.cubrid.cubridmanager.core.common.socket.TreeNode)

Example 63 with TreeNode

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);
}
Also used : TransFileProgressInfo(com.cubrid.cubridmanager.core.replication.model.TransFileProgressInfo) TreeNode(com.cubrid.cubridmanager.core.common.socket.TreeNode)

Example 64 with TreeNode

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());
}
Also used : TreeNode(com.cubrid.cubridmanager.core.common.socket.TreeNode)

Example 65 with TreeNode

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"));
}
Also used : TreeNode(com.cubrid.cubridmanager.core.common.socket.TreeNode)

Aggregations

TreeNode (com.cubrid.cubridmanager.core.common.socket.TreeNode)142 ArrayList (java.util.ArrayList)20 HashMap (java.util.HashMap)7 Map (java.util.Map)6 Trigger (com.cubrid.common.core.common.model.Trigger)2 ServerInfo (com.cubrid.cubridmanager.core.common.model.ServerInfo)2 ServerUserInfo (com.cubrid.cubridmanager.core.common.model.ServerUserInfo)2 DbBackupInfo (com.cubrid.cubridmanager.core.cubrid.database.model.DbBackupInfo)2 DbUnloadInfo (com.cubrid.cubridmanager.core.cubrid.database.model.DbUnloadInfo)2 DbUserInfo (com.cubrid.cubridmanager.core.cubrid.user.model.DbUserInfo)2 GetExecuteCasRunnerResultInfo (com.cubrid.cubridmanager.core.logs.model.GetExecuteCasRunnerResultInfo)2 ManagerLogInfoList (com.cubrid.cubridmanager.core.logs.model.ManagerLogInfoList)2 ManagerLogInfos (com.cubrid.cubridmanager.core.logs.model.ManagerLogInfos)2 DbProcessStatusInfo (com.cubrid.cubridmanager.core.mondashboard.model.DbProcessStatusInfo)2 HADatabaseStatusInfo (com.cubrid.cubridmanager.core.mondashboard.model.HADatabaseStatusInfo)2 HAHostStatusInfo (com.cubrid.cubridmanager.core.mondashboard.model.HAHostStatusInfo)2 ReplicationInfo (com.cubrid.cubridmanager.core.replication.model.ReplicationInfo)2 ReplicationParamInfo (com.cubrid.cubridmanager.core.replication.model.ReplicationParamInfo)2 TransFileProgressInfo (com.cubrid.cubridmanager.core.replication.model.TransFileProgressInfo)2 CasAuthType (com.cubrid.cubridmanager.core.common.model.CasAuthType)1