Search in sources :

Example 11 with IncidentQuery

use of org.camunda.bpm.engine.runtime.IncidentQuery in project camunda-bpm-platform by camunda.

the class MultiTenancyIncidentQueryTest method testQueryByNonExistingTenantId.

public void testQueryByNonExistingTenantId() {
    IncidentQuery query = runtimeService.createIncidentQuery().tenantIdIn("nonExisting");
    assertThat(query.count(), is(0L));
}
Also used : IncidentQuery(org.camunda.bpm.engine.runtime.IncidentQuery)

Example 12 with IncidentQuery

use of org.camunda.bpm.engine.runtime.IncidentQuery in project camunda-bpm-platform by camunda.

the class MultiTenancyIncidentQueryTest method testQueryNoAuthenticatedTenants.

public void testQueryNoAuthenticatedTenants() {
    identityService.setAuthentication("user", null, null);
    IncidentQuery query = runtimeService.createIncidentQuery();
    assertThat(query.count(), is(0L));
}
Also used : IncidentQuery(org.camunda.bpm.engine.runtime.IncidentQuery)

Example 13 with IncidentQuery

use of org.camunda.bpm.engine.runtime.IncidentQuery in project camunda-bpm-platform by camunda.

the class MultiTenancyIncidentQueryTest method testQueryDisabledTenantCheck.

public void testQueryDisabledTenantCheck() {
    processEngineConfiguration.setTenantCheckEnabled(false);
    identityService.setAuthentication("user", null, null);
    IncidentQuery query = runtimeService.createIncidentQuery();
    assertThat(query.count(), is(2L));
}
Also used : IncidentQuery(org.camunda.bpm.engine.runtime.IncidentQuery)

Example 14 with IncidentQuery

use of org.camunda.bpm.engine.runtime.IncidentQuery in project camunda-bpm-platform by camunda.

the class MultiTenancyIncidentQueryTest method testQueryAuthenticatedTenants.

public void testQueryAuthenticatedTenants() {
    identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE, TENANT_TWO));
    IncidentQuery query = runtimeService.createIncidentQuery();
    assertThat(query.count(), is(2L));
    assertThat(query.tenantIdIn(TENANT_ONE).count(), is(1L));
    assertThat(query.tenantIdIn(TENANT_TWO).count(), is(1L));
}
Also used : IncidentQuery(org.camunda.bpm.engine.runtime.IncidentQuery)

Example 15 with IncidentQuery

use of org.camunda.bpm.engine.runtime.IncidentQuery in project camunda-bpm-platform by camunda.

the class IncidentTest method testDoNotCreateNewIncident.

@Deployment(resources = { "org/camunda/bpm/engine/test/api/mgmt/IncidentTest.testShouldCreateOneIncident.bpmn" })
public void testDoNotCreateNewIncident() {
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("failingProcess");
    executeAvailableJobs();
    IncidentQuery query = runtimeService.createIncidentQuery().processInstanceId(processInstance.getId());
    Incident incident = query.singleResult();
    assertNotNull(incident);
    JobDefinition jobDefinition = managementService.createJobDefinitionQuery().singleResult();
    // set retries to 1 by job definition id
    managementService.setJobRetriesByJobDefinitionId(jobDefinition.getId(), 1);
    // the incident still exists
    Incident tmp = query.singleResult();
    assertEquals(incident.getId(), tmp.getId());
    // execute the available job (should fail again)
    executeAvailableJobs();
    // the incident still exists and there
    // should be not a new incident
    assertEquals(1, query.count());
    tmp = query.singleResult();
    assertEquals(incident.getId(), tmp.getId());
}
Also used : IncidentQuery(org.camunda.bpm.engine.runtime.IncidentQuery) ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) Incident(org.camunda.bpm.engine.runtime.Incident) JobDefinition(org.camunda.bpm.engine.management.JobDefinition) Deployment(org.camunda.bpm.engine.test.Deployment)

Aggregations

IncidentQuery (org.camunda.bpm.engine.runtime.IncidentQuery)55 Incident (org.camunda.bpm.engine.runtime.Incident)34 Test (org.junit.Test)21 HistoricIncident (org.camunda.bpm.engine.history.HistoricIncident)7 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)3 Deployment (org.camunda.bpm.engine.test.Deployment)3 IncidentQueryDto (org.camunda.bpm.engine.rest.dto.runtime.IncidentQueryDto)2 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)1 HistoricIncidentQuery (org.camunda.bpm.engine.history.HistoricIncidentQuery)1 RuntimeServiceImpl (org.camunda.bpm.engine.impl.RuntimeServiceImpl)1 JobDefinition (org.camunda.bpm.engine.management.JobDefinition)1 CountResultDto (org.camunda.bpm.engine.rest.dto.CountResultDto)1 IncidentDto (org.camunda.bpm.engine.rest.dto.runtime.IncidentDto)1 Execution (org.camunda.bpm.engine.runtime.Execution)1 Job (org.camunda.bpm.engine.runtime.Job)1