Java Code Examples for org.flowable.engine.ProcessEngine

The following examples show how to use org.flowable.engine.ProcessEngine. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);

    Mockito.when(flowableFacade.getHistoricProcessById(DEFAULT_PROCESS_ID))
           .thenReturn(mockedProcessInstance);
    ProcessEngine processEngine = Mockito.mock(ProcessEngine.class);
    Mockito.when(flowableFacade.getProcessEngine())
           .thenReturn(processEngine);
    HistoryService historyServiceMock = Mockito.mock(HistoryService.class);
    Mockito.when(processEngine.getHistoryService())
           .thenReturn(historyServiceMock);
    Mockito.when(historyServiceMock.createHistoricActivityInstanceQuery())
           .thenReturn(historicActivityInstanceQueryMock);
    Mockito.when(historicActivityInstanceQueryMock.processInstanceId(DEFAULT_PROCESS_ID))
           .thenReturn(historicActivityInstanceQueryMock);

    processTimeCalculator = new ProcessTimeCalculator(flowableFacade);
}
 
Example 2
@Test
public void appEngineWithProcessEngineAndTaskIdGenerator() {
    contextRunner.withUserConfiguration(CustomIdGeneratorConfiguration.class
    ).withConfiguration(AutoConfigurations.of(
        ProcessEngineServicesAutoConfiguration.class,
        ProcessEngineAutoConfiguration.class
    )).run(context -> {
        ProcessEngine processEngine = context.getBean(ProcessEngine.class);
        ProcessEngineConfiguration processEngineConfiguration = processEngine.getProcessEngineConfiguration();
        assertThat(processEngineConfiguration.getIdGenerator().getNextId()).as("Process id generator must be DB id generator").doesNotContain("-");
        
        AppEngine appEngine = context.getBean(AppEngine.class);
        deleteDeployments(appEngine);
        deleteDeployments(processEngine);
    });
}
 
Example 3
Source Project: flowable-engine   Source File: MuleVMTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void send() throws Exception {
    Assert.assertTrue(muleContext.isStarted());

    ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
    RepositoryService repositoryService = processEngine.getRepositoryService();
    Deployment deployment = repositoryService.createDeployment()
            .addClasspathResource("org/activiti/mule/testVM.bpmn20.xml")
            .deploymentProperty(DeploymentProperties.DEPLOY_AS_FLOWABLE5_PROCESS_DEFINITION, Boolean.TRUE)
            .deploy();

    RuntimeService runtimeService = processEngine.getRuntimeService();
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("muleProcess");
    Assert.assertFalse(processInstance.isEnded());
    Object result = runtimeService.getVariable(processInstance.getProcessInstanceId(), "theVariable");
    Assert.assertEquals(30, result);
    runtimeService.deleteProcessInstance(processInstance.getId(), "test");

    processEngine.getHistoryService().deleteHistoricProcessInstance(processInstance.getId());
    repositoryService.deleteDeployment(deployment.getId());
    assertAndEnsureCleanDb(processEngine);
    ProcessEngines.destroy();
}
 
Example 4
@Test
public void testForceCloseMybatisConnectionPoolTrue() {

    // given
    // that the process engine is configured with forceCloseMybatisConnectionPool = true
    StandaloneInMemProcessEngineConfiguration standaloneInMemProcessEngineConfiguration =  new StandaloneInMemProcessEngineConfiguration();
    standaloneInMemProcessEngineConfiguration.setJdbcUrl("jdbc:h2:mem:flowable-bpmn-" + this.getClass().getName());
    standaloneInMemProcessEngineConfiguration.setForceCloseMybatisConnectionPool(true);

    ProcessEngine processEngine = standaloneInMemProcessEngineConfiguration.buildProcessEngine();

    PooledDataSource pooledDataSource = (PooledDataSource) standaloneInMemProcessEngineConfiguration.getDataSource();
    PoolState state = pooledDataSource.getPoolState();
    assertThat(state.getIdleConnectionCount()).isGreaterThan(0);

    // then
    // if the process engine is closed
    processEngine.close();

    // the idle connections are closed
    assertThat(state.getIdleConnectionCount()).isZero();
}
 
