@@ -144,22 +144,18 @@ private void runMfSetup(TestSuite testSuite)
144
144
145
145
private void runMfTearDown (TestSuite testSuite )
146
146
{
147
- IContext tearDownContext = null ;
147
+ IContext tearDownContext = setupContext ;
148
148
if (Core .getMicroflowNames ().contains (testSuite .getModule () + ".TearDown" )) {
149
149
try
150
150
{
151
151
LOG .info ("Running TearDown microflow.." );
152
+ if (tearDownContext == null ) {
153
+ tearDownContext = Core .createSystemContext ();
154
+ }
152
155
if (testSuite .getAutoRollbackMFs ()) {
153
- if (Core .getMicroflowNames ().contains (testSuite .getModule () + ".Setup" )) {
154
- tearDownContext = setupContext ;
155
- } else {
156
- tearDownContext = Core .createSystemContext ();
157
- tearDownContext .startTransaction ();
158
- }
159
- Core .execute (tearDownContext , testSuite .getModule () + ".TearDown" , emptyArguments );
160
- } else {
161
- Core .execute (Core .createSystemContext (), testSuite .getModule () + ".TearDown" , emptyArguments );
156
+ tearDownContext .startTransaction ();
162
157
}
158
+ Core .execute (tearDownContext , testSuite .getModule () + ".TearDown" , emptyArguments );
163
159
}
164
160
catch (Exception e )
165
161
{
@@ -168,9 +164,13 @@ private void runMfTearDown(TestSuite testSuite)
168
164
}
169
165
}
170
166
171
- if (testSuite .getAutoRollbackMFs ()) {
167
+ // Either we had a teardown a teardown or
168
+ if (testSuite .getAutoRollbackMFs () && tearDownContext != null ) {
172
169
tearDownContext .rollbackTransAction ();
173
170
}
171
+
172
+ // Make sure we clean setupContext after running this test/suite
173
+ setupContext = null ;
174
174
}
175
175
176
176
public synchronized void runTestSuites () throws CoreException {
0 commit comments