Search in sources :

Example 91 with TreeNode

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

Example 92 with TreeNode

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

Example 93 with TreeNode

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

Example 94 with TreeNode

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

Example 95 with TreeNode

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());
}
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