Search in sources :

Example 1 with TestSuite

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();
    }
}
Also used : TestSuite(com.rockwellcollins.atc.tcg.suite.TestSuite) PartInitException(org.eclipse.ui.PartInitException)

Example 2 with TestSuite

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);
            }
        });
    }
}
Also used : TestSuite(com.rockwellcollins.atc.tcg.suite.TestSuite)

Example 3 with TestSuite

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;
}
Also used : ComponentImplementation(org.osate.aadl2.ComponentImplementation) TestSuite(com.rockwellcollins.atc.tcg.suite.TestSuite) TcgLinkerFactory(com.rockwellcollins.atc.tcg.views.TcgLinkerFactory) TcgException(com.rockwellcollins.atc.tcg.TcgException) PartInitException(org.eclipse.ui.PartInitException) IOException(java.io.IOException)

Example 4 with TestSuite

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);
    }
}
Also used : Shell(org.eclipse.swt.widgets.Shell) TestSuite(com.rockwellcollins.atc.tcg.suite.TestSuite) FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) TcgXmlReader(com.rockwellcollins.atc.tcg.readers.TcgXmlReader) IOException(java.io.IOException) FileInputStream(java.io.FileInputStream) TcgException(com.rockwellcollins.atc.tcg.TcgException)

Example 5 with TestSuite

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;
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) Program(jkind.lustre.Program) JKindException(jkind.JKindException) TestSuite(com.rockwellcollins.atc.tcg.suite.TestSuite) KindApi(jkind.api.KindApi) TcgRenaming(com.rockwellcollins.atc.tcg.obligations.ufc.TcgRenaming) JKindResult(jkind.api.results.JKindResult)

Aggregations

TestSuite (com.rockwellcollins.atc.tcg.suite.TestSuite)6 TcgException (com.rockwellcollins.atc.tcg.TcgException)2 IOException (java.io.IOException)2 Shell (org.eclipse.swt.widgets.Shell)2 PartInitException (org.eclipse.ui.PartInitException)2 TcgRenaming (com.rockwellcollins.atc.tcg.obligations.ufc.TcgRenaming)1 TcgXmlReader (com.rockwellcollins.atc.tcg.readers.TcgXmlReader)1 TcgLinkerFactory (com.rockwellcollins.atc.tcg.views.TcgLinkerFactory)1 TestSuiteLinker (com.rockwellcollins.atc.tcg.views.TestSuiteLinker)1 TestSuiteView (com.rockwellcollins.atc.tcg.views.TestSuiteView)1 TcgXmlWriter (com.rockwellcollins.atc.tcg.writers.TcgXmlWriter)1 FileInputStream (java.io.FileInputStream)1 FileNotFoundException (java.io.FileNotFoundException)1 InputStream (java.io.InputStream)1 JKindException (jkind.JKindException)1 KindApi (jkind.api.KindApi)1 AnalysisResult (jkind.api.results.AnalysisResult)1 JKindResult (jkind.api.results.JKindResult)1 Program (jkind.lustre.Program)1 Type (jkind.lustre.Type)1