Browse Source

[YAKHMI-1082] SCTUnit tests für Local Reactions ohne Events

Added tests for Java, C, C++ and Interpreter
malknet42 11 years ago
parent
commit
18b182266a
21 changed files with 530 additions and 18 deletions
  1. 26 0
      test-plugins/org.yakindu.sct.generator.c.test/gtests/LocalReactions/LocalReactions.cc
  2. 8 0
      test-plugins/org.yakindu.sct.generator.c.test/gtests/LocalReactions/LocalReactions.sgen
  3. 8 0
      test-plugins/org.yakindu.sct.generator.c.test/model/test.sgen
  4. 7 6
      test-plugins/org.yakindu.sct.generator.c.test/test-gen/org/yakindu/sct/generator/c/test/AllTests.java
  5. 39 0
      test-plugins/org.yakindu.sct.generator.c.test/test-gen/org/yakindu/sct/generator/c/test/LocalReactions.java
  6. 8 0
      test-plugins/org.yakindu.sct.generator.cpp.test/gtests/LocalReactionsTest/LocalReactions.sgen
  7. 23 0
      test-plugins/org.yakindu.sct.generator.cpp.test/gtests/LocalReactionsTest/LocalReactionsTest.cc
  8. 8 0
      test-plugins/org.yakindu.sct.generator.cpp.test/model/test.sgen
  9. 4 4
      test-plugins/org.yakindu.sct.generator.cpp.test/test-gen/org/yakindu/sct/generator/cpp/test/AllTestsTest.java
  10. 39 0
      test-plugins/org.yakindu.sct.generator.cpp.test/test-gen/org/yakindu/sct/generator/cpp/test/LocalReactionsTest.java
  11. 12 0
      test-plugins/org.yakindu.sct.generator.java.test/model/model.sgen
  12. 10 0
      test-plugins/org.yakindu.sct.generator.java.test/model/test.sgen
  13. 14 0
      test-plugins/org.yakindu.sct.generator.java.test/src-gen/org/yakindu/scr/localreactions/ILocalReactionsStatemachine.java
  14. 135 0
      test-plugins/org.yakindu.sct.generator.java.test/src-gen/org/yakindu/scr/localreactions/LocalReactionsStatemachine.java
  15. 4 4
      test-plugins/org.yakindu.sct.generator.java.test/test-gen/org/yakindu/sct/generator/java/test/AllTestsTest.java
  16. 46 0
      test-plugins/org.yakindu.sct.generator.java.test/test-gen/org/yakindu/sct/generator/java/test/LocalReactionsTest.java
  17. 8 0
      test-plugins/org.yakindu.sct.simulation.core.sexec.test/model/test.sgen
  18. 4 4
      test-plugins/org.yakindu.sct.simulation.core.sexec.test/test-gen/org/yakindu/sct/simulation/core/sexec/test/AllTestsTest.java
  19. 43 0
      test-plugins/org.yakindu.sct.simulation.core.sexec.test/test-gen/org/yakindu/sct/simulation/core/sexec/test/LocalReactionsTest.java
  20. 72 0
      test-plugins/org.yakindu.sct.test.models/testmodels/SCTUnit/LocalReactions.sct
  21. 12 0
      test-plugins/org.yakindu.sct.test.models/tests/LocalReactions.sctunit

+ 26 - 0
test-plugins/org.yakindu.sct.generator.c.test/gtests/LocalReactions/LocalReactions.cc

@@ -0,0 +1,26 @@
+/**
+* Copyright (c) 2014 committers of YAKINDU and others.
+* All rights reserved. This program and the accompanying materials
+* are made available under the terms of the Eclipse Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/epl-v10.html
+*
+* Contributors:
+*     committers of YAKINDU - initial API and implementation
+*/
+#include <string>
+#include "gtest/gtest.h"
+#include "LocalReactions.h"
+
+
+LocalReactions handle;
+
+TEST(StatemachineTest, LocalReactionsTest) {
+	localReactions_init(&handle);
+	localReactions_enter(&handle);
+	EXPECT_TRUE(localReactions_isActive(&handle, LocalReactions_A));
+	localReactions_runCycle(&handle);
+	EXPECT_TRUE(localReactionsIface_get_x(&handle) == 1);
+}
+
+		

