JBoss JBPM SVN: r5086 - in jbpm3/branches/jbpm-3.2-soa: hudson and 1 other directory.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2009-06-23 02:53:18 -0400 (Tue, 23 Jun 2009)
New Revision: 5086
Modified:
jbpm3/branches/jbpm-3.2-soa/hudson/profiles.xml.local.qa
jbpm3/branches/jbpm-3.2-soa/hudson/profiles.xml.redhat.qa
jbpm3/branches/jbpm-3.2-soa/profiles.xml.example
Log:
JBPM-1357: Add QA for db2 (CODING IN PROGRESS)
Change activation method from 'activeByDefault' to 'property: database' as profiles active by default are deactivated when another profile in the pom is activated
Modified: jbpm3/branches/jbpm-3.2-soa/hudson/profiles.xml.local.qa
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/hudson/profiles.xml.local.qa 2009-06-23 05:26:15 UTC (rev 5085)
+++ jbpm3/branches/jbpm-3.2-soa/hudson/profiles.xml.local.qa 2009-06-23 06:53:18 UTC (rev 5086)
@@ -1,13 +1,13 @@
<profilesXml xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/profiles-1.0.0.xsd">
<profiles>
-
- <!-- This profile can also be defined in ~/.m2/settings.xml -->
<profile>
- <id>local</id>
+ <id>qa-local</id>
<activation>
- <activeByDefault>true</activeByDefault>
+ <property>
+ <name>database</name>
+ </property>
</activation>
<properties>
@@ -42,6 +42,5 @@
<jdbc.oracle.password>jbpmtest</jdbc.oracle.password>
</properties>
</profile>
-
</profiles>
</profilesXml>
Modified: jbpm3/branches/jbpm-3.2-soa/hudson/profiles.xml.redhat.qa
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/hudson/profiles.xml.redhat.qa 2009-06-23 05:26:15 UTC (rev 5085)
+++ jbpm3/branches/jbpm-3.2-soa/hudson/profiles.xml.redhat.qa 2009-06-23 06:53:18 UTC (rev 5086)
@@ -1,13 +1,13 @@
<profilesXml xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/profiles-1.0.0.xsd">
<profiles>
-
- <!-- This profile can also be defined in ~/.m2/settings.xml -->
<profile>
- <id>redhat</id>
+ <id>qa-redhat</id>
<activation>
- <activeByDefault>true</activeByDefault>
+ <property>
+ <name>database</name>
+ </property>
</activation>
<properties>
@@ -49,6 +49,5 @@
<jdbc.db2.password>jbpm3</jdbc.db2.password>
</properties>
</profile>
-
</profiles>
</profilesXml>
Modified: jbpm3/branches/jbpm-3.2-soa/profiles.xml.example
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/profiles.xml.example 2009-06-23 05:26:15 UTC (rev 5085)
+++ jbpm3/branches/jbpm-3.2-soa/profiles.xml.example 2009-06-23 06:53:18 UTC (rev 5086)
@@ -5,10 +5,14 @@
<profiles>
<!-- This profile can also be defined in ~/.m2/settings.xml -->
<profile>
- <id>local</id>
+ <id>dev-local</id>
+
<activation>
- <activeByDefault>true</activeByDefault>
+ <property>
+ <name>database</name>
+ </property>
</activation>
+
<properties>
<jboss405.home>${user.home}/jboss-4.0.5.GA</jboss405.home>
<jboss423.home>${user.home}/jboss-4.2.3.GA</jboss423.home>
16 years, 10 months
JBoss JBPM SVN: r5085 - in jbpm3/branches/jbpm-3.2-soa: hudson and 5 other directories.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2009-06-23 01:26:15 -0400 (Tue, 23 Jun 2009)
New Revision: 5085
Added:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/jbpm-db2-ds.xml
Modified:
jbpm3/branches/jbpm-3.2-soa/hudson/hudson-home/jobs/jBPM3-Container-Matrix/config.xml
jbpm3/branches/jbpm-3.2-soa/hudson/hudson-home/jobs/jBPM3-Database-Matrix/config.xml
jbpm3/branches/jbpm-3.2-soa/hudson/profiles.xml.local.qa
jbpm3/branches/jbpm-3.2-soa/hudson/profiles.xml.redhat.qa
jbpm3/branches/jbpm-3.2-soa/modules/core/pom.xml
jbpm3/branches/jbpm-3.2-soa/modules/core/scripts/antrun-jbpm-config.xml
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/hibernate.properties.db2.xml
jbpm3/branches/jbpm-3.2-soa/pom.xml
Log:
JBPM-1357: Add QA for db2 (CODING IN PROGRESS)
Provide connection properties, data source, maven profiles for DB2
Modified: jbpm3/branches/jbpm-3.2-soa/hudson/hudson-home/jobs/jBPM3-Container-Matrix/config.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/hudson/hudson-home/jobs/jBPM3-Container-Matrix/config.xml 2009-06-22 18:02:22 UTC (rev 5084)
+++ jbpm3/branches/jbpm-3.2-soa/hudson/hudson-home/jobs/jBPM3-Container-Matrix/config.xml 2009-06-23 05:26:15 UTC (rev 5085)
@@ -41,8 +41,10 @@
<axis>
<name>database</name>
<values>
+ <string>postgresql</string>
<string>sybase</string>
<string>oracle</string>
+ <string>db2</string>
</values>
</axis>
<axis>
Modified: jbpm3/branches/jbpm-3.2-soa/hudson/hudson-home/jobs/jBPM3-Database-Matrix/config.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/hudson/hudson-home/jobs/jBPM3-Database-Matrix/config.xml 2009-06-22 18:02:22 UTC (rev 5084)
+++ jbpm3/branches/jbpm-3.2-soa/hudson/hudson-home/jobs/jBPM3-Database-Matrix/config.xml 2009-06-23 05:26:15 UTC (rev 5085)
@@ -45,13 +45,13 @@
<string>postgresql</string>
<string>sybase</string>
<string>oracle</string>
+ <string>db2</string>
</values>
</axis>
<axis>
<name>jdk</name>
<values>
<string>jdk1.4</string>
- <string>jdk1.5</string>
</values>
</axis>
</axes>
Modified: jbpm3/branches/jbpm-3.2-soa/hudson/profiles.xml.local.qa
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/hudson/profiles.xml.local.qa 2009-06-22 18:02:22 UTC (rev 5084)
+++ jbpm3/branches/jbpm-3.2-soa/hudson/profiles.xml.local.qa 2009-06-23 05:26:15 UTC (rev 5085)
@@ -4,12 +4,10 @@
<!-- This profile can also be defined in ~/.m2/settings.xml -->
<profile>
- <id>jboss-home-profile</id>
+ <id>local</id>
<activation>
- <property>
- <name>user.name</name>
- </property>
+ <activeByDefault>true</activeByDefault>
</activation>
<properties>
@@ -20,7 +18,7 @@
<jdbc.mysql.username>jbpmtest</jdbc.mysql.username>
<jdbc.mysql.password></jdbc.mysql.password>
- <jdbc.sybase.server>192.168.0.101</jdbc.sybase.server>
+ <jdbc.sybase.server>localhost</jdbc.sybase.server>
<jdbc.sybase.port>5000</jdbc.sybase.port>
<jdbc.sybase.database>jbpmtest</jdbc.sybase.database>
<jdbc.sybase.url>jdbc:sybase:Tds:${jdbc.sybase.server}:${jdbc.sybase.port}/${jdbc.sybase.database}</jdbc.sybase.url>
Modified: jbpm3/branches/jbpm-3.2-soa/hudson/profiles.xml.redhat.qa
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/hudson/profiles.xml.redhat.qa 2009-06-22 18:02:22 UTC (rev 5084)
+++ jbpm3/branches/jbpm-3.2-soa/hudson/profiles.xml.redhat.qa 2009-06-23 05:26:15 UTC (rev 5085)
@@ -4,12 +4,10 @@
<!-- This profile can also be defined in ~/.m2/settings.xml -->
<profile>
- <id>jboss-home-profile</id>
+ <id>redhat</id>
<activation>
- <property>
- <name>user.name</name>
- </property>
+ <activeByDefault>true</activeByDefault>
</activation>
<properties>
@@ -42,6 +40,13 @@
<jdbc.oracle.url>jdbc:oracle:thin:@${jdbc.oracle.server}:${jdbc.oracle.port}:${jdbc.oracle.database}</jdbc.oracle.url>
<jdbc.oracle.username>jbpm3</jdbc.oracle.username>
<jdbc.oracle.password>jbpm3</jdbc.oracle.password>
+
+ <jdbc.db2.server>dev67.qa.atl.jboss.com</jdbc.db2.server>
+ <jdbc.db2.port>50000</jdbc.db2.port>
+ <jdbc.db2.database>jbossqa</jdbc.db2.database>
+ <jdbc.db2.url>jdbc:db2://${jdbc.db2.server}:${jdbc.db2.port}/${jdbc.db2.database}</jdbc.db2.url>
+ <jdbc.db2.username>jbpm3</jdbc.db2.username>
+ <jdbc.db2.password>jbpm3</jdbc.db2.password>
</properties>
</profile>
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/pom.xml 2009-06-22 18:02:22 UTC (rev 5084)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/pom.xml 2009-06-23 05:26:15 UTC (rev 5085)
@@ -348,5 +348,26 @@
</build>
</profile>
+ <!--
+ Name: db2
+ Descr: DB2 Database Setup
+ -->
+ <profile>
+ <id>db2</id>
+ <activation>
+ <property>
+ <name>database</name>
+ <value>db2</value>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
</profiles>
</project>
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/scripts/antrun-jbpm-config.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/scripts/antrun-jbpm-config.xml 2009-06-22 18:02:22 UTC (rev 5084)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/scripts/antrun-jbpm-config.xml 2009-06-23 05:26:15 UTC (rev 5085)
@@ -90,18 +90,16 @@
<macro-database-cfg database="mckoi" />
<macro-database-cfg database="mssql" />
<macro-database-cfg database="mysql"/>
+ <macro-database-cfg database="oracle" />
<macro-database-cfg database="postgresql"/>
<macro-database-cfg database="sapdb" />
<macro-database-cfg database="sybase"/>
- <macro-database-cfg database="oracle" />
- <macro-database-cfg database="postgresql" />
<echo message="Copy hibernate.cfg.${database}.xml to hibernate.cfg.xml" />
<copy file="${project.build.directory}/classes/hibernate.cfg.${database}.xml" tofile="${project.build.directory}/classes/hibernate.cfg.xml"/>
<loadfile property="hibernate.properties.xml" srcFile="${build.resources.directory}/hibernate.properties.${database}.xml"/>
<echo message="${hibernate.properties.xml}"/>
- <echo/>
</target>
<!-- Generate the custom jbpm.cfg.xml for the SOA platform -->
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/hibernate.properties.db2.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/hibernate.properties.db2.xml 2009-06-22 18:02:22 UTC (rev 5084)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/hibernate.properties.db2.xml 2009-06-23 05:26:15 UTC (rev 5085)
@@ -3,10 +3,9 @@
<property name="hibernate.dialect">org.hibernate.dialect.DB2Dialect</property>
<!-- JDBC connection properties (begin) -->
- <!-- fetch driver from http://www-128.ibm.com/developerworks/db2/downloads/jcc -->
<property name="hibernate.connection.driver_class">com.ibm.db2.jcc.DB2Driver</property>
- <property name="hibernate.connection.url">jdbc:db2://localhost:50000/testing</property>
- <property name="hibernate.connection.username"></property>
- <property name="hibernate.connection.password"></property>
+ <property name="hibernate.connection.url">${jdbc.db2.url}</property>
+ <property name="hibernate.connection.username">${jdbc.db2.username}</property>
+ <property name="hibernate.connection.password">${jdbc.db2.password}</property>
<!-- JDBC connection properties (end) -->
Added: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/jbpm-db2-ds.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/jbpm-db2-ds.xml (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/resources/jbpm-db2-ds.xml 2009-06-23 05:26:15 UTC (rev 5085)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<datasources>
+ <xa-datasource>
+ <jndi-name>JbpmDS</jndi-name>
+
+ <xa-datasource-class>com.ibm.db2.jcc.DB2XADataSource</xa-datasource-class>
+ <xa-datasource-property name="ServerName">${jdbc.db2.server}</xa-datasource-property>
+ <xa-datasource-property name="PortNumber">${jdbc.db2.port}</xa-datasource-property>
+ <xa-datasource-property name="DatabaseName">${jdbc.db2.database}</xa-datasource-property>
+ <user-name>${jdbc.db2.username}</user-name>
+ <password>${jdbc.db2.password}</password>
+
+ <!-- Must be set if using multiple DB2 XA resources in same transaction -->
+ <isSameRM-override-value>false</isSameRM-override-value>
+
+ <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml -->
+ <metadata>
+ <type-mapping>DB2</type-mapping>
+ </metadata>
+ </xa-datasource>
+</datasources>
\ No newline at end of file
Modified: jbpm3/branches/jbpm-3.2-soa/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/pom.xml 2009-06-22 18:02:22 UTC (rev 5084)
+++ jbpm3/branches/jbpm-3.2-soa/pom.xml 2009-06-23 05:26:15 UTC (rev 5085)
@@ -82,7 +82,8 @@
<jtds.version>1.2.2</jtds.version>
<jconnect.version>6.0.5</jconnect.version>
<ojdbc.version>10.2.0.4</ojdbc.version>
- </properties>
+ <db2jcc.version>3.1.57</db2jcc.version>
+ </properties>
<!-- DependencyManagement -->
<dependencyManagement>
@@ -447,7 +448,7 @@
<!--
Name: postgresql
- Descr: MySQL Database Setup
+ Descr: PostgreSQL Database Setup
-->
<profile>
<id>postgresql</id>
@@ -494,5 +495,39 @@
</repositories>
</profile>
+ <!--
+ Name: db2
+ Descr: DB2 Database Setup
+ -->
+ <profile>
+ <id>db2</id>
+ <activation>
+ <property>
+ <name>database</name>
+ <value>db2</value>
+ </property>
+ </activation>
+ <repositories>
+ <repository>
+ <id>qa.jboss.com</id>
+ <url>http://www.qa.jboss.com/jdbc-drivers/maven2</url>
+ </repository>
+ </repositories>
+ <dependencies>
+ <dependency>
+ <groupId>com.ibm</groupId>
+ <artifactId>db2jcc</artifactId>
+ <version>${db2jcc.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.ibm</groupId>
+ <artifactId>db2jcc_license_cu</artifactId>
+ <version>${db2jcc.version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+
</profiles>
</project>
16 years, 10 months
JBoss JBPM SVN: r5084 - jbpm4/trunk/modules/test-concurrent/src/test/java/org/jbpm/test/concurrent.
by do-not-reply@jboss.org
Author: jbarrez
Date: 2009-06-22 14:02:22 -0400 (Mon, 22 Jun 2009)
New Revision: 5084
Added:
jbpm4/trunk/modules/test-concurrent/src/test/java/org/jbpm/test/concurrent/BasicUsageTest.java
Log:
Added test for JBPM-2331
Added: jbpm4/trunk/modules/test-concurrent/src/test/java/org/jbpm/test/concurrent/BasicUsageTest.java
===================================================================
--- jbpm4/trunk/modules/test-concurrent/src/test/java/org/jbpm/test/concurrent/BasicUsageTest.java (rev 0)
+++ jbpm4/trunk/modules/test-concurrent/src/test/java/org/jbpm/test/concurrent/BasicUsageTest.java 2009-06-22 18:02:22 UTC (rev 5084)
@@ -0,0 +1,73 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+/**
+ *
+ */
+package org.jbpm.test.concurrent;
+
+import org.jbpm.api.ProcessInstance;
+import org.jbpm.api.job.Job;
+
+
+/**
+ * Test case for tests that only test basic usage (ie no corner cases).
+ *
+ * @author Joram Barrez
+ */
+public class BasicUsageTest extends ConcurrentJbpmTestCase {
+
+ // Test for JBPM-2331
+ public void testBasicTimeout() {
+ deployJpdlXmlString(
+ "<process key='TimerTest' name='Timer Test'>" +
+ " <start name='thestart'>" +
+ " <transition to='wait'/>" +
+ " </start>" +
+ " <state name='wait'>" +
+ " <transition name='timeout' to='end'>" +
+ " <timer duedate='30 seconds'/>" +
+ " </transition>" +
+ " </state>" +
+ " <end name='end'/>" +
+ "</process>"
+ );
+
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("TimerTest");
+ assertActiveActivity("wait", processInstance.getId());
+
+ Job job = managementService.createJobQuery()
+ .processInstanceId(processInstance.getId())
+ .uniqueResult();
+
+ SynchronizableCommandExecutor executor = new SynchronizableCommandExecutor(environmentFactory, job);
+ executor.start();
+
+ try {
+ executor.join();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+
+ assertProcessInstanceEnded(processInstance);
+ }
+
+}
16 years, 10 months
JBoss JBPM SVN: r5083 - in jbpm4/trunk/modules: test-db/src/test/java/org/jbpm/test/timer and 1 other directory.
by do-not-reply@jboss.org
Author: jbarrez
Date: 2009-06-22 14:01:48 -0400 (Mon, 22 Jun 2009)
New Revision: 5083
Modified:
jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/timer/TimerTest.java
Log:
Added test for JBPM-2331
Modified: jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java
===================================================================
--- jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java 2009-06-22 17:03:36 UTC (rev 5082)
+++ jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java 2009-06-22 18:01:48 UTC (rev 5083)
@@ -195,7 +195,8 @@
assertExecutionEnded(processInstance.getId());
}
- public void assertIsActiveActivity(String activityName, Execution execution) {
+ public void assertActiveActivity(String activityName, String executionId) {
+ Execution execution = executionService.findExecutionById(executionId);
assertTrue("The given execution (or any child execution) isn't in the activity '" + activityName
+ "' (current activities : " + listAllActiveActivites(execution) + ")",
execution.isActive(activityName));
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/timer/TimerTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/timer/TimerTest.java 2009-06-22 17:03:36 UTC (rev 5082)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/timer/TimerTest.java 2009-06-22 18:01:48 UTC (rev 5083)
@@ -31,7 +31,7 @@
*/
public class TimerTest extends JbpmTestCase {
- public void testSignalExecutionById() {
+ public void testTimerTimeout() {
deployJpdlXmlString(
"<process name='Insurance claim' key='ICL'>" +
" <start>" +
@@ -55,6 +55,7 @@
.uniqueResult();
managementService.executeJob(job.getDbid());
+ assertProcessInstanceEnded(processInstance);
}
-}
+}
\ No newline at end of file
16 years, 10 months
JBoss JBPM SVN: r5082 - in jbpm4/trunk: modules/test-db/src/test/java/org/jbpm/test/identity and 1 other directories.
by do-not-reply@jboss.org
Author: jeff.yuchang
Date: 2009-06-22 13:03:36 -0400 (Mon, 22 Jun 2009)
New Revision: 5082
Modified:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/JBossIdmIdentitySessionImpl.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/identity/IdentityTest.java
jbpm4/trunk/qa/build.xml
Log:
JBPM-2172
* Finish the jbpmGroupId <-> idmGroupId as a current solution, will switch to other if we've reached another solution.
* Update the qa build script to get the idm component correctly.
* Will release the idm beta1 tomorrow, and then update the version into beta1. Then this jira issue should be resolved.
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/JBossIdmIdentitySessionImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/JBossIdmIdentitySessionImpl.java 2009-06-22 15:18:50 UTC (rev 5081)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/JBossIdmIdentitySessionImpl.java 2009-06-22 17:03:36 UTC (rev 5082)
@@ -24,15 +24,18 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
+import java.util.StringTokenizer;
import org.jboss.identity.idm.api.Attribute;
import org.jboss.identity.idm.api.AttributesManager;
import org.jboss.identity.idm.api.IdentitySearchCriteria;
import org.jboss.identity.idm.api.IdentitySession;
import org.jboss.identity.idm.api.RoleType;
+import org.jboss.identity.idm.common.exception.FeatureNotSupportedException;
import org.jboss.identity.idm.common.exception.IdentityException;
import org.jboss.identity.idm.common.p3p.P3PConstants;
import org.jboss.identity.idm.impl.api.SimpleAttribute;
+import org.jboss.identity.idm.impl.api.model.GroupId;
import org.jbpm.api.JbpmException;
import org.jbpm.api.identity.Group;
import org.jbpm.api.identity.User;
@@ -45,8 +48,10 @@
protected IdentitySession identitySession;
- protected String MEMBER_ROLE = "jbpm_member_role";
+ public String DEFAULT_JBPM_MEMBER_ROLE = "default_jBPM_member_role";
+ public String DEFAUL_JBPM_GROUP_TYPE = "default_jBPM_Group_Type";
+
public JBossIdmIdentitySessionImpl(IdentitySession identitySession) {
this.identitySession = identitySession;
}
@@ -132,12 +137,12 @@
public List<User> findUsersByGroup(String groupId) {
try {
List<User> users = new ArrayList<User>();
- org.jboss.identity.idm.api.Group idGroup = findIdmGroupById(groupId);
+ org.jboss.identity.idm.api.Group idGroup = findIdmGroupByIdmGroupId(convertjbpmGroupId2IdmGroupId(groupId));
if (idGroup == null){
return users;
}
Collection<org.jboss.identity.idm.api.User> idusers =
- identitySession.getRelationshipManager().findAssociatedUsers(idGroup, false);
+ identitySession.getRoleManager().findUsersWithRelatedRole(idGroup, null);
for (org.jboss.identity.idm.api.User iduser : idusers) {
users.add(findUserById(iduser.getId()));
}
@@ -145,6 +150,8 @@
return users;
} catch (IdentityException e) {
throw new JbpmException("couldn't find users by groupid: " + groupId, e);
+ } catch (FeatureNotSupportedException e) {
+ throw new JbpmException("couldn't find users by groupid: " + groupId, e);
}
}
@@ -162,19 +169,19 @@
try {
String gtype = groupType;
if (gtype == null) {
- gtype = Group.TYPE_UNIT;
+ gtype = DEFAUL_JBPM_GROUP_TYPE;
}
org.jboss.identity.idm.api.Group group = identitySession.getPersistenceManager().createGroup(groupName, gtype);
String groupId = group.getId();
if (parentGroupId!=null) {
- org.jboss.identity.idm.api.Group parentGroup = findIdmGroupById(parentGroupId);
+ org.jboss.identity.idm.api.Group parentGroup = findIdmGroupByIdmGroupId(convertjbpmGroupId2IdmGroupId(parentGroupId));
if (parentGroup==null) {
throw new JbpmException("parent group "+parentGroupId+" doesn't exist");
}
identitySession.getRelationshipManager().associateGroups(parentGroup, group);
}
- return groupId;
+ return convertIdmGroupId2jbpmGroupId(groupId);
} catch (IdentityException e) {
throw new JbpmException("couldn't create group "+groupName, e);
@@ -184,12 +191,12 @@
public Group findGroupById(String groupId) {
try {
- org.jboss.identity.idm.api.Group idGroup = findIdmGroupById(groupId);
+ org.jboss.identity.idm.api.Group idGroup = findIdmGroupByIdmGroupId(convertjbpmGroupId2IdmGroupId(groupId));
if (idGroup == null) {
return null;
}
GroupImpl group = new GroupImpl();
- group.setId(idGroup.getId());
+ group.setId(convertIdmGroupId2jbpmGroupId(idGroup.getId()));
group.setType(idGroup.getGroupType());
group.setName(idGroup.getName());
@@ -199,7 +206,7 @@
if (idParentGroups.size() > 0) {
org.jboss.identity.idm.api.Group idParent = idParentGroups.iterator().next();
GroupImpl parentGroup = new GroupImpl();
- parentGroup.setId(idParent.getId());
+ parentGroup.setId(convertIdmGroupId2jbpmGroupId(idParent.getId()));
parentGroup.setType(idParent.getGroupType());
parentGroup.setName(idParent.getName());
@@ -220,7 +227,7 @@
List<Group> groups = new ArrayList<Group>();
for (org.jboss.identity.idm.api.Group idGroup: idGroups) {
- groups.add(findGroupById(idGroup.getId()));
+ groups.add(findGroupById(convertIdmGroupId2jbpmGroupId(idGroup.getId())));
}
return groups;
@@ -238,7 +245,7 @@
List<Group> groups = new ArrayList<Group>();
for (org.jboss.identity.idm.api.Group idGroup : idGroups) {
- groups.add(findGroupById(idGroup.getId()));
+ groups.add(findGroupById(convertIdmGroupId2jbpmGroupId(idGroup.getId())));
}
return groups;
} catch (Exception e) {
@@ -256,7 +263,7 @@
List<Group> groups = new ArrayList<Group>();
for (org.jboss.identity.idm.api.Group idGroup : idGroups) {
- groups.add(findGroupById(idGroup.getId()));
+ groups.add(findGroupById(convertIdmGroupId2jbpmGroupId(idGroup.getId())));
}
return groups;
} catch (Exception e) {
@@ -266,7 +273,7 @@
public void deleteGroup(String groupId) {
try {
- org.jboss.identity.idm.api.Group group = findIdmGroupById(groupId);
+ org.jboss.identity.idm.api.Group group = findIdmGroupByIdmGroupId(convertjbpmGroupId2IdmGroupId(groupId));
if (group==null) {
return;
@@ -281,7 +288,7 @@
public void createMembership(String userId, String groupId, String role) {
try {
- org.jboss.identity.idm.api.Group group = findIdmGroupById(groupId);
+ org.jboss.identity.idm.api.Group group = findIdmGroupByIdmGroupId(convertjbpmGroupId2IdmGroupId(groupId));
if (group==null) {
throw new JbpmException("group "+groupId+" doesn't exist");
}
@@ -292,10 +299,11 @@
}
if (role == null) {
- role = MEMBER_ROLE;
+ role = DEFAULT_JBPM_MEMBER_ROLE;
}
RoleType roleType = identitySession.getRoleManager().getRoleType(role);
- if (roleType==null) {
+ System.out.println("The Role Type is: " + roleType);
+ if (roleType == null) {
roleType = identitySession.getRoleManager().createRoleType(role);
}
identitySession.getRoleManager().createRole(roleType, idUser, group);
@@ -308,22 +316,16 @@
public void deleteMembership(String userId, String groupId, String role) {
try {
RoleType rtype = identitySession.getRoleManager().getRoleType(role);
- identitySession.getRoleManager().removeRole(rtype.getName(), userId, groupId);
+ identitySession.getRoleManager().removeRole(rtype.getName(), userId, convertjbpmGroupId2IdmGroupId(groupId));
} catch (Exception e) {
throw new JbpmException("couldn't delete the membership [" + userId + "," + groupId + "," + role + "]", e);
}
}
- protected org.jboss.identity.idm.api.Group findIdmGroupById(String groupId) {
+ protected org.jboss.identity.idm.api.Group findIdmGroupByIdmGroupId(String groupId) {
try {
- Collection<org.jboss.identity.idm.api.Group> groups = identitySession.getPersistenceManager().findGroup(Group.TYPE_UNIT);
- for (org.jboss.identity.idm.api.Group group : groups) {
- if (groupId.equals(group.getId())) {
- return group;
- }
- }
- return null;
+ return identitySession.getPersistenceManager().findGroupById(groupId);
} catch (IdentityException e) {
throw new JbpmException("couldn't find the group by groupId: " + groupId, e);
}
@@ -350,8 +352,39 @@
}
return null;
}
-
-
+
+
+ /**
+ * Return jBPM groupId, which is: GroupType.GroupName, from IDM GroupId
+ *
+ * @param groupId
+ * @return
+ */
+ private String convertIdmGroupId2jbpmGroupId(String groupId) {
+ GroupId theGroupId = new GroupId(groupId);
+ if (this.DEFAUL_JBPM_GROUP_TYPE.equals(theGroupId.getType()) || theGroupId.getType() == null) {
+ return theGroupId.getName();
+ }
+ return theGroupId.getType() + "." + theGroupId.getName();
+ }
+
+ /**
+ * Convert the jBPM GroupId to IDM GroupId.
+ *
+ * @param jbpmGroupId
+ * @return
+ */
+ private String convertjbpmGroupId2IdmGroupId(String jbpmGroupId) {
+ StringTokenizer st = new StringTokenizer(jbpmGroupId, ".");
+ String type = DEFAUL_JBPM_GROUP_TYPE;
+ if (st.countTokens() > 1) {
+ type = st.nextToken();
+ }
+ String name = st.nextToken();
+
+ return new GroupId(name, type).getId();
+ }
+
public IdentitySession getIdentitySession() {
return identitySession;
}
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/identity/IdentityTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/identity/IdentityTest.java 2009-06-22 15:18:50 UTC (rev 5081)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/identity/IdentityTest.java 2009-06-22 17:03:36 UTC (rev 5082)
@@ -83,7 +83,7 @@
identityService.createUser("johndoe", "John", "Doe");
String redhatGroupId = identityService.createGroup("redhat", Group.TYPE_UNIT, null);
- identityService.createMembership("johndoe", redhatGroupId, "Developer");
+ identityService.createMembership("johndoe", redhatGroupId, "developer");
List<Group> groups = identityService.findGroupsByUserAndGroupType("johndoe", Group.TYPE_UNIT);
assertTrue(groups.size() > 0);
@@ -111,7 +111,7 @@
String jbossId = identityService.createGroup("jboss", Group.TYPE_UNIT, redhatGroupId);
String jbpmId = identityService.createGroup("jbpm", Group.TYPE_UNIT, jbossId);
- identityService.createMembership("johndoe", redhatGroupId, "Developer");
+ identityService.createMembership("johndoe", redhatGroupId, "developer");
identityService.createMembership("joesmoe", jbpmId, "leader");
identityService.createMembership("jackblack", jbossId, "manager");
Modified: jbpm4/trunk/qa/build.xml
===================================================================
--- jbpm4/trunk/qa/build.xml 2009-06-22 15:18:50 UTC (rev 5081)
+++ jbpm4/trunk/qa/build.xml 2009-06-22 17:03:36 UTC (rev 5082)
@@ -8,7 +8,8 @@
<fail message="property jbpm.parent.dir must be specified" unless="jbpm.parent.dir" />
<!-- CONFIGURABLE PROPERTIES -->
- <property name="database" value="hsqldb" />
+ <property name="database" value="hsqldb" />
+ <property name="identity.component" value="jbpm-built-in" />
<property name="jbpm.version" value="4.0-SNAPSHOT" />
<property name="jbpm.home" value="${jbpm.parent.dir}/jbpm-${jbpm.version}" /> <!-- jbpm.home should not be configured. change jbpm.parent.dir instead -->
<property name="jboss.version" value="5.0.0.GA" />
@@ -35,7 +36,11 @@
<echo message="jbpm.distro.path.. ${jbpm.distro.path}" />
<echo message="jbossidm.home .... ${jbossidm.home}" />
</target>
-
+
+ <condition property="jbpm.identity.idm">
+ <equals arg1="${identity.component}" arg2="jboss.idm"/>
+ </condition>
+
<!-- TARGETS -->
<target name="delete.jbpm.installation"
description="deletes ${jbpm.home}">
@@ -122,7 +127,7 @@
</condition>
<target name="copy.jbossidm.jdbc.configuration" if="identity.component.idm">
- <copy file="../modules/distro/target/oracle/ojdbc14.jar"
+ <copy file="../modules/distro/target/libs/ojdbc14.jar"
todir="${jbossidm.home}/lib" />
<!--copy file="jdbc/${database}.properties"
todir="${jbossidm.home}/db/jdbc"
16 years, 10 months
JBoss JBPM SVN: r5081 - jbpm4/trunk/modules/integration/jboss4/src/main/java/org/jbpm/integration/jboss4.
by do-not-reply@jboss.org
Author: camunda
Date: 2009-06-22 11:18:50 -0400 (Mon, 22 Jun 2009)
New Revision: 5081
Modified:
jbpm4/trunk/modules/integration/jboss4/src/main/java/org/jbpm/integration/jboss4/JBPMDeployer.java
Log:
changed archive file suffix to ".bar" instead of outdated ".jpdl"
Modified: jbpm4/trunk/modules/integration/jboss4/src/main/java/org/jbpm/integration/jboss4/JBPMDeployer.java
===================================================================
--- jbpm4/trunk/modules/integration/jboss4/src/main/java/org/jbpm/integration/jboss4/JBPMDeployer.java 2009-06-22 14:29:53 UTC (rev 5080)
+++ jbpm4/trunk/modules/integration/jboss4/src/main/java/org/jbpm/integration/jboss4/JBPMDeployer.java 2009-06-22 15:18:50 UTC (rev 5081)
@@ -49,7 +49,7 @@
private static final Log log = Log.getLog(JBPMDeployer.class.getName());
private DeploymentAdaptor adaptor;
- private static final String ARCHIVE_SUFFIX = ".jpdl";
+ private static final String ARCHIVE_SUFFIX = ".bar";
private static final String JPDL_FILE_SUFFIX = ".jpdl.xml";
private static final String CONTEXT_REFERENCE = "jbpm.deployer.reference";
16 years, 10 months
JBoss JBPM SVN: r5080 - in jbpm4/trunk/modules/test-concurrent/src: test/java/org/jbpm/test/concurrent and 1 other directories.
by do-not-reply@jboss.org
Author: jbarrez
Date: 2009-06-22 10:29:53 -0400 (Mon, 22 Jun 2009)
New Revision: 5080
Removed:
jbpm4/trunk/modules/test-concurrent/src/test/java/org/jbpm/test/concurrent/OptimisticLockTestGround.java
Modified:
jbpm4/trunk/modules/test-concurrent/src/main/java/org/jbpm/test/concurrent/SynchronizableCommandExecutor.java
jbpm4/trunk/modules/test-concurrent/src/test/java/org/jbpm/test/concurrent/AsyncForkTest.java
jbpm4/trunk/modules/test-concurrent/src/test/java/org/jbpm/test/concurrent/TimerVsSignalConcurrencyTest.java
jbpm4/trunk/modules/test-concurrent/src/test/resources/jbpm.hibernate.cfg.xml
Log:
Work in progress: concurrency testing
Modified: jbpm4/trunk/modules/test-concurrent/src/main/java/org/jbpm/test/concurrent/SynchronizableCommandExecutor.java
===================================================================
--- jbpm4/trunk/modules/test-concurrent/src/main/java/org/jbpm/test/concurrent/SynchronizableCommandExecutor.java 2009-06-22 14:26:18 UTC (rev 5079)
+++ jbpm4/trunk/modules/test-concurrent/src/main/java/org/jbpm/test/concurrent/SynchronizableCommandExecutor.java 2009-06-22 14:29:53 UTC (rev 5080)
@@ -80,6 +80,8 @@
private CyclicBarrier afterExecutionBarrier;
+ private List<SynchronizableCommandExecutor> executorsSyncedAfterExecution;
+
private CyclicBarrier beforeExecutionBarrier;
/**
@@ -187,11 +189,13 @@
}
if (afterExecutionBarrier == null ) {
- afterExecutionBarrier = new CyclicBarrier(2);
+ setSyncPointForAfterExecution(new CyclicBarrier(2));
} else {
- afterExecutionBarrier = new CyclicBarrier(afterExecutionBarrier.getParties() + 1);
+ setSyncPointForAfterExecution(new CyclicBarrier(afterExecutionBarrier.getParties() + 1));
}
+ setSyncPointForAfterExecution(afterExecutionBarrier);
+
return this;
}
@@ -200,6 +204,11 @@
throw new RuntimeException("Cannot set synchronization point once the thread has been started");
}
+ if (executorsSyncedAfterExecution == null) {
+ executorsSyncedAfterExecution = new ArrayList<SynchronizableCommandExecutor>();
+ }
+ executorsSyncedAfterExecution.add(otherExecutor);
+
int threadsInvolved = 0;
if (afterExecutionBarrier != null) {
threadsInvolved += afterExecutionBarrier.getParties();
@@ -213,12 +222,21 @@
threadsInvolved++;
}
- this.afterExecutionBarrier = new CyclicBarrier(threadsInvolved);
- otherExecutor.afterExecutionBarrier = this.afterExecutionBarrier;
+ setSyncPointForAfterExecution(new CyclicBarrier(threadsInvolved));
return this;
}
+ private void setSyncPointForAfterExecution(CyclicBarrier syncpoint) {
+ this.afterExecutionBarrier = syncpoint;
+ if (executorsSyncedAfterExecution == null) {
+ executorsSyncedAfterExecution = new ArrayList<SynchronizableCommandExecutor>();
+ }
+ for (SynchronizableCommandExecutor executor : executorsSyncedAfterExecution) {
+ executor.afterExecutionBarrier = this.afterExecutionBarrier;
+ }
+ }
+
public SynchronizableCommandExecutor synchroniseBeforeExecution() {
if (isAlive()) {
throw new RuntimeException("Cannot set synchronization point once the JobExecutorEmulator has been started");
Modified: jbpm4/trunk/modules/test-concurrent/src/test/java/org/jbpm/test/concurrent/AsyncForkTest.java
===================================================================
--- jbpm4/trunk/modules/test-concurrent/src/test/java/org/jbpm/test/concurrent/AsyncForkTest.java 2009-06-22 14:26:18 UTC (rev 5079)
+++ jbpm4/trunk/modules/test-concurrent/src/test/java/org/jbpm/test/concurrent/AsyncForkTest.java 2009-06-22 14:29:53 UTC (rev 5080)
@@ -6,10 +6,24 @@
import org.jbpm.api.ProcessInstance;
import org.jbpm.api.job.Job;
-
+/**
+ * Concurrency test case: when using an async fork with differen outgoing
+ * transitions, potentially conflicts can occur (eg when the outgoing paths
+ * come together in the Join activity at the same time).
+ *
+ * @author jbarrez
+ */
public class AsyncForkTest extends ConcurrentJbpmTestCase {
- public void testAsyncForkNoOptimisticLockingFailure() {
+ /**
+ * Test case using an async fork with 2 outgoing transactions.
+ * In jBPM3, a StaleStateException was thrown when the different paths
+ * came together in the Join at the same time.
+ *
+ * However, the jBPM4 Join activity is designed with concurrency in mind,
+ * and the StaleStateException should not occur when this scenario happens.
+ */
+ public void testAsyncForkNoOptimisticLockingFailure() {
deployJpdlXmlString(
"<process name='asyncFork'>" +
" <start>" +
@@ -26,12 +40,19 @@
" <custom name='pathB' class='org.jbpm.test.concurrent.PassThroughActivity' >" +
" <transition to='theJoin' />" +
" </custom>" +
- " <join name='theJoin'>" +
- " <transition to='test' />" +
+ // Can't test with default lock-mode (upgrade). SELECT ... FOR UPGRADE
+ // will block transactions at database level with no decent approach
+ // to check if the thread is blocking. So we use the default lockmode,
+ // which is the standard Hibernate optimistic locking.
+ //
+ // Note: not using lockmode upgrade can cause the Join logic to
+ // work with incorrect data: ie it could be that an incoming
+ // transition is not seen as the 'last' one, due to a concurrent
+ // read of data. This siutation is avoided in the test by executing
+ // the Join activity logic of the last transition only after the other one.
+ " <join name='theJoin' lockmode='none'>" +
+ " <transition to='end' />" +
" </join>" +
- " <state name='test' >" +
- " <transition to='end' /> " +
- " </state>" +
" <end name='end' />" +
"</process>"
);
@@ -40,19 +61,30 @@
final List<Job> jobs = managementService.createJobQuery().processInstanceId(processInstance.getId()).list();
assertEquals(2, jobs.size());
- SynchronizableCommandExecutor executor1 = new SynchronizableCommandExecutor(environmentFactory, jobs.get(0));
- SynchronizableCommandExecutor executor2 = new SynchronizableCommandExecutor(environmentFactory, jobs.get(1));
+ SynchronizableCommandExecutor executor1 = startThreadAndSyncAfterExecution(jobs.get(0));
+ SynchronizableCommandExecutor executor2 = startThreadAndSyncAfterExecution(jobs.get(1));
- executor1.synchroniseAfterExecution(executor2);
- executor1.synchroniseAfterExecution();
-
- executor1.start();
- executor2.start();
+ try {
+ executor1.join();
+ executor2.join();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
if (executor1.getException() instanceof StaleStateException
|| executor2.getException() instanceof StaleStateException) {
fail("A StaleStaeException was thrown, altough this shouldn't happen");
}
+
+ assertProcessInstanceEnded(processInstance);
}
+
+ private SynchronizableCommandExecutor startThreadAndSyncAfterExecution(Job job) {
+ SynchronizableCommandExecutor executor = new SynchronizableCommandExecutor(environmentFactory, job);
+ executor.synchroniseAfterExecution();
+ executor.start();
+ executor.waitUntilExecutionFinished(false);
+ return executor;
+ }
}
Deleted: jbpm4/trunk/modules/test-concurrent/src/test/java/org/jbpm/test/concurrent/OptimisticLockTestGround.java
===================================================================
--- jbpm4/trunk/modules/test-concurrent/src/test/java/org/jbpm/test/concurrent/OptimisticLockTestGround.java 2009-06-22 14:26:18 UTC (rev 5079)
+++ jbpm4/trunk/modules/test-concurrent/src/test/java/org/jbpm/test/concurrent/OptimisticLockTestGround.java 2009-06-22 14:29:53 UTC (rev 5080)
@@ -1,255 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-/**
- *
- */
-package org.jbpm.test.concurrent;
-
-import java.util.List;
-import java.util.concurrent.Semaphore;
-
-import org.jbpm.api.Execution;
-import org.jbpm.api.ProcessInstance;
-import org.jbpm.api.env.Environment;
-import org.jbpm.api.env.EnvironmentFactory;
-import org.jbpm.api.job.Job;
-import org.jbpm.pvm.internal.cmd.ExecuteJobCmd;
-import org.jbpm.pvm.internal.tx.StandardTransaction;
-import org.jbpm.test.JbpmTestCase;
-
-
-/**
- * Class to test different approaches to the concurrency problem.
- *
- * Doesnt work anymore, but dont delete yet, I need some stuff in here for later!
- * * @author Joram Barrez
- */
-public class OptimisticLockTestGround extends JbpmTestCase {
-
- private EnvironmentFactory environmentFactory;
-
- protected void setUp() throws Exception {
- super.setUp();
- this.environmentFactory = (EnvironmentFactory) processEngine; // Better way to do this?
- }
-
-
- public void testMe() throws Exception {
- deployJpdlXmlString(
- "<process name='asyncFork'>" +
- " <start>" +
- " <transition to='theFork' />" +
- " </start>" +
- " <fork name='theFork'>" +
- " <on event='end' continue='async' />" +
- " <transition to='pathA' />" +
- " <transition to='pathB' />" +
- " </fork>" +
- " <custom name='pathA' class='org.jbpm.test.concurrent.PassThroughActivity' >" +
- " <transition to='theJoin' />" +
- " </custom>" +
- " <custom name='pathB' class='org.jbpm.test.concurrent.PassThroughActivity' >" +
- " <transition to='theJoin' />" +
- " </custom>" +
- " <join name='theJoin' lockmode='none'>" +
- " <transition to='end' />" +
- " </join>" +
- " <end name='end' />" +
- "</process>"
- );
-
- ProcessInstance processInstance = executionService.startProcessInstanceByKey("asyncFork");
- final List<Job> jobs = managementService.createJobQuery().processInstanceId(processInstance.getId()).list();
- assertEquals(2, jobs.size());
-
- JobExecutorEmulator jobExecutorEmulator1 = new JobExecutorEmulator(jobs.get(0));
- jobExecutorEmulator1.start();
-
- JobExecutorEmulator jobExecutorEmulator2 = new JobExecutorEmulator(jobs.get(1));
- jobExecutorEmulator2.start();
-
- // TODO check if transitions are marked for rollback -> exception happened
-
- jobExecutorEmulator1.join();
- if (jobExecutorEmulator1.getException() != null) {
- fail("Error while executing job: " + jobExecutorEmulator1.getException().getMessage());
- }
-
- jobExecutorEmulator2.join();
- if (jobExecutorEmulator2.getException() != null) {
- fail("Error while executing job: " + jobExecutorEmulator2.getException().getMessage());
- }
-
- }
-
- public void testMeToo() throws Exception {
-
- semaphore = new Semaphore(0);
-
- deployJpdlXmlString(
- "<process name='timer_vs_signal'>" +
- " <start>" +
- " <transition to='wait' />" +
- " </start>" +
- " <state name='wait'>" +
- " <transition name='timeout' to='end'>" +
- " <timer duedate='1 second' />" +
- " </transition>" +
- " <transition to='end' name='go on' />" +
- " </state>" +
- " <end name='end' />" +
- "</process>"
- );
-
- ProcessInstance processInstance = executionService.startProcessInstanceByKey("timer_vs_signal");
- final List<Job> jobs = managementService.createJobQuery().processInstanceId(processInstance.getId()).list();
- assertEquals(1, jobs.size());
-
- JobExecutorEmulator jobExecutorEmulator1 = new JobExecutorEmulator(jobs.get(0));
- jobExecutorEmulator1.start();
-
- while (!semaphore.hasQueuedThreads()) {
- synchronized (this) {
- System.out.println("------------------> waiting ...");
- wait(20L);
- }
- }
-
- // cause conflict
- System.out.println("---------------------------> Causing MayHem");
-
- Execution executionAtState = processInstance.findActiveExecutionIn("wait");
- assertNotNull(executionAtState);
- executionService.signalExecutionById(executionAtState.getId(), "go on");
- semaphore.release();
- System.out.println("----------------------------> Released semaphore");
-
- // TODO check if transitions are marked for rollback -> exception happened
-
- jobExecutorEmulator1.join();
- if (jobExecutorEmulator1.getException() != null) {
- fail("Error while executing job: " + jobExecutorEmulator1.getException().getMessage());
- }
-
- }
-
- // Todo refactor
- private static Semaphore semaphore = new Semaphore(1); // binary semaphore
-
-
- private class JobExecutorEmulator extends Thread {
-
- private Long jobId;
-
- private Exception exception;
-
- public JobExecutorEmulator(Job job) {
- this.jobId = job.getDbid();
- }
-
- public void run() {
-
- Environment environment = environmentFactory.openEnvironment();
- StandardTransaction standardTransaction = environment.get(StandardTransaction.class);
- standardTransaction.begin();
-
- try {
-
- System.out.println(Thread.currentThread().getName() + "----------------------------------------> executing job " + jobId);
- ExecuteJobCmd executeJobCmd = new ExecuteJobCmd(jobId);
- executeJobCmd.execute(environment);
-
- System.out.println(Thread.currentThread().getName() +"-------------------------------------------------------> DONE EXECUTING JOB " + jobId);
-
- } catch (Exception e) {
- standardTransaction.setRollbackOnly();
- this.exception = e;
-
- System.out.println(Thread.currentThread().getName() +" -----------------------------------------------------> IM A FAILURE");
- } finally {
-
-
- // error: both threads entering at the same time!
- /*
- boolean acquired = false;
- System.out.println(Thread.currentThread().getName() + "-------------------------------------------------> BEFORE SYNC BLOCK");
- synchronized (semaphore) {
- acquired = semaphore.tryAcquire();
- }
- System.out.println(Thread.currentThread().getName() + "-------------------------------------------------> AFTER SYNC BLOCK");
- if (acquired) {
-
- try {
- System.out.println(Thread.currentThread().getName() + "-------------------------------------------------> ACQUIRING");
- synchronized (semaphore) {
- semaphore.wait();
- }
- System.out.println(Thread.currentThread().getName() + "-------------------------------------------------> FREED FROM ACQUIRED");
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
- */
-
-
- if (!semaphore.hasQueuedThreads()) {
- try {
- System.out.println(Thread.currentThread().getName() + "-------------------------------------------------> ACQUIRING");
- semaphore.acquire();
- System.out.println(Thread.currentThread().getName() + "-------------------------------------------------> FREED FROM ACQUIRED");
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
-
-
- if (standardTransaction.isRollbackOnly()) {
- exception = new Exception("Transaction was rollbacked");
- }
-
- System.out.println(Thread.currentThread().getName() + "-------------------------------------------------> COMPLETING ");
- standardTransaction.complete();
-
- System.out.println(Thread.currentThread().getName() + "------------------------------------------------------> RELEASING");
-
- /*if (!acquired) {
- semaphore.release();
- synchronized (semaphore) {
- semaphore.notify();
- }
- }*/
-
- }
- environment.close();
- System.out.println(Thread.currentThread().getName() + " has finished");
- }
-
-
- public Exception getException() {
- return exception;
- }
-
-
- }
-
-}
Modified: jbpm4/trunk/modules/test-concurrent/src/test/java/org/jbpm/test/concurrent/TimerVsSignalConcurrencyTest.java
===================================================================
--- jbpm4/trunk/modules/test-concurrent/src/test/java/org/jbpm/test/concurrent/TimerVsSignalConcurrencyTest.java 2009-06-22 14:26:18 UTC (rev 5079)
+++ jbpm4/trunk/modules/test-concurrent/src/test/java/org/jbpm/test/concurrent/TimerVsSignalConcurrencyTest.java 2009-06-22 14:29:53 UTC (rev 5080)
@@ -34,11 +34,18 @@
/**
+ * Concurrency test case: when a timer is defined on an activity, a job
+ * will be executed by the jobExecutor. But when at the same time a
+ * signal is done on the same activity, a conflicting situation occurs.
+ *
+ * This test case will mimic this behaviour to understand how the different
+ * databases react on such a conflict.
+ *
* @author Joram Barrez
*/
public class TimerVsSignalConcurrencyTest extends ConcurrentJbpmTestCase {
- public void testStaleObjectExceptionThrown() throws Exception {
+ public void testStaleObjectExceptionThrown() {
deployJpdlXmlString(
"<process name='timer_vs_signal'>" +
@@ -76,13 +83,22 @@
// Best effort: wait 1 sec and see if the staleObjectException has been caused
synchronized (this) {
- wait(1000L);
+ try {
+ wait(1000L);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
}
jobExecutorEmulator.goOn();
- jobExecutorEmulator.join();
- signalThread.join();
+ try {
+ jobExecutorEmulator.join();
+ signalThread.join();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+
if (!(jobExecutorEmulator.getException() instanceof StaleStateException
Modified: jbpm4/trunk/modules/test-concurrent/src/test/resources/jbpm.hibernate.cfg.xml
===================================================================
--- jbpm4/trunk/modules/test-concurrent/src/test/resources/jbpm.hibernate.cfg.xml 2009-06-22 14:26:18 UTC (rev 5079)
+++ jbpm4/trunk/modules/test-concurrent/src/test/resources/jbpm.hibernate.cfg.xml 2009-06-22 14:29:53 UTC (rev 5080)
@@ -22,7 +22,7 @@
<property name="hibernate.connection.password">sa</property>
<property name="hibernate.default_schema">PUBLIC</property>
<property name="hibernate.dialect">org.hibernate.dialect.H2Dialect</property>
-
+
<!-- POSTGRES config
<property name="hibernate.connection.driver_class">org.h2.Driver</property>
@@ -30,7 +30,7 @@
<property name="hibernate.connection.username">postgres</property>
<property name="hibernate.connection.password">postgres</property>
<property name="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</property>
- -->
+ -->
<property name="hibernate.hbm2ddl.auto">create-drop</property>
<property name="hibernate.format_sql">true</property>
16 years, 10 months
JBoss JBPM SVN: r5079 - jbpm4/trunk/modules/test-db.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-06-22 10:26:18 -0400 (Mon, 22 Jun 2009)
New Revision: 5079
Modified:
jbpm4/trunk/modules/test-db/pom.xml
Log:
excluding failing integration tests
Modified: jbpm4/trunk/modules/test-db/pom.xml
===================================================================
--- jbpm4/trunk/modules/test-db/pom.xml 2009-06-22 14:24:15 UTC (rev 5078)
+++ jbpm4/trunk/modules/test-db/pom.xml 2009-06-22 14:26:18 UTC (rev 5079)
@@ -194,6 +194,12 @@
<configuration>
<failIfNoTests>false</failIfNoTests>
<trimStackTrace>false</trimStackTrace>
+ <excludes>
+ <exclude>org/jbpm/test/activities/ForkJoinInSameTransactionTest.java</exclude>
+ <exclude>org/jbpm/test/execution/ConcurrentEndTest.java</exclude>
+ <exclude>org/jbpm/test/async/AsyncEndCombinationTest.java</exclude>
+ <exclude>reporting/SQLStmtTest.java</exclude>
+ </excludes>
</configuration>
</plugin>
</plugins>
16 years, 10 months
JBoss JBPM SVN: r5078 - in jbpm4/trunk/modules: userguide/src/main/docbook/en/modules and 1 other directory.
by do-not-reply@jboss.org
Author: jbarrez
Date: 2009-06-22 10:24:15 -0400 (Mon, 22 Jun 2009)
New Revision: 5078
Modified:
jbpm4/trunk/modules/distro/src/main/files/gpd/build.xml
jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch02-Installation.xml
Log:
Updated demo.setup to support downloading and starting Eclipse on Linux and Mac OSX
Modified: jbpm4/trunk/modules/distro/src/main/files/gpd/build.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/gpd/build.xml 2009-06-22 14:23:38 UTC (rev 5077)
+++ jbpm4/trunk/modules/distro/src/main/files/gpd/build.xml 2009-06-22 14:24:15 UTC (rev 5078)
@@ -4,12 +4,39 @@
<!-- USER SPECIFIC CONFIGURATIONS -->
<property file="${user.home}/.jbpm4/build.properties" />
+
+ <!-- OS PROPERTIES -->
+ <condition property="isWindows">
+ <os family="windows"/>
+ </condition>
<!-- DEFAULT PROPERTY VALUES -->
<property name="jbpm.parent.dir" value="../.." />
<property name="jbpm.version" value="4.0-SNAPSHOT" />
- <property name="jbpm.home" value="${jbpm.parent.dir}/jbpm-${jbpm.version}" /> <!-- jbpm.home should not be configured. change jbpm.parent.dir instead -->
- <property name="eclipse.filename" value="eclipse-jee-ganymede-SR2-win32.zip" />
+ <property name="jbpm.home" value="${jbpm.parent.dir}/jbpm-${jbpm.version}" /> <!-- jbpm.home should not be configured. change jbpm.parent.dir instead -->
+
+ <!-- Eclipse version is dependent on OS -->
+ <condition property="eclipse.filename" value="eclipse-jee-ganymede-SR2-win32.zip">
+ <contains string="${os.name}" casesensitive="false" substring="win"/>
+ </condition>
+ <condition property="eclipse.filename" value="eclipse-jee-ganymede-SR2-macosx-carbon.tar.gz">
+ <contains string="${os.name}" casesensitive="false" substring="mac"/>
+ </condition>
+ <condition property="eclipse.filename" value="eclipse-jee-ganymede-SR2-linux-gtk.tar.gz">
+ <and>
+ <contains string="${os.name}" casesensitive="false" substring="linux"/>
+ <not>
+ <contains string="${os.arch}" casesensitive="false" substring="64" />
+ </not>
+ </and>
+ </condition>
+ <condition property="eclipse.filename" value="eclipse-jee-ganymede-SR2-linux-gtk-x86_64.tar.gz">
+ <and>
+ <contains string="${os.name}" casesensitive="false" substring="linux"/>
+ <contains string="${os.arch}" casesensitive="false" substring="64" />
+ </and>
+ </condition>
+
<property name="eclipse.distro.url" value="http://mirror.cc.vt.edu/pub/eclipse/technology/epp/downloads/release/gany..." />
<property name="eclipse.distro.dir" value="${jbpm.home}/downloads" />
<property name="eclipse.parent.dir" value="${jbpm.home}" />
@@ -26,7 +53,21 @@
<target name="install.eclipse"
depends="log.properties, get.eclipse"
description="unzips eclipse, downloads eclipse if it is not available in ${eclipse.distro.dir}">
- <unzip src="${eclipse.distro.path}" dest="${jbpm.home}" />
+ <unzip dest="${jbpm.home}" overwrite="true">
+ <fileset dir="${eclipse.distro.dir}">
+ <filename name="*eclipse*.zip" casesensitive="false" />
+ </fileset>
+ </unzip>
+ <gunzip>
+ <fileset dir="${eclipse.distro.dir}">
+ <filename name="**eclipse*.tar.gz" casesensitive="false" />
+ </fileset>
+ </gunzip>
+ <untar dest="${jbpm.home}" overwrite="true">
+ <fileset dir="${eclipse.distro.dir}">
+ <filename name="**eclipse*.tar" casesensitive="false" />
+ </fileset>
+ </untar>
</target>
<!-- ### GET ECLIPSE ##################################################### -->
@@ -43,9 +84,19 @@
<!-- ### START ECLIPSE ################################################## -->
<target name="start.eclipse"
description="starts eclipse">
+ <!-- Windows -->
<exec executable="cmd" os="Windows Vista, Windows XP,Windows 2000,Windows 98">
<arg line="/C start "${jbpm.home}/eclipse/eclipse.exe" "-data" "${jbpm.home}/workspace"" />
</exec>
+ <!-- Unix -->
+ <chmod perm="+x">
+ <fileset dir="${jbpm.home}/eclipse">
+ <filename name="eclipse"/>
+ </fileset>
+ </chmod>
+ <exec executable="/bin/bash" os="Linux,Mac OS X">
+ <arg line="-c "${jbpm.home}/eclipse/eclipse" "-data" "${jbpm.home}/workspace"" />
+ </exec>
</target>
</project>
Modified: jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch02-Installation.xml
===================================================================
--- jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch02-Installation.xml 2009-06-22 14:23:38 UTC (rev 5077)
+++ jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch02-Installation.xml 2009-06-22 14:24:15 UTC (rev 5078)
@@ -39,7 +39,8 @@
</para>
<para>If you have previously downloaded jboss-5.0.0.GA.zip, create a downloads directory
in your jBPM home directory and place the zip file in there. Otherwise the script will download
- it for you. the same is true for eclipse-jee-ganymede-SR2-win32.zip
+ it for you. The same is true for eclipse-jee-ganymede-SR2-win32.zip
+ (or eclipse-jee-ganymede-SR2-linux-gtk(-x86_64).tar.gz on Linux and eclipse-jee-ganymede-SR2-macosx-carbon.tar.gz on Mac OSX)
</para>
<para>Open a command prompt and go do directory <literal>${jbpm.home}/jboss</literal>. Then
run
16 years, 10 months
JBoss JBPM SVN: r5077 - in jbpm4/trunk/modules: test-db/src/test/java/org/jbpm/test/activities and 1 other directory.
by do-not-reply@jboss.org
Author: jbarrez
Date: 2009-06-22 10:23:38 -0400 (Mon, 22 Jun 2009)
New Revision: 5077
Modified:
jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activities/ForkJoinInSameTransactionTest.java
Log:
Added convience method: assertProcessInstanceEnded
Modified: jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java
===================================================================
--- jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java 2009-06-22 13:50:05 UTC (rev 5076)
+++ jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java 2009-06-22 14:23:38 UTC (rev 5077)
@@ -23,14 +23,17 @@
import java.util.ArrayList;
import java.util.List;
+import java.util.Set;
import org.jbpm.api.Configuration;
+import org.jbpm.api.Execution;
import org.jbpm.api.ExecutionService;
import org.jbpm.api.HistoryService;
import org.jbpm.api.IdentityService;
import org.jbpm.api.JbpmException;
import org.jbpm.api.ManagementService;
import org.jbpm.api.ProcessEngine;
+import org.jbpm.api.ProcessInstance;
import org.jbpm.api.RepositoryService;
import org.jbpm.api.TaskService;
import org.jbpm.api.cmd.CommandService;
@@ -183,9 +186,29 @@
// execution helper methods //////////////////////////////////////////
- public void assertProcessInstanceEnded(String processInstanceId) {
+ public void assertExecutionEnded(String processInstanceId) {
assertNull("Error: a process instance with id " + processInstanceId + " was found",
executionService.findProcessInstanceById(processInstanceId));
}
+ public void assertProcessInstanceEnded(ProcessInstance processInstance) {
+ assertExecutionEnded(processInstance.getId());
+ }
+
+ public void assertIsActiveActivity(String activityName, Execution execution) {
+ assertTrue("The given execution (or any child execution) isn't in the activity '" + activityName
+ + "' (current activities : " + listAllActiveActivites(execution) + ")",
+ execution.isActive(activityName));
+ }
+
+ private String listAllActiveActivites(Execution execution) {
+ Set<String> activeActivities = execution.findActiveActivityNames();
+ StringBuilder result = new StringBuilder();
+ for (String activeActivity : activeActivities) {
+ result.append(activeActivity + ", ");
+ }
+ result.setLength(result.length() - 2); // remove the last ', '
+ return result.toString();
+ }
+
}
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activities/ForkJoinInSameTransactionTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activities/ForkJoinInSameTransactionTest.java 2009-06-22 13:50:05 UTC (rev 5076)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activities/ForkJoinInSameTransactionTest.java 2009-06-22 14:23:38 UTC (rev 5077)
@@ -59,7 +59,7 @@
);
ProcessInstance processInstance = executionService.startProcessInstanceByKey("ForkJoinInOneTransaction");
- assertProcessInstanceEnded(processInstance.getId());
+ assertProcessInstanceEnded(processInstance);
}
/**
@@ -87,7 +87,7 @@
ProcessInstance processInstance = executionService.startProcessInstanceByKey("ForkJoinInOneTransaction");
executionService.signalExecutionById(processInstance.getId(), "go on");
- assertProcessInstanceEnded(processInstance.getId());
+ assertProcessInstanceEnded(processInstance);
}
/**
@@ -118,7 +118,7 @@
ProcessInstance processInstance = executionService.startProcessInstanceByKey("ForkJoinInOneTransaction");
- assertProcessInstanceEnded(processInstance.getId());
+ assertProcessInstanceEnded(processInstance);
}
/**
@@ -159,7 +159,7 @@
Map<String, Object> vars = new HashMap<String, Object>();
vars.put("testVar", new Integer(0));
ProcessInstance processInstance = executionService.startProcessInstanceByKey("ForkJoinInOneTransaction", vars);
- assertProcessInstanceEnded(processInstance.getId());
+ assertProcessInstanceEnded(processInstance);
}
}
16 years, 10 months