]> git.argeo.org Git - gpl/argeo-slc.git/commitdiff
Add unit test to easily test execution
authorMathieu Baudier <mbaudier@argeo.org>
Wed, 25 Feb 2009 16:22:52 +0000 (16:22 +0000)
committerMathieu Baudier <mbaudier@argeo.org>
Wed, 25 Feb 2009 16:22:52 +0000 (16:22 +0000)
git-svn-id: https://svn.argeo.org/slc/trunk@2180 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

demo/org.argeo.slc.demo.basic/.classpath
demo/org.argeo.slc.demo.basic/pom.xml
demo/org.argeo.slc.demo.basic/src/test/java/org/argeo/slc/demo/basic/BasicExecutionTest.java [new file with mode: 0644]

index df54f154b2b041bb1e4df96b3f7a2f0714973c3d..b5ef387afabc93bc2c852ad9eac7cca6c34252f0 100644 (file)
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
        <classpathentry kind="src" path="src/main/resources"/>
+       <classpathentry kind="src" path="src/test/java"/>
        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
        <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
        <classpathentry kind="output" path="target/classes"/>
index fc6367884d746e985b7012d33c8cfdf6cc39c40f..cc9e1ea1cb4c635a7d5594bffb4d022181ec8d6b 100644 (file)
                        <groupId>org.argeo.slc.runtime</groupId>
                        <artifactId>org.argeo.slc.support.simple</artifactId>
                </dependency>
+
+               <dependency>
+                       <groupId>org.argeo.slc.demo</groupId>
+                       <artifactId>org.argeo.slc.demo.log4j</artifactId>
+                       <version>${project.version}</version>
+               </dependency>
+
        </dependencies>
 </project>
diff --git a/demo/org.argeo.slc.demo.basic/src/test/java/org/argeo/slc/demo/basic/BasicExecutionTest.java b/demo/org.argeo.slc.demo.basic/src/test/java/org/argeo/slc/demo/basic/BasicExecutionTest.java
new file mode 100644 (file)
index 0000000..fc914a1
--- /dev/null
@@ -0,0 +1,36 @@
+package org.argeo.slc.demo.basic;
+
+import junit.framework.TestCase;
+
+import org.argeo.slc.core.execution.ExecutionContext;
+import org.argeo.slc.core.execution.NewExecutionEvent;
+import org.argeo.slc.execution.ExecutionFlow;
+import org.argeo.slc.process.SlcExecution;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+public class BasicExecutionTest extends TestCase {
+       public void testExecution() throws Exception {
+               String[] files = { "conf/main.xml", "conf/imports.xml",
+                               "conf/common.xml", "conf/basic.xml",
+                               "conf/testCases/basic-001.xml", "conf/testCases/basic-002.xml" };
+               ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext(
+                               files);
+               applicationContext.start();
+
+               String bean = "main";
+               ExecutionContext.registerExecutionContext(new ExecutionContext());
+               ExecutionContext.getVariables().put("slc.flows", bean);
+               ExecutionFlow executionFlow = (ExecutionFlow) applicationContext
+                               .getBean(bean);
+               executionFlow.execute();
+
+//              SlcExecution slcExecution = new SlcExecution();
+//              slcExecution.getAttributes().put("slc.flows", "main");
+//              applicationContext.publishEvent(new NewExecutionEvent(this,
+//              slcExecution));
+//              
+//              Thread.sleep(5000);
+
+               applicationContext.close();
+       }
+}