+ 8 - 0
test-plugins/org.yakindu.sct.generator.c.test/gtests/LocalReactions/LocalReactions.sgen

@@ -0,0 +1,8 @@
+GeneratorModel for yakindu::c {
+	statechart LocalReactions {
+		feature Outlet {
+			targetProject = "gtests"
+			targetFolder = "LocalReactions"
+		}
+	}
+}

+ 8 - 0
test-plugins/org.yakindu.sct.generator.c.test/model/test.sgen

@@ -192,6 +192,14 @@ GeneratorModel for sctunit::c {
 			targetFolder = "test-gen"			
 		}			
 	}
+	
+	test LocalReactions{
+		
+		feature Outlet{ 
+			targetProject = "org.yakindu.sct.generator.c.test" 
+			targetFolder = "test-gen"			
+		}			
+	}
 		 
 	test LogicalAndTests{
 		

+ 7 - 6
test-plugins/org.yakindu.sct.generator.c.test/test-gen/org/yakindu/sct/generator/c/test/AllTests.java

@@ -22,12 +22,13 @@ import org.junit.runners.Suite.SuiteClasses;
 		ExitState.class, FeatureCalls.class, Guard.class, GuardedEntry.class,
 		GuardedExit.class, HistoryWithoutInitialStep.class,
 		InEventLifeCycle.class, IntegerExpressions.class,
-		InternalEventLifeCycle.class, LogicalAndTests.class,
-		LogicalOrTests.class, NamedInterfaceAccess.class,
-		OutEventLifeCycle.class, Parenthesis.class, PriorityValues.class,
-		RaiseEvent.class, SameNameDifferentRegion.class, ShallowHistory.class,
-		SimpleEvent.class, StatechartLocalReactions.class,
-		SimpleHierachy.class, StateIsActive.class, StaticChoice.class,
+		InternalEventLifeCycle.class, LocalReactions.class,
+		LogicalAndTests.class, LogicalOrTests.class,
+		NamedInterfaceAccess.class, OutEventLifeCycle.class, Parenthesis.class,
+		PriorityValues.class, RaiseEvent.class, SameNameDifferentRegion.class,
+		ShallowHistory.class, SimpleEvent.class,
+		StatechartLocalReactions.class, SimpleHierachy.class,
+		StateIsActive.class, StaticChoice.class,
 		STextKeywordsInStatesAndRegions.class, StringExpressions.class,
 		SyncFork.class, SyncJoin.class, TransitionWithoutCondition.class,
 		ValuedEvents.class})

+ 39 - 0
test-plugins/org.yakindu.sct.generator.c.test/test-gen/org/yakindu/sct/generator/c/test/LocalReactions.java

@@ -0,0 +1,39 @@
+/**
+ * Copyright (c) 2014 committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     committers of YAKINDU - initial API and implementation
+ */
+package org.yakindu.sct.generator.c.test;
+
+import java.util.Collection;
+
+import org.junit.Before;
+import org.junit.runner.RunWith;
+import org.yakindu.sct.generator.c.gtest.GTest;
+import org.yakindu.sct.generator.c.gtest.GTestRunner;
+import org.yakindu.sct.generator.c.gtest.GTestHelper;
+
+@GTest(sourceFile = "gtests/LocalReactions/LocalReactions.cc", program = "gtests/LocalReactions/LocalReactions", model = "testmodels/SCTUnit/LocalReactions.sct")
+@RunWith(GTestRunner.class)
+public class LocalReactions {
+
+	protected final GTestHelper helper = new GTestHelper(this) {
+
+		@Override
+		protected void getSourceFiles(Collection<String> files) {
+			super.getSourceFiles(files);
+			files.add(getFileName(getTestProgram()) + ".c");
+		}
+	};
+
+	@Before
+	public void setUp() {
+		helper.generate();
+		helper.compile();
+	}
+}

