Search in sources :

Example 21 with TreeNode

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

the class GetBackupVolInfoTaskTest 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/cubrid/database/task/test.message/getbackupvolinfo_receive");
    String msg = Tool.getFileContent(filepath);
    TreeNode node = MessageUtil.parseResponse(msg);
    GetBackupVolInfoTask task = new GetBackupVolInfoTask(serverInfo);
    task.setResponse(node);
    assertTrue(task.getDbBackupVolInfo().length() > 0);
    //exception case1
    task.setResponse(null);
    assertTrue(task.getDbBackupVolInfo() == null);
    //exception case2
    task.setResponse(node);
    task.setErrorMsg("has error");
    assertTrue(task.getDbBackupVolInfo() == null);
}
Also used : TreeNode(com.cubrid.cubridmanager.core.common.socket.TreeNode)

Example 22 with TreeNode

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

the class GetDbUnloadInfoTaskTest 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/cubrid/database/task/test.message/getunloaddbinfo_receive");
    String msg = Tool.getFileContent(filepath);
    TreeNode node = MessageUtil.parseResponse(msg);
    GetDbUnloadInfoTask task = new GetDbUnloadInfoTask(serverInfo);
    task.setResponse(node);
    List<DbUnloadInfo> list = task.getDbUnloadInfoList();
    assertTrue(list.size() == 1);
    assertEquals(list.get(0).getDbName(), "demodb");
    assertTrue(list.get(0).getIndexDateList().size() == 2);
    assertTrue(list.get(0).getIndexPathList().size() == 2);
    assertTrue(list.get(0).getSchemaDateList().size() == 2);
    assertTrue(list.get(0).getSchemaPathList().size() == 2);
    assertTrue(list.get(0).getObjectDateList().size() == 2);
    assertTrue(list.get(0).getObjectPathList().size() == 2);
    assertTrue(list.get(0).getTriggerDateList().size() == 2);
    assertTrue(list.get(0).getTriggerPathList().size() == 2);
    //exception case
    //exception case1
    task.setResponse(null);
    assertTrue(task.getDbUnloadInfoList() == null);
    //exception case2
    task.setResponse(node);
    task.setErrorMsg("has error");
    assertTrue(task.getDbUnloadInfoList() == null);
    filepath = this.getFilePathInPlugin("/com/cubrid/cubridmanager/core/cubrid/database/task/test.message/getunloaddbinfo_receive2");
    msg = Tool.getFileContent(filepath);
    node = MessageUtil.parseResponse(msg);
    GetDbUnloadInfoTask task2 = new GetDbUnloadInfoTask(serverInfo);
    task2.setResponse(node);
    task2.getDbUnloadInfoList();
    filepath = this.getFilePathInPlugin("/com/cubrid/cubridmanager/core/cubrid/database/task/test.message/getunloaddbinfo_receive2");
    msg = Tool.getFileContent(filepath);
    node = MessageUtil.parseResponse(msg);
    GetDbUnloadInfoTask task3 = new GetDbUnloadInfoTask(serverInfo);
    task3.setResponse(node);
    task3.getDbUnloadInfoList();
}
Also used : TreeNode(com.cubrid.cubridmanager.core.common.socket.TreeNode) DbUnloadInfo(com.cubrid.cubridmanager.core.cubrid.database.model.DbUnloadInfo)

Example 23 with TreeNode

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

the class LoadDbTaskTest 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/cubrid/database/task/test.message/loaddb_receive");
    String msg = Tool.getFileContent(filepath);
    TreeNode node = MessageUtil.parseResponse(msg);
    LoadDbTask task = new LoadDbTask(serverInfo);
    task.setResponse(node);
    assertTrue(task.getLoadResult().length > 0);
    //exception case1
    task.setResponse(null);
    assertTrue(task.getLoadResult() == null);
    //exception case2
    task.setResponse(node);
    task.setErrorMsg("has error");
    assertTrue(task.getLoadResult() == null);
}
Also used : TreeNode(com.cubrid.cubridmanager.core.common.socket.TreeNode)

Example 24 with TreeNode

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

the class UnloadDatabaseTaskTest 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/cubrid/database/task/test.message/unloaddb_receive");
    String msg = Tool.getFileContent(filepath);
    TreeNode node = MessageUtil.parseResponse(msg);
    UnloadDatabaseTask task = new UnloadDatabaseTask(serverInfo);
    task.setResponse(node);
    List<String> list = task.getUnloadDbResult();
    assertTrue(list.size() == 3);
    //exception case1
    task.setResponse(null);
    assertTrue(task.getUnloadDbResult() == null);
    //exception case2
    task.setResponse(node);
    task.setErrorMsg("has error");
    assertTrue(task.getUnloadDbResult() == null);
    task.setUnloadType("both");
    task.setUnloadType("schema");
    task.setUnloadType("object");
    task.setUnloadType("aaa");
    task.setErrorMsg("err");
    task.getUnloadDbResult();
}
Also used : TreeNode(com.cubrid.cubridmanager.core.common.socket.TreeNode)

Example 25 with TreeNode

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

the class GetBackupPlanListTaskTest method testRealEnv.

public void testRealEnv() {
    if (StringUtil.isEqual(SystemParameter.getParameterValue("useMockTest"), "y"))
        return;
    boolean isSucce = this.addBackupPlan("eee");
    isSucce = isSucce && this.addBackupPlan("fff");
    if (isSucce) {
        GetBackupPlanListTask task = new GetBackupPlanListTask(serverInfo);
        task.setDbName(testDbName);
        task.execute();
        assertTrue(task.getBackupPlanInfoList().size() >= 2);
        this.deleteBackupPlan("eee");
        this.deleteBackupPlan("fff");
        task.setResponse(new TreeNode());
        task.getBackupPlanInfoList();
        task.setErrorMsg("err");
        task.getBackupPlanInfoList();
    }
}
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