Java Code Examples for org.flowable.engine.ProcessEngine#getManagementService()

The following examples show how to use org.flowable.engine.ProcessEngine#getManagementService() . 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
Source File: AbstractFlowableTestCase.java    From flowable-engine with 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 2
Source File: ProcessEngineServicesAutoConfiguration.java    From flowable-engine with Apache License 2.0 4 votes vote down vote up
@Bean
@ConditionalOnMissingBean
public ManagementService managementServiceBean(ProcessEngine processEngine) {
    return processEngine.getManagementService();
}
 
Example 3
Source File: JPAFlowableEngineConfiguration.java    From flowable-engine with Apache License 2.0 4 votes vote down vote up
@Bean
public ManagementService managementService(ProcessEngine processEngine) {
    return processEngine.getManagementService();
}
 
Example 4
Source File: EngineConfiguration.java    From flowable-engine with Apache License 2.0 4 votes vote down vote up
@Bean
public ManagementService managementService(ProcessEngine processEngine) {
    return processEngine.getManagementService();
}
 
Example 5
Source File: SpringTransactionAndExceptionsTest.java    From flowable-engine with Apache License 2.0 4 votes vote down vote up
@Bean
public ManagementService managementService(ProcessEngine processEngine) {
    return processEngine.getManagementService();
}
 
Example 6
Source File: SpringJunitJupiterTest.java    From flowable-engine with Apache License 2.0 4 votes vote down vote up
@Bean
public ManagementService managementService(ProcessEngine processEngine) {
    return processEngine.getManagementService();
}
 
Example 7
Source File: InternalFlowableExtension.java    From flowable-engine with Apache License 2.0 4 votes vote down vote up
protected void doFinally(ExtensionContext context, TestInstance.Lifecycle lifecycleForClean) {
    ProcessEngine processEngine = getProcessEngine(context);
    ProcessEngineConfigurationImpl processEngineConfiguration = (ProcessEngineConfigurationImpl) processEngine.getProcessEngineConfiguration();
    boolean isAsyncHistoryEnabled = processEngineConfiguration.isAsyncHistoryEnabled();

    if (isAsyncHistoryEnabled) {
        ManagementService managementService = processEngine.getManagementService();
        List<HistoryJob> jobs = managementService.createHistoryJobQuery().list();
        for (HistoryJob job : jobs) {
            managementService.deleteHistoryJob(job.getId());
        }
    }

    HistoryManager asyncHistoryManager = null;
    try {
        if (isAsyncHistoryEnabled) {
            processEngineConfiguration.setAsyncHistoryEnabled(false);
            asyncHistoryManager = processEngineConfiguration.getHistoryManager();
            processEngineConfiguration
                .setHistoryManager(new DefaultHistoryManager(processEngineConfiguration, 
                        processEngineConfiguration.getHistoryLevel(), processEngineConfiguration.isUsePrefixId()));
        }

        String annotationDeploymentKey = context.getUniqueId() + ANNOTATION_DEPLOYMENT_ID_KEY;
        String deploymentIdFromDeploymentAnnotation = getStore(context).get(annotationDeploymentKey, String.class);
        if (deploymentIdFromDeploymentAnnotation != null) {
            TestHelper.annotationDeploymentTearDown(processEngine, deploymentIdFromDeploymentAnnotation, context.getRequiredTestClass(),
                context.getRequiredTestMethod().getName());
            getStore(context).remove(annotationDeploymentKey);
        }

        AnnotationSupport.findAnnotation(context.getTestMethod(), CleanTest.class)
            .ifPresent(cleanTest -> removeDeployments(processEngine.getRepositoryService()));

        AbstractFlowableTestCase.cleanDeployments(processEngine);
        
        if (context.getTestInstanceLifecycle().orElse(TestInstance.Lifecycle.PER_METHOD) == lifecycleForClean
                && processEngineConfiguration.isUsingRelationalDatabase()) { // the logic only is applicable to a relational database with tables
            cleanTestAndAssertAndEnsureCleanDb(context, processEngine);
        }

    } finally {

        if (isAsyncHistoryEnabled) {
            processEngineConfiguration.setAsyncHistoryEnabled(true);
            processEngineConfiguration.setHistoryManager(asyncHistoryManager);
        }

        processEngineConfiguration.getClock().reset();
    }
}
 
Example 8
Source File: BpmnEngineTestConfiguration.java    From flowable-engine with Apache License 2.0 4 votes vote down vote up
@Bean
public ManagementService managementService(ProcessEngine processEngine) {
    return processEngine.getManagementService();
}