From c9c9879606aa3da5def3539f0b70eb2cdbe4a02a Mon Sep 17 00:00:00 2001
From: dblouin <dominique.blouin@telecom-paristech.fr>
Date: Thu, 21 Dec 2017 21:11:13 +0100
Subject: [PATCH] Fixing problems with test resources being copied in different
 structure by Gradle build

---
 .../test/TestGTURTLEModeling.launch              |  2 +-
 .../test/TestRshClient.launch                    |  2 +-
 .../test/TestTtoolAll.launch                     |  2 +-
 ttool/src/test/java/test/AbstractTest.java       | 16 ++++++++++++++++
 4 files changed, 19 insertions(+), 3 deletions(-)
 create mode 100644 ttool/src/test/java/test/AbstractTest.java

diff --git a/ttool/launch_configurations/test/TestGTURTLEModeling.launch b/ttool/launch_configurations/test/TestGTURTLEModeling.launch
index d7f0ff9e7c..f163e62e3f 100644
--- a/ttool/launch_configurations/test/TestGTURTLEModeling.launch
+++ b/ttool/launch_configurations/test/TestGTURTLEModeling.launch
@@ -12,5 +12,5 @@
 <stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
 <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="ui.TestGTURTLEModeling"/>
 <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="ttool"/>
-<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:ttool/src/test}"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dresources_dir=&quot;src/test/resources/&quot;"/>
 </launchConfiguration>
diff --git a/ttool/launch_configurations/test/TestRshClient.launch b/ttool/launch_configurations/test/TestRshClient.launch
index cf13d1ea20..fe3aded26a 100644
--- a/ttool/launch_configurations/test/TestRshClient.launch
+++ b/ttool/launch_configurations/test/TestRshClient.launch
@@ -12,5 +12,5 @@
 <stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
 <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="launcher.TestRshClient"/>
 <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="ttool"/>
-<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:ttool/src/test}"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dresources_dir=&quot;src/test/resources/&quot;"/>
 </launchConfiguration>
diff --git a/ttool/launch_configurations/test/TestTtoolAll.launch b/ttool/launch_configurations/test/TestTtoolAll.launch
index f3e6526853..827dec4f0b 100644
--- a/ttool/launch_configurations/test/TestTtoolAll.launch
+++ b/ttool/launch_configurations/test/TestTtoolAll.launch
@@ -13,5 +13,5 @@
 <booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
 <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value=""/>
 <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="ttool"/>
-<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:ttool/src/test}"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dresources_dir=&quot;src/test/resources/&quot;"/>
 </launchConfiguration>
diff --git a/ttool/src/test/java/test/AbstractTest.java b/ttool/src/test/java/test/AbstractTest.java
new file mode 100644
index 0000000000..385b84efd3
--- /dev/null
+++ b/ttool/src/test/java/test/AbstractTest.java
@@ -0,0 +1,16 @@
+package test;
+
+public abstract class AbstractTest {
+	
+	protected static String RESOURCES_DIR;
+
+	protected static String getBaseResourcesDir() {
+    	final String systemPropResDir = System.getProperty( "resources_dir" );
+    	
+    	if ( systemPropResDir == null ) {
+    		return "resources/test/";
+    	}
+
+   		return systemPropResDir;
+	}
+}
-- 
GitLab