Esempio n. 1
0
        public void MessageOlderThanRetentionDateWillBeDeleted(string specificSettings)
        {
            // Arrange: Insert a "retired" OutMessage with a referenced Reception Awareness.
            OverrideWithSpecificSettings(specificSettings);

            IConfig config = EnsureLocalConfigPointsToCreatedDatastore();
            string  outReferenceId = GenId(), outStandaloneId = GenId(),
                    inMessageId = GenId(), outExceptionId = GenId(),
                    inExceptionId = GenId();

            var        spy = new DatabaseSpy(config);
            OutMessage om  = CreateOutMessage(outReferenceId, insertionTime: DayBeforeYesterday, type: MessageType.Error);

            spy.InsertOutMessage(om);
            spy.InsertRetryReliability(RetryReliability.CreateForOutMessage(om.Id, maxRetryCount: 0, retryInterval: default(TimeSpan), type: RetryType.Send));
            spy.InsertOutMessage(CreateOutMessage(outStandaloneId, insertionTime: DayBeforeYesterday, type: MessageType.Receipt));
            spy.InsertInMessage(CreateInMessage(inMessageId, DayBeforeYesterday));
            spy.InsertOutException(CreateOutException(outExceptionId, DayBeforeYesterday));
            spy.InsertInException(CreateInException(inExceptionId, DayBeforeYesterday));

            // Act: AS4.NET Component will start the Clean Up Agent.
            ExerciseStartCleaning();

            // Assert: No OutMessage or Reception Awareness entries must be found for a given EbmsMessageId.
            Assert.Empty(spy.GetOutMessages(outReferenceId, outStandaloneId));
            Assert.Null(spy.GetRetryReliabilityFor(r => r.RefToOutMessageId == om.Id));
            Assert.Empty(spy.GetInMessages(inMessageId));
            Assert.Empty(spy.GetOutExceptions(outExceptionId));
            Assert.Empty(spy.GetInExceptions(inExceptionId));
        }
Esempio n. 2
0
 private void InsertRetryReliability(long id, int maxRetryCount)
 {
     _databaseSpy.InsertRetryReliability(
         RetryReliability.CreateForOutMessage(
             refToOutMessageId: id,
             maxRetryCount: maxRetryCount,
             retryInterval: TimeSpan.FromMilliseconds(1),
             type: RetryType.PiggyBack));
 }