Search in sources :

Example 1 with GetExecuteCasRunnerResultInfo

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

the class GetExecuteCasRunnerResultTask method getContent.

/**
	 * get result from the response.
	 * 
	 * @return GetExecuteCasRunnerResultInfo
	 */
public GetExecuteCasRunnerResultInfo getContent() {
    TreeNode response = getResponse();
    if (response == null || (this.getErrorMsg() != null && getErrorMsg().trim().length() > 0)) {
        return null;
    }
    GetExecuteCasRunnerResultInfo getExecuteCasRunnerResultInfo = new GetExecuteCasRunnerResultInfo();
    String queryResultFile = response.getValue("query_result_file");
    String queryResultFileNum = response.getValue("query_result_file_num");
    getExecuteCasRunnerResultInfo.setQueryResultFile(queryResultFile);
    getExecuteCasRunnerResultInfo.setQueryResultFileNum(queryResultFileNum);
    if (response != null && response.getValue("result_list") != null && response.getValue("result_list").equals("start")) {
        String[] results = response.getValues("result");
        if (results == null) {
            return getExecuteCasRunnerResultInfo;
        }
        for (int j = 0; j < results.length; j++) {
            String str = results[j];
            if (str != null && str.trim().length() > 0) {
                getExecuteCasRunnerResultInfo.addResult(str);
            }
        }
    }
    return getExecuteCasRunnerResultInfo;
}
Also used : GetExecuteCasRunnerResultInfo(com.cubrid.cubridmanager.core.logs.model.GetExecuteCasRunnerResultInfo) TreeNode(com.cubrid.cubridmanager.core.common.socket.TreeNode)

Example 2 with GetExecuteCasRunnerResultInfo

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

the class ExecuteSqlLogAction method run.

/**
	 * Open dialog
	 */
public void run() {
    Object[] obj = this.getSelectedObj();
    DefaultCubridNode node = null;
    LogInfo logInfo = null;
    node = (DefaultCubridNode) obj[0];
    String targetBroker = node.getParent().getParent().getLabel();
    logInfo = (LogInfo) node.getAdapter(LogInfo.class);
    List<String> allDatabaseList = node.getServer().getServerInfo().getAllDatabaseList();
    BrokerInfos brokerInfos = node.getServer().getServerInfo().getBrokerInfos();
    CasRunnerConfigDialog casRunnerConfigDialog = new CasRunnerConfigDialog(getShell());
    casRunnerConfigDialog.setBrokerInfos(brokerInfos);
    casRunnerConfigDialog.setAllDatabaseList(allDatabaseList);
    casRunnerConfigDialog.setLogInfo(logInfo);
    casRunnerConfigDialog.setTargetBroker(targetBroker);
    casRunnerConfigDialog.setExecwithFile(true);
    casRunnerConfigDialog.create();
    if (casRunnerConfigDialog.open() == Dialog.OK) {
        final GetExecuteCasRunnerResultTask task = new GetExecuteCasRunnerResultTask(((DefaultCubridNode) obj[0]).getServer().getServerInfo());
        task.setBrokerName(CasRunnerConfigDialog.getBrokerName());
        task.setUserName(CasRunnerConfigDialog.getUserName());
        task.setPasswd(CasRunnerConfigDialog.getPassword());
        task.setNumThread(CasRunnerConfigDialog.getNumThread());
        task.setRepeatCount(casRunnerConfigDialog.getNumRepeatCount());
        String isShowqueryresult = "";
        if (casRunnerConfigDialog.isShowqueryresult()) {
            isShowqueryresult = "yes";
        } else {
            isShowqueryresult = "no";
        }
        task.setShowQueryResult(isShowqueryresult);
        String isShowqueryplan = "";
        if (casRunnerConfigDialog.isShowqueryplan()) {
            isShowqueryplan = "yes";
        } else {
            isShowqueryplan = "no";
        }
        task.setShowQueryResult(isShowqueryplan);
        task.setDbName(CasRunnerConfigDialog.getDbname());
        task.setExecuteLogFile("yes");
        task.setLogFile(logInfo.getPath());
        TaskExecutor taskExcutor = new CommonTaskExec(Messages.loadSqlLogExecResultTaskName);
        taskExcutor.addTask(task);
        new ExecTaskWithProgress(taskExcutor).exec();
        if (!taskExcutor.isSuccess()) {
            return;
        }
        GetExecuteCasRunnerResultInfo getExecuteCasRunnerResultInfo = (GetExecuteCasRunnerResultInfo) task.getContent();
        StringBuffer result = new StringBuffer("");
        if (getExecuteCasRunnerResultInfo.getResult() != null) {
            for (int i = 0, n = getExecuteCasRunnerResultInfo.getResult().size(); i < n; i++) {
                result.append(getExecuteCasRunnerResultInfo.getResult().get(i) + "\n");
            }
        }
        CasRunnerResultDialog casRunnerResultDialog = new CasRunnerResultDialog(getShell());
        casRunnerResultDialog.setResult(result);
        casRunnerResultDialog.open();
    }
}
Also used : CommonTaskExec(com.cubrid.common.ui.spi.progress.CommonTaskExec) DefaultCubridNode(com.cubrid.common.ui.spi.model.DefaultCubridNode) LogInfo(com.cubrid.cubridmanager.core.logs.model.LogInfo) GetExecuteCasRunnerResultInfo(com.cubrid.cubridmanager.core.logs.model.GetExecuteCasRunnerResultInfo) BrokerInfos(com.cubrid.cubridmanager.core.broker.model.BrokerInfos) CasRunnerConfigDialog(com.cubrid.cubridmanager.ui.logs.dialog.CasRunnerConfigDialog) CasRunnerResultDialog(com.cubrid.cubridmanager.ui.logs.dialog.CasRunnerResultDialog) TaskExecutor(com.cubrid.common.ui.spi.progress.TaskExecutor) ExecTaskWithProgress(com.cubrid.common.ui.spi.progress.ExecTaskWithProgress) GetExecuteCasRunnerResultTask(com.cubrid.cubridmanager.core.logs.task.GetExecuteCasRunnerResultTask)

