From 272d2920562031c727faa2a98488f1582af17465 Mon Sep 17 00:00:00 2001
From: Jonas <jonitro165@gmail.com>
Date: Mon, 23 Mar 2020 19:12:02 +0100
Subject: [PATCH] Added launching of compiler and testmanager, NOT WORKING YET

Needs to be configured, paths and args have to be set properly, launch of testmanager throws error
---
 .../template/Main.jak                         | 36 +++++++++++++++++--
 1 file changed, 33 insertions(+), 3 deletions(-)

diff --git a/src/var/FeatureModelImplGenerator/template/Main.jak b/src/var/FeatureModelImplGenerator/template/Main.jak
index 8cf93aa..7f09b19 100644
--- a/src/var/FeatureModelImplGenerator/template/Main.jak
+++ b/src/var/FeatureModelImplGenerator/template/Main.jak
@@ -2,6 +2,8 @@
 import java.util.List;
 import java.util.ArrayList;
 import java.io.IOException;
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
 
 import org.jdom2.Document;
 import org.jdom2.Element;
@@ -29,11 +31,15 @@ public class Configurator {
 	private List m_aModuleList;
 	//output path
 	private String m_sOutputPath = "resources/output/featuremodel.xml";
-	//TODO: set this
-	//path for test case selector, which has to be launched from this application
-	private String m_sTestCaseSelectorPath;
 	//path to the feature model xml
 	private String m_sFeatureModelPath = "model.xml";
+	//path to the test manager
+	private String m_sTestManagerPath = "../../../build/sim/testmanager.sh";
+	//path to the testcase compliler
+	private String m_sTestCaseCompilerPath = "../../../build/test/compiler/compiler.dll";
+	//arguments for the testcase compiler
+	//TODO: Set paths
+	private String[] m_aCompilerArgs = new String[] {"path1", "path2"};
 	//document representation of the feature model
 	private Document m_oFeatureModelDoc; 
 
@@ -106,6 +112,30 @@ public class Configurator {
 		
 		//create and launch Adapter
 		new Adapter();
+		
+		//TODO launch compiler
+		try {
+			Process oTestCaseCompiler = Runtime.getRuntime().exec("dotnet " + m_sTestManagerPath + m_aCompilerArgs[0] +  " " + m_aCompilerArgs[1]);
+			BufferedReader oOutput = new BufferedReader(new InputStreamReader(oTestCaseCompiler.getInputStream()));
+			String sOutput = null;
+			while ((sOutput = oOutput.readLine()) != null) {
+			    System.out.println(sOutput);
+			}
+		} catch (IOException oEx) {
+			System.out.println("ERROR: launching Testcase Compiler failed: " + oEx.toString());
+		}
+		
+		//TODO launch test manager
+		try {
+			Process oTestManager = Runtime.getRuntime().exec(m_sTestManagerPath);
+			BufferedReader oOutput = new BufferedReader(new InputStreamReader(oTestManager.getInputStream()));
+			String sOutput = null;
+			while ((sOutput = oOutput.readLine()) != null) {
+			    System.out.println(sOutput);
+			}
+		} catch (IOException oEx) {
+			System.out.println("ERROR: launching TestManager failed: " + oEx.toString());
+		}
 	}
 	
 	//get all parents of a given module from the Feature Model file
-- 
GitLab