Search in sources :

Example 36 with TreeNode

use of com.cubrid.cubridmanager.core.common.socket.TreeNode in project cubrid-manager by CUBRID.

the class ErrorTraceTaskTest method testReceive.

public void testReceive() throws Exception {
    if (StringUtil.isEqual(SystemParameter.getParameterValue("useMockTest"), "y"))
        return;
    String filepath = this.getFilePathInPlugin("/com/cubrid/cubridmanager/core/logs/task/test.message/ErrorTrace_receive");
    String msg = Tool.getFileContent(filepath);
    TreeNode node = MessageUtil.parseResponse(msg);
    ErrorTraceTask task = new ErrorTraceTask(serverInfo);
    task.setResponse(node);
    //compare 
    assertTrue(task.getErrorLogs().size() > 0);
    task.setErrorMsg("error");
    assertNull(task.getErrorLogs());
}
Also used : TreeNode(com.cubrid.cubridmanager.core.common.socket.TreeNode)

Example 37 with TreeNode

use of com.cubrid.cubridmanager.core.common.socket.TreeNode in project cubrid-manager by CUBRID.

the class GetExecuteCasRunnerContentResultTaskTest method testReceive.

public void testReceive() throws Exception {
    if (StringUtil.isEqual(SystemParameter.getParameterValue("useMockTest"), "y"))
        return;
    String filepath = this.getFilePathInPlugin("/com/cubrid/cubridmanager/core/logs/task/test.message/GetExecuteCasRunnerContentResult_receive");
    String msg = Tool.getFileContent(filepath);
    TreeNode node = MessageUtil.parseResponse(msg);
    GetExecuteCasRunnerContentResultTask task = new GetExecuteCasRunnerContentResultTask(serverInfo);
    task.setResponse(node);
    task.getContent();
    //case 2
    msg = msg.replaceFirst("result_list:start", "result_list:start1");
    node = MessageUtil.parseResponse(msg);
    task.setResponse(node);
    task.getContent();
    //case 3
    msg = msg.replaceFirst("result_list:start1", "");
    msg = msg.replaceFirst("result_list:end", "");
    node = MessageUtil.parseResponse(msg);
    task.setResponse(node);
    task.getContent();
    //exception case1
    task.setResponse(null);
    task.getContent();
    //exception case2
    task.setResponse(node);
    task.setErrorMsg("has error");
    task.getContent();
    //compare 
    assertEquals("success", node.getValue("status"));
}
Also used : TreeNode(com.cubrid.cubridmanager.core.common.socket.TreeNode)

Example 38 with TreeNode

use of com.cubrid.cubridmanager.core.common.socket.TreeNode in project cubrid-manager by CUBRID.

the class GetManagerLogListTaskTest method testReceive.

public void testReceive() throws Exception {
    if (StringUtil.isEqual(SystemParameter.getParameterValue("useMockTest"), "y"))
        return;
    String filepath = this.getFilePathInPlugin("/com/cubrid/cubridmanager/core/logs/task/test.message/GetManagerLogList_receive");
    String msg = Tool.getFileContent(filepath);
    TreeNode node = MessageUtil.parseResponse(msg);
    GetManagerLogListTask task = new GetManagerLogListTask(serverInfo);
    task.setResponse(node);
    task.getLogContent();
    //case 2
    msg = msg.replaceFirst("open:accesslog", "open:accesslog1");
    msg = msg.replaceFirst("open:errorlog", "open:errorlog1");
    node = MessageUtil.parseResponse(msg);
    task.setResponse(node);
    task.getLogContent();
    //case 3
    msg = msg.replaceFirst("open:accesslog1", "");
    msg = msg.replaceFirst("open:errorlog1", "");
    msg = msg.replaceFirst("close:accesslog", "");
    msg = msg.replaceFirst("close:errorlog", "");
    node = MessageUtil.parseResponse(msg);
    task.setResponse(node);
    task.getLogContent();
    //case 4
    filepath = this.getFilePathInPlugin("/com/cubrid/cubridmanager/core/logs/task/test.message/GetManagerLogList_receive2");
    msg = Tool.getFileContent(filepath);
    node = MessageUtil.parseResponse(msg);
    GetManagerLogListTask task2 = new GetManagerLogListTask(serverInfo);
    task2.setResponse(node);
    task2.getLogContent();
    //exception case1
    task.setResponse(null);
    task.getLogContent();
    //exception case2
    task.setResponse(node);
    task.setErrorMsg("has error");
    task.getLogContent();
    //		//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());
    //		//test exception case 1
    //		task.setResponse(null);
    //		assertFalse(task.isActive());
    //		//test exception case 2
    //		task.setResponse(node);
    //		task.setErrorMsg("has error");
    //		assertFalse(task.isActive());
    //compare 
    assertEquals("success", node.getValue("status"));
}
Also used : TreeNode(com.cubrid.cubridmanager.core.common.socket.TreeNode)

Example 39 with TreeNode

use of com.cubrid.cubridmanager.core.common.socket.TreeNode in project cubrid-manager by CUBRID.

the class CheckDistributorDbTaskTest 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/CheckDistributorDb_receive");
    //case 1
    String msg = Tool.getFileContent(filepath);
    TreeNode node = MessageUtil.parseResponse(msg);
    CheckDistributorDbTask task = new CheckDistributorDbTask(serverInfo);
    task.setResponse(node);
    assertTrue(task.isDistributorDb());
    //case 2
    msg = msg.replaceFirst("is_distdb:Y", "is_distdb:N");
    node = MessageUtil.parseResponse(msg);
    task.setResponse(node);
    assertFalse(task.isDistributorDb());
    msg = msg.replaceFirst("is_distdb:N", "");
    node = MessageUtil.parseResponse(msg);
    task.setResponse(node);
    assertFalse(task.isDistributorDb());
    //exception case1
    task.setResponse(null);
    assertFalse(task.isDistributorDb());
    //exception case2
    task.setResponse(node);
    task.setErrorMsg("has error");
    assertFalse(task.isDistributorDb());
}
Also used : TreeNode(com.cubrid.cubridmanager.core.common.socket.TreeNode)

Example 40 with TreeNode

use of com.cubrid.cubridmanager.core.common.socket.TreeNode in project cubrid-manager by CUBRID.

the class CreateDistributorTaskTest 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/CreateDistributor_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