[jbpm-commits] JBoss JBPM SVN: r2602 - in jbpm3/trunk: modules/distribution/src/main/resources/database and 2 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Fri Oct 24 03:31:58 EDT 2008


Author: alex.guizar at jboss.com
Date: 2008-10-24 03:31:58 -0400 (Fri, 24 Oct 2008)
New Revision: 2602

Modified:
   jbpm3/trunk/modules/distribution/src/main/resources/database/jbpm-postgresql-ds.xml
   jbpm3/trunk/modules/enterprise/jar/pom.xml
   jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/scheduler/ejbtimer/EjbSchedulerTest.java
   jbpm3/trunk/pom.xml
Log:
[JBPM-1708] support for test exclusion with property datasource.xa
configured and tested postgresql xa datasource

Modified: jbpm3/trunk/modules/distribution/src/main/resources/database/jbpm-postgresql-ds.xml
===================================================================
--- jbpm3/trunk/modules/distribution/src/main/resources/database/jbpm-postgresql-ds.xml	2008-10-23 13:57:46 UTC (rev 2601)
+++ jbpm3/trunk/modules/distribution/src/main/resources/database/jbpm-postgresql-ds.xml	2008-10-24 07:31:58 UTC (rev 2602)
@@ -2,28 +2,22 @@
 
 <datasources>
 
-   <local-tx-datasource>
-      <jndi-name>JbpmDS</jndi-name>
-      <connection-url>jdbc:hsqldb:${jboss.server.data.dir}${/}hypersonic${/}jbpmDB</connection-url>
-      <driver-class>org.hsqldb.jdbcDriver</driver-class>
-      <user-name>sa</user-name>
-      <password></password>
-      <min-pool-size>1</min-pool-size>
-      <max-pool-size>5</max-pool-size>
-      <idle-timeout-minutes>0</idle-timeout-minutes>
-      <track-statements/>
-      <!-- 
-      <security-domain>HsqlDbRealm</security-domain>
-      -->
-      <prepared-statement-cache-size>32</prepared-statement-cache-size>
-      <metadata><type-mapping>Hypersonic SQL</type-mapping></metadata>
-      <depends>jboss:service=Hypersonic,database=jbpmDB</depends>
-   </local-tx-datasource>
+   <xa-datasource>
+     <jndi-name>JbpmDS</jndi-name>
+     <track-connection-by-tx />
 
-   <mbean code="org.jboss.jdbc.HypersonicDatabase" 
-     name="jboss:service=Hypersonic,database=jbpmDB">
-     <attribute name="Database">jbpmDB</attribute>
-     <attribute name="InProcessMode">true</attribute>
-   </mbean>
+     <xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
+     <xa-datasource-property name="ServerName">localhost</xa-datasource-property>
+     <xa-datasource-property name="PortNumber">5432</xa-datasource-property>
 
+     <xa-datasource-property name="DatabaseName">jbpmtest</xa-datasource-property>
+     <xa-datasource-property name="User">jbpmtest</xa-datasource-property>
+     <xa-datasource-property name="Password"></xa-datasource-property>
+
+     <!-- corresponding type-mapping in conf/standardjbosscmp-jdbc.xml -->
+     <metadata>
+       <type-mapping>PostgreSQL 8.0</type-mapping>
+     </metadata>
+   </xa-datasource>
+
 </datasources>

Modified: jbpm3/trunk/modules/enterprise/jar/pom.xml
===================================================================
--- jbpm3/trunk/modules/enterprise/jar/pom.xml	2008-10-23 13:57:46 UTC (rev 2601)
+++ jbpm3/trunk/modules/enterprise/jar/pom.xml	2008-10-24 07:31:58 UTC (rev 2602)
@@ -180,9 +180,9 @@
           <!-- Please only remove excludes, when the tests are working -->
           <excludes>
             <!-- https://jira.jboss.org/jira/browse/JBPM-1708 -->
-            <exclude>org/jbpm/scheduler/ejbtimer/EjbSchedulerTest.java</exclude>
+            <!-- exclude>org/jbpm/scheduler/ejbtimer/EjbSchedulerTest.java</exclude -->
             <!-- https://jira.jboss.org/jira/browse/JBPM-1709 -->
-            <exclude>org/jbpm/msg/jms/JmsMessageTest.java</exclude>
+            <!-- exclude>org/jbpm/msg/jms/JmsMessageTest.java</exclude -->
           </excludes>
         </configuration>
       </plugin>
@@ -234,6 +234,10 @@
                   <name>log4j.output.dir</name>
                   <value>${basedir}/target</value>
                 </property>
