Exemple #1
0
        public virtual void testBatchByState()
        {
            // given
            var batch1 = helper.MigrateProcessInstancesAsync(1);
            var batch2 = helper.MigrateProcessInstancesAsync(1);

            helper.CompleteBatch(batch1);

            // when
            var historicBatch = historyService.CreateHistoricBatchQuery()
                                // .Completed(true)
                                .First();

            // then
            Assert.AreEqual(batch1.Id, historicBatch.Id);

            // when
            historicBatch = historyService.CreateHistoricBatchQuery()
                            //.Completed(false)
                            .First();

            // then
            Assert.AreEqual(batch2.Id, historicBatch.Id);
        }
        public virtual void testQuery()
        {
            var statistics = managementService.CreateBatchStatisticsQuery()

                             .ToList();

            Assert.AreEqual(0, statistics.Count);

            var batch1 = helper.CreateMigrationBatchWithSize(1);

            statistics = managementService.CreateBatchStatisticsQuery()

                         .ToList();
            Assert.AreEqual(1, statistics.Count);
            Assert.AreEqual(batch1.Id, statistics[0].Id);

            var batch2 = helper.CreateMigrationBatchWithSize(1);
            var batch3 = helper.CreateMigrationBatchWithSize(1);

            statistics = managementService.CreateBatchStatisticsQuery()

                         .ToList();
            Assert.AreEqual(3, statistics.Count);

            helper.CompleteBatch(batch1);
            helper.CompleteBatch(batch3);

            statistics = managementService.CreateBatchStatisticsQuery()

                         .ToList();
            Assert.AreEqual(1, statistics.Count);
            Assert.AreEqual(batch2.Id, statistics[0].Id);

            helper.CompleteBatch(batch2);

            statistics = managementService.CreateBatchStatisticsQuery()

                         .ToList();
            Assert.AreEqual(0, statistics.Count);
        }