+ 8 - 0
test-plugins/org.yakindu.sct.generator.cpp.test/gtests/LocalReactionsTest/LocalReactions.sgen

@@ -0,0 +1,8 @@
+GeneratorModel for yakindu::cpp {
+	statechart LocalReactions {
+		feature Outlet {
+			targetProject = "gtests"
+			targetFolder = "LocalReactionsTest"
+		}
+	}
+}

+ 23 - 0
test-plugins/org.yakindu.sct.generator.cpp.test/gtests/LocalReactionsTest/LocalReactionsTest.cc

@@ -0,0 +1,23 @@
+/**
+* Copyright (c) 2014 committers of YAKINDU and others.
+* All rights reserved. This program and the accompanying materials
+* are made available under the terms of the Eclipse Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/epl-v10.html
+*
+* Contributors:
+*     committers of YAKINDU - initial API and implementation
+*/
+#include <string>
+#include "gtest/gtest.h"
+#include "LocalReactions.h"
+
+TEST(StatemachineTest, LocalReactionsTest) {
+	LocalReactions* statechart = new LocalReactions();
+	statechart->init();
+	statechart->enter();
+	EXPECT_TRUE(statechart->isActive(LocalReactions::A));
+	statechart->runCycle();
+	EXPECT_TRUE(statechart->getSCInterface()->get_x()== 1);
+	delete statechart;
+}

+ 8 - 0
test-plugins/org.yakindu.sct.generator.cpp.test/model/test.sgen

@@ -192,6 +192,14 @@ GeneratorModel for sctunit::cpp {
 			targetFolder = "test-gen"			
 		}			
 	}
+	
+	test LocalReactions{
+		
+		feature Outlet{ 
+			targetProject = "org.yakindu.sct.generator.cpp.test" 
+			targetFolder = "test-gen"			
+		}			
+	}
 		 
 	test LogicalAndTests{
 		

+ 4 - 4
test-plugins/org.yakindu.sct.generator.cpp.test/test-gen/org/yakindu/sct/generator/cpp/test/AllTestsTest.java

@@ -23,10 +23,10 @@ import org.junit.runners.Suite.SuiteClasses;
 		FeatureCallsTest.class, GuardTest.class, GuardedEntryTest.class,
 		GuardedExitTest.class, HistoryWithoutInitialStepTest.class,
 		InEventLifeCycleTest.class, IntegerExpressionsTest.class,
-		InternalEventLifeCycleTest.class, LogicalAndTestsTest.class,
-		LogicalOrTestsTest.class, NamedInterfaceAccessTest.class,
-		OutEventLifeCycleTest.class, ParenthesisTest.class,
-		PriorityValuesTest.class, RaiseEventTest.class,
+		InternalEventLifeCycleTest.class, LocalReactionsTest.class,
+		LogicalAndTestsTest.class, LogicalOrTestsTest.class,
+		NamedInterfaceAccessTest.class, OutEventLifeCycleTest.class,
+		ParenthesisTest.class, PriorityValuesTest.class, RaiseEventTest.class,
 		SameNameDifferentRegionTest.class, ShallowHistoryTest.class,
 		SimpleEventTest.class, StatechartLocalReactionsTest.class,
 		SimpleHierachyTest.class, StateIsActiveTest.class,

+ 39 - 0
test-plugins/org.yakindu.sct.generator.cpp.test/test-gen/org/yakindu/sct/generator/cpp/test/LocalReactionsTest.java

@@ -0,0 +1,39 @@
+/**
+ * Copyright (c) 2014 committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     committers of YAKINDU - initial API and implementation
+ */
+package org.yakindu.sct.generator.cpp.test;
+
+import java.util.Collection;
+
+import org.junit.Before;
+import org.junit.runner.RunWith;
+import org.yakindu.sct.generator.c.gtest.GTest;
+import org.yakindu.sct.generator.c.gtest.GTestRunner;
+import org.yakindu.sct.generator.c.gtest.GTestHelper;
+
+@GTest(sourceFile = "gtests/LocalReactionsTest/LocalReactionsTest.cc", program = "gtests/LocalReactionsTest/LocalReactions", model = "testmodels/SCTUnit/LocalReactions.sct")
+@RunWith(GTestRunner.class)
+public class LocalReactionsTest {
+
+	protected final GTestHelper helper = new GTestHelper(this) {
+
+		@Override
+		protected void getSourceFiles(Collection<String> files) {
+			super.getSourceFiles(files);
+			files.add(getFileName(getTestProgram()) + ".cpp");
+		}
+	};
+
+	@Before
+	public void setUp() {
+		helper.generate();
+		helper.compile();
+	}
+}

+ 12 - 0
test-plugins/org.yakindu.sct.generator.java.test/model/model.sgen

@@ -292,6 +292,18 @@ GeneratorModel for yakindu::java {
 			RuntimeService = true
  		}
 	}		