Example 5
@Test
public void asyncHistoryExecutorBeanWithDefault() {
    contextRunner
        .run((context -> {
            assertThat(context).doesNotHaveBean("asyncHistoryExecutor");

            AsyncExecutor processAsyncHistoryExecutor = context.getBean(ProcessEngine.class).getProcessEngineConfiguration().getAsyncHistoryExecutor();
            assertThat(processAsyncHistoryExecutor).isNull();

            assertThat(context.getBean(ProcessEngine.class).getProcessEngineConfiguration().isAsyncHistoryExecutorActivate()).isTrue();

            assertThat(((ProcessEngineConfigurationImpl) context.getBean(ProcessEngine.class).getProcessEngineConfiguration()).isAsyncHistoryEnabled())
                .isFalse();

        }));
}
 
Example 6
Source Project: flowable-engine   Source File: MuleHttpTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void http() throws Exception {
    Assert.assertTrue(muleContext.isStarted());

    ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
    Deployment deployment = processEngine.getRepositoryService().createDeployment()
            .addClasspathResource("org/activiti/mule/testHttp.bpmn20.xml")
            .deploymentProperty(DeploymentProperties.DEPLOY_AS_FLOWABLE5_PROCESS_DEFINITION, Boolean.TRUE)
            .deploy();
    RuntimeService runtimeService = processEngine.getRuntimeService();
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("muleProcess");
    Assert.assertFalse(processInstance.isEnded());
    Object result = runtimeService.getVariable(processInstance.getProcessInstanceId(), "theVariable");
    Assert.assertEquals(20, result);
    runtimeService.deleteProcessInstance(processInstance.getId(), "test");
    processEngine.getHistoryService().deleteHistoricProcessInstance(processInstance.getId());
    processEngine.getRepositoryService().deleteDeployment(deployment.getId());
    assertAndEnsureCleanDb(processEngine);
    ProcessEngines.destroy();
}
 
Example 7
Source Project: flowable-engine   Source File: MuleHttpBasicAuthTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void httpWithBasicAuth() throws Exception {
    Assert.assertTrue(muleContext.isStarted());

    ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
    Deployment deployment = processEngine.getRepositoryService()
            .createDeployment()
            .addClasspathResource("org/activiti/mule/testHttpBasicAuth.bpmn20.xml")
            .deploymentProperty(DeploymentProperties.DEPLOY_AS_FLOWABLE5_PROCESS_DEFINITION, Boolean.TRUE)
            .deploy();
    RuntimeService runtimeService = processEngine.getRuntimeService();
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("muleProcess");
    Assert.assertFalse(processInstance.isEnded());
    Object result = runtimeService.getVariable(processInstance.getProcessInstanceId(), "theVariable");
    Assert.assertEquals(10, result);
    runtimeService.deleteProcessInstance(processInstance.getId(), "test");
    processEngine.getHistoryService().deleteHistoricProcessInstance(processInstance.getId());
    processEngine.getRepositoryService().deleteDeployment(deployment.getId());
    assertAndEnsureCleanDb(processEngine);
    ProcessEngines.destroy();
}
 
Example 8
Source Project: flowable-engine   Source File: AbstractMuleTest.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Each test is assumed to clean up all DB content it entered. After a test method executed, this method scans all tables to see if the DB is completely clean. It throws AssertionFailed in case
 * the DB is not clean. If the DB is not clean, it is cleaned by performing a create a drop.
 */
protected void assertAndEnsureCleanDb(ProcessEngine processEngine) throws Exception {
    EnsureCleanDbUtils.assertAndEnsureCleanDb(
            getClass().getSimpleName() + "." + name.getMethodName(),
            LOGGER,
            processEngine.getProcessEngineConfiguration(),
            TABLENAMES_EXCLUDED_FROM_DB_CLEAN_CHECK,
            true,
            new Command<Void>() {
                @Override
                public Void execute(CommandContext commandContext) {
                    SchemaManager schemaManager = CommandContextUtil.getProcessEngineConfiguration(commandContext).getSchemaManager();
                    schemaManager.schemaDrop();
                    schemaManager.schemaCreate();
                    return null;
                }
            }
    );
}
 
