Michael Wohlfart [http://community.jboss.org/people/mwohlf] created the discussion
"Re: Obtain a handle to ExecutionImpl from unit tests" To view the discussion, visit: http://community.jboss.org/message/562580#562580 -------------------------------------------------------------- alright Al, I think what you want to do is this: import org.jbpm.api.Configuration; import org.jbpm.api.ProcessEngine; import org.jbpm.api.RepositoryService; import org.jbpm.api.task.Task; import org.jbpm.pvm.internal.cmd.CommandService; import org.jbpm.pvm.internal.cmd.GetTaskCmd; import org.jbpm.pvm.internal.env.EnvironmentImpl; import org.jbpm.pvm.internal.processengine.ProcessEngineImpl; public class Start { private static volatile ProcessEngineImpl engine; public static void main(final String[] args) { engine = (ProcessEngineImpl) new Configuration().setResource("jbpm4.jvm.cfg.xml").buildProcessEngine(); System.out.println("instanciated Engine in main: " + engine); new Start().doSomeStuff(); } private void doSomeStuff() { try { EnvironmentImpl environment = engine.openEnvironment(); System.out.println("environment is: " + environment); RepositoryService repositoryService = EnvironmentImpl.getFromCurrent(RepositoryService.class); System.out.println("RepositoryService is : " + repositoryService); long pdCount = repositoryService.createProcessDefinitionQuery().count(); System.out.println("pdcount is: " + pdCount); CommandService commandService = EnvironmentImpl.getFromCurrent(CommandService.class); System.out.println("commandService is : " + commandService); Task task = commandService.execute(new GetTaskCmd("4711")); System.out.println("task 4711 is : " + task); } finally { engine.close(); } } } jbpm4.jvm.cfg.xml example file: <?xml version="1.0" encoding="UTF-8"?> <jbpm-configuration> <process-engine-context> <task-service /> <repository-service /> <command-service /> <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-configuration annotations="enabled"> <properties resource="jbpm4.jvm.hibernate.properties" /> <cfg resource="hibernate3.cfg.xml" /> </hibernate-configuration> <hibernate-session-factory /> </process-engine-context> <transaction-context> <repository-session /> <transaction /> <hibernate-session /> <db-session /> </transaction-context> </jbpm-configuration> -------------------------------------------------------------- Reply to this message by going to Community [http://community.jboss.org/message/562580#562580] Start a new discussion in jBPM at Community [http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
_______________________________________________ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user