]> SALOME platform Git repositories - tools/siman.git/blobdiff - Workspace/Siman-Common/src/test/splat/service/TestScenarioService.java
Salome HOME
The method createStudy from Python is marked as Transactional in ScenarioService.
[tools/siman.git] / Workspace / Siman-Common / src / test / splat / service / TestScenarioService.java
index e70d404366c3eb9b2d5c026501a76bfb077049ee..7ec5b8bc97f96b237ada7a627628d10548b60fba 100644 (file)
@@ -1047,7 +1047,7 @@ public class TestScenarioService extends BaseTest {
         * <ul>
         * <li>1: The new study must be created. The new product simulation context must be created.</li>
         * <li>2: The new study must be created.</li>
-        * <li>3: The new study must not be created. Exception is thrown.</li>
+        * <li>3: The new study must not be created. Exception must be thrown.</li>
         * </ul>
         * </i>
         * 
@@ -1134,7 +1134,7 @@ public class TestScenarioService extends BaseTest {
         * <ul>
         * <li>1: The new study must be created. The new product simulation context must be created.</li>
         * <li>2: The new study must be created.</li>
-        * <li>3: The new study must not be created. Exception is thrown.</li>
+        * <li>3: The new study must not be created. Exception must be thrown.</li>
         * </ul>
         * </i>
         * 
@@ -1151,6 +1151,8 @@ public class TestScenarioService extends BaseTest {
                LOG.debug(">>>>> BEGIN testCreateStudyFromPython()");
                startNestedTransaction();
 
+               HibernateTemplate ht = getHibernateTemplate();
+
                Database.getInstance().reset();
                _projectSettings.getAllSteps().clear(); // Clear config to be able to load it again
                _projectSettings.configure("classpath:test/som.xml");
@@ -1165,10 +1167,15 @@ public class TestScenarioService extends BaseTest {
                                                "Simulation context type 'product' must be created in the database.");
 
                String productName = "New Test Product " + new Date().toString();
+               
+               ht.flush();
+               ht.clear();
                long studyId1 = _scenarioService.createStudy("goodUser",
                                "Test Study 1", productName, "Test description");
                Assert.assertTrue(studyId1 > 0);
 
+               ht.flush();
+               ht.clear();
                try {
                        _scenarioService.createStudy("badbadUser", "Test Study 2",
                                        productName, "Test description");
@@ -1177,6 +1184,8 @@ public class TestScenarioService extends BaseTest {
                        LOG.debug("Expected exception: " + ipe.getMessage());
                }
 
+               ht.flush();
+               ht.clear();
                long studyId3 = _scenarioService.createStudy("goodUser",
                                "Test Study 3", productName, "Test description");
                Assert.assertTrue(studyId3 > 0);