Example 9
Source Project: flowable-engine   Source File: EngineEventsTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testEngineEventsTest() {
    ProcessEngineConfiguration processEngineConfiguration = StandaloneProcessEngineConfiguration
            .createProcessEngineConfigurationFromResource("org/flowable/standalone/event/flowable-eventlistener.cfg.xml");
    ProcessEngine processEngine = processEngineConfiguration.buildProcessEngine();

    // Fetch the listener to check received events
    TestFlowableEventListener listener = (TestFlowableEventListener) processEngineConfiguration.getBeans().get("eventListener");
    assertThat(listener).isNotNull();

    // Check create-event
    assertThat(listener.getEventsReceived().get(0).getType()).isEqualTo(FlowableEngineEventType.ENGINE_CREATED);
    listener.clearEventsReceived();

    // Check close-event
    processEngine.close();
    assertThat(listener.getEventsReceived().get(listener.getEventsReceived().size() - 1).getType()).isEqualTo(FlowableEngineEventType.ENGINE_CLOSED);
}
 
Example 10
@Override
protected void deployResourcesInternal(String deploymentNameHint, Resource[] resources, ProcessEngine engine) {
    // Create a separate deployment for each resource using the resource name
    RepositoryService repositoryService = engine.getRepositoryService();

    for (final Resource resource : resources) {

        final String resourceName = determineResourceName(resource);
        final DeploymentBuilder deploymentBuilder = repositoryService.createDeployment().enableDuplicateFiltering().name(resourceName);
        addResource(resource, resourceName, deploymentBuilder);
        try {
            deploymentBuilder.deploy();
        } catch (RuntimeException e) {
            if (isThrowExceptionOnDeploymentFailure()) {
                throw e;
            } else {
                LOGGER.warn(
                    "Exception while autodeploying process definitions for resource {}. This exception can be ignored if the root cause indicates a unique constraint violation, which is typically caused by two (or more) servers booting up at the exact same time and deploying the same definitions. ",
                    resource, e);
            }
        }
    }
}
 
Example 11
Source Project: flowable-engine   Source File: SpringFlowableTestCase.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void initializeProcessEngine() {
    ContextConfiguration contextConfiguration = getClass().getAnnotation(ContextConfiguration.class);
    String[] value = contextConfiguration.value();
    boolean hasOneArg = value != null && value.length == 1;
    String key = hasOneArg ? value[0] : ProcessEngine.class.getName();
    ProcessEngine engine = this.cachedProcessEngines.containsKey(key) ? this.cachedProcessEngines.get(key) : this.applicationContext.getBean(ProcessEngine.class);

    this.cachedProcessEngines.put(key, engine);
    this.processEngine = engine;
}
 
Example 12
@Inject
@Bean
@DependsOn("coreChangelog")
public ProcessEngine processEngine(ApplicationContext applicationContext, SpringProcessEngineConfiguration processEngineConfiguration)
    throws Exception {
    ProcessEngineFactoryBean processEngineFactoryBean = new ProcessEngineFactoryBean();
    processEngineFactoryBean.setApplicationContext(applicationContext);
    processEngineFactoryBean.setProcessEngineConfiguration(processEngineConfiguration);
    return processEngineFactoryBean.getObject();
}
 
Example 13
@Override
public ProcessEngine buildProcessEngine() {
    ProcessEngine processEngine = super.buildProcessEngine();
    ProcessEngines.setInitialized(true);
    enginesBuild.add(processEngine.getName());
    return processEngine;
}
 
Example 14
Source Project: flowable-engine   Source File: SimulationRunContext.java    License: Apache License 2.0 5 votes vote down vote up
public static RuntimeService getRuntimeService() {
    Stack<ProcessEngine> stack = getStack(processEngineThreadLocal);
    if (stack.isEmpty()) {
        return null;
    }
    return stack.peek().getRuntimeService();
}
 
Example 15
Source Project: flowable-engine   Source File: SimulationRunContext.java    License: Apache License 2.0 5 votes vote down vote up
public static TaskService getTaskService() {
    Stack<ProcessEngine> stack = getStack(processEngineThreadLocal);
    if (stack.isEmpty()) {
        return null;
    }
    return stack.peek().getTaskService();
}
 
