Search in sources :

Example 41 with TreeNode

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

Example 42 with TreeNode

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

Example 43 with TreeNode

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

Example 44 with TreeNode

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

Example 45 with TreeNode

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

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