public async Task Test_8_3_17_AS4Message_Gets_Delivered_To_Payload_Service() { // Arrange AS4Component.OverrideSettings("8.3.17-settings.xml"); Holodeck.CopyPModeToHolodeckA("8.3.17-pmode.xml"); Holodeck.PutMessageSinglePayloadToHolodeckA("8.3.16-pmode"); // Act AS4Component.Start(); // Assert IEnumerable <FileInfo> deliverables = await PollingService.PollUntilPresentAsync( AS4Component.FullInputPath, fs => fs.Any(f => f.Extension == ".xml")); var doc = new XmlDocument(); doc.LoadXml(File.ReadAllText(deliverables.First().FullName)); XmlElement locationElement = doc["DeliverMessage"]?["Payloads"]?["Payload"]?["Location"]; Assert.True(locationElement != null, "No payload location found in delivered DeliverMessage"); HttpResponseMessage downloadResponse = await PayloadServiceClient.GetAsync(locationElement.InnerText); Assert.Equal(HttpStatusCode.OK, downloadResponse.StatusCode); }
public async Task Test_8_1_16_Respond_With_UserMessage_When_Receive_PullRequest_Result_In_Notified_Receipt() { // Arrange AS4Component.OverrideSettings("8.1.16-settings.xml"); AS4Component.Start(); AS4Component.PutSubmitMessage( "8.1.16-pmode", submit => submit.MessageInfo = new MessageInfo { Mpc = "http://example.holodeckb2b.org/mpc/1" }, AS4Component.SubmitPayloadImage); // Act Holodeck.CopyPModeToHolodeckB("8.1.16-receive-pmode.xml"); Holodeck.CopyPModeToHolodeckB("8.1.16-pmode.xml"); // Assert await PollingService.PollUntilPresentAsync( AS4Component.ReceiptsPath, fs => fs.Any(f => f.Extension == ".xml"), timeout : TimeSpan.FromMinutes(1).Add(TimeSpan.FromSeconds(30))); Holodeck.AssertDeliverMessageOnHolodeckB(); AS4Component.AssertReceipt(); }
public void Test_8_3_18_AS4Message_Gets_Delivered_To_Http_Target() { // Before const string location = "http://localhost:4001/"; using (SpyHttpDeliverTarget deliverTarget = SpyHttpDeliverTarget.AtLocation(location)) { // Arrange Holodeck.CopyPModeToHolodeckA("8.3.18-pmode.xml"); Holodeck.PutMessageSinglePayloadToHolodeckA("8.3.17-pmode"); // Act AS4Component.Start(); // Assert Assert.True(deliverTarget.IsCalled, "Receive Single Payload Deliver HTTP Integration Test failed"); string deliverContent = deliverTarget.DeliveredMessage; Assert.False(String.IsNullOrEmpty(deliverContent), "Delivered Message was empty"); var doc = new XmlDocument(); doc.LoadXml(deliverContent); XmlNode deliverMessageNode = doc.SelectSingleNode("//*[local-name()='DeliverMessage']"); Assert.NotNull(deliverMessageNode); } }
/// <summary> /// Initializes a new instance of the <see cref="ForwardingFacts"/> class. /// </summary> public ForwardingFacts() { AS4Mapper.Initialize(); string RetrieveReceiveAgentUrl(AS4Component as4Component) { var receivingAgent = as4Component.GetConfiguration().GetAgentsConfiguration().FirstOrDefault(a => a.Name.Equals("Receive Agent")); Assert.True(receivingAgent != null, "The Agent with name Receive Agent could not be found"); return(receivingAgent.Settings.Receiver?.Setting?.FirstOrDefault(s => s.Key == "Url")?.Value); } FileSystemUtils.ClearDirectory(@".\config\send-pmodes"); FileSystemUtils.ClearDirectory(@".\config\receive-pmodes"); FileSystemUtils.CopyDirectory(@".\config\scenariotest-settings\send-pmodes", @".\config\send-pmodes"); FileSystemUtils.CopyDirectory(@".\config\scenariotest-settings\receive-pmodes", @".\config\receive-pmodes"); OverrideSettings("forwardingscenario_settings.xml"); _as4Msh = AS4Component.Start(Environment.CurrentDirectory); _receiveAgentUrl = RetrieveReceiveAgentUrl(_as4Msh); }
public void AS4ComponentDoesntAlterEncryptedDataFromOriginalHolodeckMessage() { // Arrange Holodeck.CopyPModeToHolodeckB("8.1.22-pmode.xml"); AS4Component.OverrideSettings(DynamicDiscoverySettings); AS4Component.Start(); InsertSmpConfigurationForAS4Component(ReceiveAgentEndpoint, enableEncryption: false); var str = VirtualStream.Create(); str.Write(Properties.Resources._8_1_22_message, 0, Properties.Resources._8_1_22_message.Length); str.Position = 0; const string contentType = "multipart/related; boundary= \"MIMEBoundary_4ac2a25e8a3af891754f9f7316ac08062c50de1368ddfada\"; type=\"application/soap+xml\";"; // Act new StubSender().SendMessage(str, contentType); // Assert Assert.True( PollingAt(AS4ReceiptsPath), "No Receipt found at AS4.NET Component for Encrypted Dynamic Forwarding Test"); }
public async Task Test_8_3_16_Pulled_AS4Message_Gets_Delivered() { // Arrange AS4Component.OverrideSettings("8.3.16-settings.xml"); AS4Component.Start(); Holodeck.CopyPModeToHolodeckB("8.3.16-pmode.xml"); // Act Holodeck.PutMessageSinglePayloadToHolodeckB("ex-pm-pull-ut"); // Assert await PollingService.PollUntilPresentAsync( AS4Component.FullInputPath, fs => fs.Count() == 2, timeout : TimeSpan.FromSeconds(50)); var deliverDir = new DirectoryInfo(AS4Component.FullInputPath); FileInfo[] deliverables = deliverDir.GetFiles(); Assert.NotNull(deliverables.FirstOrDefault(f => f.Extension == ".xml")); Assert.NotNull(deliverables.FirstOrDefault(f => f.Extension == ".jpg" && f.Length == Holodeck.HolodeckAJpegPayload.Length)); }
/// <summary> /// Initializes a new instance of the <see cref="PiggyBackingFacts"/> class. /// </summary> public PiggyBackingFacts() { OverrideSettings("piggyback_console_settings.xml"); _consoleHost = AS4Component.Start(Environment.CurrentDirectory); _windowsService = new WindowsServiceFixture(); }
public async Task Test_8_2_7_SubmitMessage_With_SendingPMode_Specifying_Non_Existing_Url_Result_In_Send_Exception_On_Disk() { // Act AS4Component.PutSubmitMessage("8.2.7-pmode", AS4Component.SubmitPayloadImage); // Assert await PollingService.PollUntilPresentAsync(AS4Component.ExceptionsPath); }
/// <summary> /// Initializes a new instance of the <see cref="MinderReceiveAgentFacts"/> class. /// </summary> public MinderReceiveAgentFacts() { Settings settings = OverrideSettings("c3_minderreceiveagent_settings.xml"); _receiveUrl = settings.Agents.MinderTestAgents.First(a => a.Enabled).Url; _as4Msh = AS4Component.Start(Environment.CurrentDirectory); }
public async Task Test_8_2_3_SubmitMessage_With_SendingPMode_Id_Of_Invalid_PMode_Result_In_Submit_Exceptions_On_Disk() { // Act AS4Component.PutSubmitMessage("8.2.3-pmode", AS4Component.SubmitPayloadImage); // Assert await AssertOnSubmitExceptionsAsync(); }
public async Task Test_8_2_2_SubmitMessage_With_NonExisting_SendingPMode_Reference_Result_In_Submit_Exceptions_On_Disk() { // Act AS4Component.PutSubmitMessage("8.2.2-pmode", AS4Component.SubmitPayloadImage); // Assert await AssertOnSubmitExceptionsAsync(); }
public async Task Test_8_2_6_SubmitMessage_With_SendingPMode_Referencing_Non_Existing_Encryption_Certificate_Result_In_Send_Exception_On_Disk() { // Act AS4Component.PutSubmitMessage("8.2.6-pmode", AS4Component.SubmitPayloadImage); // Assert await PollingService.PollUntilPresentAsync(AS4Component.ExceptionsPath); }
private static void ExerciseStartCleaning() { var msh = AS4Component.Start(Environment.CurrentDirectory, cleanSlate: false); // Wait till AS4.NET Component has cleaned up the Messages Tables. Thread.Sleep(TimeSpan.FromSeconds(2)); msh.Dispose(); }
private void InsertSmpConfiguration(SmpConfiguration smpConfig) { PollingAt(Path.GetFullPath(@".\database"), "*.db"); // Wait for migrations to complete on datastore Thread.Sleep(TimeSpan.FromSeconds(5)); var spy = new DatastoreSpy(AS4Component.GetConfiguration()); spy.InsertSmpConfiguration(smpConfig); }
public async Task Test_8_2_4_SubmitMessage_With_Invalid_File_Payload_Reference_Result_In_Submit_Exceptions_On_Disk() { // Act AS4Component.PutSubmitMessage( "8.2.4-pmode", submit => submit.Payloads.First().Location = @"file:///C:\NotexistingFolder\earth(2).jpg", AS4Component.SubmitPayloadImage); // Assert await AssertOnSubmitExceptionsAsync(); }
public async Task Test_8_3_11_AS4Message_Gets_Responded_With_Non_Repudiation_Receipt() { // Arrange AS4Component.Start(); Holodeck.CopyPModeToHolodeckA("8.3.11-pmode.xml"); // Act Holodeck.PutMessageSinglePayloadToHolodeckA("8.3.11-pmode"); // Assert await PollingService.PollUntilPresentAsync(Holodeck.HolodeckALocations.InputPath); }
public async Task Test_8_1_18_Respond_With_Error_When_Receive_PullRequest_Is_Not_Authorized() { // Arrange AS4Component.OverrideSettings("8.1.18-settings.xml"); AS4Component.Start(); // Act Holodeck.CopyPModeToHolodeckB("8.1.18-receive-pmode.xml"); Holodeck.CopyPModeToHolodeckB("8.1.18-pmode.xml"); // Assert await PollingService.PollUntilPresentAsync(Holodeck.HolodeckBLocations.InputPath); }
/// <summary> /// Initializes a new instance of the <see cref="RetryAgentForDeliveryFacts"/> class. /// </summary> public RetryAgentForDeliveryFacts() { Settings settings = OverrideSettings("receive_deliver_agent_settings.xml"); _as4Msh = AS4Component.Start(Environment.CurrentDirectory); _databaseSpy = new DatabaseSpy(_as4Msh.GetConfiguration()); _receiveAgentUrl = settings.Agents.ReceiveAgents.First() .Receiver .Setting.FirstOrDefault(s => s.Key == "Url") ?.Value; }
public async Task Test_8_3_14_AS4Message_Test_Message_Gets_Responded_But_Not_Delivered() { // Arrange AS4Component.Start(); Holodeck.CopyPModeToHolodeckA("8.3.14-pmode.xml"); // Act Holodeck.PutMessageSinglePayloadToHolodeckA("8.3.14-pmode"); // Assert await PollingService.PollUntilPresentAsync(Holodeck.HolodeckALocations.InputPath); Assert.Empty(Directory.GetFiles(AS4Component.FullInputPath, "*.xml")); }
public void Dispose() { Disposing(true); if (_restoreSettings && File.Exists(@".\config\settings_original.xml")) { File.Copy(@".\config\settings_original.xml", @".\config\settings.xml", true); } if (_restoreSettings && File.Exists(@".\config\settings_service_original.xml")) { File.Copy(@".\config\settings_service_original.xml", @".\config\settings-service.xml", true); } AS4Component.WriteLogFilesToConsole(); }
public async Task Test_8_1_1_AS4Message_With_Single_Payload_Result_In_Notified_Receipt() { // Arrange AS4Component.Start(); Holodeck.CopyPModeToHolodeckB("8.1.1-pmode.xml"); // Act AS4Component.PutSubmitMessageSinglePayload("8.1.1-pmode"); // Assert await PollingService.PollUntilPresentAsync(AS4Component.ReceiptsPath); Holodeck.AssertSinglePayloadOnHolodeckB(); AS4Component.AssertReceipt(); }
public async Task Test_8_3_13_AS4Message_With_Single_Payload_Gets_Responded_With_Signed_NonRepudiation_Receipt() { // Arrange AS4Component.Start(); Holodeck.CopyPModeToHolodeckA("8.3.13-pmode.xml"); // Act Holodeck.PutMessageSinglePayloadToHolodeckA("8.3.13-pmode"); // Assert await PollingService.PollUntilPresentAsync( Holodeck.HolodeckALocations.InputPath, fs => fs.Any(f => f.Extension == ".xml"), timeout : TimeSpan.FromSeconds(50)); }
private async Task TestAS4MessageWithMultiplePayloadsUsingPModeAsync(string pmodeId) { // Arrange AS4Component.Start(); Holodeck.CopyPModeToHolodeckB($"{pmodeId}.xml"); // Act AS4Component.PutSubmitMessageMultiplePayloads(pmodeId); // Assert await PollingService.PollUntilPresentAsync(AS4Component.ReceiptsPath); AS4Component.AssertMultiplePayloadsOnHolodeckB(); AS4Component.AssertReceipt(); }
public async Task Test_8_2_1_SubmitMessage_That_Tries_To_Override_SendingPMode_Values_Result_In_Submit_Exceptions_On_Disk() { // Act AS4Component.PutSubmitMessage( "8.2.1-pmode", submit => submit.MessageInfo = new MessageInfo { Mpc = "Some other than pmode mpc" }, AS4Component.SubmitPayloadImage); // Assert await PollingService.PollUntilPresentAsync( AS4Component.FullOutputPath, fs => fs.Any(f => f.Name.EndsWith(".exception.details")) && fs.Any(f => f.Name.EndsWith(".exception.details"))); }
private async Task SendPayloadToStaticSubmit(string settingsFile, Func <DatabaseSpy, Task> assertion) { // Arrange OverrideSettings(settingsFile); var msh = AS4Component.Start(Environment.CurrentDirectory); var databaseSpy = new DatabaseSpy(msh.GetConfiguration()); // Act await SubmitAnonymousPayload(); // Assert await assertion(databaseSpy); // TearDown msh.Dispose(); }
public async Task Test_8_3_1_AS4Message_With_Single_Payload_Result_In_File_Deliver() { // Arrange AS4Component.Start(); Holodeck.CopyPModeToHolodeckA("8.3.1-pmode.xml"); // Act Holodeck.PutMessageSinglePayloadToHolodeckA("8.3.1-pmode"); // Assert await PollingService.PollUntilPresentAsync( AS4Component.FullInputPath, fs => fs.Any(f => f.Extension == ".xml")); Holodeck.AssertSinglePayloadOnHolodeckA(); }
/// <summary> /// Initializes a new instance of the <see cref="ReceiveAgentFacts" /> class. /// </summary> public ReceiveAgentFacts() { Settings receiveSettings = OverrideSettings("receiveagent_http_settings.xml"); _as4Msh = AS4Component.Start(Environment.CurrentDirectory); _databaseSpy = new DatabaseSpy(_as4Msh.GetConfiguration()); _receiveAgentUrl = receiveSettings.Agents.ReceiveAgents.First().Receiver.Setting .FirstOrDefault(s => s.Key == "Url") ?.Value; Assert.False( string.IsNullOrWhiteSpace(_receiveAgentUrl), "The URL where the receive agent is listening on, could not be retrieved."); }
private static OutMessage CreateOutMessageRefStoredAS4Message(AS4Component as4Msh) { string ebmsMessageId = $"receipt-{Guid.NewGuid()}"; var store = new AS4MessageBodyFileStore(); return(new OutMessage(ebmsMessageId) { ContentType = Constants.ContentTypes.Soap, MessageLocation = store.SaveAS4Message( as4Msh.GetConfiguration().InMessageStoreLocation, AS4Message.Create( new Receipt( ebmsMessageId, $"reftoid-{Guid.NewGuid()}"))) }); }
public async Task Test_8_3_15_AS4Message_Duplicate_Doesnt_Get_Delivered() { // Arrange AS4Component.Start(); const string contentType = "multipart/related; boundary=\"=-M9awlqbs/xWAPxlvpSWrAg==\"; type=\"application/soap+xml\"; charset=\"utf-8\""; const string messageId = "[email protected]"; // Act await HttpClient.SendMessageAsync(duplicated_as4message, contentType); await HttpClient.SendMessageAsync(duplicated_as4message, contentType); // Assert Assert.Single( Directory.GetFiles(AS4Component.FullInputPath, messageId + ".xml") .Where(f => f.Contains(messageId))); }
public void IntermediateAS4MshCanEncryptSignedMessageAndDoesntAlterSignatureFromOriginalHolodeckMessage() { // Arrange Holodeck.CopyPModeToHolodeckB("8.1.21-pmode.xml"); AS4Component.OverrideSettings(DynamicDiscoverySettings); AS4Component.Start(); InsertEnabledEncryptionForHolodeck(url: ReceiveAgentEndpoint); // Act new StubSender().SendMessage(Properties.Resources._8_1_21_message, Constants.ContentTypes.Soap); // Assert Assert.True( PollingAt(AS4ReceiptsPath), "No Receipt found at AS4.NET Component for Simple Dynamic Discovery Test"); }