Example 16
Source Project: flowable-engine   Source File: SimulationRunContext.java    License: Apache License 2.0 5 votes vote down vote up
public static HistoryService getHistoryService() {
    Stack<ProcessEngine> stack = getStack(processEngineThreadLocal);
    if (stack.isEmpty()) {
        return null;
    }
    return stack.peek().getHistoryService();
}
 
Example 17
Source Project: flowable-engine   Source File: EventRecorderTestUtils.java    License: Apache License 2.0 5 votes vote down vote up
public static void closeProcessEngine(ProcessEngine processEngine, FlowableEventListener listener) {
    if (listener != null) {
        final ProcessEngineConfigurationImpl processEngineConfiguration = ((ProcessEngineImpl) processEngine).getProcessEngineConfiguration();
        processEngineConfiguration.getEventDispatcher().removeEventListener(listener);
    }
    processEngine.close();
}
 
Example 18
Source Project: flowable-engine   Source File: ProcessEngineConfigurator.java    License: Apache License 2.0 5 votes vote down vote up
protected synchronized ProcessEngine initProcessEngine() {
    if (processEngineConfiguration == null) {
        throw new FlowableException("ProcessEngineConfiguration is required");
    }

    return processEngineConfiguration.buildProcessEngine();
}
 
Example 19
@Override
public ProcessEngine getProcessEngine() {
    if (processEngine == null) {
        processEngine = ProcessEngines.getDefaultProcessEngine();
    }
    return processEngine;
}
 
Example 20
Source Project: flowable-engine   Source File: TestHelper.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Each test is assumed to clean up all DB content it entered. After a test method executed, this method scans all tables to see if the DB is completely clean. It throws AssertionFailed in case
 * the DB is not clean. If the DB is not clean, it is cleaned by performing a create a drop.
 */
public static void assertAndEnsureCleanDb(ProcessEngine processEngine) {
    LOGGER.debug("verifying that db is clean after test");
    Map<String, Long> tableCounts = processEngine.getManagementService().getTableCount();
    StringBuilder outputMessage = new StringBuilder();
    for (String tableName : tableCounts.keySet()) {
        if (!TABLENAMES_EXCLUDED_FROM_DB_CLEAN_CHECK.contains(tableName)) {
            Long count = tableCounts.get(tableName);
            if (count != 0L) {
                outputMessage.append("  ").append(tableName).append(": ").append(count).append(" record(s) ");
            }
        }
    }
    if (outputMessage.length() > 0) {
        outputMessage.insert(0, "DB NOT CLEAN: \n");
        LOGGER.error(EMPTY_LINE);
        LOGGER.error(outputMessage.toString());

        ((ProcessEngineImpl) processEngine)
                .getProcessEngineConfiguration().getCommandExecutor()
                .execute(new Command<Object>() {
                    public Object execute(CommandContext commandContext) {
                        SchemaManager schemaManager = CommandContextUtil.getProcessEngineConfiguration(commandContext).getSchemaManager();
                        schemaManager.schemaDrop();
                        schemaManager.schemaCreate();
                        return null;
                    }
                });

        throw new AssertionError(outputMessage.toString());
    }
}
 
Example 21
Source Project: flowable-engine   Source File: ActivitiMockSupport.java    License: Apache License 2.0 5 votes vote down vote up
public ActivitiMockSupport(ProcessEngine processEngine) {
    ProcessEngineConfigurationImpl processEngineConfiguration = ((ProcessEngineImpl) processEngine).getProcessEngineConfiguration();
    org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl activiti5ProcessEngineConfiguration = (org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl) processEngineConfiguration.getFlowable5CompatibilityHandler()
            .getRawProcessConfiguration();
    ActivityBehaviorFactory existingActivityBehaviorFactory = activiti5ProcessEngineConfiguration.getActivityBehaviorFactory();
    this.testActivityBehaviorFactory = new TestActivityBehaviorFactory(existingActivityBehaviorFactory);

    activiti5ProcessEngineConfiguration.setActivityBehaviorFactory(testActivityBehaviorFactory);
    activiti5ProcessEngineConfiguration.getBpmnParser().setActivityBehaviorFactory(testActivityBehaviorFactory);
}
 