+	
+	statechart LocalReactions {
+		feature Outlet {
+			targetProject = "org.yakindu.sct.generator.java.test"
+			targetFolder = "src-gen"
+		}
+
+		feature GeneralFeatures {
+			TimerService = true
+			RuntimeService = true
+ 		}
+	}	
 		
 	statechart LogicalAnd {
 			feature Outlet {

+ 10 - 0
test-plugins/org.yakindu.sct.generator.java.test/model/test.sgen

@@ -194,6 +194,16 @@ GeneratorModel for sctunit::java {
 		}			
 	}
 		
+		
+	test LocalReactions{
+		
+		feature Outlet{ 
+			targetProject = "org.yakindu.sct.generator.java.test" 
+			targetFolder = "test-gen"			
+		}			
+	}	
+		
+		
 	test LogicalAndTests{
 		
 		feature Outlet{ 

+ 14 - 0
test-plugins/org.yakindu.sct.generator.java.test/src-gen/org/yakindu/scr/localreactions/ILocalReactionsStatemachine.java

@@ -0,0 +1,14 @@
+package org.yakindu.scr.localreactions;
+import org.yakindu.scr.IStatemachine;
+
+public interface ILocalReactionsStatemachine extends IStatemachine {
+
+	public interface SCInterface {
+		public long getX();
+		public void setX(long value);
+
+	}
+
+	public SCInterface getSCInterface();
+
+}

+ 135 - 0
test-plugins/org.yakindu.sct.generator.java.test/src-gen/org/yakindu/scr/localreactions/LocalReactionsStatemachine.java

@@ -0,0 +1,135 @@
+package org.yakindu.scr.localreactions;
+
+public class LocalReactionsStatemachine implements ILocalReactionsStatemachine {
+
+	private final class SCInterfaceImpl implements SCInterface {
+
+		private long x;
+
+		public long getX() {
+			return x;
+		}
+
+		public void setX(long value) {
+			this.x = value;
+		}
+
+	}
+
+	private SCInterfaceImpl sCInterface;
+
+	public enum State {
+		main_region_A, $NullState$
+	};
+
+	private final State[] stateVector = new State[1];
+
+	private int nextStateIndex;
+
+	public LocalReactionsStatemachine() {
+
+		sCInterface = new SCInterfaceImpl();
+	}
+
+	public void init() {
+		for (int i = 0; i < 1; i++) {
+			stateVector[i] = State.$NullState$;
+		}
+
+		clearEvents();
+		clearOutEvents();
+
+		sCInterface.x = 0;
+	}
+
+	public void enter() {
+		entryAction();
+
+		nextStateIndex = 0;
+		stateVector[0] = State.main_region_A;
+	}
+
+	public void exit() {
+		switch (stateVector[0]) {
+			case main_region_A :
+				nextStateIndex = 0;
+				stateVector[0] = State.$NullState$;
+				break;
+
+			default :
+				break;
+		}
+
+		exitAction();
+	}
+
+	/**
+	 * This method resets the incoming events (time events included).
+	 */
+	protected void clearEvents() {
+
+	}
+
+	/**
+	 * This method resets the outgoing events.
+	 */
+	protected void clearOutEvents() {
+	}
+
+	/**
+	 * Returns true if the given state is currently active otherwise false.
+	 */
+	public boolean isStateActive(State state) {
+		switch (state) {
+			case main_region_A :
+				return stateVector[0] == State.main_region_A;
+			default :
+				return false;
+		}
+	}
+
+	public SCInterface getSCInterface() {
+		return sCInterface;
+	}
+
+	public long getX() {
+		return sCInterface.getX();
+	}
+
+	public void setX(long value) {
+		sCInterface.setX(value);
+	}
+
+	/* Entry action for statechart 'LocalReactions'. */
+	private void entryAction() {
+	}
+
+	/* Exit action for state 'LocalReactions'. */
+	private void exitAction() {
+	}
+
+	/* The reactions of state A. */
+	private void reactMain_region_A() {
+		if (sCInterface.x == 0) {
+			sCInterface.x += 1;
+		}
+	}
+
+	public void runCycle() {
+
+		clearOutEvents();
+
+		for (nextStateIndex = 0; nextStateIndex < stateVector.length; nextStateIndex++) {
+
+			switch (stateVector[nextStateIndex]) {
+				case main_region_A :
+					reactMain_region_A();
+					break;
+				default :
+					// $NullState$
+			}
+		}
+
+		clearEvents();
+	}
+}

+ 4 - 4
test-plugins/org.yakindu.sct.generator.java.test/test-gen/org/yakindu/sct/generator/java/test/AllTestsTest.java

@@ -23,10 +23,10 @@ import org.junit.runners.Suite.SuiteClasses;
 		FeatureCallsTest.class, GuardTest.class, GuardedEntryTest.class,
 		GuardedExitTest.class, HistoryWithoutInitialStepTest.class,
 		InEventLifeCycleTest.class, IntegerExpressionsTest.class,
-		InternalEventLifeCycleTest.class, LogicalAndTestsTest.class,
-		LogicalOrTestsTest.class, NamedInterfaceAccessTest.class,
-		OutEventLifeCycleTest.class, ParenthesisTest.class,
-		PriorityValuesTest.class, RaiseEventTest.class,
+		InternalEventLifeCycleTest.class, LocalReactionsTest.class,
+		LogicalAndTestsTest.class, LogicalOrTestsTest.class,
+		NamedInterfaceAccessTest.class, OutEventLifeCycleTest.class,
+		ParenthesisTest.class, PriorityValuesTest.class, RaiseEventTest.class,
 		SameNameDifferentRegionTest.class, ShallowHistoryTest.class,
 		SimpleEventTest.class, StatechartLocalReactionsTest.class,
 		SimpleHierachyTest.class, StateIsActiveTest.class,

+ 46 - 0
test-plugins/org.yakindu.sct.generator.java.test/test-gen/org/yakindu/sct/generator/java/test/LocalReactionsTest.java

@@ -0,0 +1,46 @@
+/**
+ * Copyright (c) 2014 committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     committers of YAKINDU - initial API and implementation
+ */
+
+package org.yakindu.sct.generator.java.test;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import static org.junit.Assert.*;
+import org.yakindu.scr.localreactions.LocalReactionsStatemachine;
+import org.yakindu.scr.localreactions.LocalReactionsStatemachine.State;
+/**
+ *  Unit TestCase for LocalReactions
+ */
+@SuppressWarnings("all")
+public class LocalReactionsTest {
+
+	private LocalReactionsStatemachine statemachine;
+
+	@Before
+	public void setUp() {
+		statemachine = new LocalReactionsStatemachine();
+		statemachine.init();
+	}
+
+	@After
+	public void tearDown() {
+		statemachine = null;
+	}
+
+	@Test
+	public void testLocalReactionsTest() {
+		statemachine.enter();
+		assertTrue(statemachine.isStateActive(State.main_region_A));
+		statemachine.runCycle();
+		assertTrue(statemachine.getX() == 1);
+	}
+}

+ 8 - 0
test-plugins/org.yakindu.sct.simulation.core.sexec.test/model/test.sgen

@@ -193,6 +193,14 @@ GeneratorModel for sctunit::interpreter {
 			targetFolder = "test-gen"			
 		}			
 	}
+			
+	test LocalReactions {
+		
+		feature Outlet{ 
+			targetProject = "org.yakindu.sct.simulation.core.sexec.test" 
+			targetFolder = "test-gen"			
+		}			
+	}	
 		
 	test LogicalAndTests {
 		

+ 4 - 4
test-plugins/org.yakindu.sct.simulation.core.sexec.test/test-gen/org/yakindu/sct/simulation/core/sexec/test/AllTestsTest.java

@@ -24,10 +24,10 @@ import org.junit.runners.Suite.SuiteClasses;
 		FeatureCallsTest.class, GuardTest.class, GuardedEntryTest.class,
 		GuardedExitTest.class, HistoryWithoutInitialStepTest.class,
 		InEventLifeCycleTest.class, IntegerExpressionsTest.class,
-		InternalEventLifeCycleTest.class, LogicalAndTestsTest.class,
-		LogicalOrTestsTest.class, NamedInterfaceAccessTest.class,
-		OutEventLifeCycleTest.class, ParenthesisTest.class,
-		PriorityValuesTest.class, RaiseEventTest.class,
+		InternalEventLifeCycleTest.class, LocalReactionsTest.class,
+		LogicalAndTestsTest.class, LogicalOrTestsTest.class,
+		NamedInterfaceAccessTest.class, OutEventLifeCycleTest.class,
+		ParenthesisTest.class, PriorityValuesTest.class, RaiseEventTest.class,
 		SameNameDifferentRegionTest.class, ShallowHistoryTest.class,
 		SimpleEventTest.class, StatechartLocalReactionsTest.class,
 		SimpleHierachyTest.class, StateIsActiveTest.class,

+ 43 - 0
test-plugins/org.yakindu.sct.simulation.core.sexec.test/test-gen/org/yakindu/sct/simulation/core/sexec/test/LocalReactionsTest.java

@@ -0,0 +1,43 @@
+/**
+ * Copyright (c) 2014 committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     committers of YAKINDU - initial API and implementation
+ */
+package org.yakindu.sct.simulation.core.sexec.test;
+import org.eclipse.xtext.junit4.InjectWith;
+import org.eclipse.xtext.junit4.XtextRunner;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.yakindu.sct.model.sexec.ExecutionFlow;
+import org.yakindu.sct.model.sexec.interpreter.test.util.AbstractExecutionFlowTest;
+import org.yakindu.sct.model.sexec.interpreter.test.util.SExecInjectionProvider;
+import org.yakindu.sct.test.models.SCTUnitTestModels;
+import com.google.inject.Inject;
+import static org.junit.Assert.assertTrue;
+/**
+ *  Unit TestCase for LocalReactions
+ */
+@SuppressWarnings("all")
+@RunWith(XtextRunner.class)
+@InjectWith(SExecInjectionProvider.class)
+public class LocalReactionsTest extends AbstractExecutionFlowTest {
+	@Before
+	public void setup() throws Exception {
+		ExecutionFlow flow = models
+				.loadExecutionFlowFromResource("LocalReactions.sct");
+		initInterpreter(flow);
+	}
+	@Test
+	public void LocalReactionsTest() throws Exception {
+		interpreter.enter();
+		assertTrue(isActive("A"));
+		interpreter.runCycle();
+		assertTrue(getInteger("x") == 1);
+	}
+}

+ 72 - 0
test-plugins/org.yakindu.sct.test.models/testmodels/SCTUnit/LocalReactions.sct

@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:sgraph="http://www.yakindu.org/sct/sgraph/2.0.0">
+  <sgraph:Statechart xmi:id="_72u4oOSzEeOiVrie-SZr-g" specification="interface:&#xD;&#xA;var x : integer = 0" name="LocalReactions">
+    <regions xmi:id="_73cqUOSzEeOiVrie-SZr-g" name="main region">
+      <vertices xsi:type="sgraph:Entry" xmi:id="_735WQOSzEeOiVrie-SZr-g">
+        <outgoingTransitions xmi:id="_74DuUOSzEeOiVrie-SZr-g" target="_737ygOSzEeOiVrie-SZr-g"/>
+      </vertices>
+      <vertices xsi:type="sgraph:State" xmi:id="_737ygOSzEeOiVrie-SZr-g" specification="[x == 0 ] / x+= 1" name="A" incomingTransitions="_74DuUOSzEeOiVrie-SZr-g"/>
+    </regions>
+  </sgraph:Statechart>
+  <notation:Diagram xmi:id="_73a1IOSzEeOiVrie-SZr-g" type="org.yakindu.sct.ui.editor.editor.StatechartDiagramEditor" element="_72u4oOSzEeOiVrie-SZr-g" measurementUnit="Pixel">
+    <children xmi:id="_73iJ4OSzEeOiVrie-SZr-g" type="Region" element="_73cqUOSzEeOiVrie-SZr-g">
+      <children xsi:type="notation:DecorationNode" xmi:id="_731r4OSzEeOiVrie-SZr-g" type="RegionName">
+        <styles xsi:type="notation:ShapeStyle" xmi:id="_731r4eSzEeOiVrie-SZr-g"/>
+        <layoutConstraint xsi:type="notation:Location" xmi:id="_731r4uSzEeOiVrie-SZr-g"/>
+      </children>
+      <children xsi:type="notation:Shape" xmi:id="_7326AOSzEeOiVrie-SZr-g" type="RegionCompartment" fontName="Verdana" lineColor="4210752">
+        <children xmi:id="_7359UOSzEeOiVrie-SZr-g" type="Entry" element="_735WQOSzEeOiVrie-SZr-g">
+          <children xmi:id="_7359U-SzEeOiVrie-SZr-g" type="BorderItemLabelContainer">
+            <children xsi:type="notation:DecorationNode" xmi:id="_736kYOSzEeOiVrie-SZr-g" type="BorderItemLabel">
+              <styles xsi:type="notation:ShapeStyle" xmi:id="_736kYeSzEeOiVrie-SZr-g"/>
+              <layoutConstraint xsi:type="notation:Location" xmi:id="_736kYuSzEeOiVrie-SZr-g"/>
+            </children>
+            <styles xsi:type="notation:ShapeStyle" xmi:id="_7359VOSzEeOiVrie-SZr-g" fontName="Verdana" lineColor="4210752"/>
+            <layoutConstraint xsi:type="notation:Bounds" xmi:id="_7359VeSzEeOiVrie-SZr-g"/>
+          </children>
+          <styles xsi:type="notation:ShapeStyle" xmi:id="_7359UeSzEeOiVrie-SZr-g" fontName="Verdana" lineColor="4210752"/>
+          <layoutConstraint xsi:type="notation:Bounds" xmi:id="_736kY-SzEeOiVrie-SZr-g" x="70" y="20"/>
+        </children>
+        <children xmi:id="_73_c4OSzEeOiVrie-SZr-g" type="State" element="_737ygOSzEeOiVrie-SZr-g">
+          <children xsi:type="notation:DecorationNode" xmi:id="_74AD8OSzEeOiVrie-SZr-g" type="StateName">
+            <styles xsi:type="notation:ShapeStyle" xmi:id="_74AD8eSzEeOiVrie-SZr-g"/>
+            <layoutConstraint xsi:type="notation:Location" xmi:id="_74AD8uSzEeOiVrie-SZr-g"/>
+          </children>
+          <children xsi:type="notation:Compartment" xmi:id="_74ArAOSzEeOiVrie-SZr-g" type="StateTextCompartment">
+            <children xsi:type="notation:Shape" xmi:id="_74ArAeSzEeOiVrie-SZr-g" type="StateTextCompartmentExpression" fontName="Verdana" lineColor="4210752">
+              <layoutConstraint xsi:type="notation:Bounds" xmi:id="_74ArAuSzEeOiVrie-SZr-g"/>
+            </children>
+          </children>
+          <children xsi:type="notation:Compartment" xmi:id="_74BSEOSzEeOiVrie-SZr-g" type="StateFigureCompartment"/>
+          <styles xsi:type="notation:ShapeStyle" xmi:id="_73_c4eSzEeOiVrie-SZr-g" fontName="Verdana" fillColor="15981773" lineColor="12632256"/>
+          <styles xsi:type="notation:FontStyle" xmi:id="_73_c4uSzEeOiVrie-SZr-g"/>
+          <styles xsi:type="notation:BooleanValueStyle" xmi:id="_74B5IOSzEeOiVrie-SZr-g" name="isHorizontal" booleanValue="true"/>
+          <layoutConstraint xsi:type="notation:Bounds" xmi:id="_74B5IeSzEeOiVrie-SZr-g" x="40" y="80" width="175"/>
+        </children>
+        <layoutConstraint xsi:type="notation:Bounds" xmi:id="_7326AeSzEeOiVrie-SZr-g"/>
+      </children>
+      <styles xsi:type="notation:ShapeStyle" xmi:id="_73iJ4eSzEeOiVrie-SZr-g" fontName="Verdana" fillColor="15790320" lineColor="12632256"/>
+      <layoutConstraint xsi:type="notation:Bounds" xmi:id="_733hEOSzEeOiVrie-SZr-g" x="220" y="10" width="400" height="400"/>
+    </children>
+    <children xsi:type="notation:Shape" xmi:id="_74KcAOSzEeOiVrie-SZr-g" type="StatechartText" fontName="Verdana" lineColor="4210752">
+      <children xsi:type="notation:DecorationNode" xmi:id="_74KcAuSzEeOiVrie-SZr-g" type="StatechartName">
+        <styles xsi:type="notation:ShapeStyle" xmi:id="_74KcA-SzEeOiVrie-SZr-g"/>
+        <layoutConstraint xsi:type="notation:Location" xmi:id="_74KcBOSzEeOiVrie-SZr-g"/>
+      </children>
+      <children xsi:type="notation:Shape" xmi:id="_74KcBeSzEeOiVrie-SZr-g" type="StatechartTextExpression" fontName="Verdana" lineColor="4210752">
+        <layoutConstraint xsi:type="notation:Bounds" xmi:id="_74KcBuSzEeOiVrie-SZr-g"/>
+      </children>
+      <layoutConstraint xsi:type="notation:Bounds" xmi:id="_74LDEOSzEeOiVrie-SZr-g" x="10" y="10" width="200" height="400"/>
+    </children>
+    <styles xsi:type="notation:DiagramStyle" xmi:id="_73a1IeSzEeOiVrie-SZr-g"/>
+    <edges xmi:id="_74JN4OSzEeOiVrie-SZr-g" type="Transition" element="_74DuUOSzEeOiVrie-SZr-g" source="_7359UOSzEeOiVrie-SZr-g" target="_73_c4OSzEeOiVrie-SZr-g">
+      <children xsi:type="notation:DecorationNode" xmi:id="_74J08eSzEeOiVrie-SZr-g" type="TransitionExpression">
+        <styles xsi:type="notation:ShapeStyle" xmi:id="_74J08uSzEeOiVrie-SZr-g"/>
+        <layoutConstraint xsi:type="notation:Location" xmi:id="_74J08-SzEeOiVrie-SZr-g" y="10"/>
+      </children>
+      <styles xsi:type="notation:ConnectorStyle" xmi:id="_74JN4eSzEeOiVrie-SZr-g" lineColor="4210752"/>
+      <styles xsi:type="notation:FontStyle" xmi:id="_74J08OSzEeOiVrie-SZr-g" fontName="Verdana"/>
+      <bendpoints xsi:type="notation:RelativeBendpoints" xmi:id="_74JN4uSzEeOiVrie-SZr-g" points="[0, 0, 0, 0]$[0, 0, 0, 0]"/>
+    </edges>
+  </notation:Diagram>
+</xmi:XMI>

+ 12 - 0
test-plugins/org.yakindu.sct.test.models/tests/LocalReactions.sctunit

@@ -0,0 +1,12 @@
+
+testgroup LocalReactions for statechart LocalReactions{
+	test LocalReactionsTest { 
+		
+		enter
+		assert active(LocalReactions.main_region.A) 
+		cycle
+		assert x == 1
+		 
+	} 
+}
+