[jbpm-commits] JBoss JBPM SVN: r2120 - in jbpm3/trunk/modules/jpdl/core/src/test: resources/org/jbpm/job/executor and 1 other directory.
do-not-reply at jboss.org
do-not-reply at jboss.org
Thu Sep 4 17:46:22 EDT 2008
Author: alex.guizar at jboss.com
Date: 2008-09-04 17:46:21 -0400 (Thu, 04 Sep 2008)
New Revision: 2120
Added:
jbpm3/trunk/modules/jpdl/core/src/test/java/org/jbpm/job/executor/EventCallback.java
Removed:
jbpm3/trunk/modules/jpdl/core/src/test/java/org/jbpm/job/executor/TestCallback.java
Modified:
jbpm3/trunk/modules/jpdl/core/src/test/java/org/jbpm/job/executor/MultiJobExecutorDbTest.java
jbpm3/trunk/modules/jpdl/core/src/test/java/org/jbpm/job/executor/TimerOnTimerDbTest.java
jbpm3/trunk/modules/jpdl/core/src/test/resources/org/jbpm/job/executor/timerprocess.xml
Log:
renamed TestCallback because surefire mistook it for a TestCase
Copied: jbpm3/trunk/modules/jpdl/core/src/test/java/org/jbpm/job/executor/EventCallback.java (from rev 2119, jbpm3/trunk/modules/jpdl/core/src/test/java/org/jbpm/job/executor/TestCallback.java)
===================================================================
--- jbpm3/trunk/modules/jpdl/core/src/test/java/org/jbpm/job/executor/EventCallback.java (rev 0)
+++ jbpm3/trunk/modules/jpdl/core/src/test/java/org/jbpm/job/executor/EventCallback.java 2008-09-04 21:46:21 UTC (rev 2120)
@@ -0,0 +1,105 @@
+/*
+ * 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.job.executor;
+
+import java.io.Serializable;
+
+import javax.transaction.Status;
+import javax.transaction.Synchronization;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jbpm.JbpmContext;
+import org.jbpm.graph.def.Event;
+
+public class EventCallback implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+ private static final Log log = LogFactory.getLog(EventCallback.class);
+
+ public void processStart() {
+ registerNotification(Event.EVENTTYPE_PROCESS_START);
+ }
+
+ public void processEnd() {
+ registerNotification(Event.EVENTTYPE_PROCESS_END);
+ }
+
+ public void nodeEnter() {
+ registerNotification(Event.EVENTTYPE_NODE_ENTER);
+ }
+
+ public void nodeLeave() {
+ registerNotification(Event.EVENTTYPE_NODE_LEAVE);
+ }
+
+ public void taskCreate() {
+ registerNotification(Event.EVENTTYPE_TASK_CREATE);
+ }
+
+ public void taskEnd() {
+ registerNotification(Event.EVENTTYPE_TASK_END);
+ }
+
+ public void timerCreate() {
+ registerNotification(Event.EVENTTYPE_TIMER_CREATE);
+ }
+
+ public void timer() {
+ registerNotification(Event.EVENTTYPE_TIMER);
+ }
+
+ private static void registerNotification(final String event) {
+ Synchronization notification = new Synchronization() {
+
+ public void beforeCompletion() {
+ // nothing to do here
+ }
+
+ public void afterCompletion(int status) {
+ if (status == Status.STATUS_COMMITTED) {
+ log.info("delivering " + event + " notification");
+ synchronized (event) {
+ event.notify();
+ }
+ }
+ }
+
+ };
+ JbpmContext.getCurrentJbpmContext()
+ .getSession()
+ .getTransaction()
+ .registerSynchronization(notification);
+ }
+
+ public static void waitForEvent(String event) {
+ synchronized (event) {
+ try {
+ event.wait(30000);
+ }
+ catch (InterruptedException e) {
+ // reassert interruption
+ Thread.currentThread().interrupt();
+ }
+ }
+ }
+}
\ No newline at end of file
Property changes on: jbpm3/trunk/modules/jpdl/core/src/test/java/org/jbpm/job/executor/EventCallback.java
___________________________________________________________________
Name: svn:mergeinfo
+
Modified: jbpm3/trunk/modules/jpdl/core/src/test/java/org/jbpm/job/executor/MultiJobExecutorDbTest.java
===================================================================
--- jbpm3/trunk/modules/jpdl/core/src/test/java/org/jbpm/job/executor/MultiJobExecutorDbTest.java 2008-09-04 21:15:04 UTC (rev 2119)
+++ jbpm3/trunk/modules/jpdl/core/src/test/java/org/jbpm/job/executor/MultiJobExecutorDbTest.java 2008-09-04 21:46:21 UTC (rev 2120)
@@ -29,7 +29,7 @@
public static final String PROCESS_DEFINITION = "<?xml version='1.0' encoding='UTF-8'?>"
+ "<process-definition name='" + PROCESS_NAME + "'>"
+ "<event type='process-end'>"
- + "<action expression='#{testCallback.processEnd}' />"
+ + "<action expression='#{eventCallback.processEnd}' />"
+ "</event>"
+ "<start-state name='start-state1'>"
+ "<transition to='Service 1'></transition>"
@@ -75,7 +75,7 @@
JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
try {
ProcessInstance processInstance = jbpmContext.newProcessInstanceForUpdate(PROCESS_NAME);
- processInstance.getContextInstance().setVariable("testCallback", new TestCallback());
+ processInstance.getContextInstance().setVariable("eventCallback", new EventCallback());
processInstance.signal();
}
finally {
@@ -83,7 +83,7 @@
}
// wait for process end
- TestCallback.waitForEvent(Event.EVENTTYPE_PROCESS_END);
+ EventCallback.waitForEvent(Event.EVENTTYPE_PROCESS_END);
// stop job executors
for (int i = executors.length - 1; i >= 0; i--) {
Deleted: jbpm3/trunk/modules/jpdl/core/src/test/java/org/jbpm/job/executor/TestCallback.java
===================================================================
--- jbpm3/trunk/modules/jpdl/core/src/test/java/org/jbpm/job/executor/TestCallback.java 2008-09-04 21:15:04 UTC (rev 2119)
+++ jbpm3/trunk/modules/jpdl/core/src/test/java/org/jbpm/job/executor/TestCallback.java 2008-09-04 21:46:21 UTC (rev 2120)
@@ -1,105 +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.job.executor;
-
-import java.io.Serializable;
-
-import javax.transaction.Status;
-import javax.transaction.Synchronization;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jbpm.JbpmContext;
-import org.jbpm.graph.def.Event;
-
-public class TestCallback implements Serializable {
-
- private static final long serialVersionUID = 1L;
- private static final Log log = LogFactory.getLog(TestCallback.class);
-
- public void processStart() {
- registerNotification(Event.EVENTTYPE_PROCESS_START);
- }
-
- public void processEnd() {
- registerNotification(Event.EVENTTYPE_PROCESS_END);
- }
-
- public void nodeEnter() {
- registerNotification(Event.EVENTTYPE_NODE_ENTER);
- }
-
- public void nodeLeave() {
- registerNotification(Event.EVENTTYPE_NODE_LEAVE);
- }
-
- public void taskCreate() {
- registerNotification(Event.EVENTTYPE_TASK_CREATE);
- }
-
- public void taskEnd() {
- registerNotification(Event.EVENTTYPE_TASK_END);
- }
-
- public void timerCreate() {
- registerNotification(Event.EVENTTYPE_TIMER_CREATE);
- }
-
- public void timer() {
- registerNotification(Event.EVENTTYPE_TIMER);
- }
-
- private static void registerNotification(final String event) {
- Synchronization notification = new Synchronization() {
-
- public void beforeCompletion() {
- // nothing to do here
- }
-
- public void afterCompletion(int status) {
- if (status == Status.STATUS_COMMITTED) {
- log.info("delivering " + event + " notification");
- synchronized (event) {
- event.notify();
- }
- }
- }
-
- };
- JbpmContext.getCurrentJbpmContext()
- .getSession()
- .getTransaction()
- .registerSynchronization(notification);
- }
-
- public static void waitForEvent(String event) {
- synchronized (event) {
- try {
- event.wait(30000);
- }
- catch (InterruptedException e) {
- // reassert interruption
- Thread.currentThread().interrupt();
- }
- }
- }
-}
\ No newline at end of file
Modified: jbpm3/trunk/modules/jpdl/core/src/test/java/org/jbpm/job/executor/TimerOnTimerDbTest.java
===================================================================
--- jbpm3/trunk/modules/jpdl/core/src/test/java/org/jbpm/job/executor/TimerOnTimerDbTest.java 2008-09-04 21:15:04 UTC (rev 2119)
+++ jbpm3/trunk/modules/jpdl/core/src/test/java/org/jbpm/job/executor/TimerOnTimerDbTest.java 2008-09-04 21:46:21 UTC (rev 2120)
@@ -37,14 +37,14 @@
jbpmContext.deployProcessDefinition(processDefinition);
ProcessInstance processInstance = jbpmContext.newProcessInstanceForUpdate("timerProcess");
- processInstance.getContextInstance().setVariable("testCallback", new TestCallback());
+ processInstance.getContextInstance().setVariable("eventCallback", new EventCallback());
processInstance.signal();
assertEquals("firstNode", processInstance.getRootToken().getNode().getName());
commitAndCloseSession();
startJobExecutor();
try {
- TestCallback.waitForEvent(Event.EVENTTYPE_NODE_ENTER);
+ EventCallback.waitForEvent(Event.EVENTTYPE_NODE_ENTER);
beginSessionTransaction();
long processInstanceId = processInstance.getId();
assertEquals("secondNode", jbpmContext.loadProcessInstance(processInstanceId)
@@ -53,7 +53,7 @@
.getName());
commitAndCloseSession();
- TestCallback.waitForEvent(Event.EVENTTYPE_PROCESS_END);
+ EventCallback.waitForEvent(Event.EVENTTYPE_PROCESS_END);
beginSessionTransaction();
assertTrue(jbpmContext.loadProcessInstance(processInstanceId).hasEnded());
}
Modified: jbpm3/trunk/modules/jpdl/core/src/test/resources/org/jbpm/job/executor/timerprocess.xml
===================================================================
--- jbpm3/trunk/modules/jpdl/core/src/test/resources/org/jbpm/job/executor/timerprocess.xml 2008-09-04 21:15:04 UTC (rev 2119)
+++ jbpm3/trunk/modules/jpdl/core/src/test/resources/org/jbpm/job/executor/timerprocess.xml 2008-09-04 21:46:21 UTC (rev 2120)
@@ -4,16 +4,16 @@
xsi:schemaLocation="urn:jbpm.org:jpdl-3.2 http://jbpm.org/xsd/jpdl-3.2.xsd">
<event type="process-start">
- <action expression="#{testCallback.processStart}"/>
+ <action expression="#{eventCallback.processStart}"/>
</event>
<event type="process-end">
- <action expression="#{testCallback.processEnd}"/>
+ <action expression="#{eventCallback.processEnd}"/>
</event>
<event type="node-enter">
- <action expression="#{testCallback.nodeEnter}" />
+ <action expression="#{eventCallback.nodeEnter}" />
</event>
<event type="node-leave">
- <action expression="#{testCallback.nodeLeave}" />
+ <action expression="#{eventCallback.nodeLeave}" />
</event>
<start-state name="start">
More information about the jbpm-commits
mailing list