[jbpm-commits] JBoss JBPM SVN: r3699 - jbpm3/trunk/modules/core/src/test/java/org/jbpm/context/exe.

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Jan 21 14:21:34 EST 2009


Author: alex.guizar at jboss.com
Date: 2009-01-21 14:21:34 -0500 (Wed, 21 Jan 2009)
New Revision: 3699

Modified:
   jbpm3/trunk/modules/core/src/test/java/org/jbpm/context/exe/CustomVariableLongIdDbTest.java
   jbpm3/trunk/modules/core/src/test/java/org/jbpm/context/exe/CustomVariableStringIdDbTest.java
Log:
clean up custom objects saved in variables

Modified: jbpm3/trunk/modules/core/src/test/java/org/jbpm/context/exe/CustomVariableLongIdDbTest.java
===================================================================
--- jbpm3/trunk/modules/core/src/test/java/org/jbpm/context/exe/CustomVariableLongIdDbTest.java	2009-01-21 19:18:15 UTC (rev 3698)
+++ jbpm3/trunk/modules/core/src/test/java/org/jbpm/context/exe/CustomVariableLongIdDbTest.java	2009-01-21 19:21:34 UTC (rev 3699)
@@ -58,28 +58,26 @@
     ProcessDefinition processDefinition = new ProcessDefinition();
     processDefinition.addDefinition(new ContextDefinition());
     graphSession.saveProcessDefinition(processDefinition);
+    CustomLongClass customLongObject = null;
     try {
       // create the process instance
       ProcessInstance processInstance = new ProcessInstance(processDefinition);
-      // set the jbpmSession in the context because its used to determine the
-      // jbpm-type for the custom object.
       ContextInstance contextInstance = processInstance.getContextInstance();
-
       // create the custom object
-      CustomLongClass customLongObject = new CustomLongClass("customname");
+      customLongObject = new CustomLongClass("customname");
       contextInstance.setVariable("custom hibernate object", customLongObject);
 
       processInstance = saveAndReload(processInstance);
       contextInstance = processInstance.getContextInstance();
 
-      // get the custom hibernatable object from the variableInstances
+      // get the custom hibernatable object from the variables
       customLongObject = (CustomLongClass) contextInstance.getVariable("custom hibernate object");
       assertNotNull(customLongObject);
       assertEquals("customname", customLongObject.getName());
     }
     finally {
       jbpmContext.getGraphSession().deleteProcessDefinition(processDefinition.getId());
+      if (customLongObject != null) session.delete(customLongObject);
     }
-
   }
 }

Modified: jbpm3/trunk/modules/core/src/test/java/org/jbpm/context/exe/CustomVariableStringIdDbTest.java
===================================================================
--- jbpm3/trunk/modules/core/src/test/java/org/jbpm/context/exe/CustomVariableStringIdDbTest.java	2009-01-21 19:18:15 UTC (rev 3698)
+++ jbpm3/trunk/modules/core/src/test/java/org/jbpm/context/exe/CustomVariableStringIdDbTest.java	2009-01-21 19:21:34 UTC (rev 3699)
@@ -58,27 +58,26 @@
     ProcessDefinition processDefinition = new ProcessDefinition();
     processDefinition.addDefinition(new ContextDefinition());
     graphSession.saveProcessDefinition(processDefinition);
+    CustomStringClass customStringObject = null;
     try {
       // create the process instance
       ProcessInstance processInstance = new ProcessInstance(processDefinition);
-      // set the jbpmSession in the context because its used to determine the
-      // jbpm-type for the custom object.
       ContextInstance contextInstance = processInstance.getContextInstance();
-
       // create the custom object
-      CustomStringClass customStringObject = new CustomStringClass("customname");
+      customStringObject = new CustomStringClass("customname");
       contextInstance.setVariable("custom hibernate object", customStringObject);
 
       processInstance = saveAndReload(processInstance);
       contextInstance = processInstance.getContextInstance();
 
-      // get the custom hibernatable object from the variableInstances
+      // get the custom hibernatable object from the variables
       customStringObject = (CustomStringClass) contextInstance.getVariable("custom hibernate object");
       assertNotNull(customStringObject);
       assertEquals("customname", customStringObject.getName());
     }
     finally {
       jbpmContext.getGraphSession().deleteProcessDefinition(processDefinition.getId());
+      if (customStringObject != null) session.delete(customStringObject);
     }
   }
 }




More information about the jbpm-commits mailing list