AnsweredAssumed Answered

Injecting class in (JAVA) serviceTask manually for testing

Question asked by sruiz on Dec 15, 2010
Latest reply on Dec 17, 2010 by frederikheremans1
Is it possible to inject manually in the service task the class for testing purposes?

As I read, the JavaDelegate object is injected in the process definition first time the process is instanced.

The problem is that I would like to inject a RuntimeService component (the runtimeService from the ActivitiRule test) before.

I've found a topic related:(http://forums.activiti.org/en/viewtopic.php?f=3&t=249&hilit=runtimeservice+servicetask).

I tried in the test to use:
ProcessEngineImpl engine = (ProcessEngineImpl) ProcessEngines.getDefaultProcessEngine();
for accesing to the current runtimeService of the test but it creates a new engine. I think that it is due to the fact that I'm using an in-memory database so it creates a new database in other memory location.

So I understand that the only way is using Spring Injection (http://forums.activiti.org/en/viewtopic.php?f=3&t=249&hilit=runtimeservice+servicetask).

Is there other way of testing a process without the use of Spring ?
The idea in the test should be:
1. Deploy process.
2. Inject all java beans in the several JAVA service tasks of the process. Initialize within the test these beans.
3. Run the test.

Outcomes