+                <property>
+                  <name>datasource.xa</name>
+                  <value>${datasource.xa}</value>
+                </property>
               </systemProperties>
             </configuration>
           </plugin>

Modified: jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/scheduler/ejbtimer/EjbSchedulerTest.java
===================================================================
--- jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/scheduler/ejbtimer/EjbSchedulerTest.java	2008-10-23 13:57:46 UTC (rev 2601)
+++ jbpm3/trunk/modules/enterprise/jar/src/test/java/org/jbpm/scheduler/ejbtimer/EjbSchedulerTest.java	2008-10-24 07:31:58 UTC (rev 2602)
@@ -21,12 +21,14 @@
  */
 package org.jbpm.scheduler.ejbtimer;
 
+import java.rmi.RemoteException;
 import java.util.Collections;
 
 import javax.naming.Context;
 import javax.naming.InitialContext;
 
 import junit.framework.Test;
+import junit.framework.TestSuite;
 
 import org.apache.cactus.ServletTestCase;
 import org.apache.commons.logging.Log;
@@ -49,8 +51,7 @@
  * 
  * @author Alejandro Guizar
  */
-public class EjbSchedulerTest extends ServletTestCase
-{
+public class EjbSchedulerTest extends ServletTestCase {
 
   private LocalCommandService commandService;
 
@@ -58,22 +59,19 @@
 
   private static final Log log = LogFactory.getLog(EjbSchedulerTest.class);
 
-  public static Test suite() throws Exception
-  {
-    return new IntegrationTestSetup(EjbSchedulerTest.class, "enterprise-test.war");
+  public static Test suite() throws Exception {
+    return Boolean.getBoolean("datasource.xa") ?
+        new IntegrationTestSetup(EjbSchedulerTest.class, "enterprise-test.war") :
+        new TestSuite();
   }
 
-  protected void setUp() throws Exception
-  {
-    if (commandServiceHome == null)
-    {
+  protected void setUp() throws Exception {
+    if (commandServiceHome == null) {
       Context initialContext = new InitialContext();
-      try
-      {
-        commandServiceHome = (LocalCommandServiceHome)initialContext.lookup("java:comp/env/ejb/CommandServiceBean");
+      try {
+        commandServiceHome = (LocalCommandServiceHome) initialContext.lookup("java:comp/env/ejb/CommandServiceBean");
       }
-      finally
-      {
+      finally {
         initialContext.close();
       }
     }
@@ -81,42 +79,65 @@
     log.info("### " + getName() + " started ###");
   }
 
-  protected void tearDown() throws Exception
-  {
+  protected void tearDown() throws Exception {
     log.info("### " + getName() + " done ###");
     commandService = null;
   }
 
-  public void testScheduleFuture() throws Exception
-  {
-    deployProcess("<process-definition name='future'>" + "  <event type='process-end'>" + "    <action expression='#{eventCallback.processEnd}'/>" + "  </event>"
-        + "  <start-state name='start'>" + "    <transition to='a' />" + "  </start-state>" + "  <state name='a'>"
-        + "    <timer duedate='1 second' transition='timeout' />" + "    <transition name='timeout' to='end' />" + "  </state>" + "  <end-state name='end' />"
+  public void testScheduleFuture() throws Exception {
+    deployProcess("<process-definition name='future'>"
+        + "  <event type='process-end'>"
+        + "    <action expression='#{eventCallback.processEnd}'/>"
+        + "  </event>"
+        + "  <start-state name='start'>"
+        + "    <transition to='a' />"
+        + "  </start-state>"
+        + "  <state name='a'>"
+        + "    <timer duedate='1 second' transition='timeout' />"
+        + "    <transition name='timeout' to='end' />"
+        + "  </state>"
+        + "  <end-state name='end' />"
         + "</process-definition>");
     long processId = launchProcess("future").getId();
     EventCallback.waitForEvent(Event.EVENTTYPE_PROCESS_END);
     assertTrue(isProcessFinished(processId));
   }
 
-  public void testSchedulePast() throws Exception
-  {
-    deployProcess("<process-definition name='past'>" + "  <event type='process-end'>" + "    <action expression='#{eventCallback.processEnd}'/>" + "  </event>"
-        + "  <start-state name='start'>" + "    <transition to='a' />" + "  </start-state>" + "  <state name='a'>"
-        + "    <timer duedate='-1 second' transition='timeout' />" + "    <transition name='timeout' to='end' />" + "  </state>" + "  <end-state name='end' />"
+  public void testSchedulePast() throws Exception {
+    deployProcess("<process-definition name='past'>"
+        + "  <event type='process-end'>"
+        + "    <action expression='#{eventCallback.processEnd}'/>"
+        + "  </event>"
+        + "  <start-state name='start'>"
+        + "    <transition to='a' />"
+        + "  </start-state>"
+        + "  <state name='a'>"
+        + "    <timer duedate='-1 second' transition='timeout' />"
+        + "    <transition name='timeout' to='end' />"
+        + "  </state>"
+        + "  <end-state name='end' />"
         + "</process-definition>");
     long processId = launchProcess("past").getId();
     EventCallback.waitForEvent(Event.EVENTTYPE_PROCESS_END);
     assertTrue(isProcessFinished(processId));
   }
 
-  public void testScheduleRepeat() throws Exception
-  {
-    deployProcess("<process-definition name='repeat'>" + "  <event type='timer'>" + "    <action expression='#{eventCallback.timer}'/>" + "  </event>"
-        + "  <start-state name='start'>" + "    <transition to='a' />" + "  </start-state>" + "  <state name='a'>"
-        + "    <timer duedate='1 second' repeat='1 second' />" + "    <transition to='end' />" + "  </state>" + "  <end-state name='end' />" + "</process-definition>");
+  public void testScheduleRepeat() throws Exception {
+    deployProcess("<process-definition name='repeat'>"
+        + "  <event type='timer'>"
+        + "    <action expression='#{eventCallback.timer}'/>"
+        + "  </event>"
+        + "  <start-state name='start'>"
+        + "    <transition to='a' />"
+        + "  </start-state>"
+        + "  <state name='a'>"
+        + "    <timer duedate='1 second' repeat='1 second' />"
+        + "    <transition to='end' />"
+        + "  </state>"
+        + "  <end-state name='end' />"
+        + "</process-definition>");
     long processId = launchProcess("repeat").getId();
-    for (int i = 0; i < 3; i++)
-    {
+    for (int i = 0; i < 3; i++) {
       EventCallback.waitForEvent(Event.EVENTTYPE_TIMER);
       assertEquals("a", getProcessState(processId));
     }
@@ -124,11 +145,20 @@
     assertTrue(isProcessFinished(processId));
   }
 
-  public void testCancel() throws Exception
-  {
-    deployProcess("<process-definition name='cancel'>" + "  <event type='timer'>" + "    <action expression='#{eventCallback.timer}'/>" + "  </event>"
-        + "  <start-state name='start'>" + "    <transition to='a' />" + "  </start-state>" + "  <state name='a'>"
-        + "    <timer duedate='1 second' repeat='1 second' />" + "    <transition to='end' />" + "  </state>" + "  <end-state name='end' />" + "</process-definition>");
+  public void testCancel() throws Exception {
+    deployProcess("<process-definition name='cancel'>"
+        + "  <event type='timer'>"
+        + "    <action expression='#{eventCallback.timer}'/>"
+        + "  </event>"
+        + "  <start-state name='start'>"
+        + "    <transition to='a' />"
+        + "  </start-state>"
+        + "  <state name='a'>"
+        + "    <timer duedate='1 second' repeat='1 second' />"
+        + "    <transition to='end' />"
+        + "  </state>"
+        + "  <end-state name='end' />"
+        + "</process-definition>");
     ProcessInstance process = launchProcess("cancel");
     long processId = process.getId();
     // first expiration
@@ -144,20 +174,42 @@
     assertTrue(isProcessFinished(processId));
   }
 
-  public void testScheduleSequence() throws Exception
-  {
-    deployProcess("<process-definition name='sequence'>" + "  <event type='process-end'>" + "    <action expression='#{eventCallback.processEnd}'/>" + "  </event>"
-        + "  <event type='timer'>" + "    <action expression='#{eventCallback.timer}'/>" + "  </event>" + "  <start-state>" + "    <transition to='a' />"
-        + "  </start-state>" + "  <state name='a'>" + "    <timer duedate='500 milliseconds' transition='timeout' />" + "    <transition name='timeout' to='b' />"
-        + "  </state>" + "  <state name='b'>" + "    <timer duedate='500 milliseconds' transition='timeout' />" + "    <transition name='timeout' to='c' />"
-        + "  </state>" + "  <state name='c'>" + "    <timer duedate='500 milliseconds' transition='timeout' />" + "    <transition name='timeout' to='d' />"
-        + "  </state>" + "  <state name='d'>" + "    <timer duedate='500 milliseconds' transition='timeout' />" + "    <transition name='timeout' to='e' />"
-        + "  </state>" + "  <state name='e'>" + "    <timer duedate='500 milliseconds' transition='timeout' />" + "    <transition name='timeout' to='end' />"
-        + "  </state>" + "  <end-state name='end' />" + "</process-definition>");
+  public void testScheduleSequence() throws Exception {
+    deployProcess("<process-definition name='sequence'>"
+        + "  <event type='process-end'>"
+        + "    <action expression='#{eventCallback.processEnd}'/>"
+        + "  </event>"
+        + "  <event type='timer'>"
+        + "    <action expression='#{eventCallback.timer}'/>"
+        + "  </event>"
+        + "  <start-state>"
+        + "    <transition to='a' />"
+        + "  </start-state>"
+        + "  <state name='a'>"
+        + "    <timer duedate='500 milliseconds' transition='timeout' />"
+        + "    <transition name='timeout' to='b' />"
+        + "  </state>"
+        + "  <state name='b'>"
+        + "    <timer duedate='500 milliseconds' transition='timeout' />"
+        + "    <transition name='timeout' to='c' />"
+        + "  </state>"
+        + "  <state name='c'>"
+        + "    <timer duedate='500 milliseconds' transition='timeout' />"
+        + "    <transition name='timeout' to='d' />"
+        + "  </state>"
+        + "  <state name='d'>"
+        + "    <timer duedate='500 milliseconds' transition='timeout' />"
+        + "    <transition name='timeout' to='e' />"
+        + "  </state>"
+        + "  <state name='e'>"
+        + "    <timer duedate='500 milliseconds' transition='timeout' />"
+        + "    <transition name='timeout' to='end' />"
+        + "  </state>"
+        + "  <end-state name='end' />"
+        + "</process-definition>");
     long processId = launchProcess("sequence").getId();
     char state = 'b';
-    for (int i = 0; i < 4; i++)
-    {
+    for (int i = 0; i < 4; i++) {
       EventCallback.waitForEvent(Event.EVENTTYPE_TIMER);
       assertEquals(Character.toString(state++), getProcessState(processId));
     }
@@ -165,84 +217,103 @@
     assertTrue(isProcessFinished(processId));
   }
 
-  public void testScheduleFork() throws InterruptedException
-  {
-    deployProcess("<process-definition name='fork'>" + "  <event type='process-end'>" + "    <action expression='#{eventCallback.processEnd}'/>" + "  </event>"
-        + "  <start-state>" + "    <transition to='f' />" + "  </start-state>" + "  <fork name='f'>" + "    <transition name='a' to='a' />"
-        + "    <transition name='b' to='b' />" + "    <transition name='c' to='c' />" + "    <transition name='d' to='d' />" + "    <transition name='e' to='e' />"
-        + "  </fork>" + "  <state name='a'>" + "    <timer duedate='0.25 seconds' transition='timeout' />" + "    <transition name='timeout' to='j' />" + "  </state>"
-        + "  <state name='b'>" + "    <timer duedate='0.5 seconds' transition='timeout' />" + "    <transition name='timeout' to='j' />" + "  </state>"
-        + "  <state name='c'>" + "    <timer duedate='0.75 seconds' transition='timeout' />" + "    <transition name='timeout' to='j' />" + "  </state>"
-        + "  <state name='d'>" + "    <timer duedate='1 second' transition='timeout' />" + "    <transition name='timeout' to='j' />" + "  </state>"
-        + "  <state name='e'>" + "    <timer duedate='1.25 second' transition='timeout' />" + "    <transition name='timeout' to='j' />" + "  </state>"
-        + "  <join name='j'>" + "    <transition to='end' />" + "  </join>" + "  <end-state name='end' />" + "</process-definition>");
+  public void testScheduleFork() throws Exception {
+    deployProcess("<process-definition name='fork'>"
+        + "  <event type='process-end'>"
+        + "    <action expression='#{eventCallback.processEnd}'/>"
+        + "  </event>"
+        + "  <start-state>"
+        + "    <transition to='f' />"
+        + "  </start-state>"
+        + "  <fork name='f'>"
+        + "    <transition name='a' to='a' />"
+        + "    <transition name='b' to='b' />"
+        + "    <transition name='c' to='c' />"
+        + "    <transition name='d' to='d' />"
+        + "    <transition name='e' to='e' />"
+        + "  </fork>"
+        + "  <state name='a'>"
+        + "    <timer duedate='0.25 seconds' transition='timeout' />"
+        + "    <transition name='timeout' to='j' />"
+        + "  </state>"
+        + "  <state name='b'>"
+        + "    <timer duedate='0.5 seconds' transition='timeout' />"
+        + "    <transition name='timeout' to='j' />"
+        + "  </state>"
+        + "  <state name='c'>"
+        + "    <timer duedate='0.75 seconds' transition='timeout' />"
+        + "    <transition name='timeout' to='j' />"
+        + "  </state>"
+        + "  <state name='d'>"
+        + "    <timer duedate='1 second' transition='timeout' />"
+        + "    <transition name='timeout' to='j' />"
+        + "  </state>"
+        + "  <state name='e'>"
+        + "    <timer duedate='1.25 second' transition='timeout' />"
+        + "    <transition name='timeout' to='j' />"
+        + "  </state>"
+        + "  <join name='j'>"
+        + "    <transition to='end' />"
+        + "  </join>"
+        + "  <end-state name='end' />"
+        + "</process-definition>");
     long processId = launchProcess("fork").getId();
     EventCallback.waitForEvent(Event.EVENTTYPE_PROCESS_END);
     assertTrue(isProcessFinished(processId));
   }
 
-  private ProcessDefinition deployProcess(String xml)
-  {
-    return (ProcessDefinition)commandService.execute(new DeployProcessCommand(xml));
+  private ProcessDefinition deployProcess(String xml) throws RemoteException {
+    return (ProcessDefinition) commandService.execute(new DeployProcessCommand(xml));
   }
 
-  private ProcessInstance launchProcess(String processName)
-  {
+  private ProcessInstance launchProcess(String processName) throws RemoteException {
     StartProcessInstanceCommand command = new StartProcessInstanceCommand();
     command.setProcessName(processName);
     command.setVariables(Collections.singletonMap("eventCallback", new EventCallback()));
-    return (ProcessInstance)commandService.execute(command);
+    return (ProcessInstance) commandService.execute(command);
   }
 
-  private void signalProcess(final long processId)
-  {
-    commandService.execute(new Command()
-    {
+  private void signalProcess(final long processId) throws RemoteException {
+    commandService.execute(new Command() {
+
       private static final long serialVersionUID = 1L;
 
-      public Object execute(JbpmContext jbpmContext) throws Exception
-      {
+      public Object execute(JbpmContext jbpmContext) throws Exception {
         jbpmContext.loadProcessInstanceForUpdate(processId).signal();
         return null;
       }
     });
   }
 
-  private String getProcessState(final long processId)
-  {
-    return (String)commandService.execute(new Command()
-    {
+  private String getProcessState(final long processId) throws RemoteException {
+    return (String) commandService.execute(new Command() {
+
       private static final long serialVersionUID = 1L;
 
-      public Object execute(JbpmContext jbpmContext) throws Exception
-      {
+      public Object execute(JbpmContext jbpmContext) throws Exception {
         return jbpmContext.loadProcessInstance(processId).getRootToken().getNode().getName();
       }
     });
   }
 
-  private boolean isProcessFinished(final long processId)
-  {
-    Boolean isFinished = (Boolean)commandService.execute(new Command()
-    {
+  private boolean isProcessFinished(final long processId) throws RemoteException {
+    Boolean isFinished = (Boolean) commandService.execute(new Command() {
+
       private static final long serialVersionUID = 1L;
 
-      public Object execute(JbpmContext jbpmContext) throws Exception
-      {
+      public Object execute(JbpmContext jbpmContext) throws Exception {
         return jbpmContext.loadProcessInstance(processId).hasEnded();
       }
     });
     return isFinished.booleanValue();
   }
 
-  private void cancelTimer(final String timerName, final long tokenId)
-  {
-    commandService.execute(new Command()
-    {
+  private void cancelTimer(final String timerName, final long tokenId) throws RemoteException {
+    commandService.execute(new Command() {
+
       private static final long serialVersionUID = 1L;
 
-      public Object execute(JbpmContext jbpmContext) throws Exception
-      {
+      public Object execute(JbpmContext jbpmContext) throws Exception {
         Token token = jbpmContext.loadToken(tokenId);
         jbpmContext.getServices().getSchedulerService().deleteTimersByName(timerName, token);
         return null;

Modified: jbpm3/trunk/pom.xml
===================================================================
--- jbpm3/trunk/pom.xml	2008-10-23 13:57:46 UTC (rev 2601)
+++ jbpm3/trunk/pom.xml	2008-10-24 07:31:58 UTC (rev 2602)
@@ -519,6 +519,9 @@
           <value>postgresql</value>
         </property>
       </activation>
+      <properties>
+        <datasource.xa>true</datasource.xa>
+      </properties>
       <dependencies>
         <dependency>
           <groupId>postgresql</groupId>
@@ -541,6 +544,9 @@
           <value>sybase</value>
         </property>
       </activation>
+      <properties>
+        <datasource.xa>true</datasource.xa>
+      </properties>
       <dependencies>
         <dependency>
           <groupId>com.sybase</groupId>




More information about the jbpm-commits mailing list