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 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 ElasticModule(IConfiguration config, PollingService poller) : base(config, poller) { Clusters = Settings.Clusters .Select(c => new ElasticCluster(this, c)) .Where(i => i.TryAddToGlobalPollers()) .ToList(); }
public ExceptionsModule(IConfiguration config, PollingService poller) : base(config, poller) { Stores = Settings.Stores .Select(s => new ExceptionStore(this, s)) .Where(s => s.TryAddToGlobalPollers()) .ToList(); }
private void _service_Connected(object sender, PviEventArgs e) { string serviceName = String.Empty; if (sender is Service service) { serviceName = service.FullName; } var cpuWrapper = new CpuWrapper(_service, _eventNotifier); var variableWrapper = new VariableWrapper(_service, _eventNotifier); var fw = new FileWrapper(); var cpuManager = new CpuManager(cpuWrapper); var variableInfo = new VariableInfoCollection(fw); var variableManager = new VariableManager(variableWrapper, variableInfo); var pviEventMsg = Utils.FormatPviEventMessage($"ServiceWrapper._service_Connected; ServiceName={serviceName}", e); _eventNotifier.OnPviServiceConnected(sender, new PviApplicationEventArgs() { Message = pviEventMsg, ServiceWrapper = this, CpuManager = cpuManager, CpuWrapper = cpuWrapper, VariableManager = variableManager, VariableWrapper = variableWrapper }); _pollingService = new PollingService(_service, cpuManager); _pollingService.Start(); }
private static async Task AssertOnSubmitExceptionsAsync() { await PollingService.PollUntilPresentAsync( AS4Component.FullOutputPath, fs => fs.Any(f => f.Name.EndsWith(".exception.details")) && fs.Any(f => f.Name.EndsWith(".exception.details"))); }
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)); }
protected override void OnResume() { base.OnResume(); mPollingService = new PollingService <IList <Park> >(UpdateUi); mPollingService.StartTimer(); }
public PagerDutyModule(IConfiguration config, PollingService poller) : base(config, poller) { if (Settings.Enabled) { API = new PagerDutyAPI(this); API.TryAddToGlobalPollers(); } }
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); }
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); }
public HAProxyModule(IConfiguration config, PollingService poller) : base(config, poller) { var snapshot = Settings; Groups = snapshot.Groups.Select(g => new HAProxyGroup(this, g)) .Union(snapshot.Instances.Select(c => new HAProxyGroup(this, c))) .ToList(); Admin = new HAProxyAdmin(this); }
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); }
public CloudflareModule(IConfiguration config, PollingService poller) : base(config, poller) { if (Settings.Enabled) { API = new CloudflareAPI(this); API.TryAddToGlobalPollers(); AllDatacenters = Settings?.DataCenters .ToDictionary( dc => dc.Name, dc => dc.Ranges.Concat(dc.MaskedRanges).Select(r => IPNet.Parse(r)).ToList() ) ?? new Dictionary <string, List <IPNet> >(); } }
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 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)); }
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(); }
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_4_1_Received_AS4Message_That_Cant_Be_Linked_To_ReceivingPMode_Result_In_Processing_Error() { // Arrange Holodeck.CopyPModeToHolodeckA("8.4.1-pmode.xml"); // Act Holodeck.PutMessageSinglePayloadToHolodeckA("8.4.1-pmode"); // Assert await PollingService.PollUntilPresentAsync( Holodeck.HolodeckALocations.InputPath, fs => fs.Any(f => f.Extension == ".xml")); Holodeck.AssertErrorOnHolodeckA(ErrorCode.Ebms0001); }
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(); }
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"))); }
public void TestPolling() { var yn = PollingService.ConvertAbcToYnStatic("ABC"); var yn1 = PollingService.ConvertAbcToYnStatic("aC"); var yn2 = PollingService.ConvertAbcToYnStatic("D"); var yn3 = PollingService.ConvertAbcToYnStatic("ABCDEFGHIJK"); var yn4 = PollingService.ConvertAbcToYnStatic("AAACV"); var yn5 = PollingService.ConvertAbcToYnStatic("DCAE"); Assert.AreEqual("YYYNNNNNNN", yn); Assert.AreEqual("YNYNNNNNNN", yn1); Assert.AreEqual("NNNYNNNNNN", yn2); Assert.AreEqual("YYYYYYYYYY", yn3); Assert.AreEqual("YNYNNNNNNN", yn4); Assert.AreEqual("YNYYYNNNNN", yn5); }
public RedisModule(IConfiguration config, PollingService poller, AddressCache addressCache) : base(config, poller) { Connections = LoadRedisConnections(Settings, addressCache); Instances = Connections.Select(rci => new RedisInstance(this, rci)) .Where(rsi => rsi.TryAddToGlobalPollers()) .ToList(); Hosts = Instances.GroupBy(i => i.ConnectionInfo.Server) .Select(g => { g.Key.Instances = g.ToList(); return(g.Key); }) .ToList(); ReplicationGroups = Hosts.Where(h => h.ReplicationGroupName.HasValue()) .GroupBy(h => h.ReplicationGroupName) .Select(g => new RedisReplicationGroup(g.Key, g.ToList())) .ToList(); HostNames = new HashSet <string>(Hosts.Select(h => h.HostName), StringComparer.OrdinalIgnoreCase); }
private async Task TestAS4MessageWithMultiplePayloadsUsingPModeAsync(string pmodeId) { // Arrange AS4Component.Start(); Holodeck.CopyPModeToHolodeckA($"{pmodeId}.xml"); // Act Holodeck.PutMessageTwoPayloadsToHolodeckA(pmodeId); // Assert await PollingService.PollUntilPresentAsync( AS4Component.FullInputPath, fs => fs.Count() == 3 && fs.Count(f => f.Extension == ".jpg") == 1 && fs.Count(f => f.Extension == ".xml") == 2); Holodeck.AssertSinglePayloadOnHolodeckA(); }
public SQLModule(IConfiguration config, PollingService poller) : base(config, poller) { AzureServers = Settings.Instances .Where(i => i.Type == SQLSettings.InstanceType.Azure) .Select(i => new SQLAzureServer(this, i)) .Where(i => i.TryAddToGlobalPollers()) .ToList(); StandaloneInstances = Settings.Instances .Where(i => i.Type == SQLSettings.InstanceType.Default) .Select(i => new SQLInstance(this, i)) .Where(i => i.TryAddToGlobalPollers()) .ToList(); Clusters = Settings.Clusters.Select(c => new SQLCluster(this, c)).ToList(); AllInstances = StandaloneInstances .Union(AzureServers.SelectMany(s => s.Instances.SafeData(true))) .Union(Clusters.SelectMany(n => n.Nodes)); }
private void SetupPolling() { _logger.Info("Setting up polling service"); var pollingClients = RetrieveJobs(Settings.ConfigServiceUrl).ToList(); _logger.Info("{0} clients configured".Fmt(pollingClients.Count())); // retrieve configured clients foreach (var clientSettings in pollingClients) { _logger.Info("Setting up polling service"); // create service var pollingSvc = new PollingService(Program.Container.GetInstance <IScheduler>(), Program.Container.GetInstance <ILogger>()); _pollingJobs.Add(pollingSvc); // start the service pollingSvc.Start(clientSettings); } }
public DashboardModule(IConfiguration config, ILoggerFactory loggerFactory, PollingService poller, AddressCache addressCache) : base(config, poller) { AddressCache = addressCache; var providers = Settings.Providers; if (providers?.Any() != true) { Providers.Add(new EmptyDataProvider(this, "EmptyDataProvider")); return; } Enabled = true; foreach (var p in providers.All) { p?.Normalize(); } // Add each provider type here if (providers.Bosun != null) { Providers.Add(new BosunDataProvider(this, providers.Bosun)); } if (providers.Orion != null) { Providers.Add(new OrionDataProvider(this, providers.Orion)); } if (providers.WMI != null && OperatingSystem.IsWindows()) { Providers.Add(new WmiDataProvider(this, providers.WMI)); } if (providers.SignalFx != null) { Providers.Add(new SignalFxDataProvider(this, providers.SignalFx, loggerFactory.CreateLogger <SignalFxDataProvider>())); } Providers.ForEach(p => p.TryAddToGlobalPollers()); AllCategories = Settings.Categories .Select(sc => new DashboardCategory(this, sc)) .ToList(); }
public HomeController( IOptions <OpserverSettings> _settings, PollingService poller, IEnumerable <StatusModule> modules, DashboardModule dashboard, SQLModule sql, RedisModule redis, ElasticModule elastic, ExceptionsModule exceptions, HAProxyModule haproxy ) : base(_settings) { Poller = poller; Modules = modules; Dashboard = dashboard; Sql = sql; Redis = redis; Elastic = elastic; Exceptions = exceptions; HAProxy = haproxy; }
public async Task Test_8_1_15_SubmitMessage_Via_Http_Result_In_Notified_Receipt() { // Arrange AS4Component.OverrideSettings("8.1.15-settings.xml"); AS4Component.Start(); const string submitAgentHttpEndpoint = "http://localhost:5001/"; Holodeck.CopyPModeToHolodeckB("8.1.15-pmode.xml"); // Act await HttpClient.SendMessageAsync( submitAgentHttpEndpoint, submitmessage_8_1_15_xml, "application/xml"); // Assert await PollingService.PollUntilPresentAsync(AS4Component.ReceiptsPath); Holodeck.AssertSinglePayloadOnHolodeckB(); AS4Component.AssertReceipt(); }