Пример #1
0
        public async Task ThenMultiHopSignalMessageIsToBeForwarded()
        {
            // Arrange
            SignalMessage signal = CreateMultihopSignalMessage(
                refToMessageId: "someusermessageid",
                pmodeId: "Forward_Push");

            // Act
            await StubSender.SendAS4Message(_receiveAgentUrl, AS4Message.Create(signal));

            // Assert
            InMessage inMessage = _databaseSpy.GetInMessageFor(m => m.EbmsMessageId == signal.MessageId);

            Assert.NotNull(inMessage);
            Assert.True(inMessage.Intermediary);
            Assert.Equal(Operation.ToBeForwarded, inMessage.Operation);

            Stream messageBody = await Registry.Instance
                                 .MessageBodyStore
                                 .LoadMessageBodyAsync(inMessage.MessageLocation);

            AS4Message savedMessage = await SerializerProvider.Default
                                      .Get(inMessage.ContentType)
                                      .DeserializeAsync(messageBody, inMessage.ContentType);

            Assert.NotNull(savedMessage.EnvelopeDocument.SelectSingleNode("//*[local-name()='RoutingInput']"));
        }
Пример #2
0
        public async Task ThenMultiHopSignalMessageThatHasReachedItsDestinationIsNotified()
        {
            // Arrange
            const string messageId    = "some-user-message-id";
            var          sendingPMode = new SendingProcessingMode
            {
                ReceiptHandling = new SendReceiptHandling
                {
                    NotifyMessageProducer = true,
                    NotifyMethod          = new Method
                    {
                        Type       = "FILE",
                        Parameters = new List <Parameter>
                        {
                            new Parameter
                            {
                                Name  = "Location",
                                Value = @".\messages\receipts"
                            }
                        }
                    }
                }
            };

            StoreToBeAckOutMessage(messageId, sendingPMode);

            SignalMessage signal = CreateMultihopSignalMessage(
                refToMessageId: messageId,
                pmodeId: "ComponentTest_ReceiveAgent_Sample1");

            // Act
            await StubSender.SendAS4Message(_receiveAgentUrl, AS4Message.Create(signal));

            // Assert
            var inMessage = _databaseSpy.GetInMessageFor(m => m.EbmsRefToMessageId == messageId);

            Assert.NotNull(inMessage);
            Assert.Equal(Operation.ToBeNotified, inMessage.Operation);

            var outMessage = _databaseSpy.GetOutMessageFor(m => m.EbmsMessageId == messageId);

            Assert.NotNull(outMessage);
            Assert.Equal(OutStatus.Ack, outMessage.Status.ToEnum <OutStatus>());
        }