]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - org.argeo.slc.spring/ext/test/org/argeo/slc/core/execution/AbstractExecutionFlowTestCase.java
Remove old license headers
[gpl/argeo-slc.git] / org.argeo.slc.spring / ext / test / org / argeo / slc / core / execution / AbstractExecutionFlowTestCase.java
index edb383cb573db6eea57168224ad2d82c33ac27f2..3a5e8a75b51fd94c9c5224372386bb015a977965 100644 (file)
@@ -1,83 +1,68 @@
-/*\r
- * Copyright (C) 2007-2012 Argeo GmbH\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- *         http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package org.argeo.slc.core.execution;\r
-\r
-import junit.framework.TestCase;\r
-\r
-import org.apache.commons.logging.Log;\r
-import org.apache.commons.logging.LogFactory;\r
-import org.argeo.slc.execution.ExecutionContext;\r
-import org.argeo.slc.execution.ExecutionFlow;\r
-import org.argeo.slc.runtime.test.SimpleTestResult;\r
-import org.argeo.slc.test.TestResultPart;\r
-import org.argeo.slc.test.TestStatus;\r
-import org.springframework.context.ConfigurableApplicationContext;\r
-import org.springframework.context.support.ClassPathXmlApplicationContext;\r
-\r
-public abstract class AbstractExecutionFlowTestCase extends TestCase {\r
-\r
-       protected final Log log = LogFactory.getLog(getClass());\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,\r
-                       int expectedStatus) {\r
-               for (TestResultPart part : testResult.getParts()) {\r
-                       if (part.getStatus() != expectedStatus) {\r
-                               fail("Error found in TestResult: " + part.getMessage());\r
-                       }\r
-               }\r
-       }\r
-\r
-       protected ConfigurableApplicationContext createApplicationContext(\r
-                       String applicationContextSuffix) {\r
-               ConfigurableApplicationContext applicationContext = new ClassPathXmlApplicationContext(\r
-                               inPackage(applicationContextSuffix));\r
-               // applicationContext.start();\r
-               return applicationContext;\r
-       }\r
-\r
-       protected void configureAndExecuteSlcFlow(String applicationContextSuffix,\r
-                       String beanName) {\r
-               ConfigurableApplicationContext applicationContext = createApplicationContext(applicationContextSuffix);\r
-               ExecutionContext executionContext = (ExecutionContext) applicationContext\r
-                               .getBean("executionContext");\r
-               ExecutionFlow executionFlow = (ExecutionFlow) applicationContext\r
-                               .getBean(beanName);\r
-               if (executionFlow instanceof DefaultExecutionFlow)\r
-                       ((DefaultExecutionFlow) executionFlow)\r
-                                       .setExecutionContext(executionContext);\r
-               try {\r
-                       executionContext.beforeFlow(executionFlow);\r
-                       executionFlow.run();\r
-               } finally {\r
-                       executionContext.afterFlow(executionFlow);\r
-               }\r
-               applicationContext.close();\r
-       }\r
-\r
-       protected String inPackage(String suffix) {\r
-               String prefix = getClass().getPackage().getName().replace('.', '/');\r
-               return prefix + '/' + suffix;\r
-       }\r
-}\r
+package org.argeo.slc.core.execution;
+
+import junit.framework.TestCase;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.argeo.slc.execution.ExecutionContext;
+import org.argeo.slc.execution.ExecutionFlow;
+import org.argeo.slc.runtime.test.SimpleTestResult;
+import org.argeo.slc.test.TestResultPart;
+import org.argeo.slc.test.TestStatus;
+import org.springframework.context.ConfigurableApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+public abstract class AbstractExecutionFlowTestCase extends TestCase {
+
+       protected final Log log = LogFactory.getLog(getClass());
+
+       protected void logException(Throwable ex) {
+               log.info("Got Exception of class " + ex.getClass().toString()
+                               + " with message '" + ex.getMessage() + "'.");
+       }
+
+       protected void validateTestResult(SimpleTestResult testResult) {
+               validateTestResult(testResult, TestStatus.PASSED);
+       }
+
+       protected void validateTestResult(SimpleTestResult testResult,
+                       int expectedStatus) {
+               for (TestResultPart part : testResult.getParts()) {
+                       if (part.getStatus() != expectedStatus) {
+                               fail("Error found in TestResult: " + part.getMessage());
+                       }
+               }
+       }
+
+       protected ConfigurableApplicationContext createApplicationContext(
+                       String applicationContextSuffix) {
+               ConfigurableApplicationContext applicationContext = new ClassPathXmlApplicationContext(
+                               inPackage(applicationContextSuffix));
+               // applicationContext.start();
+               return applicationContext;
+       }
+
+       protected void configureAndExecuteSlcFlow(String applicationContextSuffix,
+                       String beanName) {
+               ConfigurableApplicationContext applicationContext = createApplicationContext(applicationContextSuffix);
+               ExecutionContext executionContext = (ExecutionContext) applicationContext
+                               .getBean("executionContext");
+               ExecutionFlow executionFlow = (ExecutionFlow) applicationContext
+                               .getBean(beanName);
+               if (executionFlow instanceof DefaultExecutionFlow)
+                       ((DefaultExecutionFlow) executionFlow)
+                                       .setExecutionContext(executionContext);
+               try {
+                       executionContext.beforeFlow(executionFlow);
+                       executionFlow.run();
+               } finally {
+                       executionContext.afterFlow(executionFlow);
+               }
+               applicationContext.close();
+       }
+
+       protected String inPackage(String suffix) {
+               String prefix = getClass().getPackage().getName().replace('.', '/');
+               return prefix + '/' + suffix;
+       }
+}