Example 22
Source Project: flowable-engine   Source File: AbstractFlowableTestCase.java    License: Apache License 2.0 5 votes vote down vote up
protected static void cleanDeployments(ProcessEngine processEngine) {
    ProcessEngineConfiguration processEngineConfiguration = processEngine.getProcessEngineConfiguration();
    for (String autoDeletedDeploymentId : deploymentIdsForAutoCleanup) {
        processEngineConfiguration.getRepositoryService().deleteDeployment(autoDeletedDeploymentId, true);
    }
    deploymentIdsForAutoCleanup.clear();
}
 
Example 23
Source Project: flowable-engine   Source File: AbstractFlowableTestCase.java    License: Apache License 2.0 5 votes vote down vote up
@BeforeEach
public final void initializeServices(ProcessEngine processEngine) {
    processEngineConfiguration = ((ProcessEngineImpl) processEngine).getProcessEngineConfiguration();
    this.processEngine = processEngine;
    repositoryService = processEngine.getRepositoryService();
    runtimeService = processEngine.getRuntimeService();
    taskService = processEngine.getTaskService();
    formService = processEngine.getFormService();
    historyService = processEngine.getHistoryService();
    identityService = processEngine.getIdentityService();
    managementService = processEngine.getManagementService();
    dynamicBpmnService = processEngine.getDynamicBpmnService();
    processMigrationService = processEngine.getProcessMigrationService();
}
 
Example 24
@Test
public void processEngineWithMultipleCustomIdGeneratorsAndAQualifiedProcessOneAsBean() {
    contextRunner.withUserConfiguration(
        CustomBeanIdGeneratorConfiguration.class,
        SecondCustomBeanIdGeneratorConfiguration.class,
        ProcessQualifiedCustomBeanIdGeneratorConfiguration.class
    ).run(context -> {
        assertThat(context)
            .as("Process engine").hasSingleBean(ProcessEngine.class)
            .as("Custom Id generator").hasBean("customIdGenerator")
            .as("Second Custom Id generator").hasBean("secondCustomIdGenerator")
            .as("Process Custom Id generator").hasBean("processQualifiedCustomIdGenerator");

        Map<String, IdGenerator> idGenerators = context.getBeansOfType(IdGenerator.class);
        assertThat(idGenerators).containsOnlyKeys(
            "customIdGenerator",
            "secondCustomIdGenerator",
            "processQualifiedCustomIdGenerator"
        );

        IdGenerator customIdGenerator = idGenerators.get("customIdGenerator");
        assertThat(customIdGenerator).isInstanceOf(DbIdGenerator.class);

        IdGenerator secondCustomIdGenerator = idGenerators.get("secondCustomIdGenerator");
        assertThat(secondCustomIdGenerator).isInstanceOf(StrongUuidGenerator.class);

        IdGenerator processCustomIdGenerator = idGenerators.get("processQualifiedCustomIdGenerator");
        assertThat(processCustomIdGenerator).isInstanceOf(StrongUuidGenerator.class);

        ProcessEngine processEngine = context.getBean(ProcessEngine.class);

        ProcessEngineConfiguration engineConfiguration = processEngine.getProcessEngineConfiguration();
        assertThat(engineConfiguration.getIdGenerator())
            .isInstanceOf(StrongUuidGenerator.class)
            .isNotEqualTo(customIdGenerator)
            .isNotEqualTo(secondCustomIdGenerator)
            .isEqualTo(processCustomIdGenerator);
    });
}
 
Example 25
protected ProcessEngine initOtherProcessEngine() {
    return ProcessEngineConfiguration
        .createProcessEngineConfigurationFromResource("flowable.cfg.xml") // same datasource
        .setEngineName("otherEngine")
        .setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE)
        .buildProcessEngine();
}
 