Example 3 with GetExecuteCasRunnerResultInfo

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

the class LogsModelTest method testModelGetExecuteCasRunnerResultInfo.

public void testModelGetExecuteCasRunnerResultInfo() {
    GetExecuteCasRunnerResultInfo bean = new GetExecuteCasRunnerResultInfo();
    bean.setQueryResultFile("queryResultFile");
    assertEquals(bean.getQueryResultFile(), "queryResultFile");
    bean.setQueryResultFileNum("queryResultFileNum");
    assertEquals(bean.getQueryResultFileNum(), "queryResultFileNum");
    bean.getTaskName();
    bean.getResult();
    bean.addResult("");
}
Also used : GetExecuteCasRunnerResultInfo(com.cubrid.cubridmanager.core.logs.model.GetExecuteCasRunnerResultInfo)

Example 4 with GetExecuteCasRunnerResultInfo

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

the class LogsModelTest method testModelGetExecuteCasRunnerResultInfo.

public void testModelGetExecuteCasRunnerResultInfo() {
    GetExecuteCasRunnerResultInfo bean = new GetExecuteCasRunnerResultInfo();
    bean.setQueryResultFile("queryResultFile");
    assertEquals(bean.getQueryResultFile(), "queryResultFile");
    bean.setQueryResultFileNum("queryResultFileNum");
    assertEquals(bean.getQueryResultFileNum(), "queryResultFileNum");
    bean.getTaskName();
    bean.getResult();
    bean.addResult("");
}
Also used : GetExecuteCasRunnerResultInfo(com.cubrid.cubridmanager.core.logs.model.GetExecuteCasRunnerResultInfo)

Example 5 with GetExecuteCasRunnerResultInfo

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

the class ManagerLogInfoListTest method testModelGetExecuteCasRunnerResultInfo.

public void testModelGetExecuteCasRunnerResultInfo() {
    GetExecuteCasRunnerResultInfo bean = new GetExecuteCasRunnerResultInfo();
    bean.setQueryResultFile("queryResultFile");
    assertEquals(bean.getQueryResultFile(), "queryResultFile");
    bean.setQueryResultFileNum("queryResultFileNum");
    assertEquals(bean.getQueryResultFileNum(), "queryResultFileNum");
    bean.getTaskName();
    bean.getResult();
    bean.addResult("");
}
Also used : GetExecuteCasRunnerResultInfo(com.cubrid.cubridmanager.core.logs.model.GetExecuteCasRunnerResultInfo)

Aggregations

GetExecuteCasRunnerResultInfo (com.cubrid.cubridmanager.core.logs.model.GetExecuteCasRunnerResultInfo)7 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 BrokerInfos (com.cubrid.cubridmanager.core.broker.model.BrokerInfos)2 TreeNode (com.cubrid.cubridmanager.core.common.socket.TreeNode)2 LogInfo (com.cubrid.cubridmanager.core.logs.model.LogInfo)2 DefaultCubridNode (com.cubrid.common.ui.spi.model.DefaultCubridNode)1 AnalyzeCasLogResultInfo (com.cubrid.cubridmanager.core.logs.model.AnalyzeCasLogResultInfo)1 AnalyzeCasLogResultList (com.cubrid.cubridmanager.core.logs.model.AnalyzeCasLogResultList)1 GetExecuteCasRunnerContentResultTask (com.cubrid.cubridmanager.core.logs.task.GetExecuteCasRunnerContentResultTask)1 GetExecuteCasRunnerResultTask (com.cubrid.cubridmanager.core.logs.task.GetExecuteCasRunnerResultTask)1 CasRunnerConfigDialog (com.cubrid.cubridmanager.ui.logs.dialog.CasRunnerConfigDialog)1 CasRunnerResultDialog (com.cubrid.cubridmanager.ui.logs.dialog.CasRunnerResultDialog)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 Button (org.eclipse.swt.widgets.Button)1