[jbpm-commits] JBoss JBPM SVN: r6005 - in jbpm4/trunk/modules: test-cfg/src/test/java/org/jbpm/test/hibernatelongid and 2 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Mon Dec 21 05:03:33 EST 2009


Author: tom.baeyens at jboss.com
Date: 2009-12-21 05:03:33 -0500 (Mon, 21 Dec 2009)
New Revision: 6005

Removed:
   jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/tx/
Modified:
   jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/hibernatelongid/HibernateLongIdTest.java
   jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/hibernatestringid/HibernateStringIdTest.java
   jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/hibernatestringid/jbpm.cfg.xml
Log:
cleanup: removed dead command code from test-base

Modified: jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/hibernatelongid/HibernateLongIdTest.java
===================================================================
--- jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/hibernatelongid/HibernateLongIdTest.java	2009-12-21 09:20:53 UTC (rev 6004)
+++ jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/hibernatelongid/HibernateLongIdTest.java	2009-12-21 10:03:33 UTC (rev 6005)
@@ -26,15 +26,11 @@
 import java.util.Map;
 
 import org.hibernate.Session;
-import org.hibernate.SessionFactory;
 import org.jbpm.api.ProcessInstance;
 import org.jbpm.api.cmd.Command;
 import org.jbpm.api.cmd.Environment;
 import org.jbpm.api.cmd.ParamCommand;
 import org.jbpm.test.JbpmCustomCfgTestCase;
