Search in sources :

Example 96 with TreeNode

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

the class GetReplicatedTablesTaskTest 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/GetReplicatedTables_receive");
    String msg = Tool.getFileContent(filepath);
    TreeNode node = MessageUtil.parseResponse(msg);
    GetReplicatedTablesTask task = new GetReplicatedTablesTask(serverInfo);
    task.setResponse(node);
    String[] tables = task.getReplicatedTables();
    assertTrue(tables.length == 2);
    boolean isReplAll = task.isReplicateAll();
    assertFalse(isReplAll);
    //case 2
    msg = msg.replaceFirst("all_repl:Y", "all_repl:N");
    node = MessageUtil.parseResponse(msg);
    task.setResponse(node);
    task.isReplicateAll();
    msg = msg.replaceFirst("all_repl:N", "");
    node = MessageUtil.parseResponse(msg);
    task.setResponse(node);
    task.isReplicateAll();
    //case 3
    msg = msg.replaceFirst("open:repl_group_tablelist", "open:aa");
    node = MessageUtil.parseResponse(msg);
    task.setResponse(node);
    task.getReplicatedTables();
    msg = msg.replaceFirst("open:aa", "");
    msg = msg.replaceFirst("close:repl_group_tablelist", "");
    node = MessageUtil.parseResponse(msg);
    task.setResponse(node);
    task.getReplicatedTables();
    //exception case1
    task.setResponse(null);
    tables = task.getReplicatedTables();
    assertTrue(tables == null);
    isReplAll = task.isReplicateAll();
    assertFalse(isReplAll);
    //exception case2
    task.setResponse(node);
    task.setErrorMsg("hasError");
    tables = task.getReplicatedTables();
    assertTrue(tables == null);
    isReplAll = task.isReplicateAll();
    assertFalse(isReplAll);
}
Also used : TreeNode(com.cubrid.cubridmanager.core.common.socket.TreeNode)

Example 97 with TreeNode

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

the class TestTask method main.

/**
	 * TODO: how to write comments What and why the member function does what it
	 * does What a member function must be passed as parameters What a member
	 * function re turns Known bugs Any exceptions that a member function throws
	 * Visibility decisions How a member function changes the object Include a
	 * history of any code changes Examples of how to invoke th e member
	 * function if appropriate Applicable preconditions and postconditions
	 * Document all concurrency
	 * 
	 * @param args
	 */
public static void main(String[] args) {
    ClientSocket hostsocket = new ClientSocket("localhost", 8001, "admin");
    String message = "id:admin\npassword:1111\n" + "clientver:8.1.4\n\n";
    // send login message
    hostsocket.sendRequest(message);
    // get the latest token
    TreeNode node = hostsocket.getResponse();
    String token = node.getValue("token");
    System.out.println(token);
}
Also used : ClientSocket(com.cubrid.cubridmanager.core.common.socket.ClientSocket) TreeNode(com.cubrid.cubridmanager.core.common.socket.TreeNode)

Example 98 with TreeNode

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

the class AddTriggerTaskTest method testReceive.

public void testReceive() throws Exception {
    String filepath = this.getFilePathInPlugin("/com/cubrid/cubridmanager/core/cubrid/trigger/task/test.message/addtrigger_receive");
    String msg = Tool.getFileContent(filepath);
    TreeNode node = MessageUtil.parseResponse(msg);
    task.setResponse(node);
    boolean success = task.isSuccess();
    assertTrue(success);
    filepath = this.getFilePathInPlugin("/com/cubrid/cubridmanager/core/cubrid/trigger/task/test.message/addtrigger_receive_error");
    msg = Tool.getFileContent(filepath);
    node = MessageUtil.parseResponse(msg);
    task.setResponse(node);
    boolean failure = task.isSuccess();
    assertFalse(failure);
    //assertEquals(" invalid use of keyword 'test', expecting { name }.",
    //		task.getErrorMsg());
    task.setCondition("");
    task.setAction(Trigger.TriggerAction.OTHER_STATEMENT, "test");
}
Also used : TreeNode(com.cubrid.cubridmanager.core.common.socket.TreeNode)

Example 99 with TreeNode

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

the class AlterTriggerTaskTest method testReceive.

public void testReceive() throws Exception {
    String filepath = this.getFilePathInPlugin("/com/cubrid/cubridmanager/core/cubrid/trigger/task/test.message/altertrigger_receive");
    String msg = Tool.getFileContent(filepath);
    TreeNode node = MessageUtil.parseResponse(msg);
    task.setResponse(node);
    boolean success = task.isSuccess();
    assertTrue(success);
}
Also used : TreeNode(com.cubrid.cubridmanager.core.common.socket.TreeNode)

Example 100 with TreeNode

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

the class GetAnalyzeCasLogTaskTest 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/GetAnalyzeCasLog_receive");
    String msg = Tool.getFileContent(filepath);
    TreeNode node = MessageUtil.parseResponse(msg);
    GetAnalyzeCasLogTask task = new GetAnalyzeCasLogTask(serverInfo);
    task.setResponse(node);
    task.getAnalyzeCasLogResultList();
    //compare 
    assertEquals("success", node.getValue("status"));
    //case 2
    msg = msg.replaceFirst("result:start", "");
    msg = msg.replaceFirst("result:end", "");
    node = MessageUtil.parseResponse(msg);
    task.setResponse(node);
    task.getAnalyzeCasLogResultList();
    //case 3
    msg = msg.replaceFirst("resultlist:start", "resultlist:start1");
    node = MessageUtil.parseResponse(msg);
    task.setResponse(node);
    task.getAnalyzeCasLogResultList();
    //case 4
    msg = msg.replaceFirst("resultlist:start1", "");
    msg = msg.replaceFirst("resultlist:end", "");
    node = MessageUtil.parseResponse(msg);
    task.setResponse(node);
    task.getAnalyzeCasLogResultList();
    //case 5
    filepath = this.getFilePathInPlugin("/com/cubrid/cubridmanager/core/logs/task/test.message/GetAnalyzeCasLog_receive2");
    msg = Tool.getFileContent(filepath);
    node = MessageUtil.parseResponse(msg);
    GetAnalyzeCasLogTask task2 = new GetAnalyzeCasLogTask(serverInfo);
    task2.setResponse(node);
    task2.getAnalyzeCasLogResultList();
    //exception case1
    task.setResponse(null);
    task.getAnalyzeCasLogResultList();
    //exception case2
    task.setResponse(node);
    task.setErrorMsg("has error");
    task.getAnalyzeCasLogResultList();
}
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