Exemplo n.º 1
0
        public void verify_timeout_on_missing_commit_not_elapsed()
        {
            var sut = InitCommitSequencer();

            DateTime start  = DateTime.Now;
            var      result = sut.Handle(new TestICommit()
            {
                CheckpointToken = 1L
            });

            result.Should().Be(PollingClient2.HandlingResult.MoveToNext);
            using (DateTimeService.Override(start))
            {
                result = sut.Handle(new TestICommit()
                {
                    CheckpointToken = 3
                });
                result.Should().Be(PollingClient2.HandlingResult.Retry);
            }
            using (DateTimeService.Override(start.AddMilliseconds(_outOfSequenceTimeoutInMilliseconds - 100)))
            {
                result = sut.Handle(new TestICommit()
                {
                    CheckpointToken = 3
                });
                result.Should().Be(PollingClient2.HandlingResult.Retry);
            }
        }
Exemplo n.º 2
0
        public async Task verify_de_duplication__not_delete_original_blob_before_15_days()
        {
            DateTime now = DateTime.UtcNow.AddDays(+14);

            await _documentStoreClient.UploadAsync(TestConfig.PathToDocumentPdf, new DocumentHandle("handleA"));

            await _documentStoreClient.UploadAsync(TestConfig.PathToDocumentPdf, new DocumentHandle("handleB"));

            // wait background projection polling
            await UpdateAndWaitAsync().ConfigureAwait(false);

            using (DateTimeService.Override(() => now))
            {
                //now we need to wait cleanupJobs to start
                ExecuteCleanupJob();
            }
            //verify that blob
            Assert.That(_blobStore.GetDescriptor(new BlobId("original.1")), Is.Not.Null);
            Assert.That(_blobStore.GetDescriptor(new BlobId("original.2")), Is.Not.Null);
        }
Exemplo n.º 3
0
        public async Task verify_delete_remove_document_with_cleanup()
        {
            DateTime now  = DateTime.UtcNow.AddDays(+30);
            var      repo = _tenant.Container.Resolve <IRepositoryEx>();
            await _documentStoreClient.UploadAsync(TestConfig.PathToDocumentPdf, new DocumentHandle("handleX"));

            await UpdateAndWaitAsync().ConfigureAwait(false);

            await _documentStoreClient.DeleteAsync(new DocumentHandle("handleX"));

            await UpdateAndWaitAsync().ConfigureAwait(false);

            using (DateTimeService.Override(() => now))
            {
                //now we need to wait cleanupJobs to start
                ExecuteCleanupJob();
            }

            var aggregate = repo.GetById <Document>(new DocumentId(1L));

            Assert.That(aggregate.Version, Is.EqualTo(0));
        }