-import org.jbpm.test.tx.TxCommand;
-import org.jbpm.test.tx.TxTemplate;
-import org.jbpm.test.tx.VoidTxCommand;
 
 
 /**

Modified: jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/hibernatestringid/HibernateStringIdTest.java
===================================================================
--- jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/hibernatestringid/HibernateStringIdTest.java	2009-12-21 09:20:53 UTC (rev 6004)
+++ jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/hibernatestringid/HibernateStringIdTest.java	2009-12-21 10:03:33 UTC (rev 6005)
@@ -22,16 +22,13 @@
 package org.jbpm.test.hibernatestringid;
 
 import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
 
 import org.hibernate.Session;
-import org.hibernate.SessionFactory;
 import org.jbpm.api.ProcessInstance;
+import org.jbpm.api.cmd.Command;
+import org.jbpm.api.cmd.Environment;
 import org.jbpm.test.JbpmCustomCfgTestCase;
-import org.jbpm.test.tx.TxCommand;
-import org.jbpm.test.tx.TxTemplate;
-import org.jbpm.test.tx.VoidTxCommand;
 
 
 /**
@@ -39,49 +36,44 @@
  */
 public class HibernateStringIdTest extends JbpmCustomCfgTestCase {
   
-  private TxTemplate txTemplate;
-  
-  protected void setUp() throws Exception {
-    super.setUp();
-    SessionFactory sessionFactory = processEngine.get(SessionFactory.class);
-    this.txTemplate = new TxTemplate(sessionFactory);
-  }
+//  protected void setUp() throws Exception {
+//    super.setUp();
+//  }
+//
+//  protected void deleteRegisteredDeployments() {
+//    processEngine.execute(new Command<Object>() {
+//      public Object execute(Environment environment) {
+//        Session session = environment.get(Session.class);
+//        for (String deploymentId : registeredDeployments) {
+//          repositoryService.deleteDeploymentCascade(deploymentId);
+//        }
+//
+//        List<Order> orders = session.createQuery("from "+Order.class.getName()).list();
+//        for (Order order: orders) {
+//          session.delete(order);
+//        }
+//        return null;
+//      }
+//    });
+//  }
 
-  protected void deleteRegisteredDeployments() {
-    txTemplate.execute(new VoidTxCommand() {
-      public void execute(Session session) {
-        for (String deploymentId : registeredDeployments) {
-          repositoryService.deleteDeploymentCascade(deploymentId);
-        }
-
-        List<Order> orders = session.createQuery("from "+Order.class.getName()).list();
-        for (Order order: orders) {
-          session.delete(order);
-        }
-      }
-    });
-  }
-
   public void testHibernateStringId() {
-    txTemplate.execute(new VoidTxCommand() {
-      public void execute(Session session) {
-        deployJpdlXmlString(
-          "<process name='HibernateStringId'>" +
-          "  <start>" +
-          "    <transition to='a' />" +
-          "  </start>" +
-          "  <state name='a' />" +
-          "</process>"
-        );
-      }
-    });
+    deployJpdlXmlString(
+      "<process name='HibernateStringId'>" +
+      "  <start>" +
+      "    <transition to='a' />" +
+      "  </start>" +
+      "  <state name='a' />" +
+      "</process>"
+    );
 
-    String processInstanceId = (String) txTemplate.execute(new TxCommand() {
-      public Object execute(Session session) {
+    String processInstanceId = (String) processEngine.execute(new Command<String>() {
+      public String execute(Environment environment) {
         Order order = new Order("order1");
         order.setClient("Contador");
         order.setProduct("Shampoo");
   
+        Session session = environment.get(Session.class);
         session.save(order);
         session.flush();
         
@@ -93,15 +85,34 @@
       }
     });
 
-    txTemplate.execute(new VoidTxCommand() {
-      public void execute(Session session) {
-        String processInstanceId = (String) params.get("processInstanceId");
+    String orderId = processEngine.execute(new Command<String>() {
+      String processInstanceId;
+      public String execute(Environment environment) {
         Order order = (Order) executionService.getVariable(processInstanceId, "order");
         assertNotNull(order);
         assertEquals("Contador", order.getClient());
         assertEquals("Shampoo", order.getProduct());
+        return order.getId();
       }
-    }.setParam("processInstanceId", processInstanceId)
+      public Command<String> setProcessInstanceId(String processInstanceId) {
+        this.processInstanceId = processInstanceId;
+        return this;
+      }
+    }.setProcessInstanceId(processInstanceId)
     );
+    
+    processEngine.execute(new Command<Object>() {
+      String orderId;
+      public Object execute(Environment environment) {
+        Session session = environment.get(Session.class);
+        Order order = (Order) session.load(Order.class, orderId);
+        session.delete(order);
+        return null;
+      }
+      public Command<Object> setOrderId(String orderId) {
+        this.orderId = orderId;
+        return this;
+      }
+    }.setOrderId(orderId));
   }
 }

Modified: jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/hibernatestringid/jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/hibernatestringid/jbpm.cfg.xml	2009-12-21 09:20:53 UTC (rev 6004)
+++ jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/hibernatestringid/jbpm.cfg.xml	2009-12-21 10:03:33 UTC (rev 6005)
@@ -3,7 +3,6 @@
 <jbpm-configuration>
 
   <import resource="jbpm.businesscalendar.cfg.xml" />
-  <import resource="jbpm.tx.hibernate.cfg.xml" />
   <import resource="jbpm.jpdl.cfg.xml" />
   <import resource="jbpm.identity.cfg.xml" />
 
@@ -21,6 +20,20 @@
       <cfg resource="org/jbpm/test/hibernatestringid/jbpm.hibernate.cfg.xml" />     
     </hibernate-configuration>
 
+
+    <command-service name="txRequiredCommandService">
+      <skip-interceptor />
+      <retry-interceptor />
+      <environment-interceptor />
+      <standard-transaction-interceptor />
+    </command-service>
+
+    <command-service name="newTxRequiredCommandService">
+      <retry-interceptor />
+      <environment-interceptor policy="requiresNew" />
+      <standard-transaction-interceptor />
+    </command-service>
+
     <hibernate-session-factory />
 
     <object class="org.jbpm.pvm.internal.id.DatabaseDbidGenerator" init="eager">
@@ -64,12 +77,15 @@
   </process-engine-context>
 
   <transaction-context>
+    <transaction />
+    <hibernate-session />
+    
+    <db-session />
     <repository-session />
-    <db-session />
-    
     <message-session />
     <timer-session />
     <history-session />
+    
     <mail-session>
       <mail-server>
         <session-properties resource="jbpm.mail.properties" />



More information about the jbpm-commits mailing list