use of com.rockwellcollins.atc.tcg.suite.TestSuite in project AGREE by loonwerks.
the class TestCaseGeneratorMenuListener method viewTestSuite.
private void viewTestSuite(JKindResult result, AgreeResultsLinker linker) {
TestSuite testSuite = TestSuiteUtils.testSuiteFromJKindResult(result, linker.getComponent(result).getQualifiedName(), result.getName(), result.getText(), (TcgRenaming) linker.getRenaming(result));
try {
TestSuiteView tcView = (TestSuiteView) window.getActivePage().showView(TestSuiteView.ID);
tcView.setInput(testSuite, linker, result);
tcView.setFocus();
} catch (PartInitException e) {
e.printStackTrace();
}
}
use of com.rockwellcollins.atc.tcg.suite.TestSuite in project AGREE by loonwerks.
the class TestSuiteContentProvider method propertyChange.
@Override
public void propertyChange(PropertyChangeEvent event) {
if (event.getSource() instanceof TestSuite) {
final TestSuite result = (TestSuite) event.getSource();
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
viewer.update(result);
}
});
}
}
use of com.rockwellcollins.atc.tcg.suite.TestSuite in project AGREE by loonwerks.
the class OpenHandler method doAnalysis.
protected IStatus doAnalysis(final IProgressMonitor monitor) {
try {
System.out.println("Loading test suite...");
TestSuite testSuite = loadTests();
if (testSuite != null) {
ComponentImplementation ci = getComponentImplFromString(testSuite.getSystemImplUnderTest());
TcgLinkerFactory linkerFactory = new TcgLinkerFactory(ci, false, false);
showSuiteView(testSuite, linkerFactory.getLinker(), extractJKindResult(linkerFactory.getAnalysisResult()));
}
} catch (Exception e) {
System.out.println("Error" + e.toString());
throw e;
} finally {
System.out.println("Test suite loading complete");
}
return Status.OK_STATUS;
}
use of com.rockwellcollins.atc.tcg.suite.TestSuite in project AGREE by loonwerks.
the class OpenHandler method loadTests.
private TestSuite loadTests() throws TcgException {
try {
Shell activeShell = getWindow().getShell();
syncExec(() -> {
location = TcgPreferenceUtils.getTestCaseOpenFileDialog(activeShell, null);
});
if (location != null) {
InputStream targetStream = new FileInputStream(location);
TestSuite ts = new TestSuite();
TcgXmlReader reader = new TcgXmlReader(targetStream);
reader.readSuite(ts);
ts.setState(TestSuite.State.LOADED);
return ts;
} else {
return null;
}
} catch (IOException e) {
throw new TcgException("Error loading test file", e);
}
}
use of com.rockwellcollins.atc.tcg.suite.TestSuite in project AGREE by loonwerks.
the class VerifyHandler method doAnalysis.
protected IStatus doAnalysis(final Element root, final IProgressMonitor monitor) {
Thread analysisThread = new Thread() {
@Override
public void run() {
activateTerminateHandler(monitor);
KindApi api = PreferencesUtil.getKindApi();
while (!queue.isEmpty() && !monitor.isCanceled()) {
JKindResult result = queue.peek();
NullProgressMonitor subMonitor = new NullProgressMonitor();
monitorRef.set(subMonitor);
TcgRenaming tcgRenaming = (TcgRenaming) linker.getRenaming(result);
Program ufcProgram = constructUfcProgram(linker.getProgram(result), tcgRenaming);
ufcProgram.getMainNode().properties.forEach(p -> result.addProperty(p));
writeIntermediateFiles(linker.getProgram(result), ufcProgram);
try {
System.out.println("Calling jkind...");
api.execute(ufcProgram, result, monitor);
System.out.println("executed API...");
TestSuite testSuite = TestSuiteUtils.testSuiteFromJKindResult(result, linker.getComponent(result).getQualifiedName(), result.getName(), result.getText(), tcgRenaming);
emitResult(testSuite);
// showSuiteView(testSuite, linker);
} catch (JKindException e) {
System.out.println(result.getText());
System.out.println("******** Error Occurred: HERE IS THE LUSTRE ********");
System.out.println(linker.getProgram(result));
break;
} finally {
deactivateTerminateHandler();
System.out.println("UFC generation complete");
}
queue.remove();
}
}
};
analysisThread.start();
return Status.OK_STATUS;
}
Aggregations