[jboss-user] [jBPM] New message: "Test workflow with JUnit"

tamisier laure do-not-reply at jboss.com
Wed Feb 24 05:46:24 EST 2010


User development,

A new message was posted in the thread "Test workflow with JUnit":

http://community.jboss.org/message/528146#528146

Author  : tamisier laure
Profile : http://community.jboss.org/people/lauretamisier

Message:
--------------------------------------------------------------
Hy,
 
I try to write Junit test in order to test a workflow jBpm.
 
I have the following file, but when i run the test, i have an error when it reads the cfg file
---the process

<process name="test" xmlns="http://jbpm.org/4.3/jpdl">
   <start name="start" g="98,157,48,48">
      <transition name="to ok" to="ok" g="-29,-18"/>
   </start>
   <state name="ok" g="210,178,92,52">
      <transition name="to end" to="end" g="-9,-19"/>
   </state>
   <end name="end" g="366,210,48,48"/>
</process>
 
-----------The Test class

import org.jbpm.graph.def.ProcessDefinition;
import org.jbpm.graph.exe.ProcessInstance;
 
import junit.framework.TestCase;
public class StateTest extends TestCase {
 
    public void testMainScenario() {
 

        // parse the process definition
        ProcessDefinition testProcess = ProcessDefinition.
                parseXmlResource("fr/ucanss/workflow/test.jpdl.xml");
 
        // create a new process instance for the given process definition
        ProcessInstance processInstance = new ProcessInstance(testProcess);
 
        assertNotNull("definition should be not null", testProcess);
        
        assertNotNull("instance should be not null", processInstance);
        
        assertNotNull("root token should be not null", processInstance.getRootToken());
        
        assertNotNull("start node should be not null", processInstance.getRootToken()
                .getNode());   
 
    }
}
 
------ I have a file jbpm.cfg.xml
 
<jbpm-configuration>
 
  <import resource="jbpm.default.cfg.xml" />
  <import resource="jbpm.businesscalendar.cfg.xml" />
  <import resource="jbpm.tx.hibernate.cfg.xml" />
  <import resource="jbpm.jpdl.cfg.xml" />
  <import resource="jbpm.bpmn.cfg.xml" />
  <import resource="jbpm.identity.cfg.xml" />
 
</jbpm-configuration>
 
 
---- my error
 
org.jbpm.JbpmException: couldn't parse jbpm configuration from resource 'jbpm.cfg.xml'
    at org.jbpm.JbpmConfiguration.getInstance(JbpmConfiguration.java:320)
    at org.jbpm.JbpmConfiguration.getInstance(JbpmConfiguration.java:272)
    at org.jbpm.JbpmConfiguration$Configs.getObjectFactory(JbpmConfiguration.java:488)
    at org.jbpm.JbpmConfiguration$Configs.hasObject(JbpmConfiguration.java:500)
    at org.jbpm.util.ClassLoaderUtil.getClassLoader(ClassLoaderUtil.java:65)
    at org.jbpm.graph.def.ProcessDefinition.parseXmlResource(ProcessDefinition.java:160)
    at fr.ucanss.test.StateTest.testMainScenario(StateTest.java:21)
    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:168)
    at junit.framework.TestCase.runBare(TestCase.java:134)
    at junit.framework.TestResult$1.protect(TestResult.java:110)
    at junit.framework.TestResult.runProtected(TestResult.java:128)
    at junit.framework.TestResult.run(TestResult.java:113)
    at junit.framework.TestCase.run(TestCase.java:124)
    at junit.framework.TestSuite.runTest(TestSuite.java:232)
    at junit.framework.TestSuite.run(TestSuite.java:227)
    at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:79)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: org.jbpm.JbpmException: no ObjectInfo class specified for element 'import'
    at org.jbpm.configuration.ObjectFactoryParser.parse(ObjectFactoryParser.java:139)
    at org.jbpm.configuration.ObjectFactoryParser.parseElements(ObjectFactoryParser.java:117)
    at org.jbpm.configuration.ObjectFactoryParser.parseElementsStream(ObjectFactoryParser.java:110)
    at org.jbpm.JbpmConfiguration.parseObjectFactory(JbpmConfiguration.java:355)
    at org.jbpm.JbpmConfiguration.getInstance(JbpmConfiguration.java:314)
    ... 25 more
 
Thanks to help me
 
Laure

--------------------------------------------------------------

To reply to this message visit the message page: http://community.jboss.org/message/528146#528146




More information about the jboss-user mailing list