Search in sources :

Example 46 with CaseDefinitionQuery

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

the class CaseDefinitionQueryTest method testQueryByInvalidName.

public void testQueryByInvalidName() {
    CaseDefinitionQuery query = repositoryService.createCaseDefinitionQuery();
    query.caseDefinitionName("invalid");
    verifyQueryResults(query, 0);
    try {
        query.caseDefinitionName(null);
        fail();
    } catch (NotValidException e) {
    // Expected exception
    }
}
Also used : NotValidException(org.camunda.bpm.engine.exception.NotValidException) CaseDefinitionQuery(org.camunda.bpm.engine.repository.CaseDefinitionQuery)

Example 47 with CaseDefinitionQuery

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

the class RepositoryServiceTest method testGetCaseModel.

@Deployment(resources = { "org/camunda/bpm/engine/test/repository/one.cmmn" })
public void testGetCaseModel() throws Exception {
    CaseDefinitionQuery query = repositoryService.createCaseDefinitionQuery();
    CaseDefinition caseDefinition = query.singleResult();
    String caseDefinitionId = caseDefinition.getId();
    InputStream caseModel = repositoryService.getCaseModel(caseDefinitionId);
    assertNotNull(caseModel);
    byte[] readInputStream = IoUtil.readInputStream(caseModel, "caseModel");
    String model = new String(readInputStream, "UTF-8");
    assertTrue(model.contains("<case id=\"one\" name=\"One\">"));
    IoUtil.closeSilently(caseModel);
}
Also used : InputStream(java.io.InputStream) CaseDefinition(org.camunda.bpm.engine.repository.CaseDefinition) CaseDefinitionQuery(org.camunda.bpm.engine.repository.CaseDefinitionQuery) Deployment(org.camunda.bpm.engine.test.Deployment)

Aggregations

CaseDefinitionQuery (org.camunda.bpm.engine.repository.CaseDefinitionQuery)47 CaseDefinition (org.camunda.bpm.engine.repository.CaseDefinition)12 NotValidException (org.camunda.bpm.engine.exception.NotValidException)10 Response (com.jayway.restassured.response.Response)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 ProcessEngine (org.camunda.bpm.engine.ProcessEngine)2 User (org.camunda.bpm.engine.identity.User)2 UserQuery (org.camunda.bpm.engine.identity.UserQuery)2 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)2 ProcessDefinitionQuery (org.camunda.bpm.engine.repository.ProcessDefinitionQuery)2 CaseDefinitionQueryDto (org.camunda.bpm.engine.rest.dto.repository.CaseDefinitionQueryDto)2 Deployment (org.camunda.bpm.engine.test.Deployment)2 Test (org.junit.Test)2 Matchers.anyString (org.mockito.Matchers.anyString)2 InputStream (java.io.InputStream)1 LinkedHashMap (java.util.LinkedHashMap)1 ProcessApplicationService (org.camunda.bpm.ProcessApplicationService)1 ProcessApplicationInfo (org.camunda.bpm.application.ProcessApplicationInfo)1