diff --git a/src/main/java/tmltranslator/compareTMLTest/CompareTML.java b/src/main/java/tmltranslator/compareTMLTest/CompareTML.java index ff5d6e1c04a0a38afe60097f4ea72e84dc2c420a..c2224290c71b3d7870b5b9a6de64b504e05fdb56 100644 --- a/src/main/java/tmltranslator/compareTMLTest/CompareTML.java +++ b/src/main/java/tmltranslator/compareTMLTest/CompareTML.java @@ -21,12 +21,14 @@ public class CompareTML { while ((s1 = expectedReader.readLine()) != null) { if (!s1.contains("//") && s1.length() > 0) { + s1 = s1.trim(); expectedString += s1; } } while ((s2 = cloneReader.readLine()) != null){ if (!s2.contains("//") && s2.length() > 0) { + s2 = s2.trim(); cloneString += s2; } } diff --git a/ttool/src/test/java/tmltranslator/CompareTMLTests.java b/ttool/src/test/java/tmltranslator/CompareTMLTests.java index 04f749e1f962d63816d563fb96854ea5153e92a7..2dff6799669b66f648953200d748eab0fcb65615 100644 --- a/ttool/src/test/java/tmltranslator/CompareTMLTests.java +++ b/ttool/src/test/java/tmltranslator/CompareTMLTests.java @@ -1,8 +1,10 @@ package tmltranslator; +import test.AbstractTest; import tmltranslator.compareTMLTest.CompareTML; import org.junit.Before; import org.junit.Test; +import ui.AbstractUITest; import java.io.File; import java.nio.file.Files; @@ -10,17 +12,17 @@ import java.nio.file.Paths; import static org.junit.Assert.*; -public class CompareTMLTests { +public class CompareTMLTests extends AbstractTest { - final static String PATH_TO_TEST_COMPARE_FILE = "test/resources/tmltranslator/input/"; + final static String PATH_TO_TEST_COMPARE_FILE = "/tmltranslator/input/"; - final static String EMPTY_FILE = PATH_TO_TEST_COMPARE_FILE + "file1.tml"; - final static String ONLY_COMMENT_1 = PATH_TO_TEST_COMPARE_FILE + "file2.tml"; - final static String ONLY_COMMENT_2 = PATH_TO_TEST_COMPARE_FILE + "file3.tml"; - final static String COMMENT_AND_CONTEXT_1 = PATH_TO_TEST_COMPARE_FILE + "file4.tml"; - final static String COMMENT_AND_CONTEXT_2 = PATH_TO_TEST_COMPARE_FILE + "file5.tml"; - final static String COMMENT_AND_CONTEXT_3 = PATH_TO_TEST_COMPARE_FILE + "file6.tml"; - final static String COMMENT_AND_CONTEXT_4 = PATH_TO_TEST_COMPARE_FILE + "file7.tml"; + final static String EMPTY_FILE = getBaseResourcesDir() + PATH_TO_TEST_COMPARE_FILE + "file1.tml"; + final static String ONLY_COMMENT_1 = getBaseResourcesDir() + PATH_TO_TEST_COMPARE_FILE + "file2.tml"; + final static String ONLY_COMMENT_2 = getBaseResourcesDir() + PATH_TO_TEST_COMPARE_FILE + "file3.tml"; + final static String COMMENT_AND_CONTEXT_1 = getBaseResourcesDir() + PATH_TO_TEST_COMPARE_FILE + "file4.tml"; + final static String COMMENT_AND_CONTEXT_2 = getBaseResourcesDir() + PATH_TO_TEST_COMPARE_FILE + "file5.tml"; + final static String COMMENT_AND_CONTEXT_3 = getBaseResourcesDir() + PATH_TO_TEST_COMPARE_FILE + "file6.tml"; + final static String COMMENT_AND_CONTEXT_4 = getBaseResourcesDir() + PATH_TO_TEST_COMPARE_FILE + "file7.tml"; // Test true cases diff --git a/ttool/src/test/resources/tmltranslator/input/file2.tml b/ttool/src/test/resources/tmltranslator/input/file2.tml index a7caaedad174b2d05ebbb292fa683dd90fb12107..e3afba85e6e92b534954a17c8d031f0c62be8d8d 100644 --- a/ttool/src/test/resources/tmltranslator/input/file2.tml +++ b/ttool/src/test/resources/tmltranslator/input/file2.tml @@ -1,5 +1,5 @@ -// comment 1 +// TML Application - FORMAT 0.1 +// Application: /home/pham/Documents/TToolDev/TTool/ttool/build/../../modeling/DIPLODOCUS/CloneCompositeComponentTest.xml -// todo1 - +// Generated: Fri Jan 25 16:38:37 CET 2019 diff --git a/ttool/src/test/resources/tmltranslator/input/file3.tml b/ttool/src/test/resources/tmltranslator/input/file3.tml index f197c765e8d9ea0ed71b34fac1d336e07a78af61..b84806eeaf5c34ee266ebee46e39bd6089e5112f 100644 --- a/ttool/src/test/resources/tmltranslator/input/file3.tml +++ b/ttool/src/test/resources/tmltranslator/input/file3.tml @@ -1,6 +1,5 @@ -// comment 2 - // todo1 +// TML Application - FORMAT 0.1 - -// todo2 +// Application: /home/pham/Documents/TToolDev/TTool/ttool/build/../../modeling/DIPLODOCUS/SmartCardProtocol.xml +// Generated: Fri Jan 25 16:38:37 CET 2019 diff --git a/ttool/src/test/resources/tmltranslator/input/file4.tml b/ttool/src/test/resources/tmltranslator/input/file4.tml index 47fca61e097aae176f9a64fffe5b6fab46517467..c0ae71b5b83b4d84ece18c3aa0451823ec1171ed 100644 --- a/ttool/src/test/resources/tmltranslator/input/file4.tml +++ b/ttool/src/test/resources/tmltranslator/input/file4.tml @@ -1,26 +1,80 @@ -// File with comment + context 1 +// TML Application - FORMAT 0.1 +// Application: /home/pham/Documents/TToolDev/TTool/ttool/build/../../modeling/DIPLODOCUS/CloneCompositeComponentTest.xml +// Generated: Fri Jan 25 16:38:37 CET 2019 + // Channels -CHANNEL DIPLODOCUS_C_Design__channel BRBW 4 8 OUT DIPLODOCUS_C_Design__PrimitiveComp1 IN DIPLODOCUS_C_Design__PrimitiveComp2 +CHANNEL DIPLODOCUS_C_Design__channel BRBW 4 8 OUT DIPLODOCUS_C_Design__PrimitiveComp1 IN DIPLODOCUS_C_Design__PrimitiveComp2 + + +CHANNEL DIPLODOCUS_C_Design__channel_0 BRBW 4 8 OUT DIPLODOCUS_C_Design__PrimitiveComp1_0 IN DIPLODOCUS_C_Design__PrimitiveComp2_0 + +// Events +EVENT DIPLODOCUS_C_Design__event_0__DIPLODOCUS_C_Design__event_0() NIB 8 DIPLODOCUS_C_Design__PrimitiveComp1_0 DIPLODOCUS_C_Design__PrimitiveComp2_0 +EVENT DIPLODOCUS_C_Design__event__DIPLODOCUS_C_Design__event() NIB 8 DIPLODOCUS_C_Design__PrimitiveComp1 DIPLODOCUS_C_Design__PrimitiveComp2 + // Requests + TASK DIPLODOCUS_C_Design__PrimitiveComp1 + //Local variables - X = Y + //Behavior + RAND + CASERAND 50 + NOTIFY DIPLODOCUS_C_Design__event__DIPLODOCUS_C_Design__event + ENDCASERAND + CASERAND 50 + WRITE DIPLODOCUS_C_Design__channel 1 + ENDCASERAND + ENDRAND + ENDTASK + TASK DIPLODOCUS_C_Design__PrimitiveComp1_0 + //Local variables + //Behavior + RAND + CASERAND 50 + NOTIFY DIPLODOCUS_C_Design__event_0__DIPLODOCUS_C_Design__event_0 + ENDCASERAND + CASERAND 50 + WRITE DIPLODOCUS_C_Design__channel_0 1 + ENDCASERAND + ENDRAND + ENDTASK + TASK DIPLODOCUS_C_Design__PrimitiveComp2 + //Local variables + //Behavior + RAND + CASERAND 50 + WAIT DIPLODOCUS_C_Design__event__DIPLODOCUS_C_Design__event + ENDCASERAND + CASERAND 50 + READ DIPLODOCUS_C_Design__channel 1 + ENDCASERAND + ENDRAND + ENDTASK -CHANNEL DIPLODOCUS_C_Design__channel_0 BRBW 4 8 OUT DIPLODOCUS_C_Design__PrimitiveComp1_0 IN DIPLODOCUS_C_Design__PrimitiveComp2_0 + TASK DIPLODOCUS_C_Design__PrimitiveComp2_0 + //Local variables + //Behavior + RAND + CASERAND 50 + WAIT DIPLODOCUS_C_Design__event_0__DIPLODOCUS_C_Design__event_0 + ENDCASERAND + CASERAND 50 + READ DIPLODOCUS_C_Design__channel_0 1 + ENDCASERAND + ENDRAND + ENDTASK -//todo1 -// todo2 - //todo3 \ No newline at end of file diff --git a/ttool/src/test/resources/tmltranslator/input/file5.tml b/ttool/src/test/resources/tmltranslator/input/file5.tml index a0828f65bdc405aac61699b40ad292b0fedd84d6..82b6d867801da3a6f6ec1ef9f8b2b88402434c7e 100644 --- a/ttool/src/test/resources/tmltranslator/input/file5.tml +++ b/ttool/src/test/resources/tmltranslator/input/file5.tml @@ -1,22 +1,69 @@ - // File with comment + context 2 - - - - // Channels -CHANNEL DIPLODOCUS_C_Design__channel BRBW 4 8 OUT DIPLODOCUS_C_Design__PrimitiveComp1 IN DIPLODOCUS_C_Design__PrimitiveComp2 - - - - - - X = Y - - - - - - - - - -CHANNEL DIPLODOCUS_C_Design__channel_0 BRBW 4 8 OUT DIPLODOCUS_C_Design__PrimitiveComp1_0 IN DIPLODOCUS_C_Design__PrimitiveComp2_0 \ No newline at end of file +// TML Application - FORMAT 0.1 +// Application: /home/pham/Documents/TToolDev/TTool/ttool/build/../../modeling/DIPLODOCUS/CloneCompositeComponentTest.xml +// Generated: Fri Jan 25 16:38:37 CET 2019 + +// Channels +CHANNEL DIPLODOCUS_C_Design__channel BRBW 4 8 OUT DIPLODOCUS_C_Design__PrimitiveComp1 IN DIPLODOCUS_C_Design__PrimitiveComp2 +CHANNEL DIPLODOCUS_C_Design__channel_0 BRBW 4 8 OUT DIPLODOCUS_C_Design__PrimitiveComp1_0 IN DIPLODOCUS_C_Design__PrimitiveComp2_0 + +// Events +EVENT DIPLODOCUS_C_Design__event_0__DIPLODOCUS_C_Design__event_0() NIB 8 DIPLODOCUS_C_Design__PrimitiveComp1_0 DIPLODOCUS_C_Design__PrimitiveComp2_0 +EVENT DIPLODOCUS_C_Design__event__DIPLODOCUS_C_Design__event() NIB 8 DIPLODOCUS_C_Design__PrimitiveComp1 DIPLODOCUS_C_Design__PrimitiveComp2 + +// Requests + +TASK DIPLODOCUS_C_Design__PrimitiveComp1 + //Local variables + + //Behavior + RAND + CASERAND 50 + NOTIFY DIPLODOCUS_C_Design__event__DIPLODOCUS_C_Design__event + ENDCASERAND + CASERAND 50 + WRITE DIPLODOCUS_C_Design__channel 1 + ENDCASERAND + ENDRAND +ENDTASK + +TASK DIPLODOCUS_C_Design__PrimitiveComp1_0 + //Local variables + + //Behavior + RAND + CASERAND 50 + NOTIFY DIPLODOCUS_C_Design__event_0__DIPLODOCUS_C_Design__event_0 + ENDCASERAND + CASERAND 50 + WRITE DIPLODOCUS_C_Design__channel_0 1 + ENDCASERAND + ENDRAND +ENDTASK + +TASK DIPLODOCUS_C_Design__PrimitiveComp2 + //Local variables + + //Behavior + RAND + CASERAND 50 + WAIT DIPLODOCUS_C_Design__event__DIPLODOCUS_C_Design__event + ENDCASERAND + CASERAND 50 + READ DIPLODOCUS_C_Design__channel 1 + ENDCASERAND + ENDRAND +ENDTASK + +TASK DIPLODOCUS_C_Design__PrimitiveComp2_0 + //Local variables + + //Behavior + RAND + CASERAND 50 + WAIT DIPLODOCUS_C_Design__event_0__DIPLODOCUS_C_Design__event_0 + ENDCASERAND + CASERAND 50 + READ DIPLODOCUS_C_Design__channel_0 1 + ENDCASERAND + ENDRAND +ENDTASK diff --git a/ttool/src/test/resources/tmltranslator/input/file6.tml b/ttool/src/test/resources/tmltranslator/input/file6.tml index bab402541d84a4ed2f1a8a4283ed4d534501f1bb..e9b37285bf966aa9ddff556ae67b209b6b0e1f3b 100644 --- a/ttool/src/test/resources/tmltranslator/input/file6.tml +++ b/ttool/src/test/resources/tmltranslator/input/file6.tml @@ -1,22 +1,69 @@ - // File with comment + context 2 - - - - // Channels -EVENT DIPLODOCUS_C_Design__channel BRBW 4 8 OUT DIPLODOCUS_C_Design__PrimitiveComp1 IN DIPLODOCUS_C_Design__PrimitiveComp2 - - - - - - X = Y - - - - - - - - - -CHANNEL DIPLODOCUS_C_Design__channel_0 BRBW 4 8 OUT DIPLODOCUS_C_Design__PrimitiveComp1_0 IN DIPLODOCUS_C_Design__PrimitiveComp2_0 \ No newline at end of file +// TML Application - FORMAT 0.1 +// Application: /home/pham/Documents/TToolDev/TTool/ttool/build/../../modeling/DIPLODOCUS/CloneCompositeComponentTest.xml +// Generated: Fri Jan 25 16:38:37 CET 2019 + +// Channels +CHANNEL DIPLODOCUS_C_Design__channel BRBW 4 8 OUT DIPLODOCUS_C_Design__PrimitiveComp1 IN DIPLODOCUS_C_Design__PrimitiveComp2 +CHANNEL DIPLODOCUS_C_Design__channel_0 BRBW 4 8 OUT DIPLODOCUS_C_Design__PrimitiveComp1 IN DIPLODOCUS_C_Design__PrimitiveComp2 + +// Events +EVENT DIPLODOCUS_C_Design__event_0__DIPLODOCUS_C_Design__event_0() NIB 8 DIPLODOCUS_C_Design__PrimitiveComp1_0 DIPLODOCUS_C_Design__PrimitiveComp2_0 +EVENT DIPLODOCUS_C_Design__event__DIPLODOCUS_C_Design__event() NIB 8 DIPLODOCUS_C_Design__PrimitiveComp1 DIPLODOCUS_C_Design__PrimitiveComp2 + +// Requests + +TASK DIPLODOCUS_C_Design__PrimitiveComp1 + //Local variables + + //Behavior + RAND + CASERAND 50 + NOTIFY DIPLODOCUS_C_Design__event__DIPLODOCUS_C_Design__event + ENDCASERAND + CASERAND 50 + WRITE DIPLODOCUS_C_Design__channel 1 + ENDCASERAND + ENDRAND +ENDTASK + +TASK DIPLODOCUS_C_Design__PrimitiveComp1_0 + //Local variables + + //Behavior + RAND + CASERAND 50 + NOTIFY DIPLODOCUS_C_Design__event_0__DIPLODOCUS_C_Design__event_0 + ENDCASERAND + CASERAND 50 + WRITE DIPLODOCUS_C_Design__channel_0 1 + ENDCASERAND + ENDRAND +ENDTASK + +TASK DIPLODOCUS_C_Design__PrimitiveComp2 + //Local variables + + //Behavior + RAND + CASERAND 50 + WAIT DIPLODOCUS_C_Design__event__DIPLODOCUS_C_Design__event + ENDCASERAND + CASERAND 50 + READ DIPLODOCUS_C_Design__channel 1 + ENDCASERAND + ENDRAND +ENDTASK + +TASK DIPLODOCUS_C_Design__PrimitiveComp2_0 + //Local variables + + //Behavior + RAND + CASERAND 50 + WAIT DIPLODOCUS_C_Design__event_0__DIPLODOCUS_C_Design__event_0 + ENDCASERAND + CASERAND 50 + READ DIPLODOCUS_C_Design__channel_0 1 + ENDCASERAND + ENDRAND +ENDTASK diff --git a/ttool/src/test/resources/tmltranslator/input/file7.tml b/ttool/src/test/resources/tmltranslator/input/file7.tml index 476f5ce835955923fa6cffdee9d6a84bb8a8e849..9b8524911d253a0838448c8917a8fe29f730fffb 100644 --- a/ttool/src/test/resources/tmltranslator/input/file7.tml +++ b/ttool/src/test/resources/tmltranslator/input/file7.tml @@ -1,30 +1,83 @@ - // File with comment + context 2 +// TML Application - FORMAT 0.1 +// Application: /home/pham/Documents/TToolDev/TTool/ttool/build/../../modeling/DIPLODOCUS/CloneCompositeComponentTest.xml +// Generated: Fri Jan 25 16:38:37 CET 2019 - - - // Channels +// Channels CHANNEL DIPLODOCUS_C_Design__channel BRBW 4 8 OUT DIPLODOCUS_C_Design__PrimitiveComp1 IN DIPLODOCUS_C_Design__PrimitiveComp2 - - - - - - - - - -CHANNEL DIPLODOCUS_C_Design__channel_0 BRBW 4 8 OUT DIPLODOCUS_C_Design__PrimitiveComp1_0 IN DIPLODOCUS_C_Design__PrimitiveComp2_0 - - - - - -CHANNEL DIPLODOCUS_C_Design__channel_0 BRBW 4 8 OUT DIPLODOCUS_C_Design__PrimitiveComp1_0 IN DIPLODOCUS_C_Design__PrimitiveComp2_0 - - - // Event - - - EVENT - - EVENT +CHANNEL DIPLODOCUS_C_Design__channel_0 BRBW 4 8 OUT DIPLODOCUS_C_Design__PrimitiveComp1_0 IN DIPLODOCUS_C_Design__PrimitiveComp2_0 + +// Events +EVENT DIPLODOCUS_C_Design__event_0__DIPLODOCUS_C_Design__event_0() NIB 8 DIPLODOCUS_C_Design__PrimitiveComp1_0 DIPLODOCUS_C_Design__PrimitiveComp2_0 +EVENT DIPLODOCUS_C_Design__event__DIPLODOCUS_C_Design__event() NIB 8 DIPLODOCUS_C_Design__PrimitiveComp1 DIPLODOCUS_C_Design__PrimitiveComp2 + +// Requests + +TASK DIPLODOCUS_C_Design__PrimitiveComp1 + //Local variables + + //Behavior + RAND + CASERAND 50 + NOTIFY DIPLODOCUS_C_Design__event__DIPLODOCUS_C_Design__event + ENDCASERAND + CASERAND 50 + WRITE DIPLODOCUS_C_Design__channel 1 + ENDCASERAND + ENDRAND +ENDTASK + +TASK DIPLODOCUS_C_Design__PrimitiveComp1_0 + //Local variables + + //Behavior + RAND + CASERAND 50 + NOTIFY DIPLODOCUS_C_Design__event_0__DIPLODOCUS_C_Design__event_0 + ENDCASERAND + CASERAND 50 + WRITE DIPLODOCUS_C_Design__channel_0 1 + ENDCASERAND + ENDRAND +ENDTASK + +TASK DIPLODOCUS_C_Design__PrimitiveComp2 + //Local variables + + //Behavior + RAND + CASERAND 50 + WAIT DIPLODOCUS_C_Design__event__DIPLODOCUS_C_Design__event + ENDCASERAND + CASERAND 50 + READ DIPLODOCUS_C_Design__channel 1 + ENDCASERAND + ENDRAND +ENDTASK + +TASK DIPLODOCUS_C_Design__PrimitiveComp2_0 + //Local variables + + //Behavior + RAND + CASERAND 50 + WAIT DIPLODOCUS_C_Design__event_0__DIPLODOCUS_C_Design__event_0 + ENDCASERAND + CASERAND 50 + READ DIPLODOCUS_C_Design__channel_0 1 + ENDCASERAND + ENDRAND +ENDTASK + +TASK DIPLODOCUS_C_Design__PrimitiveComp2_0 + //Local variables + + //Behavior + RAND + CASERAND 50 + WAIT DIPLODOCUS_C_Design__event_0__DIPLODOCUS_C_Design__event_0 + ENDCASERAND + CASERAND 50 + READ DIPLODOCUS_C_Design__channel_0 1 + ENDCASERAND + ENDRAND +ENDTASK