Search in sources :

Example 16 with AnalysisResult

use of jkind.api.results.AnalysisResult in project AGREE by loonwerks.

the class TestCaseGeneratorResultLabelProvider method getText.

@Override
public String getText(Object element) {
    if (element instanceof PropertyResult) {
        PropertyResult pr = (PropertyResult) element;
        switch(column) {
            case PROPERTY:
                if (pr.getName().equals(Util.REALIZABLE)) {
                    return pr.getParent().getName();
                } else {
                    return pr.getName();
                }
            case RESULT:
                Status tcgStatus = StatusToTcgStatus.get(pr.getStatus());
                String tcgStatusString = TcgStatusToTcgStatusString.get(tcgStatus);
                switch(tcgStatus) {
                    case WAITING:
                        return tcgStatusString;
                    case WORKING:
                        return tcgStatusString + "..." + getProgress(pr) + " (" + pr.getElapsed() + "s)";
                    default:
                        return getFinalStatus(pr) + " (" + pr.getElapsed() + "s)";
                }
        }
    } else if (element instanceof JRealizabilityResult) {
        JRealizabilityResult result = (JRealizabilityResult) element;
        return getText(result.getPropertyResult());
    } else if (element instanceof AnalysisResult) {
        AnalysisResult result = (AnalysisResult) element;
        switch(column) {
            case PROPERTY:
                return result.getName();
            case RESULT:
                return TcgResultsUtil.getMultiStatus(result).toString();
        }
    }
    return "";
}
Also used : Status(jkind.api.results.Status) JRealizabilityResult(jkind.api.results.JRealizabilityResult) PropertyResult(jkind.api.results.PropertyResult) AnalysisResult(jkind.api.results.AnalysisResult)

Example 17 with AnalysisResult

use of jkind.api.results.AnalysisResult in project AGREE by loonwerks.

the class SaveHandler method doAnalysis.

protected IStatus doAnalysis(final IProgressMonitor monitor) {
    Thread analysisThread = new Thread() {

        String filePath;

        TestSuiteView view;

        @Override
        public void run() {
            activateTerminateHandler(monitor);
            Shell activeShell = getWindow().getShell();
            System.out.println("Saving test suite...");
            syncExec(() -> {
                view = (TestSuiteView) getWindow().getActivePage().findView(TestSuiteView.ID);
            });
            if (view != null) {
                TestSuite suite = view.getInput();
                if (suite != null) {
                    System.out.println("Bringing up file dialog...");
                    syncExec(() -> {
                        FileDialog dialog = new FileDialog(activeShell, SWT.SAVE);
                        if (startingFilePath != null) {
                            dialog.setFileName(startingFilePath);
                        }
                        String[] filterNames = new String[] { "XML Files", "All Files (*)" };
                        String[] filterExtensions = new String[] { "*.xml", "*" };
                        dialog.setFilterNames(filterNames);
                        dialog.setFilterExtensions(filterExtensions);
                        dialog.setOverwrite(true);
                        filePath = dialog.open();
                    });
                    if (filePath != null) {
                        startingFilePath = filePath;
                        System.out.println("filePath: " + filePath);
                        TestSuiteLinker linker = (TestSuiteLinker) view.getMenuListener().getLinker();
                        AnalysisResult result = view.getMenuListener().getAnalysisResult();
                        List<Type> types = linker.getAgreeProgram(result).globalTypes;
                        try {
                            TcgXmlWriter tcgXmlWriter = new TcgXmlWriter(filePath, types, false);
                            tcgXmlWriter.writeSuite(suite);
                            System.out.println("This would be where test suite written to " + filePath);
                        } catch (FileNotFoundException fnfe) {
                            fnfe.printStackTrace();
                        }
                    // TcgXmlWriter consoleWriter = new TcgXmlWriter(null, null, true);
                    // consoleWriter.writeSuite(suite);
                    }
                } else {
                    syncExec(() -> {
                        MessageBox mb = new MessageBox(activeShell);
                        mb.setMessage("Error: no test suite loaded.  Please open a test suite\n");
                        mb.open();
                    });
                }
            } else {
                syncExec(() -> {
                    MessageBox mb = new MessageBox(activeShell);
                    mb.setMessage("Error: test suite view needs to be active in order to save.\n");
                    mb.open();
                });
            }
            deactivateTerminateHandler();
        }
    };
    analysisThread.start();
    return Status.OK_STATUS;
}
Also used : TestSuiteView(com.rockwellcollins.atc.tcg.views.TestSuiteView) TestSuiteLinker(com.rockwellcollins.atc.tcg.views.TestSuiteLinker) FileNotFoundException(java.io.FileNotFoundException) AnalysisResult(jkind.api.results.AnalysisResult) TcgXmlWriter(com.rockwellcollins.atc.tcg.writers.TcgXmlWriter) MessageBox(org.eclipse.swt.widgets.MessageBox) Shell(org.eclipse.swt.widgets.Shell) Type(jkind.lustre.Type) TestSuite(com.rockwellcollins.atc.tcg.suite.TestSuite) FileDialog(org.eclipse.swt.widgets.FileDialog)

