Пример #1
0
        public virtual void testQueryByNameLike()
        {
            DeploymentQuery query = repositoryService.createDeploymentQuery().deploymentNameLike("%camunda%");

            assertEquals(2, query.list().size());
            assertEquals(2, query.count());

            query = repositoryService.createDeploymentQuery().deploymentNameLike("%two\\_%");
            assertEquals(1, query.list().size());
            assertEquals(1, query.count());
            assertEquals("org/camunda/bpm/engine/test/repository/two_.bpmn20.xml", query.singleResult().Name);
        }
Пример #2
0
        public virtual void testQueryByInvalidSource()
        {
            DeploymentQuery query = repositoryService.createDeploymentQuery().deploymentSource("invalid");

            assertEquals(0, query.list().size());
            assertEquals(0, query.count());
        }
Пример #3
0
        public virtual void testQueryByNullSource()
        {
            DeploymentQuery query = repositoryService.createDeploymentQuery().deploymentSource(null);

            assertEquals(1, query.list().size());
            assertEquals(1, query.count());
        }
Пример #4
0
        public virtual void testQueryBySource()
        {
            DeploymentQuery query = repositoryService.createDeploymentQuery().deploymentSource(org.camunda.bpm.engine.repository.ProcessApplicationDeployment_Fields.PROCESS_APPLICATION_DEPLOYMENT_SOURCE);

            assertEquals(1, query.list().size());
            assertEquals(1, query.count());
        }
Пример #5
0
        public virtual IList <DeploymentDto> getDeployments(UriInfo uriInfo, int?firstResult, int?maxResults)
        {
            DeploymentQueryDto queryDto = new DeploymentQueryDto(ObjectMapper, uriInfo.QueryParameters);

            ProcessEngine   engine = ProcessEngine;
            DeploymentQuery query  = queryDto.toQuery(engine);

            IList <Deployment> matchingDeployments;

            if (firstResult != null || maxResults != null)
            {
                matchingDeployments = executePaginatedQuery(query, firstResult, maxResults);
            }
            else
            {
                matchingDeployments = query.list();
            }

            IList <DeploymentDto> deployments = new List <DeploymentDto>();

            foreach (Deployment deployment in matchingDeployments)
            {
                DeploymentDto def = DeploymentDto.fromDeployment(deployment);
                deployments.Add(def);
            }
            return(deployments);
        }
Пример #6
0
        public virtual void testQueryByDeploymentId()
        {
            DeploymentQuery query = repositoryService.createDeploymentQuery().deploymentId(deploymentOneId);

            assertNotNull(query.singleResult());
            assertEquals(1, query.list().size());
            assertEquals(1, query.count());
        }
Пример #7
0
        private DeploymentQuery setUpMockDeploymentQuery(IList <Deployment> mockedDeployments)
        {
            DeploymentQuery sampleDeploymentQuery = mock(typeof(DeploymentQuery));

            when(sampleDeploymentQuery.list()).thenReturn(mockedDeployments);
            when(sampleDeploymentQuery.count()).thenReturn((long)mockedDeployments.Count);
            when(processEngine.RepositoryService.createDeploymentQuery()).thenReturn(sampleDeploymentQuery);
            return(sampleDeploymentQuery);
        }
Пример #8
0
        public virtual void testQueryNoCriteria()
        {
            DeploymentQuery query = repositoryService.createDeploymentQuery();

            assertEquals(2, query.list().size());
            assertEquals(2, query.count());

            try
            {
                query.singleResult();
                fail();
            }
            catch (ProcessEngineException)
            {
            }
        }
Пример #9
0
        public virtual 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 (ProcessEngineException)
            {
            }
        }