Search in sources :

Example 1 with AnalyzeCasLogResultList

use of com.cubrid.cubridmanager.core.logs.model.AnalyzeCasLogResultList in project cubrid-manager by CUBRID.

the class GetAnalyzeCasLogTask method getAnalyzeCasLogResultList.

/**
	 * <p>
	 * Get result from the response.
	 * </p>
	 * 
	 * @return {@link AnalyzeCasLogResultList}
	 */
public AnalyzeCasLogResultList getAnalyzeCasLogResultList() {
    TreeNode response = getResponse();
    if (response == null || (this.getErrorMsg() != null && getErrorMsg().trim().length() > 0)) {
        return null;
    }
    AnalyzeCasLogResultList analyzeCasLogResultList = new AnalyzeCasLogResultList();
    String resultfile = response.getValue("resultfile");
    analyzeCasLogResultList.setResultfile(resultfile);
    // TOOLS-4132 CM can't make the broker_log_top result - fixed by cmserver https api bug
    if (response != null && response.getValue("resultlist") != null && response.getValues("result") != null) {
        String[] results = response.getValues("result");
        for (int i = 0; i < results.length / 2; i++) {
            AnalyzeCasLogResultInfo analyzeCasLogResultInfo = new AnalyzeCasLogResultInfo();
            analyzeCasLogResultInfo.setQindex((response.getValues("qindex"))[i]);
            if (response.getValue("max") == null) {
                analyzeCasLogResultInfo.setExecTime((response.getValues("exec_time"))[i]);
            } else {
                analyzeCasLogResultInfo.setMax((response.getValues("max"))[i]);
                analyzeCasLogResultInfo.setMin((response.getValues("min"))[i]);
                analyzeCasLogResultInfo.setAvg((response.getValues("avg"))[i]);
                analyzeCasLogResultInfo.setCnt((response.getValues("cnt"))[i]);
                analyzeCasLogResultInfo.setErr((response.getValues("err"))[i]);
            }
            analyzeCasLogResultList.addResultFile(analyzeCasLogResultInfo);
        }
    }
    return analyzeCasLogResultList;
}
Also used : AnalyzeCasLogResultList(com.cubrid.cubridmanager.core.logs.model.AnalyzeCasLogResultList) AnalyzeCasLogResultInfo(com.cubrid.cubridmanager.core.logs.model.AnalyzeCasLogResultInfo) TreeNode(com.cubrid.cubridmanager.core.common.socket.TreeNode)

Example 2 with AnalyzeCasLogResultList

use of com.cubrid.cubridmanager.core.logs.model.AnalyzeCasLogResultList in project cubrid-manager by CUBRID.

the class AnalyzeSqlLogAction method run.

/**
	 * Open dialog
	 */
public void run() {
    Object[] obj = this.getSelectedObj();
    DefaultCubridNode node = null;
    LogInfo logInfo = null;
    node = (DefaultCubridNode) obj[0];
    logInfo = (LogInfo) node.getAdapter(LogInfo.class);
    SqlLogFileListDialog cASLogTopConfigDialog = new SqlLogFileListDialog(getShell());
    List<String> targetStringList = new ArrayList<String>();
    if (logInfo == null) {
        for (int j = 0, m = node.getChildren().size(); j < m; j++) {
            targetStringList.add(((LogInfo) node.getChildren().get(j).getAdapter(LogInfo.class)).getPath());
        }
    } else {
        targetStringList.add(logInfo.getPath());
    }
    cASLogTopConfigDialog.create();
    cASLogTopConfigDialog.setInfo(targetStringList);
    int returnCode = cASLogTopConfigDialog.open();
    if (returnCode == SqlLogFileListDialog.OK) {
        String optionT;
        final GetAnalyzeCasLogTask task = new GetAnalyzeCasLogTask(node.getServer().getServerInfo());
        if (cASLogTopConfigDialog.isOption()) {
            optionT = "yes";
        } else {
            optionT = "no";
        }
        List<String> selectedStringList = cASLogTopConfigDialog.getSelectedStringList();
        String[] path = new String[selectedStringList.size()];
        selectedStringList.toArray(path);
        task.setLogFiles(path);
        task.setOptionT(optionT);
        TaskExecutor taskExcutor = new CommonTaskExec(Messages.loadLogTaskName);
        taskExcutor.addTask(task);
        new ExecTaskWithProgress(taskExcutor).exec();
        if (!taskExcutor.isSuccess()) {
            return;
        }
        AnalyzeCasLogResultList analyzeCasLogResultList = (AnalyzeCasLogResultList) task.getAnalyzeCasLogResultList();
        SqlLogAnalyzeResultDialog activityCASLogPathDialog = new SqlLogAnalyzeResultDialog(getShell());
        activityCASLogPathDialog.setOption(cASLogTopConfigDialog.isOption());
        activityCASLogPathDialog.setNode(node);
        activityCASLogPathDialog.setResultFile(analyzeCasLogResultList.getResultfile());
        activityCASLogPathDialog.setAnalyzeCasLogResultList(analyzeCasLogResultList);
        activityCASLogPathDialog.create();
        activityCASLogPathDialog.setLabel(selectedStringList);
        activityCASLogPathDialog.insertArrayToTable(analyzeCasLogResultList);
        activityCASLogPathDialog.open();
    }
}
Also used : CommonTaskExec(com.cubrid.common.ui.spi.progress.CommonTaskExec) AnalyzeCasLogResultList(com.cubrid.cubridmanager.core.logs.model.AnalyzeCasLogResultList) DefaultCubridNode(com.cubrid.common.ui.spi.model.DefaultCubridNode) LogInfo(com.cubrid.cubridmanager.core.logs.model.LogInfo) GetAnalyzeCasLogTask(com.cubrid.cubridmanager.core.logs.task.GetAnalyzeCasLogTask) ArrayList(java.util.ArrayList) SqlLogAnalyzeResultDialog(com.cubrid.cubridmanager.ui.logs.dialog.SqlLogAnalyzeResultDialog) SqlLogFileListDialog(com.cubrid.cubridmanager.ui.logs.dialog.SqlLogFileListDialog) TaskExecutor(com.cubrid.common.ui.spi.progress.TaskExecutor) ExecTaskWithProgress(com.cubrid.common.ui.spi.progress.ExecTaskWithProgress)

