[jbpm-commits] JBoss JBPM SVN: r5044 - in jbpm4/trunk: modules/distro/src/main/files/jboss and 23 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Tue Jun 16 15:43:57 EDT 2009
Author: tom.baeyens at jboss.com
Date: 2009-06-16 15:43:57 -0400 (Tue, 16 Jun 2009)
New Revision: 5044
Added:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/jta/
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/jta/JtaStatusHelper.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/jta/JtaTransaction.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/jta/JtaTransactionInterceptor.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/JtaTransactionInterceptorBinding.java
jbpm4/trunk/qa/jbpm.cfg.jboss.testsuite/
jbpm4/trunk/qa/jbpm.cfg.jboss.testsuite/jboss.idm/
jbpm4/trunk/qa/jbpm.cfg.jboss.testsuite/jboss.idm/jbpm.cfg.xml
jbpm4/trunk/qa/jbpm.cfg.jboss.testsuite/jbpm.identity/
jbpm4/trunk/qa/jbpm.cfg.jboss.testsuite/jbpm.identity/jbpm.cfg.xml
jbpm4/trunk/qa/jbpm.cfg.jboss.testsuite/jbpm.identity/jbpm.mail.properties
jbpm4/trunk/qa/jbpm.cfg.jboss.testsuite/jbpm.identity/jbpm.mail.templates.examples.xml
Removed:
jbpm4/trunk/modules/distro/src/main/files/jboss/jbpm.cfg.idm/jbpm.integration.test.cfg.xml
jbpm4/trunk/modules/distro/src/main/files/jboss/jbpm.cfg.integration.tests/jbpm.cfg.xml
jbpm4/trunk/modules/distro/src/main/files/jboss/jbpm.cfg.integration.tests/jbpm.mail.properties
jbpm4/trunk/modules/distro/src/main/files/jboss/jbpm.cfg.integration.tests/jbpm.mail.templates.examples.xml
jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/wire/binding/JtaTransactionInterceptorBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/jta/JtaStatusHelper.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/jta/JtaTransaction.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/jta/JtaTransactionInterceptor.java
jbpm4/trunk/qa/jbpm.cfg.jboss.testsuite/jboss.idm/
jbpm4/trunk/qa/jbpm.cfg.jboss.testsuite/jboss.idm/jbpm.cfg.xml
jbpm4/trunk/qa/jbpm.cfg.jboss.testsuite/jbpm.identity/
jbpm4/trunk/qa/jbpm.cfg.jboss.testsuite/jbpm.identity/jbpm.cfg.xml
jbpm4/trunk/qa/jbpm.cfg.jboss.testsuite/jbpm.identity/jbpm.mail.properties
jbpm4/trunk/qa/jbpm.cfg.jboss.testsuite/jbpm.identity/jbpm.mail.templates.examples.xml
Modified:
jbpm4/trunk/modules/distro/pom.xml
jbpm4/trunk/modules/distro/src/main/files/jboss/build.xml
jbpm4/trunk/modules/distro/src/main/files/jboss/config.common/deploy/jbpm/jbpm-enterprise.jar/META-INF/ejb-jar.xml
jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/EjbRemoteCommandService.java
jbpm4/trunk/modules/examples/pom.xml
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/repository/JpdlDeployer.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/ExecuteJobCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetResourceAsStreamCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentClassLoader.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryServiceImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositorySessionImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/session/RepositorySession.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/TransactionBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/JbossIdmIdentitySessionDescriptor.java
jbpm4/trunk/modules/pvm/src/main/resources/jbpm.tx.jta.cfg.xml
jbpm4/trunk/modules/pvm/src/main/resources/jbpm.wire.bindings.xml
jbpm4/trunk/modules/test-db/pom.xml
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/async/AsyncBasicsTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/eventlistener/EventListenerTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskHandlerTest.java
jbpm4/trunk/qa/build.xml
Log:
JBPM-2322 enabled module test-db in the integration test suite
Modified: jbpm4/trunk/modules/distro/pom.xml
===================================================================
--- jbpm4/trunk/modules/distro/pom.xml 2009-06-16 19:08:55 UTC (rev 5043)
+++ jbpm4/trunk/modules/distro/pom.xml 2009-06-16 19:43:57 UTC (rev 5044)
@@ -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/trunk/modules/distro/src/main/files/jboss/build.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/jboss/build.xml 2009-06-16 19:08:55 UTC (rev 5043)
+++ jbpm4/trunk/modules/distro/src/main/files/jboss/build.xml 2009-06-16 19:43:57 UTC (rev 5044)
@@ -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" />
Modified: jbpm4/trunk/modules/distro/src/main/files/jboss/config.common/deploy/jbpm/jbpm-enterprise.jar/META-INF/ejb-jar.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/jboss/config.common/deploy/jbpm/jbpm-enterprise.jar/META-INF/ejb-jar.xml 2009-06-16 19:08:55 UTC (rev 5043)
+++ jbpm4/trunk/modules/distro/src/main/files/jboss/config.common/deploy/jbpm/jbpm-enterprise.jar/META-INF/ejb-jar.xml 2009-06-16 19:43:57 UTC (rev 5044)
@@ -20,7 +20,7 @@
<local>org.jbpm.enterprise.internal.ejb.LocalCommandExecutor</local>
<ejb-class>org.jbpm.enterprise.internal.ejb.CommandExecutorSLSB</ejb-class>
<session-type>Stateless</session-type>
- <transaction-type>Container</transaction-type>
+ <transaction-type>Bean</transaction-type>
<ejb-local-ref>
<description>
@@ -150,13 +150,13 @@
<assembly-descriptor>
- <container-transaction>
+ <!-- container-transaction>
<method>
<ejb-name>CommandExecutor</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
- </container-transaction>
+ </container-transaction -->
<container-transaction>
<method>
Deleted: jbpm4/trunk/modules/distro/src/main/files/jboss/jbpm.cfg.idm/jbpm.integration.test.cfg.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/jboss/jbpm.cfg.idm/jbpm.integration.test.cfg.xml 2009-06-16 19:08:55 UTC (rev 5043)
+++ jbpm4/trunk/modules/distro/src/main/files/jboss/jbpm.cfg.idm/jbpm.integration.test.cfg.xml 2009-06-16 19:43:57 UTC (rev 5044)
@@ -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/trunk/modules/distro/src/main/files/jboss/jbpm.cfg.integration.tests/jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/jboss/jbpm.cfg.integration.tests/jbpm.cfg.xml 2009-06-16 19:08:55 UTC (rev 5043)
+++ jbpm4/trunk/modules/distro/src/main/files/jboss/jbpm.cfg.integration.tests/jbpm.cfg.xml 2009-06-16 19:43:57 UTC (rev 5044)
@@ -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/trunk/modules/distro/src/main/files/jboss/jbpm.cfg.integration.tests/jbpm.mail.properties
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/jboss/jbpm.cfg.integration.tests/jbpm.mail.properties 2009-06-16 19:08:55 UTC (rev 5043)
+++ jbpm4/trunk/modules/distro/src/main/files/jboss/jbpm.cfg.integration.tests/jbpm.mail.properties 2009-06-16 19:43:57 UTC (rev 5044)
@@ -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/trunk/modules/distro/src/main/files/jboss/jbpm.cfg.integration.tests/jbpm.mail.templates.examples.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/jboss/jbpm.cfg.integration.tests/jbpm.mail.templates.examples.xml 2009-06-16 19:08:55 UTC (rev 5043)
+++ jbpm4/trunk/modules/distro/src/main/files/jboss/jbpm.cfg.integration.tests/jbpm.mail.templates.examples.xml 2009-06-16 19:43:57 UTC (rev 5044)
@@ -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/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/EjbRemoteCommandService.java
===================================================================
--- jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/EjbRemoteCommandService.java 2009-06-16 19:08:55 UTC (rev 5043)
+++ jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/ejb/EjbRemoteCommandService.java 2009-06-16 19:43:57 UTC (rev 5044)
@@ -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);
}
}
}
Deleted: jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/wire/binding/JtaTransactionInterceptorBinding.java
===================================================================
--- jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/wire/binding/JtaTransactionInterceptorBinding.java 2009-06-16 19:08:55 UTC (rev 5043)
+++ jbpm4/trunk/modules/enterprise/src/main/java/org/jbpm/enterprise/internal/wire/binding/JtaTransactionInterceptorBinding.java 2009-06-16 19:43:57 UTC (rev 5044)
@@ -1,65 +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.enterprise.internal.wire.binding;
-
-import org.jbpm.enterprise.internal.jta.JtaTransactionInterceptor;
-import org.jbpm.pvm.internal.util.XmlUtil;
-import org.jbpm.pvm.internal.wire.Descriptor;
-import org.jbpm.pvm.internal.wire.binding.PropertiesBinding;
-import org.jbpm.pvm.internal.wire.binding.WireInterceptorBinding;
-import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.StringDescriptor;
-import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
-import org.w3c.dom.Element;
-
-/**
- * Mapping between a <code>jta-transaction-interceptor</code> element and a
- * {@link JtaTransactionInterceptor} object.
- *
- * @author Alejandro Guizar
- */
-public class JtaTransactionInterceptorBinding extends WireInterceptorBinding {
-
- private static final PropertiesBinding propertiesBinding = new PropertiesBinding();
-
- public JtaTransactionInterceptorBinding() {
- super("jta-transaction-interceptor");
- }
-
- public Object parse(Element element, Parse parse, Parser parser) {
- ObjectDescriptor descriptor = new ObjectDescriptor(JtaTransactionInterceptor.class);
- // user transaction jndi name
- String userTransactionName = XmlUtil.attribute(element, "user-transaction-name");
- if (userTransactionName != null) {
- descriptor.addInjection("userTransactionName", new StringDescriptor(userTransactionName));
- }
- // jndi properties
- Element jndiPropertiesElement = XmlUtil.element(element, "jndi-properties");
- if (jndiPropertiesElement != null) {
- descriptor.addInjection("jndiProperties", (Descriptor) propertiesBinding.parse(
- jndiPropertiesElement, parse, parser));
- }
- return descriptor;
- }
-
-}
Modified: jbpm4/trunk/modules/examples/pom.xml
===================================================================
--- jbpm4/trunk/modules/examples/pom.xml 2009-06-16 19:08:55 UTC (rev 5043)
+++ jbpm4/trunk/modules/examples/pom.xml 2009-06-16 19:43:57 UTC (rev 5044)
@@ -183,16 +183,6 @@
<configuration>
<failIfNoTests>false</failIfNoTests>
<trimStackTrace>false</trimStackTrace>
- <excludes>
- <!-- https://jira.jboss.org/jira/browse/JBPM-2147 -->
- <!-- https://jira.jboss.org/jira/browse/JBPM-2200
- <exclude>org/jbpm/examples/task/swimlane/TaskSwimlaneTest.java</exclude>
- <exclude>org/jbpm/examples/task/candidates/TaskCandidatesTest.java</exclude>
- <exclude>org/jbpm/examples/mail/template/TemplateMailTest.java</exclude>
- <exclude>org/jbpm/examples/mail/inline/InlineMailTest.java</exclude>
- <exclude>org/jbpm/examples/eventlistener/EventListenerTest.java</exclude>
- -->
- </excludes>
</configuration>
</plugin>
</plugins>
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/repository/JpdlDeployer.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/repository/JpdlDeployer.java 2009-06-16 19:08:55 UTC (rev 5043)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/repository/JpdlDeployer.java 2009-06-16 19:43:57 UTC (rev 5044)
@@ -21,6 +21,7 @@
*/
package org.jbpm.jpdl.internal.repository;
+import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.util.List;
@@ -51,7 +52,8 @@
for (String resourceName: deployment.getResourceNames()) {
if (resourceName.endsWith(".jpdl.xml")) {
- InputStream inputStream = deployment.getResourceAsStream(resourceName);
+ byte[] bytes = deployment.getBytes(resourceName);
+ InputStream inputStream = new ByteArrayInputStream(bytes);
Parse parse = jpdlParser.createParse();
parse.setProblems(deployment.getProblems());
parse.setInputStream(inputStream);
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/ExecuteJobCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/ExecuteJobCmd.java 2009-06-16 19:08:55 UTC (rev 5043)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/ExecuteJobCmd.java 2009-06-16 19:43:57 UTC (rev 5044)
@@ -98,7 +98,7 @@
* transaction. */
protected void handleJobExecutionException(Environment environment, JobImpl<?> job, Throwable exception) {
Transaction transaction = environment.get(Transaction.class);
- transaction.setRollbackOnly();
+ // transaction.setRollbackOnly();
CommandService commandService = (CommandService) environment.get(CommandService.class);
JobExceptionHandler jobExceptionHandler = new JobExceptionHandler(job.getDbid(), exception, commandService);
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetResourceAsStreamCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetResourceAsStreamCmd.java 2009-06-16 19:08:55 UTC (rev 5043)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/GetResourceAsStreamCmd.java 2009-06-16 19:43:57 UTC (rev 5044)
@@ -30,7 +30,7 @@
/**
* @author Tom Baeyens
*/
-public class GetResourceAsStreamCmd extends AbstractCommand<InputStream> {
+public class GetResourceAsStreamCmd extends AbstractCommand<byte[]> {
private static final long serialVersionUID = 1L;
@@ -42,8 +42,8 @@
this.resourceName = resourceName;
}
- public InputStream execute(Environment environment) {
+ public byte[] execute(Environment environment) {
RepositorySession repositorySession = environment.get(RepositorySession.class);
- return repositorySession.getResourceAsStream(deploymentDbid, resourceName);
+ return repositorySession.getBytes(deploymentDbid, resourceName);
}
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentClassLoader.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentClassLoader.java 2009-06-16 19:08:55 UTC (rev 5043)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentClassLoader.java 2009-06-16 19:43:57 UTC (rev 5044)
@@ -21,6 +21,7 @@
*/
package org.jbpm.pvm.internal.repository;
+import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
@@ -46,8 +47,9 @@
public URL findResource(String name) {
URL url = null;
- InputStream inputStream = deployment.getResourceAsStream(name);
- if (inputStream!=null) {
+ byte[] bytes = deployment.getBytes(name);
+ if (bytes!=null) {
+ InputStream inputStream = new ByteArrayInputStream(bytes);
try {
url = new URL(null, "jbpm://"+deployment.getDbid()+"/"+name, new BytesUrlStreamHandler(inputStream));
} catch (MalformedURLException e) {
@@ -84,9 +86,10 @@
Class clazz = null;
String fileName = name.replace( '.', '/' ) + ".class";
- InputStream inputStream = deployment.getResourceAsStream(fileName);
- if (inputStream!=null) {
+ byte[] bytes = deployment.getBytes(fileName);
+ if (bytes!=null) {
try {
+ InputStream inputStream = new ByteArrayInputStream(bytes);
byte[] classBytes = IoUtil.readBytes(inputStream);
clazz = defineClass(name, classBytes, 0, classBytes.length);
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentImpl.java 2009-06-16 19:08:55 UTC (rev 5043)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentImpl.java 2009-06-16 19:43:57 UTC (rev 5044)
@@ -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;
@@ -156,12 +154,11 @@
return resources.keySet();
}
- public InputStream getResourceAsStream(String resourceName) {
+ public byte[] getBytes(String resourceName) {
if (resources!=null) {
Lob lob = resources.get(resourceName);
if (lob!=null) {
- byte[] bytes = lob.extractBytes();
- return new ByteArrayInputStream(bytes);
+ return lob.extractBytes();
}
}
return null;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryServiceImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryServiceImpl.java 2009-06-16 19:08:55 UTC (rev 5043)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryServiceImpl.java 2009-06-16 19:43:57 UTC (rev 5044)
@@ -21,6 +21,7 @@
*/
package org.jbpm.pvm.internal.repository;
+import java.io.ByteArrayInputStream;
import java.io.InputStream;
import org.jbpm.api.Deployment;
@@ -64,7 +65,11 @@
}
public InputStream getResourceAsStream(long deploymentDbid, String resource) {
- return commandService.execute(new GetResourceAsStreamCmd(deploymentDbid, resource));
+ byte[] bytes = commandService.execute(new GetResourceAsStreamCmd(deploymentDbid, resource));
+ if (bytes!=null) {
+ return new ByteArrayInputStream(bytes);
+ }
+ return null;
}
public ProcessDefinitionQuery createProcessDefinitionQuery() {
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositorySessionImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositorySessionImpl.java 2009-06-16 19:08:55 UTC (rev 5043)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositorySessionImpl.java 2009-06-16 19:43:57 UTC (rev 5044)
@@ -139,12 +139,12 @@
return object;
}
- public InputStream getResourceAsStream(long deploymentDbid, String resourceName) {
+ public byte[] getBytes(long deploymentDbid, String resourceName) {
DeploymentImpl deployment = getDeployment(deploymentDbid);
if (deployment==null) {
return null;
}
- return deployment.getResourceAsStream(resourceName);
+ return deployment.getBytes(resourceName);
}
// queries //////////////////////////////////////////////////////////////////
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/session/RepositorySession.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/session/RepositorySession.java 2009-06-16 19:08:55 UTC (rev 5043)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/session/RepositorySession.java 2009-06-16 19:43:57 UTC (rev 5044)
@@ -21,8 +21,6 @@
*/
package org.jbpm.pvm.internal.session;
-import java.io.InputStream;
-
import org.jbpm.api.Deployment;
import org.jbpm.api.client.ClientProcessDefinition;
import org.jbpm.pvm.internal.query.ProcessDefinitionQueryImpl;
@@ -37,7 +35,7 @@
Object getObject(long deploymentDbid, String objectName);
- InputStream getResourceAsStream(long deploymentDbid, String resourceName);
+ byte[] getBytes(long deploymentDbid, String resourceName);
/** create a process definition query */
ProcessDefinitionQueryImpl createProcessDefinitionQuery();
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/jta (from rev 5043, jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/jta)
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/jta/JtaStatusHelper.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/jta/JtaStatusHelper.java 2009-06-16 19:08:55 UTC (rev 5043)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/jta/JtaStatusHelper.java 2009-06-16 19:43:57 UTC (rev 5044)
@@ -1,57 +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.pvm.internal.tx.jta;
-
-import javax.transaction.Status;
-
-
-/**
- * @author Tom Baeyens
- */
-public abstract class JtaStatusHelper {
-
- public static String toString(int txStatus) {
- if (txStatus==Status.STATUS_ACTIVE) {
- return "STATUS_ACTIVE";
- } else if (txStatus==Status.STATUS_COMMITTED) {
- return "STATUS_COMMITTED";
- } else if (txStatus==Status.STATUS_COMMITTING) {
- return "STATUS_COMMITTING";
- } else if (txStatus==Status.STATUS_MARKED_ROLLBACK) {
- return "STATUS_MARKED_ROLLBACK";
- } else if (txStatus==Status.STATUS_NO_TRANSACTION) {
- return "STATUS_NO_TRANSACTION";
- } else if (txStatus==Status.STATUS_PREPARED) {
- return "STATUS_PREPARED";
- } else if (txStatus==Status.STATUS_PREPARING) {
- return "STATUS_PREPARING";
- } else if (txStatus==Status.STATUS_ROLLEDBACK) {
- return "STATUS_ROLLEDBACK";
- } else if (txStatus==Status.STATUS_ROLLING_BACK) {
- return "STATUS_ROLLING_BACK";
- } else if (txStatus==Status.STATUS_UNKNOWN) {
- return "STATUS_UNKNOWN";
- } else {
- return "unknown";
- }
- }
-}
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/jta/JtaStatusHelper.java (from rev 5043, jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/jta/JtaStatusHelper.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/jta/JtaStatusHelper.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/jta/JtaStatusHelper.java 2009-06-16 19:43:57 UTC (rev 5044)
@@ -0,0 +1,57 @@
+/*
+ * 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.tx.jta;
+
+import javax.transaction.Status;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public abstract class JtaStatusHelper {
+
+ public static String toString(int txStatus) {
+ if (txStatus==Status.STATUS_ACTIVE) {
+ return "STATUS_ACTIVE";
+ } else if (txStatus==Status.STATUS_COMMITTED) {
+ return "STATUS_COMMITTED";
+ } else if (txStatus==Status.STATUS_COMMITTING) {
+ return "STATUS_COMMITTING";
+ } else if (txStatus==Status.STATUS_MARKED_ROLLBACK) {
+ return "STATUS_MARKED_ROLLBACK";
+ } else if (txStatus==Status.STATUS_NO_TRANSACTION) {
+ return "STATUS_NO_TRANSACTION";
+ } else if (txStatus==Status.STATUS_PREPARED) {
+ return "STATUS_PREPARED";
+ } else if (txStatus==Status.STATUS_PREPARING) {
+ return "STATUS_PREPARING";
+ } else if (txStatus==Status.STATUS_ROLLEDBACK) {
+ return "STATUS_ROLLEDBACK";
+ } else if (txStatus==Status.STATUS_ROLLING_BACK) {
+ return "STATUS_ROLLING_BACK";
+ } else if (txStatus==Status.STATUS_UNKNOWN) {
+ return "STATUS_UNKNOWN";
+ } else {
+ return "unknown";
+ }
+ }
+}
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/jta/JtaTransaction.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/jta/JtaTransaction.java 2009-06-16 19:08:55 UTC (rev 5043)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/jta/JtaTransaction.java 2009-06-16 19:43:57 UTC (rev 5044)
@@ -1,134 +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.pvm.internal.tx.jta;
-
-import javax.naming.InitialContext;
-import javax.transaction.Status;
-import javax.transaction.Synchronization;
-import javax.transaction.SystemException;
-import javax.transaction.TransactionManager;
-import javax.transaction.UserTransaction;
-
-import org.jbpm.api.JbpmException;
-import org.jbpm.api.env.Transaction;
-
-
-/**
- * @author Tom Baeyens
- */
-public class JtaTransaction implements Transaction {
-
- protected String userTransactionJndiName = "java:comp/UserTransaction";
- protected String transactionManagerJndiName = "java:/TransactionManager";
-
- public boolean isRollbackOnly() {
- try {
- return lookupJeeUserTransaction().getStatus()==Status.STATUS_MARKED_ROLLBACK;
- } catch (SystemException e) {
- throw new JbpmException("couldn't get status of user transaction: "+e.getMessage(), e);
- }
- }
-
- public void setRollbackOnly() {
- try {
- lookupJeeUserTransaction().setRollbackOnly();
- } catch (Exception e) {
- throw new JbpmException("couldn't set user transaction to rollback only: "+e.getMessage(), e);
- }
- }
-
- public void registerSynchronization(Synchronization synchronization) {
- try {
- lookupJeeTransaction().registerSynchronization(synchronization);
- } catch (Exception e) {
- throw new JbpmException("couldn't register synchronization: "+e.getMessage(), e);
- }
- }
-
- public void begin() {
- try {
- lookupJeeUserTransaction().begin();
- } catch (Exception e) {
- throw new JbpmException("couldn't begin transaction: "+e.getMessage(), e);
- }
- }
-
- public void rollback() {
- try {
- lookupJeeUserTransaction().rollback();
- } catch (Exception e) {
- throw new JbpmException("couldn't rollback: "+e.getMessage(), e);
- }
- }
-
- public void commit() {
- try {
- lookupJeeUserTransaction().commit();
- } catch (Exception e) {
- throw new JbpmException("couldn't commit: "+e.getMessage(), e);
- }
- }
-
- public javax.transaction.Transaction suspend() {
- try {
- return lookupJeeTransactionManager().suspend();
- } catch (Exception e) {
- throw new JbpmException("couldn't suspend: "+e.getMessage(), e);
- }
- }
-
- public void resume(javax.transaction.Transaction transaction) {
- try {
- lookupJeeTransactionManager().resume(transaction);
- } catch (Exception e) {
- throw new JbpmException("couldn't resume: "+e.getMessage(), e);
- }
- }
-
- // lookups //////////////////////////////////////////////////////////////////
-
- public UserTransaction lookupJeeUserTransaction() {
- return (UserTransaction) lookupFromJndi(userTransactionJndiName);
- }
-
- public javax.transaction.Transaction lookupJeeTransaction() {
- try {
- TransactionManager transactionManager = lookupJeeTransactionManager();
- return transactionManager.getTransaction();
- } catch (Exception e) {
- throw new JbpmException("couldn't get transaction from transaction manager "+transactionManagerJndiName+": "+e.getMessage(), e);
- }
- }
-
- public TransactionManager lookupJeeTransactionManager() {
- return (TransactionManager) lookupFromJndi(transactionManagerJndiName);
- }
-
- public static Object lookupFromJndi(String jndiName) {
- try {
- InitialContext initialContext = new InitialContext();
- return initialContext.lookup(jndiName);
- } catch (Exception e) {
- throw new JbpmException("couldn't lookup '"+jndiName+"' from jndi: "+e.getMessage()+": "+e.getMessage(), e);
- }
- }
-}
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/jta/JtaTransaction.java (from rev 5043, jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/jta/JtaTransaction.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/jta/JtaTransaction.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/jta/JtaTransaction.java 2009-06-16 19:43:57 UTC (rev 5044)
@@ -0,0 +1,134 @@
+/*
+ * 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.tx.jta;
+
+import javax.naming.InitialContext;
+import javax.transaction.Status;
+import javax.transaction.Synchronization;
+import javax.transaction.SystemException;
+import javax.transaction.TransactionManager;
+import javax.transaction.UserTransaction;
+
+import org.jbpm.api.JbpmException;
+import org.jbpm.api.env.Transaction;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class JtaTransaction implements Transaction {
+
+ protected String userTransactionJndiName = "java:comp/UserTransaction";
+ protected String transactionManagerJndiName = "java:/TransactionManager";
+
+ public boolean isRollbackOnly() {
+ try {
+ return lookupJeeUserTransaction().getStatus()==Status.STATUS_MARKED_ROLLBACK;
+ } catch (SystemException e) {
+ throw new JbpmException("couldn't get status of user transaction: "+e.getMessage(), e);
+ }
+ }
+
+ public void setRollbackOnly() {
+ try {
+ lookupJeeUserTransaction().setRollbackOnly();
+ } catch (Exception e) {
+ throw new JbpmException("couldn't set user transaction to rollback only: "+e.getMessage(), e);
+ }
+ }
+
+ public void registerSynchronization(Synchronization synchronization) {
+ try {
+ lookupJeeTransaction().registerSynchronization(synchronization);
+ } catch (Exception e) {
+ throw new JbpmException("couldn't register synchronization: "+e.getMessage(), e);
+ }
+ }
+
+ public void begin() {
+ try {
+ lookupJeeUserTransaction().begin();
+ } catch (Exception e) {
+ throw new JbpmException("couldn't begin transaction: "+e.getMessage(), e);
+ }
+ }
+
+ public void rollback() {
+ try {
+ lookupJeeUserTransaction().rollback();
+ } catch (Exception e) {
+ throw new JbpmException("couldn't rollback: "+e.getMessage(), e);
+ }
+ }
+
+ public void commit() {
+ try {
+ lookupJeeUserTransaction().commit();
+ } catch (Exception e) {
+ throw new JbpmException("couldn't commit: "+e.getMessage(), e);
+ }
+ }
+
+ public javax.transaction.Transaction suspend() {
+ try {
+ return lookupJeeTransactionManager().suspend();
+ } catch (Exception e) {
+ throw new JbpmException("couldn't suspend: "+e.getMessage(), e);
+ }
+ }
+
+ public void resume(javax.transaction.Transaction transaction) {
+ try {
+ lookupJeeTransactionManager().resume(transaction);
+ } catch (Exception e) {
+ throw new JbpmException("couldn't resume: "+e.getMessage(), e);
+ }
+ }
+
+ // lookups //////////////////////////////////////////////////////////////////
+
+ public UserTransaction lookupJeeUserTransaction() {
+ return (UserTransaction) lookupFromJndi(userTransactionJndiName);
+ }
+
+ public javax.transaction.Transaction lookupJeeTransaction() {
+ try {
+ TransactionManager transactionManager = lookupJeeTransactionManager();
+ return transactionManager.getTransaction();
+ } catch (Exception e) {
+ throw new JbpmException("couldn't get transaction from transaction manager "+transactionManagerJndiName+": "+e.getMessage(), e);
+ }
+ }
+
+ public TransactionManager lookupJeeTransactionManager() {
+ return (TransactionManager) lookupFromJndi(transactionManagerJndiName);
+ }
+
+ public static Object lookupFromJndi(String jndiName) {
+ try {
+ InitialContext initialContext = new InitialContext();
+ return initialContext.lookup(jndiName);
+ } catch (Exception e) {
+ throw new JbpmException("couldn't lookup '"+jndiName+"' from jndi: "+e.getMessage()+": "+e.getMessage(), e);
+ }
+ }
+}
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/jta/JtaTransactionInterceptor.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/jta/JtaTransactionInterceptor.java 2009-06-16 19:08:55 UTC (rev 5043)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/jta/JtaTransactionInterceptor.java 2009-06-16 19:43:57 UTC (rev 5044)
@@ -1,91 +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.pvm.internal.tx.jta;
-
-import javax.transaction.Status;
-import javax.transaction.SystemException;
-import javax.transaction.Transaction;
-import javax.transaction.UserTransaction;
-
-import org.jbpm.api.JbpmException;
-import org.jbpm.api.cmd.Command;
-import org.jbpm.api.env.Environment;
-import org.jbpm.internal.log.Log;
-import org.jbpm.pvm.internal.svc.Interceptor;
-
-
-/**
- * @author Tom Baeyens
- */
-public class JtaTransactionInterceptor extends Interceptor {
-
- private static Log log = Log.getLog(JtaTransactionInterceptor.class.getName());
-
- public <T> T execute(Command<T> command) {
- JtaTransaction jtaTransaction = Environment.getFromCurrent(JtaTransaction.class);
-
- UserTransaction userTransaction = jtaTransaction.lookupJeeUserTransaction();
-
- int status = -1;
- try {
- status = userTransaction.getStatus();
- } catch (SystemException e) {
- throw new JbpmException("couldn't get transaction status: "+e.getMessage(), e);
- }
- log.debug("jta transaction status: "+JtaStatusHelper.toString(status));
-
- if ( (status != Status.STATUS_NO_TRANSACTION)
- && (status != Status.STATUS_COMMITTED)
- && (status != Status.STATUS_ROLLEDBACK)
- ) {
- throw new JbpmException("invalid transaction state: "+JtaStatusHelper.toString(status));
- }
-
- Transaction suspendedTransaction = null;
- if ((status == Status.STATUS_COMMITTED) || (status == Status.STATUS_ROLLEDBACK)) {
- suspendedTransaction = jtaTransaction.suspend();
- }
-
- Object returnValue = null;
-
- try {
- jtaTransaction.begin();
-
- returnValue = next.execute(command);
-
- jtaTransaction.commit();
-
- } catch (RuntimeException e) {
- jtaTransaction.rollback();
- throw e;
-
- } finally {
-
- if (suspendedTransaction!=null) {
- jtaTransaction.resume(suspendedTransaction);
- }
- }
-
- return (T) returnValue;
- }
-
-}
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/jta/JtaTransactionInterceptor.java (from rev 5043, jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/jta/JtaTransactionInterceptor.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/jta/JtaTransactionInterceptor.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/jta/JtaTransactionInterceptor.java 2009-06-16 19:43:57 UTC (rev 5044)
@@ -0,0 +1,91 @@
+/*
+ * 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.tx.jta;
+
+import javax.transaction.Status;
+import javax.transaction.SystemException;
+import javax.transaction.Transaction;
+import javax.transaction.UserTransaction;
+
+import org.jbpm.api.JbpmException;
+import org.jbpm.api.cmd.Command;
+import org.jbpm.api.env.Environment;
+import org.jbpm.internal.log.Log;
+import org.jbpm.pvm.internal.svc.Interceptor;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class JtaTransactionInterceptor extends Interceptor {
+
+ private static Log log = Log.getLog(JtaTransactionInterceptor.class.getName());
+
+ public <T> T execute(Command<T> command) {
+ JtaTransaction jtaTransaction = Environment.getFromCurrent(JtaTransaction.class);
+
+ UserTransaction userTransaction = jtaTransaction.lookupJeeUserTransaction();
+
+ int status = -1;
+ try {
+ status = userTransaction.getStatus();
+ } catch (SystemException e) {
+ throw new JbpmException("couldn't get transaction status: "+e.getMessage(), e);
+ }
+ log.debug("jta transaction status: "+JtaStatusHelper.toString(status));
+
+ if ( (status != Status.STATUS_NO_TRANSACTION)
+ && (status != Status.STATUS_COMMITTED)
+ && (status != Status.STATUS_ROLLEDBACK)
+ ) {
+ throw new JbpmException("invalid transaction state: "+JtaStatusHelper.toString(status));
+ }
+
+ Transaction suspendedTransaction = null;
+ if ((status == Status.STATUS_COMMITTED) || (status == Status.STATUS_ROLLEDBACK)) {
+ suspendedTransaction = jtaTransaction.suspend();
+ }
+
+ Object returnValue = null;
+
+ try {
+ jtaTransaction.begin();
+
+ returnValue = next.execute(command);
+
+ jtaTransaction.commit();
+
+ } catch (RuntimeException e) {
+ jtaTransaction.rollback();
+ throw e;
+
+ } finally {
+
+ if (suspendedTransaction!=null) {
+ jtaTransaction.resume(suspendedTransaction);
+ }
+ }
+
+ return (T) returnValue;
+ }
+
+}
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/JtaTransactionInterceptorBinding.java (from rev 5043, jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/JtaTransactionInterceptorBinding.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/JtaTransactionInterceptorBinding.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/JtaTransactionInterceptorBinding.java 2009-06-16 19:43:57 UTC (rev 5044)
@@ -0,0 +1,46 @@
+/*
+ * 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.wire.binding;
+
+import org.jbpm.pvm.internal.tx.jta.JtaTransactionInterceptor;
+import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+/**
+ * Mapping between a <code>jta-transaction-interceptor</code> element and a
+ * {@link JtaTransactionInterceptor} object.
+ *
+ * @author Alejandro Guizar
+ */
+public class JtaTransactionInterceptorBinding extends WireInterceptorBinding {
+
+ public JtaTransactionInterceptorBinding() {
+ super("jta-transaction-interceptor");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ return new ObjectDescriptor(JtaTransactionInterceptor.class);
+ }
+
+}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/TransactionBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/TransactionBinding.java 2009-06-16 19:08:55 UTC (rev 5043)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/TransactionBinding.java 2009-06-16 19:43:57 UTC (rev 5044)
@@ -22,8 +22,8 @@
package org.jbpm.pvm.internal.wire.binding;
import org.jbpm.api.env.Transaction;
-import org.jbpm.pvm.internal.tx.JtaTransaction;
import org.jbpm.pvm.internal.tx.StandardTransaction;
+import org.jbpm.pvm.internal.tx.jta.JtaTransaction;
import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
import org.jbpm.pvm.internal.xml.Parse;
import org.jbpm.pvm.internal.xml.Parser;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/JbossIdmIdentitySessionDescriptor.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/JbossIdmIdentitySessionDescriptor.java 2009-06-16 19:08:55 UTC (rev 5043)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/JbossIdmIdentitySessionDescriptor.java 2009-06-16 19:43:57 UTC (rev 5044)
@@ -28,8 +28,8 @@
import org.jbpm.api.env.Environment;
import org.jbpm.pvm.internal.identity.impl.IdentitySessionResource;
import org.jbpm.pvm.internal.identity.impl.JBossIdmIdentitySessionImpl;
-import org.jbpm.pvm.internal.tx.JtaTransaction;
import org.jbpm.pvm.internal.tx.StandardTransaction;
+import org.jbpm.pvm.internal.tx.jta.JtaTransaction;
import org.jbpm.pvm.internal.wire.WireContext;
import org.jbpm.pvm.internal.wire.WireDefinition;
Modified: jbpm4/trunk/modules/pvm/src/main/resources/jbpm.tx.jta.cfg.xml
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/resources/jbpm.tx.jta.cfg.xml 2009-06-16 19:08:55 UTC (rev 5043)
+++ jbpm4/trunk/modules/pvm/src/main/resources/jbpm.tx.jta.cfg.xml 2009-06-16 19:43:57 UTC (rev 5044)
@@ -4,8 +4,8 @@
<process-engine-context>
<command-service>
+ <environment-interceptor />
<jta-transaction-interceptor />
- <environment-interceptor />
</command-service>
</process-engine-context>
Modified: jbpm4/trunk/modules/pvm/src/main/resources/jbpm.wire.bindings.xml
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/resources/jbpm.wire.bindings.xml 2009-06-16 19:08:55 UTC (rev 5043)
+++ jbpm4/trunk/modules/pvm/src/main/resources/jbpm.wire.bindings.xml 2009-06-16 19:43:57 UTC (rev 5044)
@@ -78,6 +78,7 @@
<binding class="org.jbpm.pvm.internal.wire.binding.RetryInterceptorBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.StandardTransactionInterceptorBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.SerializeInterceptorBinding" />
+ <binding class="org.jbpm.pvm.internal.wire.binding.JtaTransactionInterceptorBinding" />
<!-- operation -->
<binding class="org.jbpm.pvm.internal.wire.binding.PropertyBinding" />
@@ -90,7 +91,6 @@
<binding class="org.jbpm.enterprise.internal.wire.binding.EjbTimerSessionBinding" />
<binding class="org.jbpm.enterprise.internal.wire.binding.EjbLocalCommandServiceBinding" />
<binding class="org.jbpm.enterprise.internal.wire.binding.EjbRemoteCommandServiceBinding" />
- <binding class="org.jbpm.enterprise.internal.wire.binding.JtaTransactionInterceptorBinding" />
<!-- jpdl bindings -->
<binding class="org.jbpm.jpdl.internal.xml.JpdlDeployerBinding" />
Modified: jbpm4/trunk/modules/test-db/pom.xml
===================================================================
--- jbpm4/trunk/modules/test-db/pom.xml 2009-06-16 19:08:55 UTC (rev 5043)
+++ jbpm4/trunk/modules/test-db/pom.xml 2009-06-16 19:43:57 UTC (rev 5044)
@@ -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>
@@ -104,26 +128,8 @@
</build>
</profile>
- <!--
- skip tests if this is an integration test run
- (only examples and test-db are part of the integration test runs)
- -->
+ <!-- -Djboss.bind.address -->
<profile>
- <id>integration.test</id>
- <activation>
- <property>
- <name>jboss.bind.address</name>
- </property>
- </activation>
- <properties>
- <skipTests>true</skipTests>
- </properties>
- </profile>
-
-
-
- <!-- -Djboss.bind.address
- <profile>
<id>integration.tests</id>
<activation>
<property>
@@ -137,6 +143,7 @@
<artifactId>jbpm-enterprise</artifactId>
<scope>test</scope>
</dependency>
+ <!-- AS 5 Integration tests -->
<dependency>
<groupId>org.jboss.jbossas</groupId>
<artifactId>jboss-as-client</artifactId>
@@ -165,10 +172,10 @@
<configuration>
<tasks>
<copy todir="target/test-classes" overwrite="true" failonerror="false">
- <fileset dir="../../qa/jbossremote" />
+ <fileset dir="../distro/src/main/files/jboss/jbpm.cfg.remote.client" />
</copy>
<copy todir="target/test-classes" overwrite="true" failonerror="false">
- <fileset dir="${user.home}/.jbpm4/qa/jbossremote" />
+ <fileset dir="${user.home}/.jbpm4/jbpm.cfg.remote.client" />
</copy>
</tasks>
</configuration>
@@ -180,15 +187,13 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<failIfNoTests>false</failIfNoTests>
- <trimStackTrace>false</trimStackTrace>
- <excludes>
- </excludes>
+ <trimStackTrace>false</trimStackTrace>
</configuration>
</plugin>
</plugins>
</build>
- </profile
--->
+ </profile>
+
</profiles>
</project>
\ No newline at end of file
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/async/AsyncBasicsTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/async/AsyncBasicsTest.java 2009-06-16 19:08:55 UTC (rev 5043)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/async/AsyncBasicsTest.java 2009-06-16 19:43:57 UTC (rev 5044)
@@ -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/trunk/modules/test-db/src/test/java/org/jbpm/test/eventlistener/EventListenerTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/eventlistener/EventListenerTest.java 2009-06-16 19:08:55 UTC (rev 5043)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/eventlistener/EventListenerTest.java 2009-06-16 19:43:57 UTC (rev 5044)
@@ -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/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskHandlerTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskHandlerTest.java 2009-06-16 19:08:55 UTC (rev 5043)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskHandlerTest.java 2009-06-16 19:43:57 UTC (rev 5044)
@@ -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/trunk/qa/build.xml
===================================================================
--- jbpm4/trunk/qa/build.xml 2009-06-16 19:08:55 UTC (rev 5043)
+++ jbpm4/trunk/qa/build.xml 2009-06-16 19:43:57 UTC (rev 5044)
@@ -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,18 +108,18 @@
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"
@@ -109,9 +131,9 @@
</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/trunk/qa/jbpm.cfg.jboss.testsuite (from rev 5043, jbpm4/branches/tbaeyens/qa/jbpm.cfg.jboss.testsuite)
Copied: jbpm4/trunk/qa/jbpm.cfg.jboss.testsuite/jboss.idm (from rev 5043, jbpm4/branches/tbaeyens/qa/jbpm.cfg.jboss.testsuite/jboss.idm)
Deleted: jbpm4/trunk/qa/jbpm.cfg.jboss.testsuite/jboss.idm/jbpm.cfg.xml
===================================================================
--- jbpm4/branches/tbaeyens/qa/jbpm.cfg.jboss.testsuite/jboss.idm/jbpm.cfg.xml 2009-06-16 19:08:55 UTC (rev 5043)
+++ jbpm4/trunk/qa/jbpm.cfg.jboss.testsuite/jboss.idm/jbpm.cfg.xml 2009-06-16 19:43:57 UTC (rev 5044)
@@ -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.jboss.idm.cfg.xml" />
-
- <import resource="jbpm.mail.templates.examples.xml" />
-
-</jbpm-configuration>
Copied: jbpm4/trunk/qa/jbpm.cfg.jboss.testsuite/jboss.idm/jbpm.cfg.xml (from rev 5043, jbpm4/branches/tbaeyens/qa/jbpm.cfg.jboss.testsuite/jboss.idm/jbpm.cfg.xml)
===================================================================
--- jbpm4/trunk/qa/jbpm.cfg.jboss.testsuite/jboss.idm/jbpm.cfg.xml (rev 0)
+++ jbpm4/trunk/qa/jbpm.cfg.jboss.testsuite/jboss.idm/jbpm.cfg.xml 2009-06-16 19:43:57 UTC (rev 5044)
@@ -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/trunk/qa/jbpm.cfg.jboss.testsuite/jbpm.identity (from rev 5043, jbpm4/branches/tbaeyens/qa/jbpm.cfg.jboss.testsuite/jbpm.identity)
Deleted: jbpm4/trunk/qa/jbpm.cfg.jboss.testsuite/jbpm.identity/jbpm.cfg.xml
===================================================================
--- jbpm4/branches/tbaeyens/qa/jbpm.cfg.jboss.testsuite/jbpm.identity/jbpm.cfg.xml 2009-06-16 19:08:55 UTC (rev 5043)
+++ jbpm4/trunk/qa/jbpm.cfg.jboss.testsuite/jbpm.identity/jbpm.cfg.xml 2009-06-16 19:43:57 UTC (rev 5044)
@@ -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>
Copied: jbpm4/trunk/qa/jbpm.cfg.jboss.testsuite/jbpm.identity/jbpm.cfg.xml (from rev 5043, jbpm4/branches/tbaeyens/qa/jbpm.cfg.jboss.testsuite/jbpm.identity/jbpm.cfg.xml)
===================================================================
--- jbpm4/trunk/qa/jbpm.cfg.jboss.testsuite/jbpm.identity/jbpm.cfg.xml (rev 0)
+++ jbpm4/trunk/qa/jbpm.cfg.jboss.testsuite/jbpm.identity/jbpm.cfg.xml 2009-06-16 19:43:57 UTC (rev 5044)
@@ -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>
Deleted: jbpm4/trunk/qa/jbpm.cfg.jboss.testsuite/jbpm.identity/jbpm.mail.properties
===================================================================
--- jbpm4/branches/tbaeyens/qa/jbpm.cfg.jboss.testsuite/jbpm.identity/jbpm.mail.properties 2009-06-16 19:08:55 UTC (rev 5043)
+++ jbpm4/trunk/qa/jbpm.cfg.jboss.testsuite/jbpm.identity/jbpm.mail.properties 2009-06-16 19:43:57 UTC (rev 5044)
@@ -1,3 +0,0 @@
-mail.smtp.host localhost
-mail.smtp.port 2525
-mail.from noreply at jbpm.org
\ No newline at end of file
Copied: jbpm4/trunk/qa/jbpm.cfg.jboss.testsuite/jbpm.identity/jbpm.mail.properties (from rev 5043, jbpm4/branches/tbaeyens/qa/jbpm.cfg.jboss.testsuite/jbpm.identity/jbpm.mail.properties)
===================================================================
--- jbpm4/trunk/qa/jbpm.cfg.jboss.testsuite/jbpm.identity/jbpm.mail.properties (rev 0)
+++ jbpm4/trunk/qa/jbpm.cfg.jboss.testsuite/jbpm.identity/jbpm.mail.properties 2009-06-16 19:43:57 UTC (rev 5044)
@@ -0,0 +1,3 @@
+mail.smtp.host localhost
+mail.smtp.port 2525
+mail.from noreply at jbpm.org
\ No newline at end of file
Deleted: jbpm4/trunk/qa/jbpm.cfg.jboss.testsuite/jbpm.identity/jbpm.mail.templates.examples.xml
===================================================================
--- jbpm4/branches/tbaeyens/qa/jbpm.cfg.jboss.testsuite/jbpm.identity/jbpm.mail.templates.examples.xml 2009-06-16 19:08:55 UTC (rev 5043)
+++ jbpm4/trunk/qa/jbpm.cfg.jboss.testsuite/jbpm.identity/jbpm.mail.templates.examples.xml 2009-06-16 19:43:57 UTC (rev 5044)
@@ -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
Copied: jbpm4/trunk/qa/jbpm.cfg.jboss.testsuite/jbpm.identity/jbpm.mail.templates.examples.xml (from rev 5043, jbpm4/branches/tbaeyens/qa/jbpm.cfg.jboss.testsuite/jbpm.identity/jbpm.mail.templates.examples.xml)
===================================================================
--- jbpm4/trunk/qa/jbpm.cfg.jboss.testsuite/jbpm.identity/jbpm.mail.templates.examples.xml (rev 0)
+++ jbpm4/trunk/qa/jbpm.cfg.jboss.testsuite/jbpm.identity/jbpm.mail.templates.examples.xml 2009-06-16 19:43:57 UTC (rev 5044)
@@ -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
More information about the jbpm-commits
mailing list