From 5d0f5e630c32412685b56976dca0ce7ea4ba6e2e Mon Sep 17 00:00:00 2001
From: Rico Bergmann <rico.bergmann1@tu-dresden.de>
Date: Fri, 21 Jun 2019 15:19:10 +0200
Subject: [PATCH] [RSYNC] Fix stuff and extend default workflow

The wrong transformation strategies were chosen before.
---
 .../ttc2019/metamodels/create/Launcher.java   |  4 ++--
 solutions/RSync/src/main/scala/MainApp.scala  | 19 +++++++++++--------
 .../scala/ttc2019/CompleteTTCProcess.scala    |  5 +++--
 3 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/solutions/RSync/src/main/java/ttc2019/metamodels/create/Launcher.java b/solutions/RSync/src/main/java/ttc2019/metamodels/create/Launcher.java
index a23fca3..b93e7f4 100644
--- a/solutions/RSync/src/main/java/ttc2019/metamodels/create/Launcher.java
+++ b/solutions/RSync/src/main/java/ttc2019/metamodels/create/Launcher.java
@@ -46,7 +46,7 @@ public class Launcher {
 			}
 
 			if (valid) {
-				System.out.println(String.format("BDD %2$s matches TT %1$s: all OK", fInputTT.getName(), fOutputBDD.getName()));
+				//System.out.println(String.format("BDD %2$s matches TT %1$s: all OK", fInputTT.getName(), fOutputBDD.getName()));
 			} else {
 				System.err.println(String.format("BDD %2$s does not match TT %1$s: see issues above", fInputTT.getName(), fOutputBDD.getName()));
 				System.exit(2);
@@ -87,7 +87,7 @@ public class Launcher {
 			}
 
 			if (valid) {
-				System.out.println(String.format("BDD %2$s matches TT %1$s: all OK", fInputTT.getName(), fOutputBDD.getName()));
+				//System.out.println(String.format("BDD %2$s matches TT %1$s: all OK", fInputTT.getName(), fOutputBDD.getName()));
 			} else {
 				System.err.println(String.format("BDD %2$s does not match TT %1$s: see issues above", fInputTT.getName(), fOutputBDD.getName()));
 				System.exit(2);
diff --git a/solutions/RSync/src/main/scala/MainApp.scala b/solutions/RSync/src/main/scala/MainApp.scala
index e892842..155b4a6 100644
--- a/solutions/RSync/src/main/scala/MainApp.scala
+++ b/solutions/RSync/src/main/scala/MainApp.scala
@@ -15,10 +15,11 @@ object MainApp extends App {
   var processMode = ProcessMode.BDT
   if (args.length >= 1) {
     args.apply(0) match {
-      case "bdt" => processMode = ProcessMode.BDT
-      case "bdd" => processMode = ProcessMode.BDD
-      case "bdt-u" => processMode = ProcessMode.BDTU
-      case "bdd-u" => processMode = ProcessMode.BDDU
+        // working as intended!
+      case "bdt" => processMode = ProcessMode.BDTU
+      case "bdd" => processMode = ProcessMode.BDDU
+      case "bdt-u" => processMode = ProcessMode.BDT
+      case "bdd-u" => processMode = ProcessMode.BDD
     }
   }
 
@@ -59,6 +60,9 @@ object MainApp extends App {
     } else {
       reportingService.report(benchmarkInfo, Run, benchmarkDuration, Some(MetricMeasurement.printMetricsBDD()))
     }
+
+    CompleteTTCProcess.doWriteOut()
+    CompleteTTCProcess.validateModelEquality()
   })
 
   /** Retrieves information about the benchmark that should be executed.
@@ -72,16 +76,15 @@ object MainApp extends App {
 
   /** Constructs the model file for the generated BDD based on the TT model.
     *
-    * Assuming the TT model file adheres to the pattern `[FILENAME].ttmodel`, the output file will
-    * be `[FILENAME]-generated.bddmodel`.
+    * Assuming the TT model file adheres to the pattern `/some/path/[FILENAME].ttmodel`, the output
+    * file will be `/current/path/[FILENAME]-generated.bddmodel`.
     */
   private def buildBddModelFile(ttModelFile: File): File = {
     val ttModelName = ttModelFile.name
-    val parentDir = ttModelFile.parent
 
     val bddModelName = ttModelName.replace(".ttmodel", "").concat("-generated.bddmodel")
 
-    parentDir / File(bddModelName)
+    File(System.getProperty("user.dir")) / File(bddModelName)
   }
 
 }
diff --git a/solutions/RSync/src/main/scala/ttc2019/CompleteTTCProcess.scala b/solutions/RSync/src/main/scala/ttc2019/CompleteTTCProcess.scala
index cea1df9..2213170 100644
--- a/solutions/RSync/src/main/scala/ttc2019/CompleteTTCProcess.scala
+++ b/solutions/RSync/src/main/scala/ttc2019/CompleteTTCProcess.scala
@@ -68,7 +68,8 @@ object CompleteTTCProcess extends App {
     * [[TTCProcessConfiguration process configuration]] specified during
     * [[initialize() initialization]] '''after transformation'''.
     */
-  def writeBdd(): Unit = writeOut.generateEverything(processConfig.bddFileName)
+  def doWriteOut(): Unit = writeOut.generateEverything(processConfig.bddFileName)
+
 
   /** Checks, whether the generated BDD and the original TT work as expected (after
     * transformation!).
@@ -86,7 +87,7 @@ object CompleteTTCProcess extends App {
     load()
     run()
     printModelElements()
-    writeBdd()
+    doWriteOut()
     validateModelEquality()
   }
 
-- 
GitLab