Ejemplo n.º 1
0
        public async Task MoveFromScriptingToIntegration()
        {
            using (var scope = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled))
            {
                try
                {
                    var scriptingQueueItems = _unitOfWork.GetScriptingQueueRepository().GetMultiple(q => q.ProcessStage == EnumProcessStage.PostProcess);
                    foreach (var scriptingQueueItem in scriptingQueueItems)
                    {
                        IntegrationQueue integrationQueue = new IntegrationQueue
                        {
                            Guid       = scriptingQueueItem.Guid,
                            TemplateId = scriptingQueueItem.TemplateId,
                            FilenameWithoutExtension = scriptingQueueItem.FilenameWithoutExtension,
                            Extension    = scriptingQueueItem.Extension,
                            Fullpath     = scriptingQueueItem.Fullpath,
                            ProcessStage = EnumProcessStage.Preprocess
                        };
                        _unitOfWork.GetIntegrationQueueRepository().Add(integrationQueue);
                        _unitOfWork.GetScriptingQueueRepository().Delete(pq => pq.Id == scriptingQueueItem.Id);
                    }
                    await _unitOfWork.Commit();

                    scope.Complete();
                }
                catch (Exception ex)
                {
                    scope.Dispose();
                    throw ex;
                }
            }
        }
Ejemplo n.º 2
0
        public void SetUp()
        {
            this.mocks      = new MockRepository();
            workingDirPath  = TempFileUtil.CreateTempDir("workingDir");
            artifactDirPath = TempFileUtil.CreateTempDir("artifactDir");
            Assert.IsTrue(Directory.Exists(workingDirPath));
            Assert.IsTrue(Directory.Exists(artifactDirPath));
            queue             = new IntegrationQueue("foo", new DefaultQueueConfiguration("foo"), null);
            mockery           = new Mockery();
            mockSourceControl = mockery.NewStrictMock(typeof(ISourceControl));
            mockStateManager  = mockery.NewStrictMock(typeof(IStateManager));
            mockTrigger       = mockery.NewStrictMock(typeof(ITrigger));
            mockLabeller      = mockery.NewStrictMock(typeof(ILabeller));
            mockPublisher     = mockery.NewStrictMock((typeof(ITask)));
            mockTask          = mockery.NewStrictMock((typeof(ITask)));

            project = new Project();
            SetupProject();
        }