[jbpm-commits] JBoss JBPM SVN: r5051 - in jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test: execution and 1 other directory.
do-not-reply at jboss.org
do-not-reply at jboss.org
Wed Jun 17 08:35:36 EDT 2009
Author: tom.baeyens at jboss.com
Date: 2009-06-17 08:35:36 -0400 (Wed, 17 Jun 2009)
New Revision: 5051
Added:
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/async/AsyncEndCombinationTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/async/AsyncEventListenerOnEndTest.java
Removed:
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/AsyncEndCombinationTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/AsyncEventListenerOnEndTest.java
Log:
JBPM-2275 async end combinations
Copied: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/async/AsyncEndCombinationTest.java (from rev 5049, jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/AsyncEndCombinationTest.java)
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/async/AsyncEndCombinationTest.java (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/async/AsyncEndCombinationTest.java 2009-06-17 12:35:36 UTC (rev 5051)
@@ -0,0 +1,126 @@
+/*
+ * 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.test.async;
+
+import java.util.List;
+
+import org.jbpm.api.Execution;
+import org.jbpm.api.ProcessInstance;
+import org.jbpm.api.job.Job;
+import org.jbpm.test.JbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class AsyncEndCombinationTest extends JbpmTestCase {
+
+ public void testConcurrentEndScenario1() {
+ deployJpdlXmlString(
+ "<process name='AsyncEndCombination'>" +
+ " <start>" +
+ " <transition to='f' />" +
+ " </start>" +
+ " <fork name='f'>" +
+ " <transition to='a' continue='async' />" +
+ " <transition to='end' />" +
+ " </fork>" +
+ " <state name='a' />" +
+ " <end name='end' />" +
+ "</process>"
+ );
+
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("AsyncEndCombination");
+ assertEquals(Execution.STATE_ENDED, processInstance.getState());
+
+ List<Job> jobs = managementService
+ .createJobQuery()
+ .processInstanceId(processInstance.getId())
+ .list();
+
+ assertEquals(0, jobs.size());
+ }
+
+ public void testConcurrentScenario2() {
+ deployJpdlXmlString(
+ "<process name='AsyncEndCombination'>" +
+ " <start>" +
+ " <transition to='f' />" +
+ " </start>" +
+ " <fork name='f'>" +
+ " <transition to='end' />" +
+ " <transition to='a' continue='async' />" +
+ " </fork>" +
+ " <state name='a' />" +
+ " <end name='end' />" +
+ "</process>"
+ );
+
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("AsyncEndCombination");
+ assertEquals(Execution.STATE_ENDED, processInstance.getState());
+
+ List<Job> jobs = managementService
+ .createJobQuery()
+ .processInstanceId(processInstance.getId())
+ .list();
+
+ assertEquals(0, jobs.size());
+ }
+
+ public void testAsyncToEnd() {
+ deployJpdlXmlString(
+ "<process name='AsyncEndCombination'>" +
+ " <start>" +
+ " <transition to='s' />" +
+ " </start>" +
+ " <state name='s'>" +
+ " <transition to='end' continue='async' />" +
+ " </state>" +
+ " <end name='end' />" +
+ "</process>"
+ );
+
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("AsyncEndCombination");
+ String processInstanceId = processInstance.getId();
+ processInstance = executionService.signalExecutionById(processInstanceId);
+
+ assertEquals(Execution.STATE_ASYNC, processInstance.getState());
+
+ List<Job> jobs = managementService
+ .createJobQuery()
+ .processInstanceId(processInstanceId)
+ .list();
+
+ assertEquals(1, jobs.size());
+
+ managementService.executeJob(jobs.get(0).getDbid());
+
+ jobs = managementService
+ .createJobQuery()
+ .processInstanceId(processInstanceId)
+ .list();
+
+ assertEquals(0, jobs.size());
+
+ assertNull(executionService.findProcessInstanceById(processInstanceId));
+ }
+}
Property changes on: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/async/AsyncEndCombinationTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/async/AsyncEventListenerOnEndTest.java (from rev 5049, jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/AsyncEventListenerOnEndTest.java)
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/async/AsyncEventListenerOnEndTest.java (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/async/AsyncEventListenerOnEndTest.java 2009-06-17 12:35:36 UTC (rev 5051)
@@ -0,0 +1,108 @@
+/*
+ * 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.test.async;
+
+import org.jbpm.api.Execution;
+import org.jbpm.api.ProcessInstance;
+import org.jbpm.api.job.Job;
+import org.jbpm.api.listener.EventListener;
+import org.jbpm.api.listener.EventListenerExecution;
+import org.jbpm.test.JbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class AsyncEventListenerOnEndTest extends JbpmTestCase {
+
+ public static class AsyncEventListener implements EventListener {
+ private static final long serialVersionUID = 1L;
+ public void notify(EventListenerExecution execution) throws Exception {
+ }
+ }
+
+ public void testAsyncEventListenerAfterWaitState() {
+ deployJpdlXmlString(
+ "<process name='AsyncEventListenerOnEnd'>" +
+ " <start>" +
+ " <transition to='a' />" +
+ " </start>" +
+ " <state name='a'>" +
+ " <transition name='start-to-end' to='end'>" +
+ " <event-listener continue='async' class='"+AsyncEventListener.class.getName()+"' />" +
+ " </transition>" +
+ " </state>" +
+ " <end name='end' />" +
+ "</process>"
+ );
+
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("AsyncEventListenerOnEnd");
+
+ processInstance = executionService.signalExecutionById(processInstance.getId());
+
+ assertEquals(Execution.STATE_ASYNC, processInstance.getState());
+
+ Job job = managementService.createJobQuery()
+ .processInstanceId(processInstance.getId())
+ .uniqueResult();
+
+ assertNotNull(job);
+
+ managementService.executeJob(job.getDbid());
+
+ assertEquals(Execution.STATE_ENDED,
+ historyService.createHistoryProcessInstanceQuery()
+ .processInstanceId(processInstance.getId())
+ .uniqueResult()
+ .getState() );
+ }
+
+ public void testAsyncEventListenerInStartTransaction() {
+ deployJpdlXmlString(
+ "<process name='AsyncEventListenerOnEnd'>" +
+ " <start name='start'>" +
+ " <transition name='start-to-end' to='end'>" +
+ " <event-listener continue='async' class='"+AsyncEventListener.class.getName()+"' />" +
+ " </transition>" +
+ " </start>" +
+ " <end name='end' />" +
+ "</process>"
+ );
+
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("AsyncEventListenerOnEnd");
+ assertEquals(Execution.STATE_ASYNC, processInstance.getState());
+
+ Job job = managementService.createJobQuery()
+ .processInstanceId(processInstance.getId())
+ .uniqueResult();
+
+ assertNotNull(job);
+
+ managementService.executeJob(job.getDbid());
+
+ assertEquals(Execution.STATE_ENDED,
+ historyService.createHistoryProcessInstanceQuery()
+ .processInstanceId(processInstance.getId())
+ .uniqueResult()
+ .getState() );
+ }
+}
Property changes on: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/async/AsyncEventListenerOnEndTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/AsyncEndCombinationTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/AsyncEndCombinationTest.java 2009-06-17 09:57:20 UTC (rev 5050)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/AsyncEndCombinationTest.java 2009-06-17 12:35:36 UTC (rev 5051)
@@ -1,71 +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.test.execution;
-
-import org.jbpm.api.Execution;
-import org.jbpm.api.ProcessInstance;
-import org.jbpm.test.JbpmTestCase;
-
-
-/**
- * @author Tom Baeyens
- */
-public class AsyncEndCombinationTest extends JbpmTestCase {
-
- public void testConcurrentEndScenario1() {
- deployJpdlXmlString(
- "<process name='AsyncEndCombination'>" +
- " <start>" +
- " <transition to='f' />" +
- " </start>" +
- " <fork name='f'>" +
- " <transition to='a' continue='async' />" +
- " <transition to='end' />" +
- " </fork>" +
- " <state name='a' />" +
- " <end name='end' />" +
- "</process>"
- );
-
- ProcessInstance processInstance = executionService.startProcessInstanceByKey("AsyncEndCombination");
- assertEquals(Execution.STATE_ENDED, processInstance.getState());
- }
-
- public void testConcurrentScenario2() {
- deployJpdlXmlString(
- "<process name='AsyncEndCombination'>" +
- " <start>" +
- " <transition to='f' />" +
- " </start>" +
- " <fork name='f'>" +
- " <transition to='end' />" +
- " <transition to='a' continue='async' />" +
- " </fork>" +
- " <state name='a' />" +
- " <end name='end' />" +
- "</process>"
- );
-
- ProcessInstance processInstance = executionService.startProcessInstanceByKey("AsyncEndCombination");
- assertEquals(Execution.STATE_ENDED, processInstance.getState());
- }
-}
Deleted: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/AsyncEventListenerOnEndTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/AsyncEventListenerOnEndTest.java 2009-06-17 09:57:20 UTC (rev 5050)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/AsyncEventListenerOnEndTest.java 2009-06-17 12:35:36 UTC (rev 5051)
@@ -1,108 +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.test.execution;
-
-import org.jbpm.api.Execution;
-import org.jbpm.api.ProcessInstance;
-import org.jbpm.api.job.Job;
-import org.jbpm.api.listener.EventListener;
-import org.jbpm.api.listener.EventListenerExecution;
-import org.jbpm.test.JbpmTestCase;
-
-
-/**
- * @author Tom Baeyens
- */
-public class AsyncEventListenerOnEndTest extends JbpmTestCase {
-
- public static class AsyncEventListener implements EventListener {
- private static final long serialVersionUID = 1L;
- public void notify(EventListenerExecution execution) throws Exception {
- }
- }
-
- public void testAsyncEventListenerAfterWaitState() {
- deployJpdlXmlString(
- "<process name='AsyncEventListenerOnEnd'>" +
- " <start>" +
- " <transition to='a' />" +
- " </start>" +
- " <state name='a'>" +
- " <transition name='start-to-end' to='end'>" +
- " <event-listener continue='async' class='"+AsyncEventListener.class.getName()+"' />" +
- " </transition>" +
- " </state>" +
- " <end name='end' />" +
- "</process>"
- );
-
- ProcessInstance processInstance = executionService.startProcessInstanceByKey("AsyncEventListenerOnEnd");
-
- processInstance = executionService.signalExecutionById(processInstance.getId());
-
- assertEquals(Execution.STATE_ASYNC, processInstance.getState());
-
- Job job = managementService.createJobQuery()
- .processInstanceId(processInstance.getId())
- .uniqueResult();
-
- assertNotNull(job);
-
- managementService.executeJob(job.getDbid());
-
- assertEquals(Execution.STATE_ENDED,
- historyService.createHistoryProcessInstanceQuery()
- .processInstanceId(processInstance.getId())
- .uniqueResult()
- .getState() );
- }
-
- public void testAsyncEventListenerInStartTransaction() {
- deployJpdlXmlString(
- "<process name='AsyncEventListenerOnEnd'>" +
- " <start name='start'>" +
- " <transition name='start-to-end' to='end'>" +
- " <event-listener continue='async' class='"+AsyncEventListener.class.getName()+"' />" +
- " </transition>" +
- " </start>" +
- " <end name='end' />" +
- "</process>"
- );
-
- ProcessInstance processInstance = executionService.startProcessInstanceByKey("AsyncEventListenerOnEnd");
- assertEquals(Execution.STATE_ASYNC, processInstance.getState());
-
- Job job = managementService.createJobQuery()
- .processInstanceId(processInstance.getId())
- .uniqueResult();
-
- assertNotNull(job);
-
- managementService.executeJob(job.getDbid());
-
- assertEquals(Execution.STATE_ENDED,
- historyService.createHistoryProcessInstanceQuery()
- .processInstanceId(processInstance.getId())
- .uniqueResult()
- .getState() );
- }
-}
More information about the jbpm-commits
mailing list