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;
}
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();
}
}
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);
}
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();
}
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();
}
Aggregations