Example 3 with AnalyzeCasLogResultList

use of com.cubrid.cubridmanager.core.logs.model.AnalyzeCasLogResultList in project cubrid-manager by CUBRID.

the class LogsModelTest method testModelAnalyzeCasLogResultList.

public void testModelAnalyzeCasLogResultList() {
    AnalyzeCasLogResultList bean = new AnalyzeCasLogResultList();
    bean.addResultFile(new AnalyzeCasLogResultInfo());
    // assertEquals(bean.getResultFile() instanceof List, true);
    bean.setResultfile("resultfile");
    assertEquals(bean.getResultfile(), "resultfile");
    bean.getTaskName();
    bean.getLogFileInfoList();
    AnalyzeCasLogResultInfo analyzeCasLogResultInfo = new AnalyzeCasLogResultInfo();
    analyzeCasLogResultInfo.setQindex("qindex");
    bean.addResultFile(analyzeCasLogResultInfo);
}
Also used : AnalyzeCasLogResultList(com.cubrid.cubridmanager.core.logs.model.AnalyzeCasLogResultList) AnalyzeCasLogResultInfo(com.cubrid.cubridmanager.core.logs.model.AnalyzeCasLogResultInfo)

Example 4 with AnalyzeCasLogResultList

use of com.cubrid.cubridmanager.core.logs.model.AnalyzeCasLogResultList in project cubrid-manager by CUBRID.

the class LogsModelTest method testModelAnalyzeCasLogResultList.

public void testModelAnalyzeCasLogResultList() {
    AnalyzeCasLogResultList bean = new AnalyzeCasLogResultList();
    bean.addResultFile(new AnalyzeCasLogResultInfo());
    // assertEquals(bean.getResultFile() instanceof List, true);
    bean.setResultfile("resultfile");
    assertEquals(bean.getResultfile(), "resultfile");
    bean.getTaskName();
    bean.getLogFileInfoList();
}
Also used : AnalyzeCasLogResultList(com.cubrid.cubridmanager.core.logs.model.AnalyzeCasLogResultList) AnalyzeCasLogResultInfo(com.cubrid.cubridmanager.core.logs.model.AnalyzeCasLogResultInfo)

Example 5 with AnalyzeCasLogResultList

use of com.cubrid.cubridmanager.core.logs.model.AnalyzeCasLogResultList in project cubrid-manager by CUBRID.

the class ManagerLogInfoListTest method testModelAnalyzeCasLogResultList.

public void testModelAnalyzeCasLogResultList() {
    AnalyzeCasLogResultList bean = new AnalyzeCasLogResultList();
    bean.addResultFile(new AnalyzeCasLogResultInfo());
    // assertEquals(bean.getResultFile() instanceof List, true);
    bean.setResultfile("resultfile");
    assertEquals(bean.getResultfile(), "resultfile");
    bean.getTaskName();
    bean.getLogFileInfoList();
}
Also used : AnalyzeCasLogResultList(com.cubrid.cubridmanager.core.logs.model.AnalyzeCasLogResultList) AnalyzeCasLogResultInfo(com.cubrid.cubridmanager.core.logs.model.AnalyzeCasLogResultInfo)

Aggregations

AnalyzeCasLogResultList (com.cubrid.cubridmanager.core.logs.model.AnalyzeCasLogResultList)6 AnalyzeCasLogResultInfo (com.cubrid.cubridmanager.core.logs.model.AnalyzeCasLogResultInfo)5 CommonTaskExec (com.cubrid.common.ui.spi.progress.CommonTaskExec)2 ExecTaskWithProgress (com.cubrid.common.ui.spi.progress.ExecTaskWithProgress)2 TaskExecutor (com.cubrid.common.ui.spi.progress.TaskExecutor)2 LogInfo (com.cubrid.cubridmanager.core.logs.model.LogInfo)2 DefaultCubridNode (com.cubrid.common.ui.spi.model.DefaultCubridNode)1 BrokerInfos (com.cubrid.cubridmanager.core.broker.model.BrokerInfos)1 TreeNode (com.cubrid.cubridmanager.core.common.socket.TreeNode)1 GetExecuteCasRunnerResultInfo (com.cubrid.cubridmanager.core.logs.model.GetExecuteCasRunnerResultInfo)1 GetAnalyzeCasLogTask (com.cubrid.cubridmanager.core.logs.task.GetAnalyzeCasLogTask)1 GetExecuteCasRunnerContentResultTask (com.cubrid.cubridmanager.core.logs.task.GetExecuteCasRunnerContentResultTask)1 SqlLogAnalyzeResultDialog (com.cubrid.cubridmanager.ui.logs.dialog.SqlLogAnalyzeResultDialog)1 SqlLogFileListDialog (com.cubrid.cubridmanager.ui.logs.dialog.SqlLogFileListDialog)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 GridData (org.eclipse.swt.layout.GridData)1 GridLayout (org.eclipse.swt.layout.GridLayout)1