[jbpm-commits] JBoss JBPM SVN: r2254 - in jbpm3/trunk/modules/examples: src/test/java/org/jbpm/examples/door and 1 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Mon Sep 15 11:16:13 EDT 2008
Author: thomas.diesler at jboss.com
Date: 2008-09-15 11:16:13 -0400 (Mon, 15 Sep 2008)
New Revision: 2254
Added:
jbpm3/trunk/modules/examples/src/test/resources/log4j.xml
Modified:
jbpm3/trunk/modules/examples/pom.xml
jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/door/DoorProcessTest.java
Log:
Enable passing example tests
Modified: jbpm3/trunk/modules/examples/pom.xml
===================================================================
--- jbpm3/trunk/modules/examples/pom.xml 2008-09-15 15:12:00 UTC (rev 2253)
+++ jbpm3/trunk/modules/examples/pom.xml 2008-09-15 15:16:13 UTC (rev 2254)
@@ -1,25 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- ====================================================================== -->
-<!-- -->
-<!-- JBoss, the OpenSource J2EE webOS -->
-<!-- -->
-<!-- Distributable under LGPL license. -->
-<!-- See terms of license at http://www.gnu.org. -->
-<!-- -->
-<!-- ====================================================================== -->
+ <!-- ====================================================================== -->
+ <!-- -->
+ <!-- JBoss, the OpenSource J2EE webOS -->
+ <!-- -->
+ <!-- Distributable under LGPL license. -->
+ <!-- See terms of license at http://www.gnu.org. -->
+ <!-- -->
+ <!-- ====================================================================== -->
-<!-- $Id$ -->
+ <!-- $Id$ -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
-
+
<name>JBoss jBPM3 - Examples</name>
<groupId>org.jbpm.jbpm3</groupId>
<artifactId>jbpm-examples</artifactId>
<packaging>jar</packaging>
-
+
<!-- Parent -->
<parent>
<groupId>org.jbpm.jbpm3</groupId>
@@ -27,7 +27,7 @@
<version>3.3.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
-
+
<!-- Dependencies -->
<dependencies>
<!-- jBPM Dependencies -->
@@ -36,7 +36,7 @@
<artifactId>jbpm-identity</artifactId>
<version>${version}</version>
</dependency>
-
+
<!-- Test Dependencies -->
<dependency>
<groupId>drools</groupId>
@@ -49,19 +49,19 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
</dependency>
<dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <scope>test</scope>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <scope>test</scope>
</dependency>
<dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate</artifactId>
- <scope>provided</scope>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate</artifactId>
+ <scope>provided</scope>
</dependency>
</dependencies>
@@ -72,7 +72,17 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<!-- [JBPM-1290] Integrate example tests in automated testrun -->
- <skipTests>true</skipTests>
+ <excludes>
+ <exclude>org/jbpm/examples/assignment/**</exclude>
+ <exclude>org/jbpm/examples/businesstrip/**</exclude>
+ <exclude>org/jbpm/examples/door/**</exclude>
+ <exclude>org/jbpm/examples/mail/**</exclude>
+ <exclude>org/jbpm/examples/raise/**</exclude>
+ <exclude>org/jbpm/examples/rulesAction/**</exclude>
+ <exclude>org/jbpm/examples/taskinstance/**</exclude>
+ <exclude>org/jbpm/examples/taskmgmt/**</exclude>
+ <exclude>org/jbpm/examples/websale/**</exclude>
+ </excludes>
</configuration>
</plugin>
</plugins>
Modified: jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/door/DoorProcessTest.java
===================================================================
--- jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/door/DoorProcessTest.java 2008-09-15 15:12:00 UTC (rev 2253)
+++ jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/door/DoorProcessTest.java 2008-09-15 15:16:13 UTC (rev 2254)
@@ -1,6 +1,9 @@
package org.jbpm.examples.door;
+import junit.extensions.TestSetup;
+import junit.framework.Test;
import junit.framework.TestCase;
+import junit.framework.TestSuite;
import org.jbpm.JbpmException;
import org.jbpm.graph.def.Node;
@@ -8,34 +11,39 @@
import org.jbpm.graph.exe.ProcessInstance;
import org.jbpm.graph.exe.Token;
-public class DoorProcessTest extends TestCase {
-
-
+public class DoorProcessTest extends TestCase
+{
/**
- * The doorProcess is a reference to the single ProcessDefinition that will be used
- * for all executions in all the tests of this test case.
+ * The doorProcess is a reference to the single ProcessDefinition that will be used for all executions in all the tests of this test case.
*
- * In this case, we'll just store the process definition object in memory in a
- * static member field. In practice, most often process definitions will be
- * deployed to a database.
+ * In this case, we'll just store the process definition object in memory in a static member field. In practice, most often process definitions will be deployed to a
+ * database.
*/
- static ProcessDefinition doorProcess = ProcessDefinition.parseXmlInputStream(
- DoorProcessTest.class.getResourceAsStream("processdefinition.xml")
- );
+ static ProcessDefinition doorProcess;
+ static Node locked, closed, open, openLocked;
+
+ public static Test suite()
+ {
+ return new TestSetup(new TestSuite(DoorProcessTest.class))
+ {
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ doorProcess = ProcessDefinition.parseXmlInputStream(DoorProcessTest.class.getResourceAsStream("processdefinition.xml"));
+ locked = doorProcess.getNode("Locked");
+ closed = doorProcess.getNode("Closed");
+ open = doorProcess.getNode("Open");
+ openLocked = doorProcess.getNode("Open Locked");
+ }
+ };
+ }
- static Node locked = doorProcess.getNode("Locked");
- static Node closed = doorProcess.getNode("Closed");
- static Node open = doorProcess.getNode("Open");
- static Node openLocked = doorProcess.getNode("Open Locked");
-
-
/**
- * This test shows how you can execute one scenario in a test method.
- * Inside the test method, the external triggers (=signals) are provided
- * to a process instance. Then you assert wether the process instance
- * ends up in the expected state.
+ * This test shows how you can execute one scenario in a test method. Inside the test method, the external triggers (=signals) are provided to a process instance.
+ * Then you assert wether the process instance ends up in the expected state.
*/
- public void testScenarioOne() {
+ public void testScenarioOne()
+ {
ProcessInstance processInstance = new ProcessInstance(doorProcess);
Token token = processInstance.getRootToken();
assertEquals("Closed", token.getNode().getName());
@@ -43,63 +51,81 @@
assertEquals("Open", token.getNode().getName());
token.signal("close");
assertEquals("Closed", token.getNode().getName());
- try {
+ try
+ {
token.signal("unlock");
fail("excepted exception");
- } catch (RuntimeException e) {
}
+ catch (RuntimeException e)
+ {
+ }
}
// Below are all the simple state-change tests.
- // Note that you can actually put a token into a given state with
+ // Note that you can actually put a token into a given state with
// the setNode method.
- public void testClosedOpen() {
+ public void testClosedOpen()
+ {
ProcessInstance processInstance = new ProcessInstance(doorProcess);
Token token = processInstance.getRootToken();
token.signal("open");
assertEquals("Open", token.getNode().getName());
}
- public void testClosedLock() {
+ public void testClosedLock()
+ {
ProcessInstance processInstance = new ProcessInstance(doorProcess);
Token token = processInstance.getRootToken();
token.signal("lock");
assertEquals("Locked", token.getNode().getName());
}
- public void testClosedClose() {
+ public void testClosedClose()
+ {
ProcessInstance processInstance = new ProcessInstance(doorProcess);
Token token = processInstance.getRootToken();
- try {
+ try
+ {
token.signal("close");
fail("expected exception");
- } catch (JbpmException e) {
}
+ catch (JbpmException e)
+ {
+ }
}
- public void testClosedUnlock() {
+ public void testClosedUnlock()
+ {
ProcessInstance processInstance = new ProcessInstance(doorProcess);
Token token = processInstance.getRootToken();
- try {
+ try
+ {
token.signal("unlock");
fail("expected exception");
- } catch (JbpmException e) {
}
+ catch (JbpmException e)
+ {
+ }
}
- public void testOpenedOpen() {
+ public void testOpenedOpen()
+ {
ProcessInstance processInstance = new ProcessInstance(doorProcess);
Token token = processInstance.getRootToken();
token.setNode(open);
- try {
+ try
+ {
token.signal("open");
fail("expected exception");
- } catch (JbpmException e) {
}
+ catch (JbpmException e)
+ {
+ }
}
- public void testOpenedLock() {
+ public void testOpenedLock()
+ {
ProcessInstance processInstance = new ProcessInstance(doorProcess);
Token token = processInstance.getRootToken();
token.setNode(open);
@@ -107,7 +133,8 @@
assertEquals("Open Locked", token.getNode().getName());
}
- public void testOpenedClose() {
+ public void testOpenedClose()
+ {
ProcessInstance processInstance = new ProcessInstance(doorProcess);
Token token = processInstance.getRootToken();
token.setNode(open);
@@ -115,51 +142,68 @@
assertEquals("Closed", token.getNode().getName());
}
- public void testOpenedUnlock() {
+ public void testOpenedUnlock()
+ {
ProcessInstance processInstance = new ProcessInstance(doorProcess);
Token token = processInstance.getRootToken();
token.setNode(open);
- try {
+ try
+ {
token.signal("unlock");
fail("expected exception");
- } catch (JbpmException e) {
}
+ catch (JbpmException e)
+ {
+ }
}
- public void testLockedOpen() {
+ public void testLockedOpen()
+ {
ProcessInstance processInstance = new ProcessInstance(doorProcess);
Token token = processInstance.getRootToken();
token.setNode(locked);
- try {
+ try
+ {
token.signal("open");
fail("expected exception");
- } catch (JbpmException e) {
}
+ catch (JbpmException e)
+ {
+ }
}
- public void testLockedLock() {
+ public void testLockedLock()
+ {
ProcessInstance processInstance = new ProcessInstance(doorProcess);
Token token = processInstance.getRootToken();
token.setNode(locked);
- try {
+ try
+ {
token.signal("lock");
fail("expected exception");
- } catch (JbpmException e) {
}
+ catch (JbpmException e)
+ {
+ }
}
- public void testLockedClose() {
+ public void testLockedClose()
+ {
ProcessInstance processInstance = new ProcessInstance(doorProcess);
Token token = processInstance.getRootToken();
token.setNode(locked);
- try {
+ try
+ {
token.signal("close");
fail("expected exception");
- } catch (JbpmException e) {
}
+ catch (JbpmException e)
+ {
+ }
}
- public void testLockedUnlock() {
+ public void testLockedUnlock()
+ {
ProcessInstance processInstance = new ProcessInstance(doorProcess);
Token token = processInstance.getRootToken();
token.setNode(locked);
@@ -167,40 +211,53 @@
assertEquals("Closed", token.getNode().getName());
}
- public void testOpenLockedOpen() {
+ public void testOpenLockedOpen()
+ {
ProcessInstance processInstance = new ProcessInstance(doorProcess);
Token token = processInstance.getRootToken();
token.setNode(openLocked);
- try {
+ try
+ {
token.signal("open");
fail("expected exception");
- } catch (JbpmException e) {
}
+ catch (JbpmException e)
+ {
+ }
}
- public void testOpenLockedLock() {
+ public void testOpenLockedLock()
+ {
ProcessInstance processInstance = new ProcessInstance(doorProcess);
Token token = processInstance.getRootToken();
token.setNode(openLocked);
- try {
+ try
+ {
token.signal("lock");
fail("expected exception");
- } catch (JbpmException e) {
}
+ catch (JbpmException e)
+ {
+ }
}
- public void testOpenLockedClose() {
+ public void testOpenLockedClose()
+ {
ProcessInstance processInstance = new ProcessInstance(doorProcess);
Token token = processInstance.getRootToken();
token.setNode(openLocked);
- try {
+ try
+ {
token.signal("close");
fail("expected exception");
- } catch (JbpmException e) {
}
+ catch (JbpmException e)
+ {
+ }
}
- public void testOpenLockedUnlock() {
+ public void testOpenLockedUnlock()
+ {
ProcessInstance processInstance = new ProcessInstance(doorProcess);
Token token = processInstance.getRootToken();
token.setNode(openLocked);
Added: jbpm3/trunk/modules/examples/src/test/resources/log4j.xml
===================================================================
--- jbpm3/trunk/modules/examples/src/test/resources/log4j.xml (rev 0)
+++ jbpm3/trunk/modules/examples/src/test/resources/log4j.xml 2008-09-15 15:16:13 UTC (rev 2254)
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+ <!-- ================================= -->
+ <!-- Preserve messages in a local file -->
+ <!-- ================================= -->
+
+ <appender name="FILE" class="org.apache.log4j.FileAppender">
+ <param name="File" value="${log4j.output.dir}/test.log"/>
+ <param name="Append" value="false"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] Message\n -->
+ <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
+ </layout>
+ </appender>
+
+ <!-- ============================== -->
+ <!-- Append messages to the console -->
+ <!-- ============================== -->
+
+ <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <param name="Target" value="System.out" />
+ <param name="Threshold" value="INFO" />
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d{HH:mm:ss,SSS} %-5p [%c{1}] %m%n" />
+ </layout>
+ </appender>
+
+ <!-- ================ -->
+ <!-- Limit categories -->
+ <!-- ================ -->
+
+ <category name="org.jbpm">
+ <priority value="DEBUG" />
+ </category>
+
+ <category name="org.hibernate">
+ <priority value="INFO" />
+ </category>
+
+ <!-- hide optimistic locking failures
+ <category name="org.hibernate.event.def.AbstractFlushingEventListener">
+ <priority value="FATAL" />
+ </category>
+ -->
+
+ <!-- hide proxy narrowing warns -->
+ <category name="org.hibernate.engine.StatefulPersistenceContext.ProxyWarnLog">
+ <priority value="ERROR" />
+ </category>
+
+ <!-- show SQL DML statements as they are executed -->
+ <category name="org.hibernate.SQL">
+ <priority value="DEBUG" />
+ </category>
+
+ <!-- show JDBC parameters
+ <category name="org.hibernate.type">
+ <priority value="TRACE" />
+ </category>
+ -->
+
+ <!-- ======================= -->
+ <!-- Setup the Root category -->
+ <!-- ======================= -->
+
+ <root>
+ <!--appender-ref ref="CONSOLE"/-->
+ <appender-ref ref="FILE"/>
+ </root>
+
+</log4j:configuration>
Property changes on: jbpm3/trunk/modules/examples/src/test/resources/log4j.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
More information about the jbpm-commits
mailing list