use of org.jbpm.test.entity.DocumentVariable in project jbpm by kiegroup.
the class ProcessInstanceTest method testJPAStrategy.
@Test
@BZ("1062346")
public void testJPAStrategy() {
RuntimeEnvironment environment = RuntimeEnvironmentBuilder.Factory.get().newDefaultBuilder().entityManagerFactory(getEmf()).addEnvironmentEntry(EnvironmentName.OBJECT_MARSHALLING_STRATEGIES, new ObjectMarshallingStrategy[] { // order does matter
new JPAPlaceholderResolverStrategy(getEmf()), new SerializablePlaceholderResolverStrategy(ClassObjectMarshallingStrategyAcceptor.DEFAULT) }).addAsset(ResourceFactory.newClassPathResource(VARIABLE_PERSISTENCE, getClass()), ResourceType.BPMN2).get();
createRuntimeManager(Strategy.SINGLETON, new HashMap<String, ResourceType>(), environment, "custom-rm");
RuntimeEngine engine = manager.getRuntimeEngine(ProcessInstanceIdContext.get());
DocumentVariable dv = new DocumentVariable();
dv.setContent("empty");
Map<String, Object> params = new HashMap<String, Object>();
params.put("document", dv);
ProcessInstance pi = engine.getKieSession().startProcess(VARIABLE_PERSISTENCE_ID, params);
EntityManager em = getEmf().createEntityManager();
List<DocumentVariable> documents = em.createQuery("from DocumentVariable").getResultList();
Assertions.assertThat(documents).hasSize(1);
Assertions.assertThat(documents.get(0).getContent()).isEqualTo("content-changed");
engine.getKieSession().abortProcessInstance(pi.getId());
}
Aggregations