Search in sources :

Example 26 with ProcessDefinitionQuery

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

the class ProcessDefinitionQueryTest method testQueryByIncidentId.

@org.camunda.bpm.engine.test.Deployment(resources = { "org/camunda/bpm/engine/test/api/repository/failingProcessCreateOneIncident.bpmn20.xml" })
public void testQueryByIncidentId() {
    assertEquals(1, repositoryService.createProcessDefinitionQuery().processDefinitionKey("failingProcess").count());
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("failingProcess");
    executeAvailableJobs();
    List<Incident> incidentList = runtimeService.createIncidentQuery().list();
    assertEquals(1, incidentList.size());
    Incident incident = runtimeService.createIncidentQuery().processInstanceId(processInstance.getId()).singleResult();
    ProcessDefinitionQuery query = repositoryService.createProcessDefinitionQuery().incidentId(incident.getId());
    verifyQueryResults(query, 1);
}
Also used : ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) ProcessDefinitionQuery(org.camunda.bpm.engine.repository.ProcessDefinitionQuery) Incident(org.camunda.bpm.engine.runtime.Incident)

Example 27 with ProcessDefinitionQuery

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

the class ProcessDefinitionQueryTest method testQueryByIncidentType.

@org.camunda.bpm.engine.test.Deployment(resources = { "org/camunda/bpm/engine/test/api/repository/failingProcessCreateOneIncident.bpmn20.xml" })
public void testQueryByIncidentType() {
    assertEquals(1, repositoryService.createProcessDefinitionQuery().processDefinitionKey("failingProcess").count());
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("failingProcess");
    executeAvailableJobs();
    List<Incident> incidentList = runtimeService.createIncidentQuery().list();
    assertEquals(1, incidentList.size());
    Incident incident = runtimeService.createIncidentQuery().processInstanceId(processInstance.getId()).singleResult();
    ProcessDefinitionQuery query = repositoryService.createProcessDefinitionQuery().incidentType(incident.getIncidentType());
    verifyQueryResults(query, 1);
}
Also used : ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) ProcessDefinitionQuery(org.camunda.bpm.engine.repository.ProcessDefinitionQuery) Incident(org.camunda.bpm.engine.runtime.Incident)

Example 28 with ProcessDefinitionQuery

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

the class ProcessDefinitionQueryTest method testQueryByInvalidIncidentId.

public void testQueryByInvalidIncidentId() {
    ProcessDefinitionQuery query = repositoryService.createProcessDefinitionQuery();
    verifyQueryResults(query.incidentId("invalid"), 0);
    try {
        query.incidentId(null);
        fail();
    } catch (ProcessEngineException e) {
    // Expected Exception
    }
}
Also used : ProcessDefinitionQuery(org.camunda.bpm.engine.repository.ProcessDefinitionQuery) ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException)

Example 29 with ProcessDefinitionQuery

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

the class ProcessDefinitionQueryTest method testQueryByLatest.

public void testQueryByLatest() {
    ProcessDefinitionQuery query = repositoryService.createProcessDefinitionQuery().latestVersion();
    verifyQueryResults(query, 3);
    query = repositoryService.createProcessDefinitionQuery().processDefinitionKey("one").latestVersion();
    verifyQueryResults(query, 1);
    query = repositoryService.createProcessDefinitionQuery().processDefinitionKey("two").latestVersion();
    verifyQueryResults(query, 1);
}
Also used : ProcessDefinitionQuery(org.camunda.bpm.engine.repository.ProcessDefinitionQuery)

Example 30 with ProcessDefinitionQuery

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

the class ProcessDefinitionQueryTest method testQueryByDeploymentId.

public void testQueryByDeploymentId() {
    ProcessDefinitionQuery query = repositoryService.createProcessDefinitionQuery().deploymentId(deploymentOneId);
    verifyQueryResults(query, 2);
}
Also used : ProcessDefinitionQuery(org.camunda.bpm.engine.repository.ProcessDefinitionQuery)

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