Add FTA, FMEA, contract-based FTA tests.
Change-Id: I3960bd6a10dce373d5e791071bb7ec3224edf6ce
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/nuXmv_win64.exe b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/nuXmv_win64.exe
deleted file mode 100644
index 0726884..0000000
--- a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/nuXmv_win64.exe
+++ /dev/null
Binary files differ
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/ocra_win64.exe b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/ocra_win64.exe
deleted file mode 100644
index 8ae22d9..0000000
--- a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/ocra_win64.exe
+++ /dev/null
Binary files differ
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP_win64.exe b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP_win64.exe
deleted file mode 100644
index c723be2..0000000
--- a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP_win64.exe
+++ /dev/null
Binary files differ
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/src/org/polarsys/chess/contracts/verificationService/test/runtime/tests/TestSafetyAnalysisOperations.java b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/src/org/polarsys/chess/contracts/verificationService/test/runtime/tests/TestSafetyAnalysisOperations.java
index f226c4d..06e8557 100644
--- a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/src/org/polarsys/chess/contracts/verificationService/test/runtime/tests/TestSafetyAnalysisOperations.java
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/src/org/polarsys/chess/contracts/verificationService/test/runtime/tests/TestSafetyAnalysisOperations.java
@@ -160,6 +160,72 @@
@Test
@PluginResource(projectPath)
+ public void testFMEA() throws Exception {
+
+ // File ossFile = exportModelAsOssFile(testTempOutput);
+
+ String oracleFolder = projectFolderPath + "/VandVResults/FMEA";
+
+ File outputFolder = new File(testOutput);
+ String selectedDirectory = outputFolder.getAbsolutePath();
+ String resultFilePath = selectedDirectory + File.separator + "result_fmea.xml";
+ System.out.println("resultFilePath: " + resultFilePath);
+ // OCRAExecService ocraExecService =
+ // OCRAExecService.getInstance(ChessSystemModel.getInstance());
+ // ocraExecService.executeComputeFaultTree(ossFile, true,
+ // resultFilePath, new NullProgressMonitor(), true);
+
+ XSapExecService xSapExecService = XSapExecService.getInstance();
+
+ File tempFolder = new File(testTempOutput);
+ String selectedTempDirectory = tempFolder.getAbsolutePath();
+ String extendedSmvFileName = selectedTempDirectory + File.separator + "extendedSmv.smv";
+ String expandedFeiFileName = selectedTempDirectory + File.separator + "extendedFei.smv";
+ String feiFileName = selectedTempDirectory + File.separator + "RootElement_System.fei";
+
+ String fmsFileName = selectedTempDirectory + File.separator + "fms.xml";
+ String ftaFmeaCond = "sensor1.sensed_speed_is_present=TRUE";
+
+ Model model = getModel();
+ //IEditorPart editor = TestBasicOperations.openEditor(model);
+ Class umlSelectedComponent = getSystemComponent();
+
+ String fileName = model.getName();
+ String systemQN = umlSelectedComponent.getQualifiedName();
+ List<String> args = new ArrayList<String>();
+ args.add(systemQN);
+ final String systemName = systemQN.substring(systemQN.lastIndexOf("::") + 2);
+ args.add(systemName);
+ String modelName = systemQN; // Used by the
+ args.add(modelName);
+
+ IFile umlFile = TestBasicOperations.getUmlFile(model);
+ URI modelURI = URI.createPlatformResourceURI(umlFile.getFullPath().toString() , true);
+
+ // Generate the monolithic SMV file
+ File smvFile = TestBasicOperations.exportModelAsMonolithicSmvFile(selectedTempDirectory, umlSelectedComponent);
+ String smvFileName = smvFile.getAbsolutePath();
+
+
+ // Generate the FEI file
+ GenerateFaultExtensions genFei = new GenerateFaultExtensions(modelURI, tempFolder, args);
+ genFei.doGenerate(null);
+
+ // Expand the FEI file
+ xSapExecService.expandFaultExtensions(feiFileName, expandedFeiFileName, true);
+ // Extend the SMV model
+ xSapExecService.extendModel(smvFileName, expandedFeiFileName, fmsFileName, extendedSmvFileName, true);
+
+ String ftFileName = selectedDirectory + File.separator + "ft.xml";
+
+ xSapExecService.computeFmea(extendedSmvFileName, fmsFileName, ftaFmeaCond, ftFileName, true);
+
+ verifyDirsAreEqual(Paths.get(oracleFolder), Paths.get(selectedDirectory));
+ verifyDirsAreEqual(Paths.get(selectedDirectory), Paths.get(oracleFolder));
+ }
+
+ @Test
+ @PluginResource(projectPath)
// @Ignore
public void testContractBasedFTA() throws Exception {
@@ -203,6 +269,7 @@
String OCRAFilePath = getConfigTestProperties().getProperty("OCRAFilePath");
String nuXmvFilePath = getConfigTestProperties().getProperty("nuXmvFilePath");
String xSapFilePath = getConfigTestProperties().getProperty("xSapFilePath");
+ String feiFilePath = getConfigTestProperties().getProperty("feiFilePathPath");
// String xSAPFilePath =
// getConfigTestProperties().getProperty("xSAPFilePath");
@@ -210,6 +277,7 @@
File ocraFile = new File(OCRAFilePath);
File nuXmvFile = new File(nuXmvFilePath);
File xSapFile = new File(xSapFilePath);
+ File feiExpFile = new File(feiFilePath);
eu.fbk.tools.adapter.ui.Activator.getDefault().getPreferenceStore().setValue(PreferenceConstants.TOOL_WORKSPACE,
// "C:/Users/Alberto/Google Drive/AMASS
@@ -229,6 +297,10 @@
PreferenceConstants.XSAP_EXECUTABLE,
xSapFile.getAbsolutePath());
+ eu.fbk.tools.adapter.ui.Activator.getDefault().getPreferenceStore().setValue(
+ PreferenceConstants.FEI_EXPANDER_EXECUTABLE,
+ feiExpFile.getAbsolutePath());
+
}
Model getModel() {
diff --git a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/src/org/polarsys/chess/contracts/verificationService/test/runtime/tests/TestVAndVOperations.java b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/src/org/polarsys/chess/contracts/verificationService/test/runtime/tests/TestVAndVOperations.java
index 924e597..72c2958 100644
--- a/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/src/org/polarsys/chess/contracts/verificationService/test/runtime/tests/TestVAndVOperations.java
+++ b/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/src/org/polarsys/chess/contracts/verificationService/test/runtime/tests/TestVAndVOperations.java
@@ -308,6 +308,7 @@
// Project/ARTA_p1/eclipse/git_home/CHESS_FBK/plugins/contracts/org.polarsys.chess.contracts.verificationService.test.runtime/resources/tools/xSAP_win64.exe"
nuXmvFile.getAbsolutePath());
+
}
Model getModel() {