Browse Source

Fixed issues with internal events causing recursive and duplicate runCycle execution - Issue 1983 (#1992)

* Removed recursive runCycle() and duplicate singleCycle() calls.

* include LocalEventtest in AllTests

* regenerated Java generator tests

* ...
Axel Terfloth 7 years ago
parent
commit
b16fd35794

+ 1 - 3
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/eventdriven/EventDrivenStatemachine.xtend

@@ -101,7 +101,7 @@ class EventDrivenStatemachine extends Statemachine {
 				@Override public void run() {
 					«IF hasPayload»«valueIdentifier» = value;«ENDIF»
 					«identifier» = true;					
-					runCycle();
+					singleCycle();
 				}
 			});
 		}
@@ -121,7 +121,6 @@ class EventDrivenStatemachine extends Statemachine {
 			// process queued events
 			while (internalEventQueue.size() > 0) {
 				internalEventQueue.poll().run();
-				singleCycle();
 				clearEvents();
 			}
 			«ENDIF»
@@ -147,6 +146,5 @@ class EventDrivenStatemachine extends Statemachine {
 			}
 		}
 	'''
-	
 
 }

+ 2 - 3
test-plugins/org.yakindu.sct.generator.java.test/src-gen/org/yakindu/scr/eventdriveninternalevent/EventDrivenInternalEventStatemachine.java

@@ -175,7 +175,7 @@ public class EventDrivenInternalEventStatemachine implements IEventDrivenInterna
 		internalEventQueue.add( new Runnable() {
 			@Override public void run() {
 				i1 = true;					
-				runCycle();
+				singleCycle();
 			}
 		});
 	}
@@ -186,7 +186,7 @@ public class EventDrivenInternalEventStatemachine implements IEventDrivenInterna
 		internalEventQueue.add( new Runnable() {
 			@Override public void run() {
 				i2 = true;					
-				runCycle();
+				singleCycle();
 			}
 		});
 	}
@@ -528,7 +528,6 @@ public class EventDrivenInternalEventStatemachine implements IEventDrivenInterna
 		// process queued events
 		while (internalEventQueue.size() > 0) {
 			internalEventQueue.poll().run();
-			singleCycle();
 			clearEvents();
 		}
 	}

+ 3 - 4
test-plugins/org.yakindu.sct.generator.java.test/src-gen/org/yakindu/scr/localevents/LocalEventsStatemachine.java

@@ -192,7 +192,7 @@ public class LocalEventsStatemachine implements ILocalEventsStatemachine {
 		internalEventQueue.add( new Runnable() {
 			@Override public void run() {
 				activate_b = true;					
-				runCycle();
+				singleCycle();
 			}
 		});
 	}
@@ -203,7 +203,7 @@ public class LocalEventsStatemachine implements ILocalEventsStatemachine {
 		internalEventQueue.add( new Runnable() {
 			@Override public void run() {
 				activate_c = true;					
-				runCycle();
+				singleCycle();
 			}
 		});
 	}
@@ -215,7 +215,7 @@ public class LocalEventsStatemachine implements ILocalEventsStatemachine {
 			@Override public void run() {
 				activate_dValue = value;
 				activate_d = true;					
-				runCycle();
+				singleCycle();
 			}
 		});
 	}
@@ -628,7 +628,6 @@ public class LocalEventsStatemachine implements ILocalEventsStatemachine {
 		// process queued events
 		while (internalEventQueue.size() > 0) {
 			internalEventQueue.poll().run();
-			singleCycle();
 			clearEvents();
 		}
 	}

+ 1 - 0
test-plugins/org.yakindu.sct.generator.java.test/test-gen/org/yakindu/sct/generator/java/test/AllTests.java

@@ -50,6 +50,7 @@ import org.junit.runners.Suite.SuiteClasses;
 	LocalReactions.class,
 	LogicalAndTests.class,
 	LogicalOrTests.class,
+	LocalEvents.class,
 	NamedInterfaceAccess.class,
 	OperationsTest.class,
 	OutEventLifeCycle.class,

+ 1 - 1
test-plugins/org.yakindu.sct.test.models/tests/AllTests.sctunit

@@ -43,7 +43,7 @@ testsuite AllTests {
 	LocalReactions,
 	LogicalAndTests, 
 	LogicalOrTests,
-//	LocalEvents,
+	LocalEvents,
 	NamedInterfaceAccess,
 	OperationsTest,
 //	OperationsWithoutBraces,