Ejemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testBatchQueryByActiveBatches()
        public virtual void testBatchQueryByActiveBatches()
        {
            // given
            Batch batch1 = helper.migrateProcessInstancesAsync(1);
            Batch batch2 = helper.migrateProcessInstancesAsync(1);
            Batch batch3 = helper.migrateProcessInstancesAsync(1);

            // when
            managementService.suspendBatchById(batch1.Id);
            managementService.suspendBatchById(batch2.Id);
            managementService.activateBatchById(batch1.Id);

            // then
            BatchQuery query = managementService.createBatchQuery().active();

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

            IList <string> foundIds = new List <string>();

            foreach (Batch batch in query.list())
            {
                foundIds.Add(batch.Id);
            }
            Assert.assertThat(foundIds, hasItems(batch1.Id, batch3.Id));
        }
Ejemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setUpBatchQueryMock()
        public virtual void setUpBatchQueryMock()
        {
            IList <Batch> mockedBatches = MockProvider.createMockBatches();

            queryMock = mock(typeof(BatchQuery));

            when(queryMock.list()).thenReturn(mockedBatches);
            when(queryMock.count()).thenReturn((long)mockedBatches.Count);

            when(processEngine.ManagementService.createBatchQuery()).thenReturn(queryMock);
        }
Ejemplo n.º 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testBatchQueryBySuspendedBatches()
        public virtual void testBatchQueryBySuspendedBatches()
        {
            // given
            Batch batch1 = helper.migrateProcessInstancesAsync(1);
            Batch batch2 = helper.migrateProcessInstancesAsync(1);

            helper.migrateProcessInstancesAsync(1);

            // when
            managementService.suspendBatchById(batch1.Id);
            managementService.suspendBatchById(batch2.Id);
            managementService.activateBatchById(batch1.Id);

            // then
            BatchQuery query = managementService.createBatchQuery().suspended();

            Assert.assertEquals(1, query.count());
            Assert.assertEquals(1, query.list().size());
            Assert.assertEquals(batch2.Id, query.singleResult().Id);
        }
Ejemplo n.º 4
0
        public virtual IList <BatchDto> getBatches(UriInfo uriInfo, int?firstResult, int?maxResults)
        {
            BatchQueryDto queryDto = new BatchQueryDto(ObjectMapper, uriInfo.QueryParameters);
            BatchQuery    query    = queryDto.toQuery(ProcessEngine);

            IList <Batch> matchingBatches;

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

            IList <BatchDto> batchResults = new List <BatchDto>();

            foreach (Batch matchingBatch in matchingBatches)
            {
                batchResults.Add(BatchDto.fromBatch(matchingBatch));
            }
            return(batchResults);
        }