i have used the framework as "spring in the air"
when i run testcase as follow, there was the "session is closed".
how can i resolve it?


  | import java.util.Iterator;
  | import java.util.List;
  | 
  | import org.jbpm.JbpmConfiguration;
  | import org.jbpm.JbpmContext;
  | import org.jbpm.graph.def.ProcessDefinition;
  | 
  | import com.macrowise.common.spring.SpringTestCase;
  | 
  | public class ProcessManagerTest extends SpringTestCase {
  |     
  |     private ProcessManager processManager;
  |     
  |     private JbpmConfiguration jbpmConfiguration;
  | 
  |     public static void main(String[] args) {
  |             junit.textui.TestRunner.run(ProcessManagerTest.class);
  |             System.exit(0);
  |     }
  |     
  |     protected void setUp() {
  |             try {
  |                     super.setUp();
  | 
  |                     springSetup(new String[] { 
"beans/applicationContext.xml",
  |                                     "beans/persist.xml", "beans/jbpm.xml", 
"beans/jbpm/ProcessManager.xml" });
  | 
  |                     processManager = (ProcessManager) 
getBean("processManager");
  |                     
  |                     jbpmConfiguration = (JbpmConfiguration) 
getBean("jbpmConfiguration");
  | 
  |                     beginTransaction();
  | 
  |             } catch (Exception e) {
  |                     e.printStackTrace();
  |             }
  |     }
  |     
  |     protected void tearDown() {
  |             try {
  |                     super.tearDown();
  |                     rollback();
  |             } catch (Exception e) {
  |                     e.printStackTrace();
  |             }
  |     }
  |     
  |     public void testDeploy() {
  |             JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
  | 
  |             ProcessDefinition processDefinition = ProcessDefinition
  |                             .parseXmlString("<process-definition 
name='hello world'>"
  |                                             + "  <start-state name='start'>"
  |                                             + "    <transition to='s' />" + 
"  </start-state>"
  |                                             + "  <state name='s'>" + "    
<transition to='end' />"
  |                                             + "  </state>" + "  <end-state 
name='end' />"
  |                                             + "</process-definition>");
  | 
  |             jbpmContext.deployProcessDefinition(processDefinition);
  |     }
  | 
  |     public void testFindAllProcess() {
  |             List allProcessList = processManager.findAllProcess();
  |             assertNotNull(allProcessList);
  |     }
  |     
  |     public void testGetProcess() {;
  |             List allProcessList = processManager.findAllProcess();
  |             
  |             for (Iterator iter = allProcessList.iterator(); 
iter.hasNext();) {
  |                     ProcessDefinition element = (ProcessDefinition) 
iter.next();
  |                     ProcessDefinition testProcess = 
processManager.getProcess(element.getId());
  |                     assertEquals(testProcess, element);
  |             }       
  |     }
  | }
  | 
  | 


  | org.jbpm.JbpmException: couldn't find all process definitions
  |     at 
org.jbpm.db.GraphSession.findAllProcessDefinitions(GraphSession.java:214)
  |     at 
com.macrowise.common.bpm.jbpm.manager.ProcessManagerImpl.findAllProcess(ProcessManagerImpl.java:15)
  |     at 
com.macrowise.common.bpm.jbpm.manager.ProcessManagerTest.testFindAllProcess(ProcessManagerTest.java:65)
  |     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  |     at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
  |     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
  |     at java.lang.reflect.Method.invoke(Unknown Source)
  |     at junit.framework.TestCase.runTest(TestCase.java:164)
  |     at junit.framework.TestCase.runBare(TestCase.java:130)
  |     at junit.framework.TestResult$1.protect(TestResult.java:106)
  |     at junit.framework.TestResult.runProtected(TestResult.java:124)
  |     at junit.framework.TestResult.run(TestResult.java:109)
  |     at junit.framework.TestCase.run(TestCase.java:120)
  |     at junit.framework.TestSuite.runTest(TestSuite.java:230)
  |     at junit.framework.TestSuite.run(TestSuite.java:225)
  |     at 
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
  |     at 
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
  |     at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
  |     at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
  |     at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
  |     at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
  | Caused by: org.hibernate.SessionException: Session is closed!
  |     at 
org.hibernate.impl.AbstractSessionImpl.errorIfClosed(AbstractSessionImpl.java:49)
  |     at org.hibernate.impl.SessionImpl.getNamedQuery(SessionImpl.java:1222)
  |     at 
org.jbpm.db.GraphSession.findAllProcessDefinitions(GraphSession.java:209)
  |     ... 20 more
  | 
  | 
  | 

the testDeploy() can run successfully. But  the testFindAllProcess() and 
testGetProcess() will be failed(session is closed)

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3960926#3960926

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3960926
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to