public void testExtract_myRole() {
   // role ref
   from.setEndpointReference(Reference.MY_ROLE);
   // endpoint ref
   EndpointReference endpointRef = new WsaEndpointReference();
   MockIntegrationService relationService =
       (MockIntegrationService)
           jbpmContext.getServices().getService(IntegrationService.SERVICE_NAME);
   relationService.setMyReference(from.getPartnerLink(), endpointRef);
   // verify extraction
   assertSame(endpointRef, from.extract(token));
 }
示例#2
0
 public void save(ProcessInstance processInstance, JbpmContext jbpmContext) {
   // check if transaction is active before saving process instance
   // https://jira.jboss.org/browse/JBPM-2983
   PersistenceService persistenceService = jbpmContext.getServices().getPersistenceService();
   if (persistenceService instanceof DbPersistenceService) {
     DbPersistenceService dbPersistenceService = (DbPersistenceService) persistenceService;
     if (dbPersistenceService.isTransactionActive()) {
       Session session = dbPersistenceService.getSession();
       if (session != null && session.isOpen()) {
         session.save(processInstance);
       }
     }
   }
 }