Search in sources :

Example 6 with DeploymentQuery

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

the class SpringAutoDeployTest method testNoRedeploymentForSpringContainerRestart.

public void testNoRedeploymentForSpringContainerRestart() throws Exception {
    createAppContext(CTX_PATH);
    DeploymentQuery deploymentQuery = repositoryService.createDeploymentQuery();
    assertEquals(1, deploymentQuery.count());
    ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery();
    assertEquals(3, processDefinitionQuery.count());
    // Creating a new app context with same resources doesn't lead to more
    // deployments
    new ClassPathXmlApplicationContext(CTX_NO_DROP_PATH);
    assertEquals(1, deploymentQuery.count());
    assertEquals(3, processDefinitionQuery.count());
}
Also used : DeploymentQuery(org.activiti.engine.repository.DeploymentQuery) ClassPathXmlApplicationContext(org.springframework.context.support.ClassPathXmlApplicationContext) ProcessDefinitionQuery(org.activiti.engine.repository.ProcessDefinitionQuery)

Example 7 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();
        assertEquals(4, query.list().size());
        Set<String> deploymentNames = getDeploymentNames(repositoryService.createDeploymentQuery().deploymentCategory("one").list());
        Set<String> expectedDeploymentNames = new HashSet<String>();
        expectedDeploymentNames.add("1");
        assertEquals(expectedDeploymentNames, deploymentNames);
        deploymentNames = getDeploymentNames(repositoryService.createDeploymentQuery().deploymentCategoryNotEquals("two").list());
        expectedDeploymentNames.add("0");
        assertEquals(expectedDeploymentNames, deploymentNames);
        deploymentTwoNoCategory = repositoryService.createDeployment().name("noCategory").addClasspathResource("org/activiti/engine/test/repository/two.bpmn20.xml").deploy().getId();
        Deployment deploymentNoCategory = repositoryService.createDeploymentQuery().deploymentId(deploymentTwoNoCategory).singleResult();
        assertNull(deploymentNoCategory.getCategory());
        repositoryService.setDeploymentCategory(deploymentTwoNoCategory, "newCategory");
        deploymentNoCategory = repositoryService.createDeploymentQuery().deploymentId(deploymentTwoNoCategory).singleResult();
        assertEquals("newCategory", deploymentNoCategory.getCategory());
    } 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)

Example 8 with DeploymentQuery

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

the class DeploymentQueryTest method testQueryByDeploymentId.

public void testQueryByDeploymentId() {
    DeploymentQuery query = repositoryService.createDeploymentQuery().deploymentId(deploymentOneId);
    assertNotNull(query.singleResult());
    assertEquals(1, query.list().size());
    assertEquals(1, query.count());
}
Also used : DeploymentQuery(org.activiti.engine.repository.DeploymentQuery)

Example 9 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");
    assertNull(query.singleResult());
    assertEquals(0, query.list().size());
    assertEquals(0, query.count());
    try {
        repositoryService.createDeploymentQuery().deploymentId(null);
        fail();
    } catch (ActivitiIllegalArgumentException e) {
    }
}
Also used : DeploymentQuery(org.activiti.engine.repository.DeploymentQuery) ActivitiIllegalArgumentException(org.activiti.engine.ActivitiIllegalArgumentException)

Example 10 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%");
    assertEquals(2, query.list().size());
    assertEquals(2, query.count());
}
Also used : DeploymentQuery(org.activiti.engine.repository.DeploymentQuery)

Aggregations

DeploymentQuery (org.activiti.engine.repository.DeploymentQuery)17 ActivitiIllegalArgumentException (org.activiti.engine.ActivitiIllegalArgumentException)3 ActivitiException (org.activiti.engine.ActivitiException)2 HashSet (java.util.HashSet)1 Deployment (org.activiti.engine.repository.Deployment)1 ProcessDefinitionQuery (org.activiti.engine.repository.ProcessDefinitionQuery)1 DataResponse (org.activiti.rest.common.api.DataResponse)1 ClassPathXmlApplicationContext (org.springframework.context.support.ClassPathXmlApplicationContext)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1