[jbpm-commits] JBoss JBPM SVN: r5042 - in jbpm4/branches/tbaeyens: modules/distro/src/main/files/jboss and 13 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Tue Jun 16 12:15:36 EDT 2009
Author: tom.baeyens at jboss.com
Date: 2009-06-16 12:15:35 -0400 (Tue, 16 Jun 2009)
New Revision: 5042
Added:
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/SerializableByteArrayInputStream.java
jbpm4/branches/tbaeyens/qa/jbpm.cfg.jboss.testsuite/
jbpm4/branches/tbaeyens/qa/jbpm.cfg.jboss.testsuite/jboss.idm/
jbpm4/branches/tbaeyens/qa/jbpm.cfg.jboss.testsuite/jboss.idm/jbpm.cfg.xml
jbpm4/branches/tbaeyens/qa/jbpm.cfg.jboss.testsuite/jbpm.identity/
jbpm4/branches/tbaeyens/qa/jbpm.cfg.jboss.testsuite/jbpm.identity/jbpm.cfg.xml
jbpm4/branches/tbaeyens/qa/jbpm.cfg.jboss.testsuite/jbpm.identity/jbpm.mail.properties
jbpm4/branches/tbaeyens/qa/jbpm.cfg.jboss.testsuite/jbpm.identity/jbpm.mail.templates.examples.xml
Removed:
jbpm4/branches/tbaeyens/modules/distro/src/main/files/jboss/jbpm.cfg.idm/jbpm.integration.test.cfg.xml
jbpm4/branches/tbaeyens/modules/distro/src/main/files/jboss/jbpm.cfg.integration.tests/jbpm.cfg.xml
jbpm4/branches/tbaeyens/modules/distro/src/main/files/jboss/jbpm.cfg.integration.tests/jbpm.mail.properties
jbpm4/branches/tbaeyens/modules/distro/src/main/files/jboss/jbpm.cfg.integration.tests/jbpm.mail.templates.examples.xml
Modified:
jbpm4/branches/tbaeyens/modules/distro/pom.xml
jbpm4/branches/tbaeyens/modules/distro/src/main/files/jboss/build.xml
jbpm4/branches/tbaeyens/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/EjbRemoteCommandService.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentImpl.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/resources/jbpm.tx.jta.cfg.xml
jbpm4/branches/tbaeyens/modules/test-db/pom.xml
jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/async/AsyncBasicsTest.java
jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/eventlistener/EventListenerTest.java
jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/task/TaskHandlerTest.java
jbpm4/branches/tbaeyens/qa/build.xml
Log:
test-db integration test fixes
Modified: jbpm4/branches/tbaeyens/modules/distro/pom.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/distro/pom.xml 2009-06-16 04:33:46 UTC (rev 5041)
+++ jbpm4/branches/tbaeyens/modules/distro/pom.xml 2009-06-16 16:15:35 UTC (rev 5042)
@@ -212,7 +212,7 @@
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
- <id>get.oracle.driver.lib</id>
+ <id>get.oracle.driver.and.junit.lib</id>
<phase>package</phase>
<goals>
<goal>copy</goal>
@@ -225,8 +225,14 @@
<version>${oracle.version}</version>
<destFileName>ojdbc14.jar</destFileName>
</artifactItem>
+ <artifactItem>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${junit.version}</version>
+ <destFileName>junit.jar</destFileName>
+ </artifactItem>
</artifactItems>
- <outputDirectory>target/oracle</outputDirectory>
+ <outputDirectory>target/libs</outputDirectory>
</configuration>
</execution>
</executions>
Modified: jbpm4/branches/tbaeyens/modules/distro/src/main/files/jboss/build.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/distro/src/main/files/jboss/build.xml 2009-06-16 04:33:46 UTC (rev 5041)
+++ jbpm4/branches/tbaeyens/modules/distro/src/main/files/jboss/build.xml 2009-06-16 16:15:35 UTC (rev 5042)
@@ -22,9 +22,9 @@
<property name="jboss.server.configuration" value="default" />
<property name="jboss.server.config.dir" value="${jboss.home}/server/${jboss.server.configuration}" />
<property name="jboss.server.data.dir" value="${jboss.home}/server/${jboss.server.configuration}/data" />
-
<property name="jbossidm.version" value="1.0.0.Alpha8" />
<property name="jbossidm.home" value="${jbpm.parent.dir}/jbossidm-${jbossidm.version}" />
+
<!-- for SNAPSHOT temporarily -->
<property name="jbossidm.distro.url" value="http://repository.jboss.com/maven2/org/jboss/identity/idm/jbossidm/${jbossidm.version}/jbossidm-${jbossidm.version}.zip" />
<property name="jbossidm.distro.path" value="${jbpm.parent.dir}/idm-assembly-${jbossidm.version}.zip" />
@@ -255,24 +255,6 @@
overwrite="true" />
</target>
- <!-- ### THE JBOSS INTEGRATION TEST SPECIFICS ####################### -->
- <target name="internal.install.jbpm.into.jboss.integrationtestspecifics">
- <copy todir="${jboss.server.config.dir}/deploy/jbpm/jbpm-service.sar" overwrite="true">
- <fileset dir="${jbpm.home}/jboss/jbpm.cfg.integration.tests" />
- </copy>
- <antcall target="internal.install.idm.into.jboss.integrationtestspecifics" />
- <ant antfile="${jbpm.home}/examples/build.xml" target="examples.jar" />
- <mkdir dir="${jboss.server.config.dir}/deploy/jbpm/userlibs" />
- <copy file="${jbpm.home}/examples/target/examples.jar"
- todir="${jboss.server.config.dir}/deploy/jbpm/userlibs" />
- </target>
-
- <target name="internal.install.idm.into.jboss.integrationtestspecifics" if="jbpm.identity.idm">
- <copy file="${jbpm.home}/jboss/jbpm.cfg.idm/jbpm.integration.test.cfg.xml"
- tofile="${jboss.server.config.dir}/deploy/jbpm/jbpm-service.sar/jbpm.cfg.xml"
- overwrite="true" />
- </target>
-
<!-- ### THE HSQLDB SPECIFIC PART ####################################### -->
<target name="internal.install.jbpm.into.jboss.db.hsqldb" />
Deleted: jbpm4/branches/tbaeyens/modules/distro/src/main/files/jboss/jbpm.cfg.idm/jbpm.integration.test.cfg.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/distro/src/main/files/jboss/jbpm.cfg.idm/jbpm.integration.test.cfg.xml 2009-06-16 04:33:46 UTC (rev 5041)
+++ jbpm4/branches/tbaeyens/modules/distro/src/main/files/jboss/jbpm.cfg.idm/jbpm.integration.test.cfg.xml 2009-06-16 16:15:35 UTC (rev 5042)
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<jbpm-configuration>
-
- <import resource="jbpm.default.cfg.xml" />
- <import resource="jbpm.tx.jta.cfg.xml" />
- <import resource="jbpm.jpdl.cfg.xml" />
- <import resource="jbpm.jboss.idm.cfg.xml" />
-
- <import resource="jbpm.mail.templates.examples.xml" />
-
- <!-- Job executor is excluded for running the example test cases.
- To enable timers and messages in production use, this should be included.
- import resource="jbpm.jobexecutor.cfg.xml" / -->
-
-</jbpm-configuration>
Deleted: jbpm4/branches/tbaeyens/modules/distro/src/main/files/jboss/jbpm.cfg.integration.tests/jbpm.cfg.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/distro/src/main/files/jboss/jbpm.cfg.integration.tests/jbpm.cfg.xml 2009-06-16 04:33:46 UTC (rev 5041)
+++ jbpm4/branches/tbaeyens/modules/distro/src/main/files/jboss/jbpm.cfg.integration.tests/jbpm.cfg.xml 2009-06-16 16:15:35 UTC (rev 5042)
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<jbpm-configuration>
-
- <import resource="jbpm.default.cfg.xml" />
- <import resource="jbpm.tx.jta.cfg.xml" />
- <import resource="jbpm.jpdl.cfg.xml" />
- <import resource="jbpm.identity.cfg.xml" />
-
- <import resource="jbpm.mail.templates.examples.xml" />
-
-</jbpm-configuration>
Deleted: jbpm4/branches/tbaeyens/modules/distro/src/main/files/jboss/jbpm.cfg.integration.tests/jbpm.mail.properties
===================================================================
--- jbpm4/branches/tbaeyens/modules/distro/src/main/files/jboss/jbpm.cfg.integration.tests/jbpm.mail.properties 2009-06-16 04:33:46 UTC (rev 5041)
+++ jbpm4/branches/tbaeyens/modules/distro/src/main/files/jboss/jbpm.cfg.integration.tests/jbpm.mail.properties 2009-06-16 16:15:35 UTC (rev 5042)
@@ -1,3 +0,0 @@
-mail.smtp.host localhost
-mail.smtp.port 2525
-mail.from noreply at jbpm.org
\ No newline at end of file
Deleted: jbpm4/branches/tbaeyens/modules/distro/src/main/files/jboss/jbpm.cfg.integration.tests/jbpm.mail.templates.examples.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/distro/src/main/files/jboss/jbpm.cfg.integration.tests/jbpm.mail.templates.examples.xml 2009-06-16 04:33:46 UTC (rev 5041)
+++ jbpm4/branches/tbaeyens/modules/distro/src/main/files/jboss/jbpm.cfg.integration.tests/jbpm.mail.templates.examples.xml 2009-06-16 16:15:35 UTC (rev 5042)
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<jbpm-configuration>
-
- <process-engine-context>
-
- <mail-template name="rectify-template">
- <to addresses="${addressee}" />
- <cc users="bb" groups="innerparty" />
- <bcc groups="thinkpol" />
- <subject>rectify ${newspaper}</subject>
- <text>${newspaper} ${date} ${details}</text>
- </mail-template>
-
- </process-engine-context>
-
-</jbpm-configuration>
\ No newline at end of file
Modified: jbpm4/branches/tbaeyens/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/EjbRemoteCommandService.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/EjbRemoteCommandService.java 2009-06-16 04:33:46 UTC (rev 5041)
+++ jbpm4/branches/tbaeyens/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/EjbRemoteCommandService.java 2009-06-16 16:15:35 UTC (rev 5042)
@@ -68,7 +68,7 @@
return (T) result;
} catch (Exception e) {
- throw new JbpmException("couldn't execute remote command", e);
+ throw new JbpmException("couldn't execute remote command: "+e.getMessage(), e);
}
}
}
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentImpl.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentImpl.java 2009-06-16 04:33:46 UTC (rev 5041)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentImpl.java 2009-06-16 16:15:35 UTC (rev 5042)
@@ -21,7 +21,6 @@
*/
package org.jbpm.pvm.internal.repository;
-import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
@@ -41,7 +40,6 @@
import org.jbpm.api.env.Environment;
import org.jbpm.pvm.internal.cmd.DeployCmd;
import org.jbpm.pvm.internal.lob.Lob;
-import org.jbpm.pvm.internal.session.RepositorySession;
import org.jbpm.pvm.internal.stream.ByteArrayStreamInput;
import org.jbpm.pvm.internal.stream.FileStreamInput;
import org.jbpm.pvm.internal.stream.InputStreamInput;
@@ -161,7 +159,7 @@
Lob lob = resources.get(resourceName);
if (lob!=null) {
byte[] bytes = lob.extractBytes();
- return new ByteArrayInputStream(bytes);
+ return new SerializableByteArrayInputStream(bytes);
}
}
return null;
Added: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/SerializableByteArrayInputStream.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/SerializableByteArrayInputStream.java (rev 0)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/SerializableByteArrayInputStream.java 2009-06-16 16:15:35 UTC (rev 5042)
@@ -0,0 +1,42 @@
+/*
+ * 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.pvm.internal.repository;
+
+import java.io.ByteArrayInputStream;
+import java.io.Serializable;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class SerializableByteArrayInputStream extends ByteArrayInputStream implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ public SerializableByteArrayInputStream(byte[] buf) {
+ super(buf);
+ }
+
+ Object readResolve() {
+ return new ByteArrayInputStream(buf);
+ }
+}
Property changes on: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/SerializableByteArrayInputStream.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/resources/jbpm.tx.jta.cfg.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/resources/jbpm.tx.jta.cfg.xml 2009-06-16 04:33:46 UTC (rev 5041)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/resources/jbpm.tx.jta.cfg.xml 2009-06-16 16:15:35 UTC (rev 5042)
@@ -4,8 +4,8 @@
<process-engine-context>
<command-service>
+ <environment-interceptor />
<jta-transaction-interceptor />
- <environment-interceptor />
</command-service>
</process-engine-context>
Modified: jbpm4/branches/tbaeyens/modules/test-db/pom.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/test-db/pom.xml 2009-06-16 04:33:46 UTC (rev 5041)
+++ jbpm4/branches/tbaeyens/modules/test-db/pom.xml 2009-06-16 16:15:35 UTC (rev 5042)
@@ -54,6 +54,30 @@
</dependency>
</dependencies>
+
+ <build>
+ <plugins>
+ <!-- this create jar file of code from src/test/java so modules with tests can share code -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>test-jar</goal>
+ </goals>
+ <configuration>
+ <excludes>
+ <exclude>jbpm.*</exclude>
+ <exclude>logging.properties</exclude>
+ <exclude>META-INF/*</exclude>
+ </excludes>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
<profiles>
Modified: jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/async/AsyncBasicsTest.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/async/AsyncBasicsTest.java 2009-06-16 04:33:46 UTC (rev 5041)
+++ jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/async/AsyncBasicsTest.java 2009-06-16 16:15:35 UTC (rev 5042)
@@ -21,10 +21,14 @@
*/
package org.jbpm.test.async;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import org.jbpm.api.Execution;
import org.jbpm.api.ProcessInstance;
+import org.jbpm.api.activity.ActivityBehaviour;
+import org.jbpm.api.activity.ActivityExecution;
import org.jbpm.api.job.Job;
import org.jbpm.test.JbpmTestCase;
@@ -34,42 +38,43 @@
*/
public class AsyncBasicsTest extends JbpmTestCase {
- static boolean doneSomething;
-
- protected void setUp() throws Exception {
- super.setUp();
-
- doneSomething = false;
+ public static class DoABit implements ActivityBehaviour {
+ public void execute(ActivityExecution execution) {
+ execution.setVariable("done", "a bit");
+ }
}
-
- public static class Do {
- public void something() {
- doneSomething = true;
+ public static class DoALot implements ActivityBehaviour {
+ public void execute(ActivityExecution execution) {
+ execution.setVariable("done", "a lot");
}
}
- public void testAsyncWaitStatesSequence() {
+ public void testAsyncAutomaticSequence() {
deployJpdlXmlString(
"<process name='TwoAsyncStates'>" +
" <start>" +
" <transition to='a' />" +
" </start>" +
- " <java name='a' continue='async' class='"+Do.class.getName()+"' method='something'>" +
+ " <custom name='a' continue='async' class='"+DoABit.class.getName()+"'>" +
" <transition to='b' />" +
- " </java>" +
- " <java name='b' continue='async' class='"+Do.class.getName()+"' method='something'>" +
+ " </custom>" +
+ " <custom name='b' continue='async' class='"+DoALot.class.getName()+"'>" +
" <transition to='end' />" +
- " </java>" +
- " <end name='end' />" +
+ " </custom>" +
+ " <state name='end' />" +
"</process>"
);
- ProcessInstance processInstance = executionService.startProcessInstanceByKey("TwoAsyncStates");
+ Map<String, Object> variables = new HashMap<String, Object>();
+ variables.put("done", "nothing");
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("TwoAsyncStates", variables);
+ String processInstanceId = processInstance.getId();
+
assertEquals(Execution.STATE_ASYNC, processInstance.getState());
+
+ assertEquals("nothing", executionService.getVariable(processInstanceId, "done"));
- assertFalse(doneSomething);
-
List<Job> jobs = managementService
.createJobQuery()
.processInstanceId(processInstance.getId())
@@ -81,8 +86,7 @@
managementService.executeJob(job.getDbid());
- assertTrue(doneSomething);
- doneSomething = false;
+ assertEquals("a bit", executionService.getVariable(processInstanceId, "done"));
processInstance = executionService.findProcessInstanceById(processInstance.getId());
assertEquals(Execution.STATE_ASYNC, processInstance.getState());
@@ -98,9 +102,10 @@
managementService.executeJob(job.getDbid());
- assertTrue(doneSomething);
- processInstance = executionService.findProcessInstanceById(processInstance.getId());
- assertNull(processInstance);
+ assertEquals("a lot", executionService.getVariable(processInstanceId, "done"));
+
+ processInstance = executionService.findProcessInstanceById(processInstanceId);
+ assertTrue(processInstance.isActive("end"));
}
public void testAsyncTransitions() {
@@ -109,21 +114,24 @@
" <start>" +
" <transition to='a' />" +
" </start>" +
- " <java name='a' class='"+Do.class.getName()+"' method='something'>" +
+ " <custom name='a' class='"+DoABit.class.getName()+"'>" +
" <transition continue='async' to='b' />" +
- " </java>" +
- " <java name='b' class='"+Do.class.getName()+"' method='something'>" +
+ " </custom>" +
+ " <custom name='b' class='"+DoALot.class.getName()+"'>" +
" <transition continue='async' to='end' />" +
- " </java>" +
- " <end name='end' />" +
+ " </custom>" +
+ " <state name='end' />" +
"</process>"
);
- ProcessInstance processInstance = executionService.startProcessInstanceByKey("TwoAsyncStates");
+ Map<String, Object> variables = new HashMap<String, Object>();
+ variables.put("done", "nothing");
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("TwoAsyncStates", variables);
+ String processInstanceId = processInstance.getId();
+
assertEquals(Execution.STATE_ASYNC, processInstance.getState());
- assertTrue(doneSomething);
- doneSomething = false;
+ assertEquals("a bit", executionService.getVariable(processInstanceId, "done"));
List<Job> jobs = managementService
.createJobQuery()
@@ -136,7 +144,7 @@
managementService.executeJob(job.getDbid());
- assertTrue(doneSomething);
+ assertEquals("a lot", executionService.getVariable(processInstanceId, "done"));
processInstance = executionService.findProcessInstanceById(processInstance.getId());
assertEquals(Execution.STATE_ASYNC, processInstance.getState());
@@ -152,8 +160,8 @@
managementService.executeJob(job.getDbid());
- processInstance = executionService.findProcessInstanceById(processInstance.getId());
- assertNull(processInstance);
+ processInstance = executionService.findProcessInstanceById(processInstanceId);
+ assertTrue(processInstance.isActive("end"));
}
Modified: jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/eventlistener/EventListenerTest.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/eventlistener/EventListenerTest.java 2009-06-16 04:33:46 UTC (rev 5041)
+++ jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/eventlistener/EventListenerTest.java 2009-06-16 16:15:35 UTC (rev 5042)
@@ -22,9 +22,12 @@
package org.jbpm.test.eventlistener;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import org.jbpm.api.Execution;
+import org.jbpm.api.ProcessInstance;
import org.jbpm.api.listener.EventListener;
import org.jbpm.api.listener.EventListenerExecution;
import org.jbpm.test.JbpmTestCase;
@@ -35,18 +38,10 @@
*/
public class EventListenerTest extends JbpmTestCase {
- static boolean isInvoked = false;
- static List<Integer> order;
-
- protected void setUp() throws Exception {
- super.setUp();
- isInvoked = false;
- }
-
public static class ProcessStartListener implements EventListener {
private static final long serialVersionUID = 1L;
public void notify(EventListenerExecution execution) {
- isInvoked = true;
+ execution.setVariable("isInvoked", "true");
}
}
@@ -63,40 +58,15 @@
"</process>"
);
- executionService.startProcessInstanceByKey("ICL");
+ String processInstanceId = executionService.startProcessInstanceByKey("ICL").getId();
- assertTrue("process start listener not invoked", isInvoked);
+ assertEquals("true", executionService.getVariable(processInstanceId, "isInvoked"));
}
- public static class ProcessEndListener implements EventListener {
- private static final long serialVersionUID = 1L;
- public void notify(EventListenerExecution execution) {
- isInvoked = true;
- }
- }
-
- public void testProcessEndListener() {
- deployJpdlXmlString(
- "<process name='Insurance claim' key='ICL'>" +
- " <on event='end'>" +
- " <event-listener class='"+ProcessEndListener.class.getName()+"' />" +
- " </on>" +
- " <start>" +
- " <transition to='end' />" +
- " </start>" +
- " <end name='end' />" +
- "</process>"
- );
-
- executionService.startProcessInstanceByKey("ICL");
-
- assertTrue("process end listener not invoked", isInvoked);
- }
-
public static class ActivityStartListener implements EventListener {
private static final long serialVersionUID = 1L;
public void notify(EventListenerExecution execution) {
- isInvoked = true;
+ execution.setVariable("isInvoked", "true");
}
}
@@ -112,19 +82,19 @@
" </on>" +
" <transition to='end' />" +
" </state>" +
- " <end name='end' />" +
+ " <state name='end' />" +
"</process>"
);
- executionService.startProcessInstanceByKey("ICL");
+ String processInstanceId = executionService.startProcessInstanceByKey("ICL").getId();
- assertTrue("activity start listener not invoked", isInvoked);
+ assertEquals("true", executionService.getVariable(processInstanceId, "isInvoked"));
}
public static class ActivityEndListener implements EventListener {
private static final long serialVersionUID = 1L;
public void notify(EventListenerExecution execution) {
- isInvoked = true;
+ execution.setVariable("isInvoked", "true");
}
}
@@ -140,29 +110,29 @@
" </on>" +
" <transition to='end' />" +
" </state>" +
- " <end name='end' />" +
+ " <state name='end' />" +
"</process>"
);
- Execution execution = executionService.startProcessInstanceByKey("ICL");
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("ICL");
+ String processInstanceId = processInstance.getId();
- assertFalse("activity end listener invoked too early", isInvoked);
+ assertNull(executionService.getVariable(processInstanceId, "isInvoked"));
- executionService.signalExecutionById(execution.getId());
+ executionService.signalExecutionById(processInstance.getId());
- assertTrue("activity end listener not invoked", isInvoked);
+ assertEquals("true", executionService.getVariable(processInstanceId, "isInvoked"));
}
public static class TransitionListener implements EventListener {
private static final long serialVersionUID = 1L;
public void notify(EventListenerExecution execution) {
assertNotNull(execution.getTransition());
- isInvoked = true;
+ execution.setVariable("isInvoked", "true");
}
}
public void testTransitionListener() {
- order = new ArrayList<Integer>();
deployJpdlXmlString(
"<process name='Insurance claim' key='ICL'>" +
" <start>" +
@@ -170,25 +140,26 @@
" <event-listener class='"+TransitionListener.class.getName()+"' />" +
" </transition>" +
" </start>" +
- " <end name='end' />" +
+ " <state name='end' />" +
"</process>"
);
- executionService.startProcessInstanceByKey("ICL");
+ String processInstanceId = executionService.startProcessInstanceByKey("ICL").getId();
- assertTrue("transition listener not invoked", isInvoked);
+ assertEquals("true", executionService.getVariable(processInstanceId, "isInvoked"));
}
public static class OrderListener implements EventListener {
private static final long serialVersionUID = 1L;
int i;
public void notify(EventListenerExecution execution) {
+ List<Integer> order = (List<Integer>) execution.getVariable("order");
order.add(i);
+ execution.setVariable("order", order);
}
}
public void testEventOrdering() {
- order = new ArrayList<Integer>();
deployJpdlXmlString(
"<process name='Insurance claim' key='ICL'>" +
" <start>" +
@@ -210,11 +181,13 @@
" </event-listener>" +
" </transition>" +
" </start>" +
- " <end name='end' />" +
+ " <state name='end' />" +
"</process>"
);
- executionService.startProcessInstanceByKey("ICL");
+ Map<String, Object> variables = new HashMap<String, Object>();
+ variables.put("order", new ArrayList<Integer>());
+ String processInstanceId = executionService.startProcessInstanceByKey("ICL", variables).getId();
List<Integer> expectedOrder = new ArrayList<Integer>();
expectedOrder.add(1);
@@ -223,6 +196,6 @@
expectedOrder.add(4);
expectedOrder.add(5);
- assertEquals(expectedOrder, order);
+ assertEquals(expectedOrder, executionService.getVariable(processInstanceId, "order"));
}
}
Modified: jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/task/TaskHandlerTest.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/task/TaskHandlerTest.java 2009-06-16 04:33:46 UTC (rev 5041)
+++ jbpm4/branches/tbaeyens/modules/test-db/src/test/java/org/jbpm/test/task/TaskHandlerTest.java 2009-06-16 16:15:35 UTC (rev 5042)
@@ -33,52 +33,34 @@
*/
public class TaskHandlerTest extends JbpmTestCase {
- static boolean isExecutionCreateTaskCalled;
- static boolean isExecutionSignalledCalled;
- static boolean isTaskCancelCalled;
- static boolean isTaskCompleteCalled;
- static boolean isSubTaskCompleteCalled;
- static boolean isTaskVariableUpdateCalled;
-
- public void setUp() throws Exception {
- super.setUp();
-
- isExecutionCreateTaskCalled = false;
- isExecutionSignalledCalled = false;
- isTaskCancelCalled = false;
- isTaskCompleteCalled = false;
- isSubTaskCompleteCalled = false;
- isTaskVariableUpdateCalled = false;
- }
-
public static class ReviewHandler extends TaskHandler {
public boolean executionCreateTask(OpenTask task) {
- isExecutionCreateTaskCalled = true;
+ task.getExecution().setVariable("isExecutionCreateTaskCalled", "true");
return super.executionCreateTask(task);
}
public void executionSignal(OpenTask task) {
- isExecutionSignalledCalled = true;
+ task.getExecution().setVariable("isExecutionSignalledCalled", "true");
super.executionSignal(task);
}
public void taskCancel(OpenTask task, String reason) {
- isTaskCancelCalled = true;
+ task.getExecution().setVariable("isTaskCancelCalled", "true");
super.taskCancel(task, reason);
}
public void taskComplete(OpenTask task, String outcome) {
- isTaskCompleteCalled = true;
+ task.getExecution().setVariable("isTaskCompleteCalled", "true");
super.taskComplete(task, outcome);
}
public void taskSubTaskComplete(OpenTask task, OpenTask subTask, String outcome) {
- isSubTaskCompleteCalled = true;
+ task.getExecution().setVariable("isSubTaskCompleteCalled", "true");
super.taskSubTaskComplete(task, subTask, outcome);
}
public void taskVariableUpdate(OpenTask task, String key, Object value) {
- isTaskVariableUpdateCalled = true;
+ task.getExecution().setVariable("isTaskVariableUpdateCalled", "true");
super.taskVariableUpdate(task, key, value);
}
}
@@ -97,26 +79,26 @@
"</process>"
);
- executionService.startProcessInstanceByKey("TaskHandler");
+ String processInstanceId = executionService.startProcessInstanceByKey("TaskHandler").getId();
- assertTrue(isExecutionCreateTaskCalled);
+ assertEquals("true", executionService.getVariable(processInstanceId, "isExecutionCreateTaskCalled"));
Task task = taskService.createTaskQuery().list().get(0);
long taskDbid = task.getDbid();
taskService.setVariable(taskDbid, "checked", "true");
- assertTrue(isExecutionCreateTaskCalled);
+ assertEquals("true", executionService.getVariable(processInstanceId, "isExecutionCreateTaskCalled"));
Task subTask = taskService.newTask(taskDbid);
long subTaskDbid = taskService.saveTask(subTask);
taskService.completeTask(subTaskDbid);
- assertTrue(isSubTaskCompleteCalled);
+ assertEquals("true", executionService.getVariable(processInstanceId, "isSubTaskCompleteCalled"));
taskService.completeTask(taskDbid);
- assertTrue(isTaskCompleteCalled);
+ assertEquals("true", executionService.getVariable(processInstanceId, "isTaskCompleteCalled"));
}
public void testTaskHandlerCancelScenario() {
@@ -133,14 +115,14 @@
"</process>"
);
- executionService.startProcessInstanceByKey("TaskHandler");
+ String processInstanceId = executionService.startProcessInstanceByKey("TaskHandler").getId();
Task task = taskService.createTaskQuery().list().get(0);
long taskDbid = task.getDbid();
taskService.deleteTask(taskDbid);
- assertTrue(isTaskCancelCalled);
+ assertEquals("true", executionService.getVariable(processInstanceId, "isTaskCancelCalled"));
}
public void testTaskHandlerExecutionSignalScenario() {
@@ -162,6 +144,6 @@
executionService.signalExecutionById(executionId);
- assertTrue(isExecutionSignalledCalled);
+ assertEquals("true", executionService.getVariable(executionId, "isExecutionSignalledCalled"));
}
}
Modified: jbpm4/branches/tbaeyens/qa/build.xml
===================================================================
--- jbpm4/branches/tbaeyens/qa/build.xml 2009-06-16 04:33:46 UTC (rev 5041)
+++ jbpm4/branches/tbaeyens/qa/build.xml 2009-06-16 16:15:35 UTC (rev 5042)
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="jbpm.qa">
-
- <!-- DEVELOPER SPECIFIC CONFIGURATIONS -->
- <property file="${user.home}/.jbpm4/build.properties" />
-
+
+ <!-- DEVELOPER SPECIFIC CONFIGURATIONS -->
+ <property file="${user.home}/.jbpm4/build.properties" />
+
<fail message="property jbpm.parent.dir must be specified" unless="jbpm.parent.dir" />
<!-- CONFIGURABLE PROPERTIES -->
@@ -33,50 +33,72 @@
<echo message="jbpm.version...... ${jbpm.version}" />
<echo message="jbpm.home......... ${jbpm.home}" />
<echo message="jbpm.distro.path.. ${jbpm.distro.path}" />
- <echo message="jbossidm.home .... ${jbossidm.home}" />
+ <echo message="jbossidm.home .... ${jbossidm.home}" />
</target>
- <!-- TARGETS -->
- <target name="delete.jbpm.installation"
- description="deletes ${jbpm.home}">
- <delete dir="${jbpm.home}" />
- </target>
+ <!-- TARGETS -->
+ <target name="delete.jbpm.installation"
+ description="deletes ${jbpm.home}">
+ <delete dir="${jbpm.home}" />
+ </target>
- <target name="install.jbpm"
- description="unzips the jbpm distro file in the ${jbpm.parent.dir}">
- <unzip src="${jbpm.distro.path}" dest="${jbpm.parent.dir}" />
- </target>
+ <target name="install.jbpm"
+ description="unzips the jbpm distro file in the ${jbpm.parent.dir}">
+ <unzip src="${jbpm.distro.path}" dest="${jbpm.parent.dir}" />
+ </target>
<target name="reinstall.jbpm"
- depends="delete.jbpm.installation, install.jbpm"
+ depends="delete.jbpm.installation, install.jbpm"
description="deletes the jbpm installation and then reinstalls jbpm"/>
- <target name="integration.testrun.setup"
- depends="log.properties, reinstall.jbpm, post.install"
- description="reinstalls jbpm, reinstalls jboss, installs jbpm into jboss, starts jboss and then creates the jbpm schema">
+ <target name="integration.testrun.setup"
+ depends="log.properties, reinstall.jbpm, post.install"
+ description="reinstalls jbpm, reinstalls jboss, installs jbpm into jboss, starts jboss and then creates the jbpm schema">
<ant antfile="${jbpm.home}/jboss/build.xml" target="reinstall.jboss" />
- <!-- initializing the schema into db -->
- <antcall target="drop.jbossidm.schema" />
- <antcall target="create.jbossidm.schema" />
+ <!-- initializing the schema into db -->
+ <antcall target="drop.jbossidm.schema" />
+ <antcall target="create.jbossidm.schema" />
<ant antfile="${jbpm.home}/jboss/build.xml" target="install.jbpm.into.jboss" />
- <ant antfile="${jbpm.home}/jboss/build.xml" target="internal.install.jbpm.into.jboss.integrationtestspecifics" />
- <antcall target="enable.jboss.debug" />
+ <antcall target="internal.tweak.jbpm.installation.for.integration.testrun" />
+ <antcall target="internal.enable.jboss.debug" />
<ant antfile="${jbpm.home}/jboss/build.xml" target="start.jboss" />
<ant antfile="${jbpm.home}/db/build.xml" target="drop.jbpm.schema" />
<ant antfile="${jbpm.home}/db/build.xml" target="create.jbpm.schema" />
- </target>
+ </target>
+
+ <target name="internal.tweak.jbpm.installation.for.integration.testrun">
+ <copy todir="${jboss.server.config.dir}/deploy/jbpm/jbpm-service.sar" overwrite="true">
+ <fileset dir="jbpm.cfg.jboss.testsuite/jbpm.identity" />
+ </copy>
+ <antcall target="internal.install.idm.into.jboss.integrationtestspecifics" />
+ <ant antfile="${jbpm.home}/examples/build.xml" target="examples.jar" />
+ <mkdir dir="${jboss.server.config.dir}/deploy/jbpm/userlibs" />
+ <copy file="${jbpm.home}/examples/target/examples.jar"
+ todir="${jboss.server.config.dir}/deploy/jbpm/userlibs" />
+ <copy file="../modules/test-db/target/jbpm-test-db-${jbpm.version}-tests.jar"
+ todir="${jboss.server.config.dir}/deploy/jbpm/userlibs" />
+ <copy file="../modules/distro/target/libs/junit.jar"
+ todir="${jboss.server.config.dir}/deploy/jbpm/userlibs"/>
+ </target>
+
+ <target name="internal.install.idm.into.jboss.integrationtestspecifics" if="jbpm.identity.idm">
+ <copy todir="${jboss.server.config.dir}/deploy/jbpm/jbpm-service.sar" overwrite="true">
+ <fileset dir="jbpm.cfg.jboss.testsuite/jboss.idm" />
+ </copy>
+ </target>
- <target name="enable.jboss.debug" if="jbpm.debug">
+
+ <target name="internal.enable.jboss.debug" if="jbpm.debug">
<replace file="${jboss.home}/bin/run.bat"
- token="rem set JAVA_OPTS=%JAVA_OPTS% -Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y"
- value="set JAVA_OPTS=%JAVA_OPTS% -Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n"/>
- <copy file="jboss/jboss-log4j.xml" todir="${jboss.server.config.dir}/conf" overwrite="true" />
+ token="rem set JAVA_OPTS=%JAVA_OPTS% -Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y"
+ value="set JAVA_OPTS=%JAVA_OPTS% -Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n"/>
+ <copy file="jboss/jboss-log4j.xml" todir="${jboss.server.config.dir}/conf" overwrite="true" />
</target>
- <target name="post.install">
- <!-- overwrite the default jdbc properties in the distro with those specified in the qa jdbc directory -->
+ <target name="post.install">
+ <!-- overwrite the default jdbc properties in the distro with those specified in the qa jdbc directory -->
<copy file="jdbc/${database}.properties"
todir="${jbpm.home}/db/jdbc"
overwrite="true"
@@ -86,32 +108,32 @@
todir="${jbpm.home}/db/jdbc"
overwrite="true"
failonerror="false" />
- <!-- copy the oracle jar as it is not allowed to be part of our distro -->
- <copy file="../modules/distro/target/oracle/ojdbc14.jar"
+ <!-- copy the oracle jar as it is not allowed to be part of our distro -->
+ <copy file="../modules/distro/target/libs/ojdbc14.jar"
todir="${jbpm.home}/lib"/>
<!-- copy the jdbc configuration and oracle jar to jbossidm -->
- <antcall target="copy.jbossidm.jdbc.configuration" />
+ <antcall target="copy.jbossidm.jdbc.configuration" />
- </target>
+ </target>
- <condition property="identity.component.idm">
- <equals arg1="${identity.component}" arg2="jboss.idm"/>
- </condition>
+ <condition property="identity.component.idm">
+ <equals arg1="${identity.component}" arg2="jboss.idm"/>
+ </condition>
- <target name="copy.jbossidm.jdbc.configuration" if="identity.component.idm">
- <copy file="../modules/distro/target/oracle/ojdbc14.jar"
- todir="${jbossidm.home}/lib" />
- <copy file="jdbc/${database}.properties"
- todir="${jbossidm.home}/db/jdbc"
- overwrite="true"
- failonerror="false" />
- </target>
+ <target name="copy.jbossidm.jdbc.configuration" if="identity.component.idm">
+ <copy file="../modules/distro/target/libs/ojdbc14.jar"
+ todir="${jbossidm.home}/lib" />
+ <copy file="jdbc/${database}.properties"
+ todir="${jbossidm.home}/db/jdbc"
+ overwrite="true"
+ failonerror="false" />
+ </target>
<target name="integration.testrun.teardown"
- description="drops the jbpm schema and stops jboss">
+ description="drops the jbpm schema and stops jboss">
<ant antfile="${jbpm.home}/db/build.xml" target="drop.jbpm.schema" />
- <antcall target="drop.jbossidm.schema" />
+ <antcall target="drop.jbossidm.schema" />
<ant antfile="${jbpm.home}/jboss/build.xml" target="stop.jboss" />
</target>
Copied: jbpm4/branches/tbaeyens/qa/jbpm.cfg.jboss.testsuite/jboss.idm/jbpm.cfg.xml (from rev 5037, jbpm4/branches/tbaeyens/modules/distro/src/main/files/jboss/jbpm.cfg.idm/jbpm.integration.test.cfg.xml)
===================================================================
--- jbpm4/branches/tbaeyens/qa/jbpm.cfg.jboss.testsuite/jboss.idm/jbpm.cfg.xml (rev 0)
+++ jbpm4/branches/tbaeyens/qa/jbpm.cfg.jboss.testsuite/jboss.idm/jbpm.cfg.xml 2009-06-16 16:15:35 UTC (rev 5042)
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<jbpm-configuration>
+
+ <import resource="jbpm.default.cfg.xml" />
+ <import resource="jbpm.tx.jta.cfg.xml" />
+ <import resource="jbpm.jpdl.cfg.xml" />
+ <import resource="jbpm.jboss.idm.cfg.xml" />
+
+ <import resource="jbpm.mail.templates.examples.xml" />
+
+</jbpm-configuration>
Copied: jbpm4/branches/tbaeyens/qa/jbpm.cfg.jboss.testsuite/jbpm.identity/jbpm.cfg.xml (from rev 5037, jbpm4/branches/tbaeyens/modules/distro/src/main/files/jboss/jbpm.cfg.integration.tests/jbpm.cfg.xml)
===================================================================
--- jbpm4/branches/tbaeyens/qa/jbpm.cfg.jboss.testsuite/jbpm.identity/jbpm.cfg.xml (rev 0)
+++ jbpm4/branches/tbaeyens/qa/jbpm.cfg.jboss.testsuite/jbpm.identity/jbpm.cfg.xml 2009-06-16 16:15:35 UTC (rev 5042)
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<jbpm-configuration>
+
+ <import resource="jbpm.default.cfg.xml" />
+ <import resource="jbpm.tx.jta.cfg.xml" />
+ <import resource="jbpm.jpdl.cfg.xml" />
+ <import resource="jbpm.identity.cfg.xml" />
+
+ <import resource="jbpm.mail.templates.examples.xml" />
+
+</jbpm-configuration>
Property changes on: jbpm4/branches/tbaeyens/qa/jbpm.cfg.jboss.testsuite/jbpm.identity/jbpm.cfg.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: jbpm4/branches/tbaeyens/qa/jbpm.cfg.jboss.testsuite/jbpm.identity/jbpm.mail.properties (from rev 5037, jbpm4/branches/tbaeyens/modules/distro/src/main/files/jboss/jbpm.cfg.integration.tests/jbpm.mail.properties)
===================================================================
--- jbpm4/branches/tbaeyens/qa/jbpm.cfg.jboss.testsuite/jbpm.identity/jbpm.mail.properties (rev 0)
+++ jbpm4/branches/tbaeyens/qa/jbpm.cfg.jboss.testsuite/jbpm.identity/jbpm.mail.properties 2009-06-16 16:15:35 UTC (rev 5042)
@@ -0,0 +1,3 @@
+mail.smtp.host localhost
+mail.smtp.port 2525
+mail.from noreply at jbpm.org
\ No newline at end of file
Property changes on: jbpm4/branches/tbaeyens/qa/jbpm.cfg.jboss.testsuite/jbpm.identity/jbpm.mail.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: jbpm4/branches/tbaeyens/qa/jbpm.cfg.jboss.testsuite/jbpm.identity/jbpm.mail.templates.examples.xml (from rev 5037, jbpm4/branches/tbaeyens/modules/distro/src/main/files/jboss/jbpm.cfg.integration.tests/jbpm.mail.templates.examples.xml)
===================================================================
--- jbpm4/branches/tbaeyens/qa/jbpm.cfg.jboss.testsuite/jbpm.identity/jbpm.mail.templates.examples.xml (rev 0)
+++ jbpm4/branches/tbaeyens/qa/jbpm.cfg.jboss.testsuite/jbpm.identity/jbpm.mail.templates.examples.xml 2009-06-16 16:15:35 UTC (rev 5042)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<jbpm-configuration>
+
+ <process-engine-context>
+
+ <mail-template name="rectify-template">
+ <to addresses="${addressee}" />
+ <cc users="bb" groups="innerparty" />
+ <bcc groups="thinkpol" />
+ <subject>rectify ${newspaper}</subject>
+ <text>${newspaper} ${date} ${details}</text>
+ </mail-template>
+
+ </process-engine-context>
+
+</jbpm-configuration>
\ No newline at end of file
Property changes on: jbpm4/branches/tbaeyens/qa/jbpm.cfg.jboss.testsuite/jbpm.identity/jbpm.mail.templates.examples.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
More information about the jbpm-commits
mailing list