JBoss JBPM SVN: r2435 - in jbpm3/trunk/modules/examples/src/test: resources/websale/jpdl and 1 other directory.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-09-29 07:01:34 -0400 (Mon, 29 Sep 2008)
New Revision: 2435
Modified:
jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/websale/WebsaleTest.java
jbpm3/trunk/modules/examples/src/test/resources/websale/jpdl/processdefinition.xml
Log:
[JBPM-1751] Fix examples/websale
Modified: jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/websale/WebsaleTest.java
===================================================================
--- jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/websale/WebsaleTest.java 2008-09-29 10:55:21 UTC (rev 2434)
+++ jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/websale/WebsaleTest.java 2008-09-29 11:01:34 UTC (rev 2435)
@@ -40,80 +40,95 @@
import org.jbpm.taskmgmt.exe.TaskInstance;
import org.jbpm.taskmgmt.exe.TaskMgmtInstance;
-public class WebsaleTest extends TestCase {
-
+public class WebsaleTest extends TestCase
+{
JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance();
- DbPersistenceServiceFactory dbPersistenceServiceFactory = (DbPersistenceServiceFactory) jbpmConfiguration.getServiceFactory(Services.SERVICENAME_PERSISTENCE);
+ DbPersistenceServiceFactory dbPersistenceServiceFactory = (DbPersistenceServiceFactory)jbpmConfiguration.getServiceFactory(Services.SERVICENAME_PERSISTENCE);
JbpmContext jbpmContext;
- ProcessInstance processInstance = null;
- ContextInstance contextInstance = null;
- TaskMgmtInstance taskMgmtInstance = null;
+ ProcessInstance processInstance;
+ ContextInstance contextInstance;
+ TaskMgmtInstance taskMgmtInstance;
long processInstanceId = -1;
- public void setUp() {
+ public void setUp()
+ {
dbPersistenceServiceFactory.createSchema();
deployProcess();
jbpmContext = jbpmConfiguration.createJbpmContext();
}
- public void tearDown() {
+ public void tearDown()
+ {
jbpmContext.close();
dbPersistenceServiceFactory.dropSchema();
jbpmContext = null;
}
- public void newTransaction() {
+ public void newTransaction()
+ {
jbpmContext.close();
jbpmContext = jbpmConfiguration.createJbpmContext();
}
-
- public void deployProcess() {
+
+ public void deployProcess()
+ {
JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
- try {
- ProcessDefinition processDefinition =
- ProcessDefinition.parseXmlResource("processdefinition.xml");
+ try
+ {
+ ProcessDefinition processDefinition = ProcessDefinition.parseXmlResource("websale/jpdl/processdefinition.xml");
jbpmContext.deployProcessDefinition(processDefinition);
- } finally {
+ }
+ finally
+ {
jbpmContext.close();
}
}
- public void loadIdentities() {
+ public void loadIdentities()
+ {
JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
- try {
- Entity[] entities = IdentityXmlParser.parseEntitiesResource("hsqldb/identity.db.xml");
+ try
+ {
+ Entity[] entities = IdentityXmlParser.parseEntitiesResource("assignment/identity.db.xml");
IdentitySession identitySession = new IdentitySession(jbpmContext.getSession());
- for (int i=0; i<entities.length; i++) {
+ for (int i = 0; i < entities.length; i++)
+ {
identitySession.saveEntity(entities[i]);
}
- } finally {
+ }
+ finally
+ {
jbpmContext.close();
}
}
- public TaskInstance createNewProcessInstance() {
+ public TaskInstance createNewProcessInstance()
+ {
processInstance = jbpmContext.newProcessInstanceForUpdate("websale");
processInstanceId = processInstance.getId();
contextInstance = processInstance.getContextInstance();
taskMgmtInstance = processInstance.getTaskMgmtInstance();
return processInstance.getTaskMgmtInstance().createStartTaskInstance();
}
-
- public void reloadProcessInstance() {
+
+ public void reloadProcessInstance()
+ {
processInstance = jbpmContext.loadProcessInstanceForUpdate(processInstanceId);
contextInstance = processInstance.getContextInstance();
taskMgmtInstance = processInstance.getTaskMgmtInstance();
}
-
- public void testWebSaleOrderTaskParameters() {
+
+ public void testWebSaleOrderTaskParameters()
+ {
TaskInstance taskInstance = createNewProcessInstance();
assertEquals("Create new web sale order", taskInstance.getName());
assertEquals(0, taskInstance.getVariables().size());
}
- public void testPerformWebSaleOrderTask() {
+ public void testPerformWebSaleOrderTask()
+ {
jbpmContext.setActorId("user");
// create a task to start the websale process
TaskInstance taskInstance = createNewProcessInstance();
@@ -122,17 +137,18 @@
taskVariables.put("item", "cookies");
taskVariables.put("quantity", "lots of them");
taskVariables.put("address", "46 Main St.");
-
+
taskInstance.addVariables(taskVariables);
taskInstance.end();
-
+
assertEquals("cookies", contextInstance.getVariable("item"));
assertEquals("lots of them", contextInstance.getVariable("quantity"));
assertEquals("46 Main St.", contextInstance.getVariable("address"));
assertEquals("user", taskMgmtInstance.getSwimlaneInstance("buyer").getActorId());
}
- public void testEvaluateAssignment() {
+ public void testEvaluateAssignment()
+ {
jbpmContext.setActorId("user");
// create a task to start the websale process
TaskInstance taskInstance = createNewProcessInstance();
@@ -140,13 +156,13 @@
taskInstance.end();
jbpmContext.save(processInstance);
processInstanceId = processInstance.getId();
-
+
newTransaction();
-
+
List sampleManagersTasks = jbpmContext.getTaskMgmtSession().findTaskInstances("manager");
assertEquals(1, sampleManagersTasks.size());
- TaskInstance evaluateTaskInstance = (TaskInstance) sampleManagersTasks.get(0);
+ TaskInstance evaluateTaskInstance = (TaskInstance)sampleManagersTasks.get(0);
assertEquals("manager", evaluateTaskInstance.getActorId());
assertEquals("Evaluate web order", evaluateTaskInstance.getName());
assertNotNull(evaluateTaskInstance.getToken());
@@ -155,23 +171,24 @@
assertNull(evaluateTaskInstance.getEnd());
}
- public void testEvaluateOk() {
+ public void testEvaluateOk()
+ {
TaskInstance taskInstance = createNewProcessInstance();
taskInstance.end();
jbpmContext.save(processInstance);
-
+
newTransaction();
-
- TaskInstance evaluateTaskInstance = (TaskInstance) jbpmContext.getTaskMgmtSession().findTaskInstances("manager").get(0);
+
+ TaskInstance evaluateTaskInstance = (TaskInstance)jbpmContext.getTaskMgmtSession().findTaskInstances("manager").get(0);
evaluateTaskInstance.end("OK");
jbpmContext.save(evaluateTaskInstance);
newTransaction();
-
+
List sampleShippersTasks = jbpmContext.getTaskMgmtSession().findTaskInstances("shipper");
assertEquals(1, sampleShippersTasks.size());
- TaskInstance waitForMoneyTaskInstance = (TaskInstance) sampleShippersTasks.get(0);
+ TaskInstance waitForMoneyTaskInstance = (TaskInstance)sampleShippersTasks.get(0);
assertEquals("shipper", waitForMoneyTaskInstance.getActorId());
assertEquals("Wait for money", waitForMoneyTaskInstance.getName());
assertNotNull(waitForMoneyTaskInstance.getToken());
@@ -180,60 +197,63 @@
assertNull(waitForMoneyTaskInstance.getEnd());
}
- public void testUnwritableVariableException() {
+ public void testUnwritableVariableException()
+ {
testEvaluateAssignment();
newTransaction();
List sampleManagersTasks = jbpmContext.getTaskMgmtSession().findTaskInstances("manager");
- TaskInstance evaluateTaskInstance = (TaskInstance) sampleManagersTasks.get(0);
+ TaskInstance evaluateTaskInstance = (TaskInstance)sampleManagersTasks.get(0);
evaluateTaskInstance.end();
newTransaction();
-
+
processInstance = jbpmContext.getGraphSession().loadProcessInstance(processInstanceId);
contextInstance = processInstance.getContextInstance();
// so the cookies should still be in the item process variable.
assertEquals("cookies", contextInstance.getVariable("item"));
}
- public void testEvaluateNok() {
+ public void testEvaluateNok()
+ {
testEvaluateAssignment();
newTransaction();
-
+
List sampleManagersTasks = jbpmContext.getTaskMgmtSession().findTaskInstances("manager");
- TaskInstance evaluateTaskInstance = (TaskInstance) sampleManagersTasks.get(0);
+ TaskInstance evaluateTaskInstance = (TaskInstance)sampleManagersTasks.get(0);
evaluateTaskInstance.setVariable("comment", "wtf");
evaluateTaskInstance.end("More info needed");
jbpmContext.save(evaluateTaskInstance);
-
+
newTransaction();
List sampleUserTasks = jbpmContext.getTaskMgmtSession().findTaskInstances("user");
assertEquals(1, sampleUserTasks.size());
- TaskInstance fixWebOrderDataTaskInstance = (TaskInstance) sampleUserTasks.get(0);
+ TaskInstance fixWebOrderDataTaskInstance = (TaskInstance)sampleUserTasks.get(0);
assertEquals("user", fixWebOrderDataTaskInstance.getActorId());
assertEquals("wtf", fixWebOrderDataTaskInstance.getVariable("comment"));
}
- public void testMoreInfoNeeded() {
+ public void testMoreInfoNeeded()
+ {
jbpmContext.setActorId("user");
-
+
// create a task to start the websale process
TaskInstance taskInstance = createNewProcessInstance();
taskInstance.end();
jbpmContext.save(processInstance);
-
+
newTransaction();
-
- TaskInstance evaluateTaskInstance = (TaskInstance) jbpmContext.getTaskMgmtSession().findTaskInstances("manager").get(0);
+
+ TaskInstance evaluateTaskInstance = (TaskInstance)jbpmContext.getTaskMgmtSession().findTaskInstances("manager").get(0);
evaluateTaskInstance.end("More info needed");
jbpmContext.save(evaluateTaskInstance);
newTransaction();
-
+
List sampleUserTasks = jbpmContext.getTaskMgmtSession().findTaskInstances("user");
assertEquals(1, sampleUserTasks.size());
- TaskInstance fixWebOrderDataTaskInstance = (TaskInstance) sampleUserTasks.get(0);
+ TaskInstance fixWebOrderDataTaskInstance = (TaskInstance)sampleUserTasks.get(0);
assertEquals("user", fixWebOrderDataTaskInstance.getActorId());
assertEquals("Fix web order data", fixWebOrderDataTaskInstance.getName());
assertNotNull(fixWebOrderDataTaskInstance.getToken());
Modified: jbpm3/trunk/modules/examples/src/test/resources/websale/jpdl/processdefinition.xml
===================================================================
--- jbpm3/trunk/modules/examples/src/test/resources/websale/jpdl/processdefinition.xml 2008-09-29 10:55:21 UTC (rev 2434)
+++ jbpm3/trunk/modules/examples/src/test/resources/websale/jpdl/processdefinition.xml 2008-09-29 11:01:34 UTC (rev 2435)
@@ -29,7 +29,7 @@
<task-node name="Evaluate web order">
<task swimlane="salesman">
<timer duedate="20 seconds" repeat="10 seconds">
- <action class="org.jbpm.websale.RemindActor">
+ <action class="org.jbpm.examples.websale.RemindActor">
<swimlaneName>salesman</swimlaneName>
</action>
</timer>
@@ -54,14 +54,14 @@
</task-node>
<node name="update books">
- <action class="org.jbpm.websale.UpdateBooks">
+ <action class="org.jbpm.examples.websale.UpdateBooks">
<msg>accountancy application is now informed of the payment</msg>
</action>
<transition to="salejoin" />
</node>
<node name="ship item">
- <action class="org.jbpm.websale.ShipItem">
+ <action class="org.jbpm.examples.websale.ShipItem">
<swimlaneName>shipper</swimlaneName>
<msg>${shipper} now ships ${item} to ${address}</msg>
</action>
17 years, 6 months
JBoss JBPM SVN: r2434 - in jbpm3/trunk/modules/examples: src/test/java/org/jbpm/examples/taskmgmt and 1 other directory.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-09-29 06:55:21 -0400 (Mon, 29 Sep 2008)
New Revision: 2434
Modified:
jbpm3/trunk/modules/examples/pom.xml
jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/taskmgmt/TaskAssignmentTest.java
Log:
[JBPM-1750] Fix examples/taskmgmt
Modified: jbpm3/trunk/modules/examples/pom.xml
===================================================================
--- jbpm3/trunk/modules/examples/pom.xml 2008-09-29 10:52:58 UTC (rev 2433)
+++ jbpm3/trunk/modules/examples/pom.xml 2008-09-29 10:55:21 UTC (rev 2434)
@@ -103,7 +103,6 @@
<configuration>
<!-- [JBPM-1290] Integrate example tests in automated testrun -->
<excludes>
- <exclude>org/jbpm/examples/taskmgmt/**</exclude>
<exclude>org/jbpm/examples/websale/**</exclude>
</excludes>
</configuration>
Modified: jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/taskmgmt/TaskAssignmentTest.java
===================================================================
--- jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/taskmgmt/TaskAssignmentTest.java 2008-09-29 10:52:58 UTC (rev 2433)
+++ jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/taskmgmt/TaskAssignmentTest.java 2008-09-29 10:55:21 UTC (rev 2434)
@@ -28,9 +28,11 @@
import org.jbpm.graph.exe.Token;
import org.jbpm.taskmgmt.exe.TaskInstance;
-public class TaskAssignmentTest extends TestCase {
+public class TaskAssignmentTest extends TestCase
+{
- public void testTaskAssignment() {
+ public void testTaskAssignment()
+ {
// The process shown below is based on the hello world process.
// The state node is replaced by a task-node. The task-node
// is a node in JPDL that represents a wait state and generates
@@ -43,7 +45,7 @@
" </start-state>" +
" <task-node name='t'>" +
" <task name='change nappy'>" +
- " <assignment class='org.jbpm.tutorial.taskmgmt.NappyAssignmentHandler' />" +
+ " <assignment class='org.jbpm.examples.taskmgmt.NappyAssignmentHandler' />" +
" </task>" +
" <transition to='end' />" +
" </task-node>" +
@@ -52,43 +54,38 @@
);
// Create an execution of the process definition.
- ProcessInstance processInstance =
- new ProcessInstance(processDefinition);
+ ProcessInstance processInstance = new ProcessInstance(processDefinition);
Token token = processInstance.getRootToken();
-
- // Let's start the process execution, leaving the start-state
+
+ // Let's start the process execution, leaving the start-state
// over its default transition.
token.signal();
- // The signal method will block until the process execution
- // enters a wait state. In this case, that is the task-node.
+ // The signal method will block until the process execution
+ // enters a wait state. In this case, that is the task-node.
assertSame(processDefinition.getNode("t"), token.getNode());
// When execution arrived in the task-node, a task 'change nappy'
// was created and the NappyAssignmentHandler was called to determine
- // to whom the task should be assigned. The NappyAssignmentHandler
+ // to whom the task should be assigned. The NappyAssignmentHandler
// returned 'papa'.
// In a real environment, the tasks would be fetched from the
// database with the methods in the org.jbpm.db.TaskMgmtSession.
- // Since we don't want to include the persistence complexity in
- // this example, we just take the first task-instance of this
+ // Since we don't want to include the persistence complexity in
+ // this example, we just take the first task-instance of this
// process instance (we know there is only one in this test
// scenario.
- TaskInstance taskInstance = (TaskInstance)
- processInstance
- .getTaskMgmtInstance()
- .getTaskInstances()
- .iterator().next();
+ TaskInstance taskInstance = (TaskInstance)processInstance.getTaskMgmtInstance().getTaskInstances().iterator().next();
// Now, we check if the taskInstance was actually assigned to 'papa'.
- assertEquals("papa", taskInstance.getActorId() );
-
- // Now suppose that 'papa' has done his duties and marks the task
- // as done.
+ assertEquals("papa", taskInstance.getActorId());
+
+ // Now suppose that 'papa' has done his duties and marks the task
+ // as done.
taskInstance.end();
// Since this was the last (only) task to do, the completion of this
// task triggered the continuation of the process instance execution.
-
+
assertSame(processDefinition.getNode("end"), token.getNode());
}
17 years, 6 months
JBoss JBPM SVN: r2433 - in jbpm3/trunk/modules/examples: src/test/java/org/jbpm/examples/taskinstance and 2 other directories.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-09-29 06:52:58 -0400 (Mon, 29 Sep 2008)
New Revision: 2433
Added:
jbpm3/trunk/modules/examples/src/test/resources/hibernate.extra.hbm.xml
jbpm3/trunk/modules/examples/src/test/resources/taskinstance/gpd.xml
jbpm3/trunk/modules/examples/src/test/resources/taskinstance/jbpm.cfg.xml
jbpm3/trunk/modules/examples/src/test/resources/taskinstance/processdefinition.xml
jbpm3/trunk/modules/examples/src/test/resources/taskinstance/processimage.jpg
Removed:
jbpm3/trunk/modules/examples/src/test/resources/taskinstance/CustomTaskInstance.hbm.xml
Modified:
jbpm3/trunk/modules/examples/pom.xml
jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/taskinstance/CustomTaskControllerHandler.java
jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/taskinstance/CustomTaskInstanceTest.java
Log:
[JBPM-1749] Fix examples/taskinstance
Modified: jbpm3/trunk/modules/examples/pom.xml
===================================================================
--- jbpm3/trunk/modules/examples/pom.xml 2008-09-29 10:23:49 UTC (rev 2432)
+++ jbpm3/trunk/modules/examples/pom.xml 2008-09-29 10:52:58 UTC (rev 2433)
@@ -103,8 +103,6 @@
<configuration>
<!-- [JBPM-1290] Integrate example tests in automated testrun -->
<excludes>
- <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>
Modified: jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/taskinstance/CustomTaskControllerHandler.java
===================================================================
--- jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/taskinstance/CustomTaskControllerHandler.java 2008-09-29 10:23:49 UTC (rev 2432)
+++ jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/taskinstance/CustomTaskControllerHandler.java 2008-09-29 10:52:58 UTC (rev 2433)
@@ -28,63 +28,53 @@
import org.jbpm.taskmgmt.def.TaskControllerHandler;
import org.jbpm.taskmgmt.exe.TaskInstance;
-public class CustomTaskControllerHandler implements TaskControllerHandler {
+public class CustomTaskControllerHandler implements TaskControllerHandler
+{
- /**
- * extracts all information from the process context (optionally indirect)
- * and initializes the task instance variables.
- * <p>
- * Use {@link TaskInstance#setVariable(String, Object)} to set variables in
- * the task instance and use
- * {@link ContextInstance#getVariable(String, Token)} to get access to the
- * process variables.
- * </p>
- * <p>
- * The task instance variable can be
- * <ul>
- * <li>A copy of process variable value</li>
- * <li>A reference to a process variable</li>
- * <li>Any object that can be persisted as a variable. This is usefull in
- * case a {@link TaskInstance} variable is a function of other process
- * instance variables. </li>
- * </ul>
- * </p>
- * <p>
- * In order to create a reference to an existing process variable, insert a
- * {@link org.jbpm.context.exe.VariableInstance} as a value in the returned
- * map. If the TaskInstance is to have copies of the process instance
- * variables, just insert POJO's (non-VariableInstance classes) as values
- * for the TaskInstance variables.
- * </p>
- */
+ /**
+ * extracts all information from the process context (optionally indirect) and initializes the task instance variables.
+ * <p>
+ * Use {@link TaskInstance#setVariable(String, Object)} to set variables in the task instance and use {@link ContextInstance#getVariable(String, Token)} to get access
+ * to the process variables.
+ * </p>
+ * <p>
+ * The task instance variable can be
+ * <ul>
+ * <li>A copy of process variable value</li>
+ * <li>A reference to a process variable</li>
+ * <li>Any object that can be persisted as a variable. This is usefull in case a {@link TaskInstance} variable is a function of other process instance variables.</li>
+ * </ul>
+ * </p>
+ * <p>
+ * In order to create a reference to an existing process variable, insert a {@link org.jbpm.context.exe.VariableInstance} as a value in the returned map. If the
+ * TaskInstance is to have copies of the process instance variables, just insert POJO's (non-VariableInstance classes) as values for the TaskInstance variables.
+ * </p>
+ */
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 1L;
- public void initializeTaskVariables(TaskInstance taskInstance,
- ContextInstance contextInstance, Token token) {
+ public void initializeTaskVariables(TaskInstance taskInstance, ContextInstance contextInstance, Token token)
+ {
- CustomTaskInstance customTaskInstance = (CustomTaskInstance) taskInstance;
+ CustomTaskInstance customTaskInstance = (CustomTaskInstance)taskInstance;
- String customId = (String) contextInstance.getVariable("customId");
+ String customId = (String)contextInstance.getVariable("customId");
- customTaskInstance.setCustomId(customId);
- System.out.println("set customId: " + customId + " on taskInstance: " + taskInstance.getId());
- }
+ customTaskInstance.setCustomId(customId);
+ // System.out.println("set customId: " + customId + " on taskInstance: " + taskInstance.getId());
+ }
- /**
- * is called when a task completes. The task controller is given the
- * opportunity to update the process context variables with the data that is
- * submitted entered in the task instance.
- * <p>
- * Use {@link TaskInstance#getVariable(String)} to get variables from the
- * task instance context and use
- * {@link ContextInstance#setVariable(String, Object, Token)} to update the
- * process variables.
- * </p>
- */
- public void submitTaskVariables(TaskInstance taskInstance,
- ContextInstance contextInstance, Token token) {
+ /**
+ * is called when a task completes. The task controller is given the opportunity to update the process context variables with the data that is submitted entered in
+ * the task instance.
+ * <p>
+ * Use {@link TaskInstance#getVariable(String)} to get variables from the task instance context and use {@link ContextInstance#setVariable(String, Object, Token)} to
+ * update the process variables.
+ * </p>
+ */
+ public void submitTaskVariables(TaskInstance taskInstance, ContextInstance contextInstance, Token token)
+ {
- }
+ }
}
Modified: jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/taskinstance/CustomTaskInstanceTest.java
===================================================================
--- jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/taskinstance/CustomTaskInstanceTest.java 2008-09-29 10:23:49 UTC (rev 2432)
+++ jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/taskinstance/CustomTaskInstanceTest.java 2008-09-29 10:52:58 UTC (rev 2433)
@@ -45,174 +45,176 @@
/**
* This example shows how to extend the TaskInstance by adding a custom property.
*/
-public class CustomTaskInstanceTest extends TestCase {
+public class CustomTaskInstanceTest extends TestCase
+{
- JbpmConfiguration jbpmConfiguration = null;
- //JbpmConfiguration.getInstance();
+ JbpmConfiguration jbpmConfiguration = null;
+ // JbpmConfiguration.getInstance();
- DbPersistenceServiceFactory dbPersistenceServiceFactory = null;
+ DbPersistenceServiceFactory dbPersistenceServiceFactory;
- JbpmContext jbpmContext;
+ JbpmContext jbpmContext;
- Session s;
+ Session s;
- ProcessInstance processInstance = null;
+ ProcessInstance processInstance = null;
- ContextInstance contextInstance = null;
+ ContextInstance contextInstance = null;
- public void setUp() {
+ public void setUp()
+ {
- // the jbpm.cfg.xml file is modified to add the CustomTaskInstanceFactory
- // so we will read in the file from the config directory of this example
- jbpmConfiguration = JbpmConfiguration.parseResource("jbpm.cfg.xml");
+ // the jbpm.cfg.xml file is modified to add the CustomTaskInstanceFactory
+ // so we will read in the file from the config directory of this example
+ jbpmConfiguration = JbpmConfiguration.parseResource("taskinstance/jbpm.cfg.xml");
- dbPersistenceServiceFactory = (DbPersistenceServiceFactory) jbpmConfiguration
- .getServiceFactory(Services.SERVICENAME_PERSISTENCE);
-
- // the CustomTaskInstance mapping file reference
- // <mapping resource="org/jbpm/taskinstance/CustomTaskInstance.hbm.xml"/>
- // has been added to to the bottom of the hibernate.cfg.xml file in the config directory
-
- // now create the schema
- // this is also a step that typically would be performed as an independent step
- // using the jbpm schema created from the jbpm mapping files
-
- dbPersistenceServiceFactory.createSchema();
- deployProcess();
- jbpmContext = jbpmConfiguration.createJbpmContext();
- }
+ dbPersistenceServiceFactory = (DbPersistenceServiceFactory)jbpmConfiguration.getServiceFactory(Services.SERVICENAME_PERSISTENCE);
- public void tearDown() {
- jbpmContext.close();
- dbPersistenceServiceFactory.dropSchema();
- jbpmContext = null;
- }
+ // the CustomTaskInstance mapping file reference
+ // <mapping resource="org/jbpm/taskinstance/CustomTaskInstance.hbm.xml"/>
+ // has been added to to the bottom of the hibernate.cfg.xml file in the config directory
- public void newTransaction() {
- jbpmContext.close();
- jbpmContext = jbpmConfiguration.createJbpmContext();
- }
+ // now create the schema
+ // this is also a step that typically would be performed as an independent step
+ // using the jbpm schema created from the jbpm mapping files
- public void deployProcess() {
- jbpmContext = jbpmConfiguration.createJbpmContext();
- try {
- ProcessDefinition processDefinition = ProcessDefinition
- .parseXmlResource("CustomTaskInstance/processdefinition.xml");
- jbpmContext.deployProcessDefinition(processDefinition);
- } finally {
- jbpmContext.close();
- }
- }
+ dbPersistenceServiceFactory.createSchema();
+ deployProcess();
+ jbpmContext = jbpmConfiguration.createJbpmContext();
+ }
- public void loadIdentities() {
- jbpmContext = jbpmConfiguration.createJbpmContext();
- try {
- Entity[] entities = IdentityXmlParser
- .parseEntitiesResource("identity.db.xml");
- IdentitySession identitySession = new IdentitySession(jbpmContext
- .getSession());
- for (int i = 0; i < entities.length; i++) {
- identitySession.saveEntity(entities[i]);
- }
- } finally {
- jbpmContext.close();
- }
- }
+ public void tearDown()
+ {
+ jbpmContext.close();
+ dbPersistenceServiceFactory.dropSchema();
+ jbpmContext = null;
+ }
- public void testCustomTaskInstance() {
- // create processInstance
- newTransaction();
- long processInstanceId = createNewProcessInstance();
- assertNotNull(processInstanceId);
- assertFalse("ProcessInstanceId is 0", processInstanceId == 0);
+ public void newTransaction()
+ {
+ jbpmContext.close();
+ jbpmContext = jbpmConfiguration.createJbpmContext();
+ }
- // perform the task
- newTransaction();
- long taskInstanceId = acquireTask();
- assertNotNull(taskInstanceId);
- assertFalse("TaskInstanceId is 0", taskInstanceId == 0);
- newTransaction();
+ public void deployProcess()
+ {
+ jbpmContext = jbpmConfiguration.createJbpmContext();
+ try
+ {
+ ProcessDefinition processDefinition = ProcessDefinition.parseXmlResource("taskinstance/processdefinition.xml");
+ jbpmContext.deployProcessDefinition(processDefinition);
+ }
+ finally
+ {
+ jbpmContext.close();
+ }
+ }
- completeTask(taskInstanceId);
+ public void loadIdentities()
+ {
+ jbpmContext = jbpmConfiguration.createJbpmContext();
+ try
+ {
+ Entity[] entities = IdentityXmlParser.parseEntitiesResource("identity.db.xml");
+ IdentitySession identitySession = new IdentitySession(jbpmContext.getSession());
+ for (int i = 0; i < entities.length; i++)
+ {
+ identitySession.saveEntity(entities[i]);
+ }
+ }
+ finally
+ {
+ jbpmContext.close();
+ }
+ }
- newTransaction();
- TaskInstance taskInstance = jbpmContext
- .loadTaskInstance(taskInstanceId);
- Date end = taskInstance.getEnd();
- assertNotNull(end);
+ public void testCustomTaskInstance()
+ {
+ // create processInstance
+ newTransaction();
+ long processInstanceId = createNewProcessInstance();
+ assertNotNull(processInstanceId);
+ assertFalse("ProcessInstanceId is 0", processInstanceId == 0);
- // check process is completed
- newTransaction();
- Date processEnd = null;
- processInstance = jbpmContext.getProcessInstance(processInstanceId);
- processEnd = processInstance.getEnd();
- assertNotNull(processEnd);
- }
+ // perform the task
+ newTransaction();
+ long taskInstanceId = acquireTask();
+ assertNotNull(taskInstanceId);
+ assertFalse("TaskInstanceId is 0", taskInstanceId == 0);
+ newTransaction();
- public long createNewProcessInstance() {
- String processDefinitionName = "CustomTaskInstance";
- processInstance = jbpmContext
- .newProcessInstanceForUpdate(processDefinitionName);
- long processInstanceId = processInstance.getId();
- contextInstance = processInstance.getContextInstance();
- contextInstance.setVariable("processDefinitionName",
- processDefinitionName);
- contextInstance.setVariable("customId", "abc");
- Token token = processInstance.getRootToken();
- token.signal();
- return processInstanceId;
+ completeTask(taskInstanceId);
- }
+ newTransaction();
+ TaskInstance taskInstance = jbpmContext.loadTaskInstance(taskInstanceId);
+ Date end = taskInstance.getEnd();
+ assertNotNull(end);
+ // check process is completed
+ newTransaction();
+ Date processEnd = null;
+ processInstance = jbpmContext.getProcessInstance(processInstanceId);
+ processEnd = processInstance.getEnd();
+ assertNotNull(processEnd);
+ }
- public long acquireTask() {
+ public long createNewProcessInstance()
+ {
+ String processDefinitionName = "CustomTaskInstance";
+ processInstance = jbpmContext.newProcessInstanceForUpdate(processDefinitionName);
+ long processInstanceId = processInstance.getId();
+ contextInstance = processInstance.getContextInstance();
+ contextInstance.setVariable("processDefinitionName", processDefinitionName);
+ contextInstance.setVariable("customId", "abc");
+ Token token = processInstance.getRootToken();
+ token.signal();
+ return processInstanceId;
- List<CustomTaskInstance> tasklist = findPooledTaskListByCustomId("reviewers", "abc");
- Iterator taskIterator = tasklist.iterator();
+ }
- CustomTaskInstance taskInstance = null;
- long taskInstanceId = 0;
- while (taskIterator.hasNext()) {
- taskInstance = (CustomTaskInstance) taskIterator.next();
- taskInstanceId = taskInstance.getId();
- taskInstance.start();
- taskInstance.setActorId("tom");
- String customId = taskInstance.getCustomId();
- assertEquals("abc", customId);
- System.out.println(taskInstanceId);
- }
- return taskInstanceId;
- }
+ public long acquireTask()
+ {
- public void completeTask(long taskInstanceId) {
- s = jbpmContext.getSession();
- CustomTaskInstance taskInstance = (CustomTaskInstance) s.load(
- CustomTaskInstance.class, new Long(taskInstanceId));
+ List<CustomTaskInstance> tasklist = findPooledTaskListByCustomId("reviewers", "abc");
+ Iterator taskIterator = tasklist.iterator();
- taskInstance.end();
+ CustomTaskInstance taskInstance = null;
+ long taskInstanceId = 0;
+ while (taskIterator.hasNext())
+ {
+ taskInstance = (CustomTaskInstance)taskIterator.next();
+ taskInstanceId = taskInstance.getId();
+ taskInstance.start();
+ taskInstance.setActorId("tom");
+ String customId = taskInstance.getCustomId();
+ assertEquals("abc", customId);
+ }
+ return taskInstanceId;
+ }
- }
+ public void completeTask(long taskInstanceId)
+ {
+ s = jbpmContext.getSession();
+ CustomTaskInstance taskInstance = (CustomTaskInstance)s.load(CustomTaskInstance.class, new Long(taskInstanceId));
+ taskInstance.end();
- private static final String findPooledTaskInstancesByCustomId = "select distinct ti "
- + "from org.jbpm.taskinstance.CustomTaskInstance ti"
- + " join ti.pooledActors pooledActor "
- + "where "
- + "pooledActor.actorId = :pooledActorId "
- + " and ti.actorId is null "
- + " and ti.end is null "
- + " and ti.isCancelled = false"
- + " and ti.customId = :customId";
+ }
- public List<CustomTaskInstance> findPooledTaskListByCustomId(
- String actorId, String customId) {
- List<CustomTaskInstance> taskList = null;
- s = jbpmContext.getSession();
- Query query = s.createQuery(findPooledTaskInstancesByCustomId);
- query.setString("pooledActorId", actorId);
- query.setString("customId", customId);
- taskList = query.list();
- return taskList;
- }
+ private static final String findPooledTaskInstancesByCustomId =
+ "select distinct ti " + "from " + CustomTaskInstance.class.getName() + " ti " +
+ " join ti.pooledActors pooledActor where pooledActor.actorId = :pooledActorId and ti.actorId is null and ti.end is null " +
+ " and ti.isCancelled = false and ti.customId = :customId";
+ public List<CustomTaskInstance> findPooledTaskListByCustomId(String actorId, String customId)
+ {
+ List<CustomTaskInstance> taskList = null;
+ s = jbpmContext.getSession();
+ Query query = s.createQuery(findPooledTaskInstancesByCustomId);
+ query.setString("pooledActorId", actorId);
+ query.setString("customId", customId);
+ taskList = query.list();
+ return taskList;
+ }
+
}
Added: jbpm3/trunk/modules/examples/src/test/resources/hibernate.extra.hbm.xml
===================================================================
--- jbpm3/trunk/modules/examples/src/test/resources/hibernate.extra.hbm.xml (rev 0)
+++ jbpm3/trunk/modules/examples/src/test/resources/hibernate.extra.hbm.xml 2008-09-29 10:52:58 UTC (rev 2433)
@@ -0,0 +1,19 @@
+<?xml version="1.0"?>
+
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping>
+
+ <!-- ################################################## -->
+ <!-- # Additional mappings defined per module go here # -->
+ <!-- ################################################## -->
+
+ <subclass name="org.jbpm.examples.taskinstance.CustomTaskInstance"
+ extends="org.jbpm.taskmgmt.exe.TaskInstance"
+ discriminator-value="C">
+ <property name="customId" column="CUSTOMID_" />
+ </subclass>
+
+</hibernate-mapping>
Property changes on: jbpm3/trunk/modules/examples/src/test/resources/hibernate.extra.hbm.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: jbpm3/trunk/modules/examples/src/test/resources/taskinstance/CustomTaskInstance.hbm.xml
===================================================================
--- jbpm3/trunk/modules/examples/src/test/resources/taskinstance/CustomTaskInstance.hbm.xml 2008-09-29 10:23:49 UTC (rev 2432)
+++ jbpm3/trunk/modules/examples/src/test/resources/taskinstance/CustomTaskInstance.hbm.xml 2008-09-29 10:52:58 UTC (rev 2433)
@@ -1,18 +0,0 @@
-<?xml version="1.0"?>
-
-<!DOCTYPE hibernate-mapping PUBLIC
- "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
- "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
-
-<hibernate-mapping default-access="field">
-
- <subclass name="org.jbpm.taskinstance.CustomTaskInstance"
- extends="org.jbpm.taskmgmt.exe.TaskInstance"
- discriminator-value="C">
-
- <property name="customId" column="CUSTOMID_" />
-
-
- </subclass>
-
-</hibernate-mapping>
Added: jbpm3/trunk/modules/examples/src/test/resources/taskinstance/gpd.xml
===================================================================
--- jbpm3/trunk/modules/examples/src/test/resources/taskinstance/gpd.xml (rev 0)
+++ jbpm3/trunk/modules/examples/src/test/resources/taskinstance/gpd.xml 2008-09-29 10:52:58 UTC (rev 2433)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process-diagram name="CustomTaskInstance" width="774" height="673">
+ <node name="start" x="176" y="65" width="-1" height="-1">
+ <transition name="">
+ <label x="5" y="-10"/>
+ </transition>
+ </node>
+ <node name="end1" x="178" y="349" width="140" height="40"/>
+ <node name="Review Order" x="177" y="205" width="140" height="40">
+ <transition name="">
+ <label x="5" y="-10"/>
+ </transition>
+ </node>
+</process-diagram>
Property changes on: jbpm3/trunk/modules/examples/src/test/resources/taskinstance/gpd.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm3/trunk/modules/examples/src/test/resources/taskinstance/jbpm.cfg.xml
===================================================================
--- jbpm3/trunk/modules/examples/src/test/resources/taskinstance/jbpm.cfg.xml (rev 0)
+++ jbpm3/trunk/modules/examples/src/test/resources/taskinstance/jbpm.cfg.xml 2008-09-29 10:52:58 UTC (rev 2433)
@@ -0,0 +1,49 @@
+<jbpm-configuration>
+
+ <!--
+ This configuration is used when there is no jbpm.cfg.xml file found in the
+ root of the classpath. It is a very basic configuration without persistence
+ and message services. Only the authorization service installed.
+ You can parse and create processes, but when you try to use one of the
+ unavailable services, you'll get an exception.
+ -->
+
+ <jbpm-context>
+ <service name="persistence" factory="org.jbpm.persistence.db.DbPersistenceServiceFactory" />
+ <service name="tx" factory="org.jbpm.tx.TxServiceFactory" />
+ <service name="message" factory="org.jbpm.msg.db.DbMessageServiceFactory" />
+ <service name="scheduler" factory="org.jbpm.scheduler.db.DbSchedulerServiceFactory" />
+ <service name="logging" factory="org.jbpm.logging.db.DbLoggingServiceFactory" />
+ <service name="authentication" factory="org.jbpm.security.authentication.DefaultAuthenticationServiceFactory" />
+ </jbpm-context>
+
+ <!-- configuration property used by persistence service impl org.jbpm.persistence.db.DbPersistenceServiceFactory -->
+ <string name="resource.hibernate.cfg.xml" value="hibernate.cfg.xml" />
+
+ <!-- configuration resource files pointing to default configuration files in jbpm-{version}.jar -->
+ <string name="resource.business.calendar" value="org/jbpm/calendar/jbpm.business.calendar.properties" />
+ <string name="resource.default.modules" value="org/jbpm/graph/def/jbpm.default.modules.properties" />
+ <string name="resource.converter" value="org/jbpm/db/hibernate/jbpm.converter.properties" />
+ <string name="resource.action.types" value="org/jbpm/graph/action/action.types.xml" />
+ <string name="resource.node.types" value="org/jbpm/graph/node/node.types.xml" />
+ <string name="resource.parsers" value="org/jbpm/jpdl/par/jbpm.parsers.xml" />
+ <string name="resource.varmapping" value="org/jbpm/context/exe/jbpm.varmapping.xml" />
+ <string name="resource.mail.templates" value="jbpm.mail.templates.xml" />
+
+ <int name="jbpm.byte.block.size" value="1024" singleton="true" />
+ <string name="jbpm.mail.smtp.host" value="localhost" />
+ <!-- bean name="jbpm.task.instance.factory" class="org.jbpm.taskmgmt.impl.DefaultTaskInstanceFactoryImpl" singleton="true" /-->
+ <bean name="jbpm.task.instance.factory" class="org.jbpm.examples.taskinstance.CustomTaskInstanceFactoryImpl" singleton="true" />
+ <bean name="jbpm.variable.resolver" class="org.jbpm.jpdl.el.impl.JbpmVariableResolver" singleton="true" />
+ <bean name="jbpm.mail.address.resolver" class="org.jbpm.identity.mail.IdentityAddressResolver" singleton="true" />
+
+ <bean name="jbpm.job.executor" class="org.jbpm.job.executor.JobExecutor">
+ <field name="jbpmConfiguration"><ref bean="jbpmConfiguration" /></field>
+ <field name="name"><string value="JbpmJobExector" /></field>
+ <field name="nbrOfThreads"><int value="1" /></field>
+ <field name="idleInterval"><int value="2500" /></field>
+ <field name="maxIdleInterval"><int value="3600000" /></field>
+ <field name="historyMaxSize"><int value="20" /></field>
+ </bean>
+
+</jbpm-configuration>
Property changes on: jbpm3/trunk/modules/examples/src/test/resources/taskinstance/jbpm.cfg.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm3/trunk/modules/examples/src/test/resources/taskinstance/processdefinition.xml
===================================================================
--- jbpm3/trunk/modules/examples/src/test/resources/taskinstance/processdefinition.xml (rev 0)
+++ jbpm3/trunk/modules/examples/src/test/resources/taskinstance/processdefinition.xml 2008-09-29 10:52:58 UTC (rev 2433)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process-definition
+ xmlns="urn:jbpm.org:jpdl-3.2" name="CustomTaskInstance">
+ <swimlane name="reviewers">
+ <assignment pooled-actors="reviewers"/>
+ </swimlane>
+ <start-state name="start">
+ <transition name="" to="Review Order"></transition>
+ </start-state>
+ <end-state name="end1"></end-state>
+ <task-node name="Review Order">
+ <task name="Review Order" swimlane="reviewers">
+ <controller class="org.jbpm.examples.taskinstance.CustomTaskControllerHandler"></controller>
+ </task>
+ <transition name="" to="end1"></transition>
+ </task-node>
+</process-definition>
\ No newline at end of file
Property changes on: jbpm3/trunk/modules/examples/src/test/resources/taskinstance/processdefinition.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm3/trunk/modules/examples/src/test/resources/taskinstance/processimage.jpg
===================================================================
(Binary files differ)
Property changes on: jbpm3/trunk/modules/examples/src/test/resources/taskinstance/processimage.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
17 years, 6 months
JBoss JBPM SVN: r2432 - in jbpm3/trunk/modules/examples/src/test: java/org/jbpm/examples/rulesaction and 1 other directories.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-09-29 06:23:49 -0400 (Mon, 29 Sep 2008)
New Revision: 2432
Added:
jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesaction/
jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesaction/Customer.java
jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesaction/Order.java
jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesaction/RulesActionHandler.java
jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesaction/RulesActionTest.java
Removed:
jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesAction/
jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesaction/Customer.java
jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesaction/Order.java
jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesaction/RulesActionHandler.java
jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesaction/RulesActionTest.java
Modified:
jbpm3/trunk/modules/examples/src/test/resources/rulesaction/Shipper.drl
jbpm3/trunk/modules/examples/src/test/resources/rulesaction/processdefinition.xml
Log:
[JBPM-1748] Fix examples/rulesaction
Copied: jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesaction (from rev 2423, jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesAction)
Deleted: jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesaction/Customer.java
===================================================================
--- jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesAction/Customer.java 2008-09-29 08:14:22 UTC (rev 2423)
+++ jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesaction/Customer.java 2008-09-29 10:23:49 UTC (rev 2432)
@@ -1,60 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package org.jbpm.examples.rulesAction;
-
-import java.io.Serializable;
-
-
-public class Customer
- implements Serializable
-{
- long id;
-
- String name;
- Integer region;
- Integer age;
- Long income;
-
- public Customer() {
- }
-
- public Customer(String name, Integer region, Integer age, Long income) {
- setName(name);
- setRegion(region);
- setAge(age);
- setIncome(income);
- }
-
- public String getName() {
- return name;
- }
- public void setName(String name) {
- this.name = name;
- }
-
- public Integer getRegion() {
- return region;
- }
- public void setRegion(Integer region) {
- this.region = region;
- }
-
- public Integer getAge() {
- return age;
- }
- public void setAge(Integer age) {
- this.age = age;
- }
-
- public Long getIncome() {
- return income;
- }
- public void setIncome(Long income) {
- this.income = income;
- }
-
-}
Copied: jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesaction/Customer.java (from rev 2431, jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesAction/Customer.java)
===================================================================
--- jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesaction/Customer.java (rev 0)
+++ jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesaction/Customer.java 2008-09-29 10:23:49 UTC (rev 2432)
@@ -0,0 +1,60 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jbpm.examples.rulesaction;
+
+import java.io.Serializable;
+
+
+public class Customer
+ implements Serializable
+{
+ long id;
+
+ String name;
+ Integer region;
+ Integer age;
+ Long income;
+
+ public Customer() {
+ }
+
+ public Customer(String name, Integer region, Integer age, Long income) {
+ setName(name);
+ setRegion(region);
+ setAge(age);
+ setIncome(income);
+ }
+
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Integer getRegion() {
+ return region;
+ }
+ public void setRegion(Integer region) {
+ this.region = region;
+ }
+
+ public Integer getAge() {
+ return age;
+ }
+ public void setAge(Integer age) {
+ this.age = age;
+ }
+
+ public Long getIncome() {
+ return income;
+ }
+ public void setIncome(Long income) {
+ this.income = income;
+ }
+
+}
Deleted: jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesaction/Order.java
===================================================================
--- jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesAction/Order.java 2008-09-29 08:14:22 UTC (rev 2423)
+++ jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesaction/Order.java 2008-09-29 10:23:49 UTC (rev 2432)
@@ -1,45 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package org.jbpm.examples.rulesAction;
-
-import java.io.Serializable;
-
-
-public class Order
- implements Serializable
-{
- long id;
-
- Long totalAmount;
-
- private static final long serialVersionUID = 1L;
-
-
- public Order() {
-
- }
-
- public Order(long totalAmount) {
-
- setTotalAmount(new Long(totalAmount));
- }
- public long getId() {
- return id;
- }
- public void setId(long id) {
- this.id = id;
- }
-
- public Long getTotalAmount() {
- return totalAmount;
- }
- public void setTotalAmount(Long totalAmount) {
- this.totalAmount = totalAmount;
- }
-
-
-}
Copied: jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesaction/Order.java (from rev 2431, jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesAction/Order.java)
===================================================================
--- jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesaction/Order.java (rev 0)
+++ jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesaction/Order.java 2008-09-29 10:23:49 UTC (rev 2432)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jbpm.examples.rulesaction;
+
+import java.io.Serializable;
+
+
+public class Order
+ implements Serializable
+{
+ long id;
+
+ Long totalAmount;
+
+ private static final long serialVersionUID = 1L;
+
+
+ public Order() {
+
+ }
+
+ public Order(long totalAmount) {
+
+ setTotalAmount(new Long(totalAmount));
+ }
+ public long getId() {
+ return id;
+ }
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ public Long getTotalAmount() {
+ return totalAmount;
+ }
+ public void setTotalAmount(Long totalAmount) {
+ this.totalAmount = totalAmount;
+ }
+
+
+}
Deleted: jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesaction/RulesActionHandler.java
===================================================================
--- jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesAction/RulesActionHandler.java 2008-09-29 08:14:22 UTC (rev 2423)
+++ jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesaction/RulesActionHandler.java 2008-09-29 10:23:49 UTC (rev 2432)
@@ -1,94 +0,0 @@
-package org.jbpm.examples.rulesAction;
-
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.util.Iterator;
-import java.util.List;
-
-import org.drools.PackageIntegrationException;
-import org.drools.RuleBase;
-import org.drools.RuleBaseFactory;
-import org.drools.RuleIntegrationException;
-import org.drools.WorkingMemory;
-import org.drools.compiler.DroolsParserException;
-import org.drools.compiler.PackageBuilder;
-import org.drools.rule.InvalidPatternException;
-import org.jbpm.context.exe.ContextInstance;
-import org.jbpm.graph.def.ActionHandler;
-import org.jbpm.graph.exe.ExecutionContext;
-
-public class RulesActionHandler implements ActionHandler {
-
- private static final long serialVersionUID = 1L;
-
- public List objectNames;
-
- public String ruleFile;
-
- public List queryStrings;
-
- /**
- * The RulesActionHandler gets variables from the ContextInstance, and asserts
- * them into the Rules Engine and invokes the rules.
- */
- public void execute(ExecutionContext executionContext) throws Exception {
-
- // load up the rulebase
- RuleBase ruleBase = readRule(ruleFile);
- WorkingMemory workingMemory = ruleBase.newWorkingMemory();
-
- // final WorkingMemoryFileLogger logger = new WorkingMemoryFileLogger(
- // workingMemory );
- // logger.setFileName( "jpdl/examples/rulesActionHandler/log/rulesAction" );
-
- // load the data
- System.out.println(objectNames.toString());
-
- // get an iterator of fully qualified object names
- Iterator iter = objectNames.iterator();
- String objectName = "";
- ContextInstance ci = executionContext.getContextInstance();
-
- while (iter.hasNext()) {
- objectName = (String) iter.next();
-
- // assume the objects are stored as process variables
- // workingMemory.assertObject(ci.getVariable(objectName));
- Object object = ci.getVariable(objectName);
- workingMemory.assertObject(object);
-
- // alternately the objects could be returned with a query
- // to Hibernate or an EJB3 entity manager
-
- }
-
- // now assert the context instance as a global, so that the rules
- // can update the process, and fire the rules
- workingMemory.setGlobal("ci", ci);
-
- workingMemory.fireAllRules();
-
- workingMemory.dispose();
-
- // logger.writeToDisk();
-
- // propagate the token so that the process continues
- executionContext.getToken().signal();
-
- }
-
- /**
- * Please note that this is the "low level" rule assembly API.
- */
- private static RuleBase readRule(String ruleFileName) throws IOException, DroolsParserException, RuleIntegrationException, PackageIntegrationException,
- InvalidPatternException, Exception {
-
- PackageBuilder builder = new PackageBuilder();
- builder.addPackageFromDrl(new InputStreamReader(RulesActionHandler.class.getResourceAsStream(ruleFileName)));
-
- RuleBase ruleBase = RuleBaseFactory.newRuleBase();
- ruleBase.addPackage(builder.getPackage());
- return ruleBase;
- }
-
-}
Copied: jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesaction/RulesActionHandler.java (from rev 2431, jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesAction/RulesActionHandler.java)
===================================================================
--- jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesaction/RulesActionHandler.java (rev 0)
+++ jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesaction/RulesActionHandler.java 2008-09-29 10:23:49 UTC (rev 2432)
@@ -0,0 +1,94 @@
+package org.jbpm.examples.rulesaction;
+
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.Iterator;
+import java.util.List;
+
+import org.drools.PackageIntegrationException;
+import org.drools.RuleBase;
+import org.drools.RuleBaseFactory;
+import org.drools.RuleIntegrationException;
+import org.drools.WorkingMemory;
+import org.drools.compiler.DroolsParserException;
+import org.drools.compiler.PackageBuilder;
+import org.drools.rule.InvalidPatternException;
+import org.jbpm.context.exe.ContextInstance;
+import org.jbpm.graph.def.ActionHandler;
+import org.jbpm.graph.exe.ExecutionContext;
+
+public class RulesActionHandler implements ActionHandler
+{
+
+ private static final long serialVersionUID = 1L;
+
+ public List objectNames;
+
+ public String ruleFile;
+
+ public List queryStrings;
+
+ /**
+ * The RulesActionHandler gets variables from the ContextInstance, and asserts them into the Rules Engine and invokes the rules.
+ */
+ public void execute(ExecutionContext executionContext) throws Exception
+ {
+
+ // load up the rulebase
+ RuleBase ruleBase = readRule(ruleFile);
+ WorkingMemory workingMemory = ruleBase.newStatefulSession();
+
+ // final WorkingMemoryFileLogger logger = new WorkingMemoryFileLogger(
+ // workingMemory );
+ // logger.setFileName( "jpdl/examples/rulesActionHandler/log/rulesAction" );
+
+ // get an iterator of fully qualified object names
+ Iterator iter = objectNames.iterator();
+ String objectName = "";
+ ContextInstance ci = executionContext.getContextInstance();
+
+ while (iter.hasNext())
+ {
+ objectName = (String)iter.next();
+
+ // assume the objects are stored as process variables
+ // workingMemory.assertObject(ci.getVariable(objectName));
+ Object object = ci.getVariable(objectName);
+ workingMemory.insert(object);
+
+ // alternately the objects could be returned with a query
+ // to Hibernate or an EJB3 entity manager
+
+ }
+
+ // now assert the context instance as a global, so that the rules
+ // can update the process, and fire the rules
+ workingMemory.setGlobal("ci", ci);
+
+ workingMemory.fireAllRules();
+
+ workingMemory.clearAgenda();
+
+ // logger.writeToDisk();
+
+ // propagate the token so that the process continues
+ executionContext.getToken().signal();
+
+ }
+
+ /**
+ * Please note that this is the "low level" rule assembly API.
+ */
+ private static RuleBase readRule(String ruleFileName) throws IOException, DroolsParserException, RuleIntegrationException, PackageIntegrationException,
+ InvalidPatternException, Exception
+ {
+
+ PackageBuilder builder = new PackageBuilder();
+ builder.addPackageFromDrl(new InputStreamReader(RulesActionHandler.class.getResourceAsStream(ruleFileName)));
+
+ RuleBase ruleBase = RuleBaseFactory.newRuleBase();
+ ruleBase.addPackage(builder.getPackage());
+ return ruleBase;
+ }
+
+}
Deleted: jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesaction/RulesActionTest.java
===================================================================
--- jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesAction/RulesActionTest.java 2008-09-29 08:14:22 UTC (rev 2423)
+++ jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesaction/RulesActionTest.java 2008-09-29 10:23:49 UTC (rev 2432)
@@ -1,118 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.examples.rulesAction;
-
-import java.util.Date;
-
-import junit.framework.TestCase;
-
-import org.jbpm.JbpmConfiguration;
-import org.jbpm.JbpmContext;
-import org.jbpm.context.exe.ContextInstance;
-import org.jbpm.graph.def.ProcessDefinition;
-import org.jbpm.graph.exe.ProcessInstance;
-import org.jbpm.persistence.db.DbPersistenceServiceFactory;
-import org.jbpm.svc.Services;
-import org.jbpm.graph.exe.Token;
-
-/**
- * This example shows how to invoke JBoss Drools from an ActionHandler.
- */
-public class RulesActionTest extends TestCase {
-
- JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance();
-
- DbPersistenceServiceFactory dbPersistenceServiceFactory = (DbPersistenceServiceFactory) jbpmConfiguration
- .getServiceFactory(Services.SERVICENAME_PERSISTENCE);
-
- JbpmContext jbpmContext;
- long processInstanceId;
-
- public void setUp() {
- dbPersistenceServiceFactory.createSchema();
- deployProcess();
- jbpmContext = jbpmConfiguration.createJbpmContext();
- }
-
- public void tearDown() {
- jbpmContext.close();
- dbPersistenceServiceFactory.dropSchema();
- jbpmContext = null;
- }
-
- public void newTransaction() {
- jbpmContext.close();
- jbpmContext = jbpmConfiguration.createJbpmContext();
- }
-
- public void deployProcess() {
- JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
- try {
- ProcessDefinition processDefinition = ProcessDefinition
- .parseXmlResource("RulesAction/processdefinition.xml");
- jbpmContext.deployProcessDefinition(processDefinition);
- } finally {
- jbpmContext.close();
- }
- }
-
-
- public void testRulesAssignment() {
- // start process
- newTransaction();
- processInstanceId = createNewProcessInstance();
- assertNotNull(processInstanceId);
-
- newTransaction();
- ProcessInstance processInstance = getProcessInstance(processInstanceId);
-
- assertNotNull(processInstance);
-
- Date processEnd = processInstance.getEnd();
- assertNotNull(processEnd);
- String shipper = (String) processInstance.getContextInstance().getVariable("shipper");
- assertEquals("shipper is FEDX", shipper, "FEDX");
-
- }
-
- public long createNewProcessInstance() {
- String processDefinitionName = "RulesAction";
- ProcessInstance processInstance = jbpmContext
- .newProcessInstanceForUpdate(processDefinitionName);
- long id = processInstance.getId();
- ContextInstance contextInstance = processInstance.getContextInstance();
- contextInstance.setVariable("processDefinitionName",
- processDefinitionName);
- Order order = new Order(300);
- Customer customer = new Customer("Fred", new Integer(5), new Integer(25), new Long (100000));
- contextInstance.setVariable("order", order);
- contextInstance.setVariable("customer", customer);
- Token token = processInstance.getRootToken();
- token.signal();
- return id;
- }
-
- public ProcessInstance getProcessInstance(long processInstanceId) {
- ProcessInstance processInstance = (ProcessInstance) jbpmContext.loadProcessInstanceForUpdate(processInstanceId);
- return processInstance;
- }
-}
Copied: jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesaction/RulesActionTest.java (from rev 2431, jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesAction/RulesActionTest.java)
===================================================================
--- jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesaction/RulesActionTest.java (rev 0)
+++ jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/rulesaction/RulesActionTest.java 2008-09-29 10:23:49 UTC (rev 2432)
@@ -0,0 +1,124 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.examples.rulesaction;
+
+import java.util.Date;
+
+import junit.framework.TestCase;
+
+import org.jbpm.JbpmConfiguration;
+import org.jbpm.JbpmContext;
+import org.jbpm.context.exe.ContextInstance;
+import org.jbpm.graph.def.ProcessDefinition;
+import org.jbpm.graph.exe.ProcessInstance;
+import org.jbpm.persistence.db.DbPersistenceServiceFactory;
+import org.jbpm.svc.Services;
+import org.jbpm.graph.exe.Token;
+
+/**
+ * This example shows how to invoke JBoss Drools from an ActionHandler.
+ */
+public class RulesActionTest extends TestCase
+{
+
+ JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance();
+
+ DbPersistenceServiceFactory dbPersistenceServiceFactory = (DbPersistenceServiceFactory)jbpmConfiguration.getServiceFactory(Services.SERVICENAME_PERSISTENCE);
+
+ JbpmContext jbpmContext;
+ long processInstanceId;
+
+ public void setUp()
+ {
+ dbPersistenceServiceFactory.createSchema();
+ deployProcess();
+ jbpmContext = jbpmConfiguration.createJbpmContext();
+ }
+
+ public void tearDown()
+ {
+ jbpmContext.close();
+ dbPersistenceServiceFactory.dropSchema();
+ jbpmContext = null;
+ }
+
+ public void newTransaction()
+ {
+ jbpmContext.close();
+ jbpmContext = jbpmConfiguration.createJbpmContext();
+ }
+
+ public void deployProcess()
+ {
+ JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
+ try
+ {
+ ProcessDefinition processDefinition = ProcessDefinition.parseXmlResource("rulesaction/processdefinition.xml");
+ jbpmContext.deployProcessDefinition(processDefinition);
+ }
+ finally
+ {
+ jbpmContext.close();
+ }
+ }
+
+ public void testRulesAssignment()
+ {
+ // start process
+ newTransaction();
+ processInstanceId = createNewProcessInstance();
+ assertNotNull(processInstanceId);
+
+ newTransaction();
+ ProcessInstance processInstance = getProcessInstance(processInstanceId);
+
+ assertNotNull(processInstance);
+
+ Date processEnd = processInstance.getEnd();
+ assertNotNull(processEnd);
+ String shipper = (String)processInstance.getContextInstance().getVariable("shipper");
+ assertEquals("shipper is FEDX", shipper, "FEDX");
+
+ }
+
+ public long createNewProcessInstance()
+ {
+ String processDefinitionName = "RulesAction";
+ ProcessInstance processInstance = jbpmContext.newProcessInstanceForUpdate(processDefinitionName);
+ long id = processInstance.getId();
+ ContextInstance contextInstance = processInstance.getContextInstance();
+ contextInstance.setVariable("processDefinitionName", processDefinitionName);
+ Order order = new Order(300);
+ Customer customer = new Customer("Fred", new Integer(5), new Integer(25), new Long(100000));
+ contextInstance.setVariable("order", order);
+ contextInstance.setVariable("customer", customer);
+ Token token = processInstance.getRootToken();
+ token.signal();
+ return id;
+ }
+
+ public ProcessInstance getProcessInstance(long processInstanceId)
+ {
+ ProcessInstance processInstance = (ProcessInstance)jbpmContext.loadProcessInstanceForUpdate(processInstanceId);
+ return processInstance;
+ }
+}
Modified: jbpm3/trunk/modules/examples/src/test/resources/rulesaction/Shipper.drl
===================================================================
--- jbpm3/trunk/modules/examples/src/test/resources/rulesaction/Shipper.drl 2008-09-29 10:17:43 UTC (rev 2431)
+++ jbpm3/trunk/modules/examples/src/test/resources/rulesaction/Shipper.drl 2008-09-29 10:23:49 UTC (rev 2432)
@@ -1,7 +1,7 @@
package org.jbpm.action
-import org.jbpm.action.Customer;
-import org.jbpm.action.Order;
+import org.jbpm.examples.rulesaction.Customer;
+import org.jbpm.examples.rulesaction.Order;
import org.jbpm.context.exe.ContextInstance;
global ContextInstance ci
@@ -10,9 +10,6 @@
when
Customer( region >= 1 )
Order( totalAmount >= 0 )
-
then
ci.setVariable("shipper", "FEDX");
- System.out.println("ship via FEDX " );
-
end
\ No newline at end of file
Modified: jbpm3/trunk/modules/examples/src/test/resources/rulesaction/processdefinition.xml
===================================================================
--- jbpm3/trunk/modules/examples/src/test/resources/rulesaction/processdefinition.xml 2008-09-29 10:17:43 UTC (rev 2431)
+++ jbpm3/trunk/modules/examples/src/test/resources/rulesaction/processdefinition.xml 2008-09-29 10:23:49 UTC (rev 2432)
@@ -3,12 +3,12 @@
<process-definition
xmlns="urn:jbpm.org:jpdl-3.2" name="RulesAction">
<node name="Ship Product">
- <action name="Execute Shipping Rules" class="org.jbpm.action.RulesActionHandler">
+ <action name="Execute Shipping Rules" class="org.jbpm.examples.rulesaction.RulesActionHandler">
<objectNames>
<element>order</element>
<element>customer</element>
</objectNames>
- <ruleFile>/Shipper.drl</ruleFile>
+ <ruleFile>/rulesaction/Shipper.drl</ruleFile>
</action>
<transition name="" to="end1"></transition>
</node>
17 years, 6 months
JBoss JBPM SVN: r2431 - in jbpm3/trunk/modules/examples: src/test/java/org/jbpm/examples/raise and 1 other directory.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-09-29 06:17:43 -0400 (Mon, 29 Sep 2008)
New Revision: 2431
Modified:
jbpm3/trunk/modules/examples/pom.xml
jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/raise/RaiseRequestTest.java
Log:
[JBPM-1747] Fix examples/raise
Modified: jbpm3/trunk/modules/examples/pom.xml
===================================================================
--- jbpm3/trunk/modules/examples/pom.xml 2008-09-29 10:15:09 UTC (rev 2430)
+++ jbpm3/trunk/modules/examples/pom.xml 2008-09-29 10:17:43 UTC (rev 2431)
@@ -103,7 +103,6 @@
<configuration>
<!-- [JBPM-1290] Integrate example tests in automated testrun -->
<excludes>
- <exclude>org/jbpm/examples/raise/**</exclude>
<exclude>org/jbpm/examples/rulesAction/**</exclude>
<exclude>org/jbpm/examples/taskinstance/**</exclude>
<exclude>org/jbpm/examples/taskmgmt/**</exclude>
Modified: jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/raise/RaiseRequestTest.java
===================================================================
--- jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/raise/RaiseRequestTest.java 2008-09-29 10:15:09 UTC (rev 2430)
+++ jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/raise/RaiseRequestTest.java 2008-09-29 10:17:43 UTC (rev 2431)
@@ -18,229 +18,229 @@
import org.jbpm.taskmgmt.exe.TaskInstance;
import org.jbpm.taskmgmt.exe.TaskMgmtInstance;
-public class RaiseRequestTest extends TestCase {
- Log log = LogFactory.getLog(this.getClass());
+public class RaiseRequestTest extends TestCase
+{
+ Log log = LogFactory.getLog(this.getClass());
- JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance();
- DbPersistenceServiceFactory dbPersistenceServiceFactory = (DbPersistenceServiceFactory) jbpmConfiguration
- .getServiceFactory(Services.SERVICENAME_PERSISTENCE);
+ JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance();
+ DbPersistenceServiceFactory dbPersistenceServiceFactory = (DbPersistenceServiceFactory)jbpmConfiguration.getServiceFactory(Services.SERVICENAME_PERSISTENCE);
- JbpmContext jbpmContext;
+ JbpmContext jbpmContext;
- ProcessInstance processInstance = null;
- ContextInstance contextInstance = null;
- TaskMgmtInstance taskMgmtInstance = null;
- long processInstanceId = -1;
+ ProcessInstance processInstance = null;
+ ContextInstance contextInstance = null;
+ TaskMgmtInstance taskMgmtInstance = null;
+ long processInstanceId = -1;
- public void setUp() {
- dbPersistenceServiceFactory.createSchema();
- deployProcess();
- jbpmContext = jbpmConfiguration.createJbpmContext();
- }
+ public void setUp()
+ {
+ dbPersistenceServiceFactory.createSchema();
+ deployProcess();
+ jbpmContext = jbpmConfiguration.createJbpmContext();
+ }
- public void tearDown() {
- jbpmContext.close();
- dbPersistenceServiceFactory.dropSchema();
- jbpmContext = null;
- }
+ public void tearDown()
+ {
+ jbpmContext.close();
+ dbPersistenceServiceFactory.dropSchema();
+ jbpmContext = null;
+ }
- private void newTransaction() {
- jbpmContext.close();
- jbpmContext = jbpmConfiguration.createJbpmContext();
- }
+ private void newTransaction()
+ {
+ jbpmContext.close();
+ jbpmContext = jbpmConfiguration.createJbpmContext();
+ }
- private void deployProcess() {
- JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
- try {
- ProcessDefinition processDefinition = ProcessDefinition
- .parseXmlResource("processdefinition.xml");
- jbpmContext.deployProcessDefinition(processDefinition);
- } finally {
- jbpmContext.close();
- }
- }
+ private void deployProcess()
+ {
+ JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
+ try
+ {
+ ProcessDefinition processDefinition = ProcessDefinition.parseXmlResource("raise/processdefinition.xml");
+ jbpmContext.deployProcessDefinition(processDefinition);
+ }
+ finally
+ {
+ jbpmContext.close();
+ }
+ }
- private TaskInstance createNewProcessInstance() {
- processInstance = jbpmContext.newProcessInstanceForUpdate("raise request");
- processInstanceId = processInstance.getId();
- contextInstance = processInstance.getContextInstance();
- taskMgmtInstance = processInstance.getTaskMgmtInstance();
- return processInstance.getTaskMgmtInstance().createStartTaskInstance();
- }
+ private TaskInstance createNewProcessInstance()
+ {
+ processInstance = jbpmContext.newProcessInstanceForUpdate("raise request");
+ processInstanceId = processInstance.getId();
+ contextInstance = processInstance.getContextInstance();
+ taskMgmtInstance = processInstance.getTaskMgmtInstance();
+ return processInstance.getTaskMgmtInstance().createStartTaskInstance();
+ }
- public void testTaskParameters() {
- TaskInstance taskInstance = createNewProcessInstance();
- assertEquals("submit raise request", taskInstance.getName());
- assertEquals(0, taskInstance.getVariables().size());
- }
+ public void testTaskParameters()
+ {
+ TaskInstance taskInstance = createNewProcessInstance();
+ assertEquals("submit raise request", taskInstance.getName());
+ assertEquals(0, taskInstance.getVariables().size());
+ }
- public void testSubmitRaiseRequestTask() {
- jbpmContext.setActorId("employee");
- TaskInstance taskInstance = createNewProcessInstance();
+ public void testSubmitRaiseRequestTask()
+ {
+ jbpmContext.setActorId("employee");
+ TaskInstance taskInstance = createNewProcessInstance();
- Map<String, Object> taskVariables = new HashMap<String, Object>();
- taskVariables.put("reason", "I need to buy a jet");
- taskVariables.put("amount", 600);
+ Map<String, Object> taskVariables = new HashMap<String, Object>();
+ taskVariables.put("reason", "I need to buy a jet");
+ taskVariables.put("amount", 600);
- taskInstance.addVariables(taskVariables);
- taskInstance.end();
+ taskInstance.addVariables(taskVariables);
+ taskInstance.end();
- assertEquals("I need to buy a jet", contextInstance.getVariable("reason"));
- assertEquals(600, contextInstance.getVariable("amount"));
- assertEquals("employee", taskMgmtInstance.getSwimlaneInstance("employee")
- .getActorId());
- }
+ assertEquals("I need to buy a jet", contextInstance.getVariable("reason"));
+ assertEquals(600, contextInstance.getVariable("amount"));
+ assertEquals("employee", taskMgmtInstance.getSwimlaneInstance("employee").getActorId());
+ }
- @SuppressWarnings("unchecked")
- public void testManagerEvaluationReject() {
- TaskInstance taskInstance = createNewProcessInstance();
- Map<String, Object> taskVariables = new HashMap<String, Object>();
- taskVariables.put("reason", "I need to buy a jet");
- taskVariables.put("amount", 600);
- taskInstance.addVariables(taskVariables);
- taskInstance.end();
- jbpmContext.save(processInstance);
- newTransaction();
+ @SuppressWarnings("unchecked")
+ public void testManagerEvaluationReject()
+ {
+ TaskInstance taskInstance = createNewProcessInstance();
+ Map<String, Object> taskVariables = new HashMap<String, Object>();
+ taskVariables.put("reason", "I need to buy a jet");
+ taskVariables.put("amount", 600);
+ taskInstance.addVariables(taskVariables);
+ taskInstance.end();
+ jbpmContext.save(processInstance);
+ newTransaction();
- List<TaskInstance> managerTasks = jbpmContext.getTaskMgmtSession()
- .findTaskInstances("manager");
- assertEquals(1, managerTasks.size());
+ List<TaskInstance> managerTasks = jbpmContext.getTaskMgmtSession().findTaskInstances("manager");
+ assertEquals(1, managerTasks.size());
- TaskInstance managerTask = managerTasks.get(0);
- managerTask.end("reject");
+ TaskInstance managerTask = managerTasks.get(0);
+ managerTask.end("reject");
- List<TaskInstance> foTasks = jbpmContext.getTaskMgmtSession()
- .findTaskInstances("fo");
- assertEquals(0, foTasks.size());
- }
+ List<TaskInstance> foTasks = jbpmContext.getTaskMgmtSession().findTaskInstances("fo");
+ assertEquals(0, foTasks.size());
+ }
- @SuppressWarnings("unchecked")
- public void testManagerEvaluationAcceptFOReject() {
- TaskInstance taskInstance = createNewProcessInstance();
- Map<String, Object> taskVariables = new HashMap<String, Object>();
- taskVariables.put("reason", "I need to buy a jet");
- taskVariables.put("amount", 600);
- taskInstance.addVariables(taskVariables);
- taskInstance.end();
- jbpmContext.save(processInstance);
- newTransaction();
+ @SuppressWarnings("unchecked")
+ public void testManagerEvaluationAcceptFOReject()
+ {
+ TaskInstance taskInstance = createNewProcessInstance();
+ Map<String, Object> taskVariables = new HashMap<String, Object>();
+ taskVariables.put("reason", "I need to buy a jet");
+ taskVariables.put("amount", 600);
+ taskInstance.addVariables(taskVariables);
+ taskInstance.end();
+ jbpmContext.save(processInstance);
+ newTransaction();
- List<TaskInstance> managerTasks = jbpmContext.getTaskMgmtSession()
- .findTaskInstances("manager");
- assertEquals(1, managerTasks.size());
- TaskInstance managerTask = managerTasks.get(0);
- managerTask.start();
- managerTask.end("accept");
+ List<TaskInstance> managerTasks = jbpmContext.getTaskMgmtSession().findTaskInstances("manager");
+ assertEquals(1, managerTasks.size());
+ TaskInstance managerTask = managerTasks.get(0);
+ managerTask.start();
+ managerTask.end("accept");
- newTransaction();
- List<TaskInstance> foTasks = jbpmContext.getTaskMgmtSession()
- .findTaskInstances("fo");
- assertEquals(1, foTasks.size());
+ newTransaction();
+ List<TaskInstance> foTasks = jbpmContext.getTaskMgmtSession().findTaskInstances("fo");
+ assertEquals(1, foTasks.size());
- TaskInstance foTask = foTasks.get(0);
- foTask.start();
- foTask.addComment("Justify two consecutive raises");
- foTask.end("reject");
+ TaskInstance foTask = foTasks.get(0);
+ foTask.start();
+ foTask.addComment("Justify two consecutive raises");
+ foTask.end("reject");
- managerTasks = jbpmContext.getTaskMgmtSession()
- .findTaskInstances("manager");
- assertEquals(0, managerTasks.size());
- }
+ managerTasks = jbpmContext.getTaskMgmtSession().findTaskInstances("manager");
+ assertEquals(0, managerTasks.size());
+ }
- @SuppressWarnings("unchecked")
- public void testManagerEvaluationAcceptFOAccpet() {
- TaskInstance taskInstance = createNewProcessInstance();
- Map<String, Object> taskVariables = new HashMap<String, Object>();
- taskVariables.put("reason", "I need to buy a jet");
- taskVariables.put("amount", 600);
- taskInstance.addVariables(taskVariables);
- taskInstance.end();
- jbpmContext.save(processInstance);
- newTransaction();
+ @SuppressWarnings("unchecked")
+ public void testManagerEvaluationAcceptFOAccpet()
+ {
+ TaskInstance taskInstance = createNewProcessInstance();
+ Map<String, Object> taskVariables = new HashMap<String, Object>();
+ taskVariables.put("reason", "I need to buy a jet");
+ taskVariables.put("amount", 600);
+ taskInstance.addVariables(taskVariables);
+ taskInstance.end();
+ jbpmContext.save(processInstance);
+ newTransaction();
- List<TaskInstance> managerTasks = jbpmContext.getTaskMgmtSession()
- .findTaskInstances("manager");
- assertEquals(1, managerTasks.size());
- TaskInstance managerTask = managerTasks.get(0);
- managerTask.start();
- managerTask.end("accept");
+ List<TaskInstance> managerTasks = jbpmContext.getTaskMgmtSession().findTaskInstances("manager");
+ assertEquals(1, managerTasks.size());
+ TaskInstance managerTask = managerTasks.get(0);
+ managerTask.start();
+ managerTask.end("accept");
- newTransaction();
- List<TaskInstance> foTasks = jbpmContext.getTaskMgmtSession()
- .findTaskInstances("fo");
- assertEquals(1, foTasks.size());
+ newTransaction();
+ List<TaskInstance> foTasks = jbpmContext.getTaskMgmtSession().findTaskInstances("fo");
+ assertEquals(1, foTasks.size());
- TaskInstance foTask = foTasks.get(0);
- foTask.start();
- foTask.addComment("Justify two consecutive raises");
- foTask.end("accept");
+ TaskInstance foTask = foTasks.get(0);
+ foTask.start();
+ foTask.addComment("Justify two consecutive raises");
+ foTask.end("accept");
- newTransaction();
- List<TaskInstance> accountantTasks = jbpmContext.getTaskMgmtSession()
- .findTaskInstances("accountant");
- assertEquals(1, accountantTasks.size());
+ newTransaction();
+ List<TaskInstance> accountantTasks = jbpmContext.getTaskMgmtSession().findTaskInstances("accountant");
+ assertEquals(1, accountantTasks.size());
- TaskInstance accountantTask = accountantTasks.get(0);
- accountantTask.start();
- accountantTask.addComment("ERP updated");
- accountantTask.end("terminate");
- }
+ TaskInstance accountantTask = accountantTasks.get(0);
+ accountantTask.start();
+ accountantTask.addComment("ERP updated");
+ accountantTask.end("terminate");
+ }
- @SuppressWarnings("unchecked")
- public void testManagerEvaluationAcceptFOMultipleIterationsAccpet() {
- TaskInstance taskInstance = createNewProcessInstance();
- Map<String, Object> taskVariables = new HashMap<String, Object>();
- taskVariables.put("reason", "I need to buy a jet");
- taskVariables.put("amount", 600);
- taskInstance.addVariables(taskVariables);
- taskInstance.end();
- jbpmContext.save(processInstance);
- newTransaction();
+ @SuppressWarnings("unchecked")
+ public void testManagerEvaluationAcceptFOMultipleIterationsAccpet()
+ {
+ TaskInstance taskInstance = createNewProcessInstance();
+ Map<String, Object> taskVariables = new HashMap<String, Object>();
+ taskVariables.put("reason", "I need to buy a jet");
+ taskVariables.put("amount", 600);
+ taskInstance.addVariables(taskVariables);
+ taskInstance.end();
+ jbpmContext.save(processInstance);
+ newTransaction();
- List<TaskInstance> managerTasks = jbpmContext.getTaskMgmtSession()
- .findTaskInstances("manager");
- assertEquals(1, managerTasks.size());
- TaskInstance managerTask = managerTasks.get(0);
- managerTask.start();
- managerTask.end("accept");
+ List<TaskInstance> managerTasks = jbpmContext.getTaskMgmtSession().findTaskInstances("manager");
+ assertEquals(1, managerTasks.size());
+ TaskInstance managerTask = managerTasks.get(0);
+ managerTask.start();
+ managerTask.end("accept");
- newTransaction();
- List<TaskInstance> foTasks = jbpmContext.getTaskMgmtSession()
- .findTaskInstances("fo");
- assertEquals(1, foTasks.size());
+ newTransaction();
+ List<TaskInstance> foTasks = jbpmContext.getTaskMgmtSession().findTaskInstances("fo");
+ assertEquals(1, foTasks.size());
- TaskInstance foTask = foTasks.get(0);
- foTask.start();
- foTask.addComment("Justify two consecutive raises");
- foTask.end("more justification required");
+ TaskInstance foTask = foTasks.get(0);
+ foTask.start();
+ foTask.addComment("Justify two consecutive raises");
+ foTask.end("more justification required");
- newTransaction();
- managerTasks = jbpmContext.getTaskMgmtSession()
- .findTaskInstances("manager");
- assertEquals(1, managerTasks.size());
+ newTransaction();
+ managerTasks = jbpmContext.getTaskMgmtSession().findTaskInstances("manager");
+ assertEquals(1, managerTasks.size());
- managerTask = managerTasks.get(0);
- managerTask.start();
- managerTask.addComment("The guy exceeds all the expectations");
- managerTask.end("accept");
+ managerTask = managerTasks.get(0);
+ managerTask.start();
+ managerTask.addComment("The guy exceeds all the expectations");
+ managerTask.end("accept");
- newTransaction();
- foTasks = jbpmContext.getTaskMgmtSession().findTaskInstances("fo");
- assertEquals(1, foTasks.size());
+ newTransaction();
+ foTasks = jbpmContext.getTaskMgmtSession().findTaskInstances("fo");
+ assertEquals(1, foTasks.size());
- foTask = foTasks.get(0);
- foTask.start();
- foTask.addComment("justification accepted");
- foTask.end("accept");
-
- newTransaction();
- List<TaskInstance> accountantTasks = jbpmContext.getTaskMgmtSession()
- .findTaskInstances("accountant");
- assertEquals(1, accountantTasks.size());
+ foTask = foTasks.get(0);
+ foTask.start();
+ foTask.addComment("justification accepted");
+ foTask.end("accept");
- TaskInstance accountantTask = accountantTasks.get(0);
- accountantTask.start();
- accountantTask.addComment("ERP updated");
- accountantTask.end("terminate");
- }
+ newTransaction();
+ List<TaskInstance> accountantTasks = jbpmContext.getTaskMgmtSession().findTaskInstances("accountant");
+ assertEquals(1, accountantTasks.size());
+
+ TaskInstance accountantTask = accountantTasks.get(0);
+ accountantTask.start();
+ accountantTask.addComment("ERP updated");
+ accountantTask.end("terminate");
+ }
}
17 years, 6 months
JBoss JBPM SVN: r2430 - jbpm3/trunk/modules/examples.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-09-29 06:15:09 -0400 (Mon, 29 Sep 2008)
New Revision: 2430
Modified:
jbpm3/trunk/modules/examples/pom.xml
Log:
[JBPM-1746] Fix examples/mail
Modified: jbpm3/trunk/modules/examples/pom.xml
===================================================================
--- jbpm3/trunk/modules/examples/pom.xml 2008-09-29 10:11:03 UTC (rev 2429)
+++ jbpm3/trunk/modules/examples/pom.xml 2008-09-29 10:15:09 UTC (rev 2430)
@@ -43,6 +43,17 @@
<version>${version}</version>
</dependency>
+ <dependency>
+ <groupId>javax.mail</groupId>
+ <artifactId>mail</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
<!-- Test Dependencies -->
<dependency>
<groupId>org.drools</groupId>
@@ -64,11 +75,6 @@
<artifactId>log4j</artifactId>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate</artifactId>
- <scope>provided</scope>
- </dependency>
</dependencies>
<!-- Plugins -->
@@ -97,7 +103,6 @@
<configuration>
<!-- [JBPM-1290] Integrate example tests in automated testrun -->
<excludes>
- <exclude>org/jbpm/examples/mail/**</exclude>
<exclude>org/jbpm/examples/raise/**</exclude>
<exclude>org/jbpm/examples/rulesAction/**</exclude>
<exclude>org/jbpm/examples/taskinstance/**</exclude>
17 years, 6 months
JBoss JBPM SVN: r2429 - in jbpm3/trunk: modules/core and 2 other directories.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-09-29 06:11:03 -0400 (Mon, 29 Sep 2008)
New Revision: 2429
Modified:
jbpm3/trunk/modules/core/pom.xml
jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/mail/MailTest.java
jbpm3/trunk/modules/jbpm4jsf/pom.xml
jbpm3/trunk/pom.xml
Log:
Move dependency scope out of DependencyManagement
Modified: jbpm3/trunk/modules/core/pom.xml
===================================================================
--- jbpm3/trunk/modules/core/pom.xml 2008-09-29 09:55:10 UTC (rev 2428)
+++ jbpm3/trunk/modules/core/pom.xml 2008-09-29 10:11:03 UTC (rev 2429)
@@ -35,7 +35,6 @@
<dependencies>
<!-- jBPM Dependencies -->
- <!-- Compile Dependencies -->
<dependency>
<groupId>bsh</groupId>
<artifactId>bsh</artifactId>
@@ -51,14 +50,17 @@
<dependency>
<groupId>javax.jcr</groupId>
<artifactId>jcr</artifactId>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
Modified: jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/mail/MailTest.java
===================================================================
--- jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/mail/MailTest.java 2008-09-29 09:55:10 UTC (rev 2428)
+++ jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/mail/MailTest.java 2008-09-29 10:11:03 UTC (rev 2429)
@@ -27,42 +27,47 @@
import org.jbpm.graph.exe.ProcessInstance;
import org.jbpm.mail.AddressResolver;
-public class MailTest {
+public class MailTest
+{
+ public static class MyAddressResolver implements AddressResolver
+ {
+ private static final long serialVersionUID = 1L;
- public static class MyAddressResolver implements AddressResolver {
- private static final long serialVersionUID = 1L;
- public Object resolveAddress(String actorId) {
- return actorId+"@dalton.com";
+ public Object resolveAddress(String actorId)
+ {
+ return actorId + "@dalton.com";
}
}
- public void testSimpleProcess() throws Exception {
+ public void testSimpleProcess() throws Exception
+ {
JbpmConfiguration jbpmConfiguration = JbpmConfiguration.parseXmlString(
- "<jbpm-configuration>" +
- " <bean name='jbpm.mail.address.resolver' class='"+MyAddressResolver.class.getName()+"' singleton='true' />" +
- "</jbpm-configuration>"
- );
-
+ "<jbpm-configuration>" +
+ " <bean name='jbpm.mail.address.resolver' class='" + MyAddressResolver.class.getName() + "' singleton='true' />" +
+ "</jbpm-configuration>");
+
JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
- try {
+ try
+ {
ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
- "<process-definition name='mailtest'>" +
- " <start-state name='start'>" +
- " <transition to='start toothpick line' />" +
- " </start-state>" +
- " <task-node name='start toothpick line'>" +
- " <task notify='yes'>" +
- " <assignment actor-id='grandma' />" +
- " </task>" +
- " <transition to='end' />" +
- " </task-node>" +
- " <end-state name='end' />" +
- "</process-definition>"
- );
- ProcessInstance processInstance = new ProcessInstance(processDefinition);
- processInstance.signal();
-
- } finally {
+ "<process-definition name='mailtest'>" +
+ " <start-state name='start'>" +
+ " <transition to='start toothpick line' />" +
+ " </start-state>" +
+ " <task-node name='start toothpick line'>" +
+ " <task notify='yes'>" +
+ " <assignment actor-id='grandma' />" +
+ " </task>" +
+ " <transition to='end' />" +
+ " </task-node>" +
+ " <end-state name='end' />" +
+ "</process-definition>");
+ ProcessInstance processInstance = new ProcessInstance(processDefinition);
+ processInstance.signal();
+
+ }
+ finally
+ {
jbpmContext.close();
}
}
Modified: jbpm3/trunk/modules/jbpm4jsf/pom.xml
===================================================================
--- jbpm3/trunk/modules/jbpm4jsf/pom.xml 2008-09-29 09:55:10 UTC (rev 2428)
+++ jbpm3/trunk/modules/jbpm4jsf/pom.xml 2008-09-29 10:11:03 UTC (rev 2429)
@@ -37,7 +37,6 @@
<version>${version}</version>
</dependency>
- <!-- Compile Dependencies -->
<dependency>
<groupId>org.jboss.gravel</groupId>
<artifactId>gravel</artifactId>
@@ -49,20 +48,22 @@
<dependency>
<groupId>javax.el</groupId>
<artifactId>el-api</artifactId>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-api</artifactId>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-impl</artifactId>
+ <scope>runtime</scope>
</dependency>
-
- <!-- Provided Dependencies -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
+ <scope>provided</scope>
</dependency>
</dependencies>
Modified: jbpm3/trunk/pom.xml
===================================================================
--- jbpm3/trunk/pom.xml 2008-09-29 09:55:10 UTC (rev 2428)
+++ jbpm3/trunk/pom.xml 2008-09-29 10:11:03 UTC (rev 2429)
@@ -187,75 +187,58 @@
<groupId>javax.ejb</groupId>
<artifactId>ejb-api</artifactId>
<version>${javax.ejb.version}</version>
- <scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.el</groupId>
<artifactId>el-api</artifactId>
<version>${javax.el.version}</version>
- <scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>${javax.faces.version}</version>
- <scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>${javax.faces.version}</version>
- <scope>runtime</scope>
</dependency>
<dependency>
<groupId>javax.jcr</groupId>
<artifactId>jcr</artifactId>
<version>${javax.jcr.version}</version>
- <scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
<version>${javax.jms.version}</version>
- <scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.jws</groupId>
<artifactId>jsr181-api</artifactId>
<version>${javax.jws.version}</version>
- <scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>${javax.mail.version}</version>
- <scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>persistence-api</artifactId>
<version>${javax.persistence.version}</version>
- <scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>${javax.servlet.version}</version>
- <scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>${javax.jaxb.version}</version>
- <scope>provided</scope>
</dependency>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>${junit.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
<groupId>opensymphony</groupId>
<artifactId>oscache</artifactId>
<version>${oscache.version}</version>
17 years, 6 months
JBoss JBPM SVN: r2428 - jbpm4/trunk.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2008-09-29 05:55:10 -0400 (Mon, 29 Sep 2008)
New Revision: 2428
Added:
jbpm4/trunk/build.xml
Log:
added eclipse IDE integration based on ant
Added: jbpm4/trunk/build.xml
===================================================================
--- jbpm4/trunk/build.xml (rev 0)
+++ jbpm4/trunk/build.xml 2008-09-29 09:55:10 UTC (rev 2428)
@@ -0,0 +1,93 @@
+<project name="jbpm4" default="install" basedir=".">
+
+ <!-- This ant build only serves as IDE integration to run maven jobs.
+ Now in eclipse it's possible to open the ant view and double click
+ the targets in this ant build that will just delegate to the maven
+ build. Also, if there are html results being produced by a target,
+ they are opened in a browser.
+ -->
+
+ <!-- Overwrite property values in your local
+ file ${user.home}/.jbpm4/ant.properties
+ -->
+ <property file="${user.home}/.jbpm4/ant.properties" />
+
+ <!-- BROWSER PROPERTIES -->
+ <!-- <property name="windows.browser" value="C:/Program Files/Internet Explorer/IEXPLORE.EXE" /> -->
+ <property name="windows.browser" value="C:/Program Files/Mozilla Firefox/firefox.exe" />
+ <property name="macos.browser" value="/usr/bin/open" />
+ <property name="linux.browser" value="mozilla" />
+
+ <target name="clean">
+ <exec executable="cmd">
+ <arg line="/C mvn clean" />
+ </exec>
+ </target>
+
+ <target name="install">
+ <exec executable="cmd" os="Windows Vista, Windows XP,Windows 2000,Windows 98">
+ <arg line="/C mvn -DskipTests install" />
+ </exec>
+ </target>
+
+ <target name="javadoc">
+ <exec executable="cmd" os="Windows Vista, Windows XP,Windows 2000,Windows 98">
+ <arg line="/C mvn javadoc:javadoc" />
+ </exec>
+ <antcall target="show.html">
+ <param name="page" value="modules/pvm/target/site/apidocs/index.html"/>
+ </antcall>
+ </target>
+
+ <target name="test">
+ <exec executable="cmd" os="Windows Vista, Windows XP,Windows 2000,Windows 98">
+ <arg line="/C mvn surefire-report:report" />
+ </exec>
+ <antcall target="show.html">
+ <param name="page" value="modules/pvm/target/site/surefire-report.html"/>
+ </antcall>
+ </target>
+
+ <target name="distro.package">
+ <exec executable="cmd" os="Windows Vista, Windows XP,Windows 2000,Windows 98">
+ <arg line="/C mvn -DskipTests package assembly:assembly" />
+ </exec>
+ <antcall target="show.html">
+ <param name="page" value="target/"/>
+ </antcall>
+ </target>
+
+ <target name="wirexsddoc">
+ <exec executable="cmd">
+ <arg line="/C mvn ?" />
+ </exec>
+ <antcall target="show.html">
+ <param name="page" value="modules/core/target/site/apidocs/index.html"/>
+ </antcall>
+ </target>
+
+ <target name="manual">
+ <exec executable="cmd" dir="modules/manual">
+ <arg line="/C mvn jdocbook:resources jdocbook:generate" />
+ </exec>
+ <antcall target="show.html">
+ <param name="page" value="modules/manual/target/docbook/publish/en/html_single/index.html"/>
+ </antcall>
+ </target>
+
+
+ <!-- HTML -->
+ <target name="show.html">
+ <fail message="property page has to be specified to use this target" unless="page" />
+ <exec executable="cmd" os="Windows Vista, Windows XP,Windows 2000,Windows 98">
+ <arg value="/C start "${windows.browser}" "file://${basedir}/${page}"" />
+ </exec>
+ <exec executable="${macos.browser}" os="Mac OS X">
+ <arg value="file://${basedir}/${page}" />
+ </exec>
+ <exec executable="${linux.browser}" os="Linux">
+ <arg value="file://${basedir}/${page}" />
+ </exec>
+ </target>
+
+</project>
\ No newline at end of file
17 years, 6 months
JBoss JBPM SVN: r2427 - jbpm4/trunk/modules/pvm.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2008-09-29 05:54:43 -0400 (Mon, 29 Sep 2008)
New Revision: 2427
Modified:
jbpm4/trunk/modules/pvm/pom.xml
Log:
added javadocs limited to interface classes
Modified: jbpm4/trunk/modules/pvm/pom.xml
===================================================================
--- jbpm4/trunk/modules/pvm/pom.xml 2008-09-29 09:37:21 UTC (rev 2426)
+++ jbpm4/trunk/modules/pvm/pom.xml 2008-09-29 09:54:43 UTC (rev 2427)
@@ -210,5 +210,21 @@
<!-- Profiles -->
<profiles>
</profiles>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <quiet>true</quiet>
+ <source>1.5</source>
+ <verbose>false</verbose>
+ <noqualifier>all</noqualifier>
+ <excludePackageNames>*.internal:*.test</excludePackageNames>
+ </configuration>
+ </plugin>
+ </plugins>
+ </reporting>
</project>
\ No newline at end of file
17 years, 6 months
JBoss JBPM SVN: r2426 - in jbpm3/trunk/modules/examples: src/test/java/org/jbpm/examples/door and 1 other directory.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-09-29 05:37:21 -0400 (Mon, 29 Sep 2008)
New Revision: 2426
Modified:
jbpm3/trunk/modules/examples/pom.xml
jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/door/DoorProcessTest.java
jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/door/DoorTest.java
Log:
[JBPM-1745] Fix examples/door
Modified: jbpm3/trunk/modules/examples/pom.xml
===================================================================
--- jbpm3/trunk/modules/examples/pom.xml 2008-09-29 09:32:46 UTC (rev 2425)
+++ jbpm3/trunk/modules/examples/pom.xml 2008-09-29 09:37:21 UTC (rev 2426)
@@ -97,7 +97,6 @@
<configuration>
<!-- [JBPM-1290] Integrate example tests in automated testrun -->
<excludes>
- <exclude>org/jbpm/examples/door/**</exclude>
<exclude>org/jbpm/examples/mail/**</exclude>
<exclude>org/jbpm/examples/raise/**</exclude>
<exclude>org/jbpm/examples/rulesAction/**</exclude>
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-29 09:32:46 UTC (rev 2425)
+++ jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/door/DoorProcessTest.java 2008-09-29 09:37:21 UTC (rev 2426)
@@ -29,7 +29,7 @@
protected void setUp() throws Exception
{
super.setUp();
- doorProcess = ProcessDefinition.parseXmlInputStream(DoorProcessTest.class.getResourceAsStream("processdefinition.xml"));
+ doorProcess = ProcessDefinition.parseXmlInputStream(DoorProcessTest.class.getResourceAsStream("/door/processdefinition.xml"));
locked = doorProcess.getNode("Locked");
closed = doorProcess.getNode("Closed");
open = doorProcess.getNode("Open");
@@ -37,7 +37,7 @@
}
};
}
-
+
/**
* 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.
Modified: jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/door/DoorTest.java
===================================================================
--- jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/door/DoorTest.java 2008-09-29 09:32:46 UTC (rev 2425)
+++ jbpm3/trunk/modules/examples/src/test/java/org/jbpm/examples/door/DoorTest.java 2008-09-29 09:37:21 UTC (rev 2426)
@@ -1,146 +1,192 @@
package org.jbpm.examples.door;
-
import junit.framework.TestCase;
/**
- * This example shows the tradeoff between implementing the behaviour of a door in plain Java and using a jPDL process.
- * This is intended for developers to learn about the aspects that are handled better in a process versus plain programming.
+ * This example shows the tradeoff between implementing the behaviour of a door in plain Java and using a jPDL process. This is intended for developers to learn about
+ * the aspects that are handled better in a process versus plain programming.
*/
-public class DoorTest extends TestCase {
+public class DoorTest extends TestCase
+{
- public void testClosedOpen() {
+ public void testClosedOpen()
+ {
Door door = new Door();
door.open();
assertSame(Door.OPEN, door.state);
}
- public void testClosedLock() {
+ public void testClosedLock()
+ {
Door door = new Door();
door.lock();
assertSame(Door.LOCKED, door.state);
}
- public void testClosedClose() {
+ public void testClosedClose()
+ {
Door door = new Door();
- try {
+ try
+ {
door.close();
fail("expected exception");
- } catch (IllegalStateException e) {
}
+ catch (IllegalStateException e)
+ {
+ }
}
- public void testClosedUnlock() {
+ public void testClosedUnlock()
+ {
Door door = new Door();
- try {
+ try
+ {
door.unlock();
fail("expected exception");
- } catch (IllegalStateException e) {
}
+ catch (IllegalStateException e)
+ {
+ }
}
- public void testOpenedOpen() {
+ public void testOpenedOpen()
+ {
Door door = new Door();
door.state = Door.OPEN;
- try {
+ try
+ {
door.open();
fail("expected exception");
- } catch (IllegalStateException e) {
}
+ catch (IllegalStateException e)
+ {
+ }
}
- public void testOpenedLock() {
+ public void testOpenedLock()
+ {
Door door = new Door();
door.state = Door.OPEN;
door.lock();
assertSame(Door.OPEN_LOCKED, door.state);
}
- public void testOpenedClose() {
+ public void testOpenedClose()
+ {
Door door = new Door();
door.state = Door.OPEN;
door.close();
assertSame(Door.CLOSED, door.state);
}
- public void testOpenedUnlock() {
+ public void testOpenedUnlock()
+ {
Door door = new Door();
door.state = Door.OPEN;
- try {
+ try
+ {
door.unlock();
fail("expected exception");
- } catch (IllegalStateException e) {
}
+ catch (IllegalStateException e)
+ {
+ }
}
- public void testLockedOpen() {
+ public void testLockedOpen()
+ {
Door door = new Door();
door.state = Door.LOCKED;
- try {
+ try
+ {
door.open();
fail("expected exception");
- } catch (IllegalStateException e) {
}
+ catch (IllegalStateException e)
+ {
+ }
}
- public void testLockedLock() {
+ public void testLockedLock()
+ {
Door door = new Door();
door.state = Door.LOCKED;
- try {
+ try
+ {
door.lock();
fail("expected exception");
- } catch (IllegalStateException e) {
}
+ catch (IllegalStateException e)
+ {
+ }
}
- public void testLockedClose() {
+ public void testLockedClose()
+ {
Door door = new Door();
door.state = Door.LOCKED;
- try {
+ try
+ {
door.close();
fail("expected exception");
- } catch (IllegalStateException e) {
}
+ catch (IllegalStateException e)
+ {
+ }
}
- public void testLockedUnlock() {
+ public void testLockedUnlock()
+ {
Door door = new Door();
door.state = Door.LOCKED;
door.unlock();
assertSame(Door.CLOSED, door.state);
}
- public void testOpenLockedOpen() {
+ public void testOpenLockedOpen()
+ {
Door door = new Door();
door.state = Door.OPEN_LOCKED;
- try {
+ try
+ {
door.open();
fail("expected exception");
- } catch (IllegalStateException e) {
}
+ catch (IllegalStateException e)
+ {
+ }
}
- public void testOpenLockedLock() {
+ public void testOpenLockedLock()
+ {
Door door = new Door();
door.state = Door.OPEN_LOCKED;
- try {
+ try
+ {
door.lock();
fail("expected exception");
- } catch (IllegalStateException e) {
}
+ catch (IllegalStateException e)
+ {
+ }
}
- public void testOpenLockedClose() {
+ public void testOpenLockedClose()
+ {
Door door = new Door();
door.state = Door.OPEN_LOCKED;
- try {
+ try
+ {
door.close();
fail("expected exception");
- } catch (IllegalStateException e) {
}
+ catch (IllegalStateException e)
+ {
+ }
}
- public void testOpenLockedUnlock() {
+ public void testOpenLockedUnlock()
+ {
Door door = new Door();
door.state = Door.OPEN_LOCKED;
door.unlock();
17 years, 6 months