Example 26
@Test
public void cmmnAndProcessEngineShouldUseDistinctTaskExecutorsWhenPrimaryIsPresent() {
    contextRunner.withUserConfiguration(DedicatedTaskExecutorsConfiguration.class, PrimaryTaskExecutorConfiguration.class)
        .run((context -> {
            AsyncExecutor processAsyncExecutor = context.getBean(ProcessEngine.class).getProcessEngineConfiguration().getAsyncExecutor();
            AsyncExecutor cmmnAsyncExecutor = context.getBean(CmmnEngine.class).getCmmnEngineConfiguration().getAsyncExecutor();

            assertThat(context)
                .doesNotHaveBean("taskExecutor")
                .hasBean("primaryTaskExecutor")
                .hasBean("cmmnTaskExecutor")
                .hasBean("processTaskExecutor");

            TaskExecutor primaryTaskExecutorBean = context.getBean("primaryTaskExecutor", TaskExecutor.class);
            TaskExecutor cmmnTaskExecutorBean = context.getBean("cmmnTaskExecutor", TaskExecutor.class);
            TaskExecutor processTaskExecutorBean = context.getBean("processTaskExecutor", TaskExecutor.class);

            assertThat(((SpringAsyncExecutor) processAsyncExecutor).getTaskExecutor())
                .as("Process Async Task Executor")
                .isSameAs(processTaskExecutorBean)
                .isNotSameAs(((SpringAsyncExecutor) cmmnAsyncExecutor).getTaskExecutor())
                .as("Process Async Task Executor with primary")
                .isNotSameAs(primaryTaskExecutorBean);

            assertThat(((SpringAsyncExecutor) cmmnAsyncExecutor).getTaskExecutor())
                .as("Cmmn Async Task Executor")
                .isSameAs(cmmnTaskExecutorBean)
                .as("Cmmn Async Task Executor with primary")
                .isNotSameAs(primaryTaskExecutorBean);
        }));
}
 
Example 27
@Test
public void standaloneIdmEngineWithBasicDataSource() {
    contextRunner.run(context -> {
        assertThat(context)
            .doesNotHaveBean(AppEngine.class)
            .doesNotHaveBean(ProcessEngine.class)
            .doesNotHaveBean("idmProcessEngineConfigurationConfigurer")
            .doesNotHaveBean("idmAppEngineConfigurationConfigurer");
        IdmEngine idmEngine = context.getBean(IdmEngine.class);
        assertThat(idmEngine).as("Idm engine").isNotNull();
        assertAllServicesPresent(context, idmEngine);

        assertThat(context).hasSingleBean(CustomUserEngineConfigurerConfiguration.class)
            .hasSingleBean(PasswordEncoder.class)
            .getBean(CustomUserEngineConfigurerConfiguration.class)
            .satisfies(configuration -> {
                assertThat(configuration.getInvokedConfigurations())
                    .containsExactly(
                        SpringIdmEngineConfiguration.class
                    );
            });

        org.flowable.idm.api.PasswordEncoder flowablePasswordEncoder = idmEngine.getIdmEngineConfiguration().getPasswordEncoder();
        PasswordEncoder passwordEncoder = context.getBean(PasswordEncoder.class);
        assertThat(flowablePasswordEncoder)
            .isInstanceOfSatisfying(SpringEncoder.class, springEncoder -> {
                assertThat(springEncoder.getSpringEncodingProvider()).isEqualTo(passwordEncoder);
            });
        assertThat(passwordEncoder).isInstanceOf(NoOpPasswordEncoder.class);
    });
}
 
Example 28
@Override
public ProcessEngine getProcessEngine() {
    if (processEngine == null) {
        processEngine = ProcessEngines.getDefaultProcessEngine();
    }
    return processEngine;
}
 
Example 29
Source Project: flowable-engine   Source File: InternalFlowableExtension.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void beforeEach(ExtensionContext context) {
    ProcessEngine processEngine = getProcessEngine(context);

    AnnotationSupport.findAnnotation(context.getTestMethod(), Deployment.class)
        .ifPresent(deployment -> {
            String deploymentIdFromDeploymentAnnotation = TestHelper
                .annotationDeploymentSetUp(processEngine, context.getRequiredTestClass(), context.getRequiredTestMethod(), deployment);
            getStore(context).put(context.getUniqueId() + ANNOTATION_DEPLOYMENT_ID_KEY, deploymentIdFromDeploymentAnnotation);
        });
}
 
Example 30
@Override
public void contextInitialized(ServletContextEvent event) {
    LOGGER.info("Booting Flowable Process Engine");
    ProcessEngine processEngine = null;
    try {
        processEngine = ProcessEngines.getDefaultProcessEngine();
    } catch (Exception e) {
        LOGGER.error("Error starting the Flowable REST API", e);
    }
    if (processEngine == null) {
        LOGGER.error("Could not start the Flowable REST API");
    }
}