Search in sources :

Example 21 with DeploymentQuery

use of org.activiti.engine.repository.DeploymentQuery in project Activiti by Activiti.

the class DeploymentQueryTest method testQueryByProcessDefinitionKeyLike.

public void testQueryByProcessDefinitionKeyLike() {
    DeploymentQuery query = repositoryService.createDeploymentQuery().processDefinitionKeyLike("%o%");
    assertThat(query.list()).hasSize(2);
    assertThat(query.count()).isEqualTo(2);
}
Also used : DeploymentQuery(org.activiti.engine.repository.DeploymentQuery)

Example 22 with DeploymentQuery

use of org.activiti.engine.repository.DeploymentQuery in project Activiti by Activiti.

the class DeploymentQueryTest method testQueryByInvalidName.

public void testQueryByInvalidName() {
    DeploymentQuery query = repositoryService.createDeploymentQuery().deploymentName("invalid");
    assertThat(query.singleResult()).isNull();
    assertThat(query.list()).hasSize(0);
    assertThat(query.count()).isEqualTo(0);
    assertThatExceptionOfType(ActivitiIllegalArgumentException.class).isThrownBy(() -> repositoryService.createDeploymentQuery().deploymentName(null));
}
Also used : DeploymentQuery(org.activiti.engine.repository.DeploymentQuery) ActivitiIllegalArgumentException(org.activiti.engine.ActivitiIllegalArgumentException)

Example 23 with DeploymentQuery

use of org.activiti.engine.repository.DeploymentQuery in project Activiti by Activiti.

the class DeploymentQueryTest method testQueryByInvalidDeploymentId.

public void testQueryByInvalidDeploymentId() {
    DeploymentQuery query = repositoryService.createDeploymentQuery().deploymentId("invalid");
    assertThat(query.singleResult()).isNull();
    assertThat(query.list()).hasSize(0);
    assertThat(query.count()).isEqualTo(0);
    assertThatExceptionOfType(ActivitiIllegalArgumentException.class).isThrownBy(() -> repositoryService.createDeploymentQuery().deploymentId(null));
}
Also used : DeploymentQuery(org.activiti.engine.repository.DeploymentQuery) ActivitiIllegalArgumentException(org.activiti.engine.ActivitiIllegalArgumentException)

Example 24 with DeploymentQuery

use of org.activiti.engine.repository.DeploymentQuery in project Activiti by Activiti.

the class DeploymentQueryTest method testQueryByProcessDefinitionKey.

public void testQueryByProcessDefinitionKey() {
    DeploymentQuery query = repositoryService.createDeploymentQuery().processDefinitionKey("one");
    assertThat(query.list()).hasSize(1);
    assertThat(query.count()).isEqualTo(1);
    assertThat(query.singleResult()).isNotNull();
}
Also used : DeploymentQuery(org.activiti.engine.repository.DeploymentQuery)

Example 25 with DeploymentQuery

use of org.activiti.engine.repository.DeploymentQuery in project Activiti by Activiti.

the class DeploymentCategoryTest method testDeploymentCategory.

public void testDeploymentCategory() {
    String noCategoryDeploymentId = null;
    String deploymentOneId = null;
    String deploymentTwoV1Id = null;
    String deploymentTwoV2Id = null;
    String deploymentTwoNoCategory = null;
    try {
        noCategoryDeploymentId = repositoryService.createDeployment().name("0").addClasspathResource("org/activiti/engine/test/service/oneTaskProcess.bpmn20.xml").deploy().getId();
        deploymentOneId = repositoryService.createDeployment().name("1").category("one").addClasspathResource("org/activiti/engine/test/repository/one.bpmn20.xml").deploy().getId();
        deploymentTwoV1Id = repositoryService.createDeployment().name("2v1").category("two").addClasspathResource("org/activiti/engine/test/repository/two.bpmn20.xml").deploy().getId();
        deploymentTwoV2Id = repositoryService.createDeployment().name("2v2").category("two").addClasspathResource("org/activiti/engine/test/repository/two.bpmn20.xml").deploy().getId();
        DeploymentQuery query = repositoryService.createDeploymentQuery();
        assertThat(query.list()).hasSize(4);
        Set<String> deploymentNames = getDeploymentNames(repositoryService.createDeploymentQuery().deploymentCategory("one").list());
        Set<String> expectedDeploymentNames = new HashSet<String>();
        expectedDeploymentNames.add("1");
        assertThat(deploymentNames).isEqualTo(expectedDeploymentNames);
        deploymentNames = getDeploymentNames(repositoryService.createDeploymentQuery().deploymentCategoryNotEquals("two").list());
        expectedDeploymentNames.add("0");
        assertThat(deploymentNames).isEqualTo(expectedDeploymentNames);
        deploymentTwoNoCategory = repositoryService.createDeployment().name("noCategory").addClasspathResource("org/activiti/engine/test/repository/two.bpmn20.xml").deploy().getId();
        Deployment deploymentNoCategory = repositoryService.createDeploymentQuery().deploymentId(deploymentTwoNoCategory).singleResult();
        assertThat(deploymentNoCategory.getCategory()).isNull();
        repositoryService.setDeploymentCategory(deploymentTwoNoCategory, "newCategory");
        deploymentNoCategory = repositoryService.createDeploymentQuery().deploymentId(deploymentTwoNoCategory).singleResult();
        assertThat(deploymentNoCategory.getCategory()).isEqualTo("newCategory");
    } finally {
        if (noCategoryDeploymentId != null)
            undeploy(noCategoryDeploymentId);
        if (deploymentOneId != null)
            undeploy(deploymentOneId);
        if (deploymentTwoV1Id != null)
            undeploy(deploymentTwoV1Id);
        if (deploymentTwoV2Id != null)
            undeploy(deploymentTwoV2Id);
        if (deploymentTwoNoCategory != null)
            undeploy(deploymentTwoNoCategory);
    }
}
Also used : DeploymentQuery(org.activiti.engine.repository.DeploymentQuery) Deployment(org.activiti.engine.repository.Deployment) HashSet(java.util.HashSet)

Aggregations

DeploymentQuery (org.activiti.engine.repository.DeploymentQuery)28 Deployment (org.activiti.engine.repository.Deployment)8 BPMNDeployment (org.wso2.carbon.bpmn.core.mgt.model.BPMNDeployment)6 ArrayList (java.util.ArrayList)5 ActivitiException (org.activiti.engine.ActivitiException)3 ActivitiIllegalArgumentException (org.activiti.engine.ActivitiIllegalArgumentException)3 ProcessEngine (org.activiti.engine.ProcessEngine)3 ProcessDefinitionQuery (org.activiti.engine.repository.ProcessDefinitionQuery)3 HashSet (java.util.HashSet)2 RepositoryService (org.activiti.engine.RepositoryService)2 ProcessDefinition (org.activiti.engine.repository.ProcessDefinition)2 PermissionDeniedException (org.alfresco.rest.framework.core.exceptions.PermissionDeniedException)2 Deployment (org.alfresco.rest.workflow.api.model.Deployment)2 BPMNProcess (org.wso2.carbon.bpmn.core.mgt.model.BPMNProcess)2 IOException (java.io.IOException)1 HashMap (java.util.HashMap)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1 DataResponse (org.activiti.rest.common.api.DataResponse)1