use of org.eclipse.titan.executor.views.testexecution.ExecutedTestcase in project titan.EclipsePlug-ins by eclipse.
the class JniExecutor method batchedInsertNotify.
/**
* Inserts a lists of messages into the notifications view in a batched manner
* <p>
* A list of String arrays issued to store every data reported regarding the message in a undecoded way. On this way if a data is not needed we
* don't need to decode it.
*
* @param s the list of String arrays.
*/
@Override
public void batchedInsertNotify(final ArrayList<String[]> s) {
if (loggingIsEnabled && consoleLogging) {
for (String[] sv : s) {
consoleStream.println(sv[2] + ": " + sv[4]);
}
}
List<String> times = new ArrayList<String>(s.size());
List<Notification> tempNotifications = new ArrayList<Notification>(s.size());
if (severityLevelExtraction) {
int severity;
for (String[] value : s) {
severity = Integer.parseInt(value[3]);
Formatter formatter = new Formatter();
formatter.format(DATETIMEFORMAT, new Date(Long.parseLong(value[0]) * 1000), Long.valueOf(value[1]));
times.add(formatter.toString());
tempNotifications.add(new Notification(formatter.toString(), SeverityResolver.getSeverityString(severity), value[2], value[4]));
formatter.close();
}
} else {
for (String[] value : s) {
Formatter formatter = new Formatter();
formatter.format(DATETIMEFORMAT, new Date(Long.parseLong(value[0]) * 1000), Long.valueOf(value[1]));
times.add(formatter.toString());
tempNotifications.add(new Notification(formatter.toString(), EMPTY_STRING, value[2], value[4]));
formatter.close();
}
}
addNotifications(tempNotifications);
if (verdictExtraction) {
for (int i = 0; i < s.size(); i++) {
if (executionFinishedMatcher.reset(s.get(i)[4]).matches()) {
String reason = executionFinishedMatcher.group(2);
if (reasonMatcher.reset(reason).matches()) {
executedTests.add(new ExecutedTestcase(times.get(i), executionFinishedMatcher.group(1), reasonMatcher.group(1), reasonMatcher.group(2)));
} else {
executedTests.add(new ExecutedTestcase(times.get(i), executionFinishedMatcher.group(1), executionFinishedMatcher.group(2), ""));
}
}
}
}
}
use of org.eclipse.titan.executor.views.testexecution.ExecutedTestcase in project titan.EclipsePlug-ins by eclipse.
the class SingleExecutor method processConsoleOutput.
/**
* Processes the output of the Main Controller
* <p>
* Note that the output is not reported in full lines.
*
* @param text the newly reported text
*
* @see #readFullLineOnly(BufferedReader)
*/
private void processConsoleOutput(final String text) {
builder.append(text);
StringReader reader = new StringReader(builder.toString());
BufferedReader stdout = new BufferedReader(reader);
fastOffset = 0;
readFullLineOnly(stdout);
while (null != fastLine) {
if (verdictExtraction && (executionFinished.reset(fastLine).matches())) {
String reason = executionFinished.group(2);
if (reasonMatcher.reset(reason).matches()) {
executedTests.add(new ExecutedTestcase((new Formatter()).format(PADDEDDATETIMEFORMAT, new Date()).toString(), executionFinished.group(1), reasonMatcher.group(1), reasonMatcher.group(2)));
} else {
executedTests.add(new ExecutedTestcase((new Formatter()).format(PADDEDDATETIMEFORMAT, new Date()).toString(), executionFinished.group(1), executionFinished.group(2), ""));
}
if (project == null) {
return;
}
try {
project.refreshLocal(IResource.DEPTH_INFINITE, null);
} catch (CoreException e) {
ErrorReporter.logExceptionStackTrace(e);
}
}
addNotification(new Notification((new Formatter()).format(PADDEDDATETIMEFORMAT, new Date()).toString(), "", "", fastLine));
builder.delete(0, fastOffset);
if (Activator.getMainView() != null) {
Activator.getMainView().refreshIfSelected(mainControllerRoot);
} else {
TestExecutionView.refreshInput(this);
}
fastOffset = 0;
readFullLineOnly(stdout);
}
try {
stdout.close();
} catch (IOException e) {
ErrorReporter.logExceptionStackTrace(e);
}
reader.close();
}
use of org.eclipse.titan.executor.views.testexecution.ExecutedTestcase in project titan.EclipsePlug-ins by eclipse.
the class JniExecutor method insertNotify.
/**
* Inserts a notification message into the notifications view.
*
* @param time the MainController reported time, when the notification message was created
* @param source the source line info of the notification message
* @param severity the severity of the message
* @param msg the message to be shown
*/
@Override
public void insertNotify(final Timeval time, final String source, final int severity, final String msg) {
if (loggingIsEnabled && consoleLogging) {
consoleStream.println(source + ": " + msg);
}
Formatter formatter = new Formatter();
formatter.format(DATETIMEFORMAT, new Date(time.tv_sec * 1000), time.tv_usec);
if (severityLevelExtraction) {
addNotification(new Notification(formatter.toString(), SeverityResolver.getSeverityString(severity), source, msg));
} else {
addNotification(new Notification(formatter.toString(), EMPTY_STRING, source, msg));
}
if (verdictExtraction && executionFinishedMatcher.reset(msg).matches()) {
String reason = executionFinishedMatcher.group(2);
if (reasonMatcher.reset(reason).matches()) {
executedTests.add(new ExecutedTestcase(formatter.toString(), executionFinishedMatcher.group(1), reasonMatcher.group(1), reasonMatcher.group(2)));
} else {
executedTests.add(new ExecutedTestcase(formatter.toString(), executionFinishedMatcher.group(1), executionFinishedMatcher.group(2), ""));
}
}
}
Aggregations