Example 18 with AnalysisResult

use of jkind.api.results.AnalysisResult in project AGREE by loonwerks.

the class VerifyHandler method runJob.

@Override
protected final IStatus runJob(Element root, IProgressMonitor monitor) {
    handlerService = getWindow().getService(IHandlerService.class);
    if (!(root instanceof ComponentImplementation)) {
        return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Must select an AADL Component Implementation");
    }
    if (isRecursive() && AgreeUtils.usingKind2()) {
        throw new AgreeException("Kind2 only supports monolithic verification");
    }
    try {
        TcgLinkerFactory factory = new TcgLinkerFactory((ComponentImplementation) root, isMonolithic(), isRecursive());
        AnalysisResult result = factory.getAnalysisResult();
        linker = factory.getLinker();
        queue = factory.getWorkQueue();
        showView(result, linker);
        return doAnalysis(root, monitor);
    } catch (Throwable e) {
        String messages = getNestedMessages(e);
        return new Status(IStatus.ERROR, Activator.PLUGIN_ID, 0, messages, e);
    }
}
Also used : ComponentImplementation(org.osate.aadl2.ComponentImplementation) IStatus(org.eclipse.core.runtime.IStatus) Status(org.eclipse.core.runtime.Status) IHandlerService(org.eclipse.ui.handlers.IHandlerService) AgreeException(com.rockwellcollins.atc.agree.analysis.AgreeException) TcgLinkerFactory(com.rockwellcollins.atc.tcg.views.TcgLinkerFactory) AnalysisResult(jkind.api.results.AnalysisResult) CompositeAnalysisResult(jkind.api.results.CompositeAnalysisResult)

Aggregations

AnalysisResult (jkind.api.results.AnalysisResult)18 CompositeAnalysisResult (jkind.api.results.CompositeAnalysisResult)11 ComponentImplementation (org.osate.aadl2.ComponentImplementation)10 AgreeException (com.rockwellcollins.atc.agree.analysis.AgreeException)7 IStatus (org.eclipse.core.runtime.IStatus)6 Status (org.eclipse.core.runtime.Status)6 IHandlerService (org.eclipse.ui.handlers.IHandlerService)6 EphemeralImplementationUtil (com.rockwellcollins.atc.agree.analysis.EphemeralImplementationUtil)5 AgreeASTBuilder (com.rockwellcollins.atc.agree.analysis.ast.AgreeASTBuilder)5 AgreeProgram (com.rockwellcollins.atc.agree.analysis.ast.AgreeProgram)5 Program (jkind.lustre.Program)5 ComponentInstance (org.osate.aadl2.instance.ComponentInstance)5 SystemInstance (org.osate.aadl2.instance.SystemInstance)5 AgreeRenaming (com.rockwellcollins.atc.agree.analysis.AgreeRenaming)4 ArrayList (java.util.ArrayList)3 JRealizabilityResult (jkind.api.results.JRealizabilityResult)3 EObject (org.eclipse.emf.ecore.EObject)3 Activator (com.rockwellcollins.atc.agree.analysis.Activator)2 AgreeLayout (com.rockwellcollins.atc.agree.analysis.AgreeLayout)2 AgreeLogger (com.rockwellcollins.atc.agree.analysis.AgreeLogger)2