Search in sources :

Example 81 with ProcessDefinitionQuery

use of org.camunda.bpm.engine.repository.ProcessDefinitionQuery in project camunda-bpm-platform by camunda.

the class ProcessApplicationDeploymentTest method testNotNullAndNullDeploymentSourceShouldDeployNewVersion.

public void testNotNullAndNullDeploymentSourceShouldDeployNewVersion() {
    // given
    String key = "process";
    String name = "my-deployment";
    BpmnModelInstance model = Bpmn.createExecutableProcess(key).done();
    ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery().processDefinitionKey(key);
    DeploymentQuery deploymentQuery = repositoryService.createDeploymentQuery().deploymentName(name);
    // when
    ProcessApplicationDeployment deployment1 = repositoryService.createDeployment(processApplication.getReference()).name(name).source("my-source1").addModelInstance("process.bpmn", model).enableDuplicateFiltering(true).deploy();
    assertEquals(1, processDefinitionQuery.count());
    assertEquals(1, deploymentQuery.count());
    ProcessApplicationDeployment deployment2 = repositoryService.createDeployment(processApplication.getReference()).name(name).source(null).addModelInstance("process.bpmn", model).enableDuplicateFiltering(true).deploy();
    // then
    assertEquals(2, processDefinitionQuery.count());
    assertEquals(2, deploymentQuery.count());
    deleteDeployments(deployment1, deployment2);
}
Also used : DeploymentQuery(org.camunda.bpm.engine.repository.DeploymentQuery) ProcessApplicationDeployment(org.camunda.bpm.engine.repository.ProcessApplicationDeployment) ProcessDefinitionQuery(org.camunda.bpm.engine.repository.ProcessDefinitionQuery) BpmnModelInstance(org.camunda.bpm.model.bpmn.BpmnModelInstance)

Example 82 with ProcessDefinitionQuery

use of org.camunda.bpm.engine.repository.ProcessDefinitionQuery in project camunda-bpm-platform by camunda.

the class ProcessApplicationDeploymentTest method testDifferentDeploymentSourceShouldDeployNewVersion.

public void testDifferentDeploymentSourceShouldDeployNewVersion() {
    // given
    String key = "process";
    String name = "my-deployment";
    BpmnModelInstance model = Bpmn.createExecutableProcess(key).done();
    ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery().processDefinitionKey(key);
    DeploymentQuery deploymentQuery = repositoryService.createDeploymentQuery().deploymentName(name);
    // when
    ProcessApplicationDeployment deployment1 = repositoryService.createDeployment(processApplication.getReference()).name(name).source("my-source1").addModelInstance("process.bpmn", model).enableDuplicateFiltering(true).deploy();
    assertEquals(1, processDefinitionQuery.count());
    assertEquals(1, deploymentQuery.count());
    ProcessApplicationDeployment deployment2 = repositoryService.createDeployment(processApplication.getReference()).name(name).source("my-source2").addModelInstance("process.bpmn", model).enableDuplicateFiltering(true).deploy();
    // then
    assertEquals(2, processDefinitionQuery.count());
    assertEquals(2, deploymentQuery.count());
    deleteDeployments(deployment1, deployment2);
}
Also used : DeploymentQuery(org.camunda.bpm.engine.repository.DeploymentQuery) ProcessApplicationDeployment(org.camunda.bpm.engine.repository.ProcessApplicationDeployment) ProcessDefinitionQuery(org.camunda.bpm.engine.repository.ProcessDefinitionQuery) BpmnModelInstance(org.camunda.bpm.model.bpmn.BpmnModelInstance)

Example 83 with ProcessDefinitionQuery

use of org.camunda.bpm.engine.repository.ProcessDefinitionQuery in project camunda-bpm-platform by camunda.

the class ProcessApplicationDeploymentTest method testNullDeploymentSourceAwareDuplicateFilter.

public void testNullDeploymentSourceAwareDuplicateFilter() {
    // given
    String key = "process";
    String name = "my-deployment";
    BpmnModelInstance model = Bpmn.createExecutableProcess(key).done();
    ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery().processDefinitionKey(key);
    DeploymentQuery deploymentQuery = repositoryService.createDeploymentQuery().deploymentName(name);
    // when
    ProcessApplicationDeployment deployment1 = repositoryService.createDeployment(processApplication.getReference()).name(name).source(null).addModelInstance("process.bpmn", model).enableDuplicateFiltering(true).deploy();
    assertEquals(1, processDefinitionQuery.count());
    assertEquals(1, deploymentQuery.count());
    ProcessApplicationDeployment deployment2 = repositoryService.createDeployment(processApplication.getReference()).name(name).source(null).addModelInstance("process.bpmn", model).enableDuplicateFiltering(true).deploy();
    // then
    assertEquals(1, processDefinitionQuery.count());
    assertEquals(1, deploymentQuery.count());
    deleteDeployments(deployment1, deployment2);
}
Also used : DeploymentQuery(org.camunda.bpm.engine.repository.DeploymentQuery) ProcessApplicationDeployment(org.camunda.bpm.engine.repository.ProcessApplicationDeployment) ProcessDefinitionQuery(org.camunda.bpm.engine.repository.ProcessDefinitionQuery) BpmnModelInstance(org.camunda.bpm.model.bpmn.BpmnModelInstance)

