Package org.camunda.bpm.engine

Examples of org.camunda.bpm.engine.RepositoryService


    mockProcessEngineConfiguration(engine);
    return engine;
  }

  private void mockServices(ProcessEngine engine) {
    RepositoryService repoService = mock(RepositoryService.class);
    IdentityService identityService = mock(IdentityService.class);
    TaskService taskService = mock(TaskService.class);
    RuntimeService runtimeService = mock(RuntimeService.class);
    FormService formService = mock(FormService.class);
    HistoryService historyService = mock(HistoryService.class);
View Full Code Here


    }
  }

  protected void autoDeployResources(ProcessEngine processEngine) {
    if (deploymentResources!=null && deploymentResources.length>0) {
      RepositoryService repositoryService = processEngine.getRepositoryService();

      DeploymentBuilder deploymentBuilder = repositoryService
        .createDeployment()
        .enableDuplicateFiltering(false)
        .name(deploymentName);

      for (Resource resource : deploymentResources) {
View Full Code Here

import org.camunda.bpm.engine.repository.ProcessDefinition;

public class MigrateProcessInstanceDelegate implements JavaDelegate {

  public void execute(DelegateExecution execution) throws Exception {
    RepositoryService repoService = execution.getProcessEngineServices().getRepositoryService();
    ProcessDefinition targetDefinition = repoService.createProcessDefinitionQuery().latestVersion().singleResult();
   
    SetProcessDefinitionVersionCmd migrationCommand =
        new SetProcessDefinitionVersionCmd(execution.getProcessInstanceId(), targetDefinition.getVersion());
   
    Context.getProcessEngineConfiguration().getCommandExecutorTxRequired().execute(migrationCommand);
View Full Code Here

      .setProcessEngineName("reboot-test-schema")
      .setDatabaseSchemaUpdate(org.camunda.bpm.engine.ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE)
      .setJdbcUrl("jdbc:h2:mem:activiti-process-cache-test;DB_CLOSE_DELAY=1000")
      .setJobExecutorActivate(false)
      .buildProcessEngine();
    RepositoryService repositoryService1 = processEngine1.getRepositoryService();
   
    ProcessEngine processEngine2 = new StandaloneProcessEngineConfiguration()
      .setProcessEngineName("reboot-test")
      .setDatabaseSchemaUpdate(org.camunda.bpm.engine.ProcessEngineConfiguration.DB_SCHEMA_UPDATE_FALSE)
      .setJdbcUrl("jdbc:h2:mem:activiti-process-cache-test;DB_CLOSE_DELAY=1000")
      .setJobExecutorActivate(false)
      .buildProcessEngine();
    RepositoryService repositoryService2 = processEngine2.getRepositoryService();
    RuntimeService runtimeService2 = processEngine2.getRuntimeService();
    TaskService taskService2 = processEngine2.getTaskService();
   
    // Deploy first version of process: start->originalTask->end on first process engine
    String deploymentId = repositoryService1.createDeployment()
      .addClasspathResource("org/camunda/bpm/engine/test/cache/originalProcess.bpmn20.xml")
      .deploy()
      .getId();
   
    // Start process instance on second engine
    String processDefinitionId = repositoryService2.createProcessDefinitionQuery().singleResult().getId();
    runtimeService2.startProcessInstanceById(processDefinitionId);
    Task task = taskService2.createTaskQuery().singleResult();
    assertEquals("original task", task.getName());
   
    // Delete the deployment on second process engine
    repositoryService2.deleteDeployment(deploymentId, true);
    assertEquals(0, repositoryService2.createDeploymentQuery().count());
    assertEquals(0, runtimeService2.createProcessInstanceQuery().count());
   
    // deploy a revised version of the process: start->revisedTask->end on first process engine
    //
    // Before the bugfix, this would set the cache on the first process engine,
    // but the second process engine still has the original process definition in his cache.
    // Since there is a deployment delete in between, the new generated process definition id is the same
    // as in the original deployment, making the second process engine using the old cached process definition.
    deploymentId = repositoryService1.createDeployment()
      .addClasspathResource("org/camunda/bpm/engine/test/cache/revisedProcess.bpmn20.xml")
      .deploy()
      .getId();
   
    // Start process instance on second process engine -> must use revised process definition
    processDefinitionId = repositoryService2.createProcessDefinitionQuery().singleResult().getId();
    runtimeService2.startProcessInstanceByKey("oneTaskProcess");
    task = taskService2.createTaskQuery().singleResult();
    assertEquals("revised task", task.getName());
   
    // cleanup
View Full Code Here

  }
 
  @Test
  public void testDeployProcessArchive() {
    Assert.assertNotNull(processEngine);
    RepositoryService repositoryService = processEngine.getRepositoryService();
    long count = repositoryService.createProcessDefinitionQuery()
      .processDefinitionKey("invoice-it")
      .count();
   
    Assert.assertEquals(1, count);
  }
View Full Code Here

  }

  public void cleanDatabase(ProcessEngine engine) {
   
    // delete all deployments
    RepositoryService repositoryService = engine.getRepositoryService();
    List<Deployment> deployments = repositoryService
      .createDeploymentQuery()
      .list();
    for (Deployment deployment : deployments) {
      repositoryService.deleteDeployment(deployment.getId(), true);
    }
   
    // drop DB
    ((ProcessEngineImpl)engine).getProcessEngineConfiguration()
      .getCommandExecutorTxRequired()
View Full Code Here

  }

  @Test
  public void testDeployProcessArchive() {
    assertNotNull(processEngine);
    RepositoryService repositoryService = processEngine.getRepositoryService();

    ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery()
      .processDefinitionKey("invoice-it");

    assertEquals(1, processDefinitionQuery.count());
    ProcessDefinition processDefinition = processDefinitionQuery.singleResult();

    String deploymentId = repositoryService.createDeploymentQuery()
      .deploymentId(processDefinition.getDeploymentId())
      .singleResult()
      .getId();
    List<Resource> deploymentResources = repositoryService.getDeploymentResources(deploymentId);
    assertEquals(3, deploymentResources.size());
  }
View Full Code Here

  }

  public static void assertDiagramIsDeployed(boolean deployed, Class<?> clazz, String expectedDiagramResource, String processDefinitionKey) throws IOException {
    ProcessEngine processEngine = ProgrammaticBeanLookup.lookup(ProcessEngine.class);
    Assert.assertNotNull(processEngine);
    RepositoryService repositoryService = processEngine.getRepositoryService();
    ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
      .processDefinitionKey(processDefinitionKey)
      .singleResult();
    assertNotNull(processDefinition);

    InputStream actualStream = null;
    InputStream expectedStream = null;
    try {
      actualStream = repositoryService.getProcessDiagram(processDefinition.getId());

      if (deployed) {
        byte[] actualDiagram = IoUtil.readInputStream(actualStream, "actualStream");
        assertNotNull(actualDiagram);
        assertTrue(actualDiagram.length > 0);
View Full Code Here

 
  @Test
  public void testTwoPasAsLib() {
    ProcessEngine processEngine = ProgrammaticBeanLookup.lookup(ProcessEngine.class);
    Assert.assertNotNull(processEngine);
    RepositoryService repositoryService = processEngine.getRepositoryService();
    long count = repositoryService.createProcessDefinitionQuery()
      .processDefinitionKey("process1")
      .count();   
    Assert.assertEquals(1, count);
   
    count = repositoryService.createProcessDefinitionQuery()
      .processDefinitionKey("process2")
      .count();   
    Assert.assertEquals(1, count);
  }
View Full Code Here

 
  @Test
  public void testPaAsEjbModule() {
    ProcessEngine processEngine = ProgrammaticBeanLookup.lookup(ProcessEngine.class);
    Assert.assertNotNull(processEngine);
    RepositoryService repositoryService = processEngine.getRepositoryService();
    long count = repositoryService.createProcessDefinitionQuery()
      .processDefinitionKey("paAsEjbModule-process")
      .count();   
    Assert.assertEquals(1, count);  
  }
View Full Code Here

TOP

Related Classes of org.camunda.bpm.engine.RepositoryService

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.