use of org.eclipse.titan.log.viewer.parsers.data.TestCase in project titan.EclipsePlug-ins by eclipse.
the class OpenTextTableStatisticalViewMenuAction method run.
@Override
public void run() {
Object element = this.selection.getFirstElement();
if (!(element instanceof TestCase)) {
return;
}
TestCase tc = (TestCase) element;
LogFileMetaData logFileMetaData = this.statisticalView.getLogFileMetaData();
TextTableViewHelper.open(logFileMetaData.getProjectName(), logFileMetaData.getProjectRelativePath(), tc.getStartRecordNumber());
}
use of org.eclipse.titan.log.viewer.parsers.data.TestCase in project titan.EclipsePlug-ins by eclipse.
the class TestCaseActionProvider method fillActionBars.
@Override
public void fillActionBars(final IActionBars actionBars) {
final IStructuredSelection selection = (IStructuredSelection) getContext().getSelection();
if (selection.size() == 1 && selection.getFirstElement() instanceof TestCase) {
openTestCaseAction.selectionChanged(null, selection);
actionBars.setGlobalActionHandler(ICommonActionConstants.OPEN, openTestCaseAction);
}
}
use of org.eclipse.titan.log.viewer.parsers.data.TestCase in project titan.EclipsePlug-ins by eclipse.
the class TestCaseExtractor method extractTestCasesFromIndexedLogFile.
/**
* Extracts test cases from a log file which already has a previously created index file
*
* @param logFile the log file to extract test cases from, can NOT be null
* @throws IOException if file IO or parse errors occur
* @throws ClassNotFoundException if test cases can not be read from the index file
*/
public void extractTestCasesFromIndexedLogFile(final IFile logFile) throws IOException, ClassNotFoundException {
this.logFile = logFile;
File indexFile = LogFileCacheHandler.getIndexFileForLogFile(logFile);
if (indexFile.length() == 0) {
throw new IOException();
}
ObjectInputStream indexFileInputStream = null;
try {
indexFileInputStream = new ObjectInputStream(new FileInputStream(indexFile));
Object o = indexFileInputStream.readObject();
if (o instanceof List) {
List<?> testCases = (List<?>) o;
double sizeFactor = 100.0 / testCases.size();
int i = 0;
for (Object testCase : testCases) {
i++;
if (testCase instanceof TestCase) {
this.currentTestCase = (TestCase) testCase;
this.currentProgress = (int) (sizeFactor * i);
addTestCase();
} else {
// $NON-NLS-1$
throw new ClassNotFoundException("Class not found!");
}
}
}
} finally {
IOUtils.closeQuietly(indexFileInputStream);
}
}
use of org.eclipse.titan.log.viewer.parsers.data.TestCase in project titan.EclipsePlug-ins by eclipse.
the class TestCaseExtractor method getTestCaseFromIndexFile.
/**
* Fetches a given test case with a passed id from a previously created index file
*
* @param indexFile the index file to extract test cases from, can NOT be null
* @param testCaseNumber number of the test case to fetch
* @throws IOException if file IO or parse errors occur
* @throws ClassNotFoundException if test cases can not be read from the index file
*/
public static TestCase getTestCaseFromIndexFile(final File indexFile, final int testCaseNumber) throws IOException, TechnicalException, ClassNotFoundException {
ObjectInputStream indexFileInputStream = null;
try {
indexFileInputStream = new ObjectInputStream(new FileInputStream(indexFile));
Object o = indexFileInputStream.readObject();
if (o instanceof List) {
List<?> testCases = (List<?>) o;
// the vector is zero based but the testCase number starts numbering on 1
// so there must be an alignment
int testCasePosition = testCaseNumber - 1;
if (testCases.size() < testCasePosition) {
// $NON-NLS-1$
throw new TechnicalException(Messages.getString("TestCaseExtractor.4"));
}
return (TestCase) testCases.get(testCasePosition);
}
} finally {
IOUtils.closeQuietly(indexFileInputStream);
}
return null;
}
use of org.eclipse.titan.log.viewer.parsers.data.TestCase in project titan.EclipsePlug-ins by eclipse.
the class TestCaseExtractor method addCrashedTestCase.
private void addCrashedTestCase() {
if (!this.crashed) {
this.crashed = true;
this.testCaseVector.add(new TestCase(logFile, -1, Messages.getString("TestCaseExtractor.3"), this.filePointer, Constants.VERDICT_CRASHED, this.recordNumber, this.recordNumber));
}
}
Aggregations