Example 84 with ProcessDefinitionQuery

use of org.camunda.bpm.engine.repository.ProcessDefinitionQuery in project camunda-bpm-platform by camunda.

the class MultiTenancyProcessDefinitionSuspensionStateTest method delayedActivateProcessDefinitionsForAllTenants.

@Test
public void delayedActivateProcessDefinitionsForAllTenants() {
    // given suspended process definitions
    engineRule.getRepositoryService().updateProcessDefinitionSuspensionState().byProcessDefinitionKey(PROCESS_DEFINITION_KEY).suspend();
    engineRule.getRepositoryService().updateProcessDefinitionSuspensionState().byProcessDefinitionKey(PROCESS_DEFINITION_KEY).executionDate(tomorrow()).activate();
    ProcessDefinitionQuery query = engineRule.getRepositoryService().createProcessDefinitionQuery();
    assertThat(query.suspended().count(), is(3L));
    assertThat(query.active().count(), is(0L));
    // when execute the job to activate the process definitions
    Job job = engineRule.getManagementService().createJobQuery().timers().singleResult();
    assertThat(job, is(notNullValue()));
    engineRule.getManagementService().executeJob(job.getId());
    assertThat(query.suspended().count(), is(0L));
    assertThat(query.active().count(), is(3L));
}
Also used : ProcessDefinitionQuery(org.camunda.bpm.engine.repository.ProcessDefinitionQuery) Job(org.camunda.bpm.engine.runtime.Job) Test(org.junit.Test)

Example 85 with ProcessDefinitionQuery

use of org.camunda.bpm.engine.repository.ProcessDefinitionQuery in project camunda-bpm-platform by camunda.

the class MultiTenancyProcessDefinitionSuspensionStateTest method delayedActivateProcessDefinitionsForNonTenant.

@Test
public void delayedActivateProcessDefinitionsForNonTenant() {
    // given suspended process definitions
    engineRule.getRepositoryService().updateProcessDefinitionSuspensionState().byProcessDefinitionKey(PROCESS_DEFINITION_KEY).suspend();
    engineRule.getRepositoryService().updateProcessDefinitionSuspensionState().byProcessDefinitionKey(PROCESS_DEFINITION_KEY).processDefinitionWithoutTenantId().executionDate(tomorrow()).activate();
    ProcessDefinitionQuery query = engineRule.getRepositoryService().createProcessDefinitionQuery();
    assertThat(query.suspended().count(), is(3L));
    assertThat(query.active().count(), is(0L));
    // when execute the job to activate the process definition
    Job job = engineRule.getManagementService().createJobQuery().timers().singleResult();
    assertThat(job, is(notNullValue()));
    engineRule.getManagementService().executeJob(job.getId());
    assertThat(query.suspended().count(), is(2L));
    assertThat(query.active().count(), is(1L));
    assertThat(query.active().withoutTenantId().count(), is(1L));
}
Also used : ProcessDefinitionQuery(org.camunda.bpm.engine.repository.ProcessDefinitionQuery) Job(org.camunda.bpm.engine.runtime.Job) Test(org.junit.Test)

Aggregations

ProcessDefinitionQuery (org.camunda.bpm.engine.repository.ProcessDefinitionQuery)112 BpmnModelInstance (org.camunda.bpm.model.bpmn.BpmnModelInstance)27 ProcessApplicationDeployment (org.camunda.bpm.engine.repository.ProcessApplicationDeployment)25 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)23 Test (org.junit.Test)23 Deployment (org.camunda.bpm.engine.repository.Deployment)19 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)14 Resource (org.camunda.bpm.engine.repository.Resource)9 DeploymentQuery (org.camunda.bpm.engine.repository.DeploymentQuery)8 Job (org.camunda.bpm.engine.runtime.Job)6 RepositoryService (org.camunda.bpm.engine.RepositoryService)5 ProcessEngine (org.camunda.bpm.engine.ProcessEngine)4 Incident (org.camunda.bpm.engine.runtime.Incident)4 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)4 Map (java.util.Map)3 ReadOnlyProcessDefinition (org.camunda.bpm.engine.impl.pvm.ReadOnlyProcessDefinition)3 Response (com.jayway.restassured.response.Response)2 HashMap (java.util.HashMap)2 Authorization (org.camunda.bpm.engine.authorization.Authorization)2 Group (org.camunda.bpm.engine.identity.Group)2