]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - runtime/org.argeo.slc.support.simple/src/test/java/org/argeo/slc/core/execution/ExecutionFlowTest.java
ExecutionParameterPostProcessor improved (placeholder resolved for each instance)
[gpl/argeo-slc.git] / runtime / org.argeo.slc.support.simple / src / test / java / org / argeo / slc / core / execution / ExecutionFlowTest.java
index d3030e95fca3564d2dfc862a4f68a4addea89bcd..721162ebb17ffa2fd85cfaf96d4ff7b80c46d429 100644 (file)
@@ -21,7 +21,25 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
 public class ExecutionFlowTest extends TestCase {\r
        \r
        protected final Log log = LogFactory.getLog(getClass());\r
-               \r
+                       \r
+       \r
+// to test: case with listener \r
+       \r
+//     public void testMyTest() throws Exception {\r
+//             ConfigurableApplicationContext applicationContext = createApplicationContext("test.xml");\r
+//             log.info("Start Execution");\r
+//             ((ExecutionFlow) applicationContext.getBean("fileDiff.SimulationView_Risk")).execute();\r
+//             applicationContext.close();             \r
+//     }\r
+//     \r
+       public void testMultipleFlows() throws Exception {\r
+               ConfigurableApplicationContext applicationContext = createApplicationContext("multipleFlow.xml");\r
+               log.info("Start Execution");\r
+               ((ExecutionFlow) applicationContext.getBean("flow1")).execute();\r
+               ((ExecutionFlow) applicationContext.getBean("flow2")).execute();\r
+               applicationContext.close();\r
+       }       \r
+       \r
        /**\r
         * Test placeholder resolution in a context without scope execution or proxy\r
         * and with cascading flows (the flow A contains the flow B)\r
@@ -109,28 +127,42 @@ public class ExecutionFlowTest extends TestCase {
                ConfigurableApplicationContext applicationContext = createApplicationContext("listSetMap.xml");\r
                ExecutionFlow executionFlow = (ExecutionFlow) applicationContext.getBean("myFlow");\r
                executionFlow.execute();                \r
-               \r
+                               \r
                validateTestResult((SimpleTestResult) applicationContext.getBean("myTestResult"));\r
                \r
-               BasicTestData res = (BasicTestData) applicationContext.getBean("cascadingComplex.testData");\r
-               log.info("res=" + res.getReached().toString());\r
+//             BasicTestData res = (BasicTestData) applicationContext.getBean("cascadingComplex.testData");\r
+//             log.info("res=" + res.getReached().toString());\r
                \r
                applicationContext.close();             \r
        }               \r
 \r
-\r
+//     public void testListSetMapMultipleFlows() throws Exception {\r
+//             ConfigurableApplicationContext applicationContext = createApplicationContext("listSetMapMultipleFlow.xml");\r
+//             ((ExecutionFlow) applicationContext.getBean("flow1")).execute();\r
+//             SimpleTestResult res = (SimpleTestResult) applicationContext.getBean("myTestResult");\r
+//             validateTestResult(res);                \r
+//             res.getParts().clear();\r
+//             ((ExecutionFlow) applicationContext.getBean("flow2")).execute();\r
+//             validateTestResult(res, TestStatus.FAILED);\r
+//             applicationContext.close();             \r
+//     }                       \r
+       \r
        protected void logException(Throwable ex) {\r
                log.info("Got Exception of class " + ex.getClass().toString()\r
                                + " with message '" + ex.getMessage() + "'.");\r
        }\r
                \r
        protected void validateTestResult(SimpleTestResult testResult) {\r
+               validateTestResult(testResult, TestStatus.PASSED);\r
+       }\r
+       \r
+       protected void validateTestResult(SimpleTestResult testResult, int expectedStatus) {\r
                for(TestResultPart part : testResult.getParts()) {\r
-                       if(part.getStatus() != TestStatus.PASSED) {\r
+                       if(part.getStatus() != expectedStatus) {\r
                                fail("Error found in TestResult: " + part.getMessage());\r
                        }\r
                }               \r
-       }\r
+       }       \r
        \r
        protected ConfigurableApplicationContext createApplicationContext(String applicationContextSuffix) {\r
                ConfigurableApplicationContext applicationContext = new ClassPathXmlApplicationContext(inPackage(applicationContextSuffix));\r