private void SinkFromFactory(SinkData sink) { LogSinkFactory factory = new LogSinkFactory(Context); ILogSink output = factory.CreateSink(sink.Name); Assert.IsNotNull(output); }
protected override Type GetConfigurationType(string sinkName) { LoggingConfigurationView loggingConfigurationView = (LoggingConfigurationView)CreateConfigurationView(); SinkData data = loggingConfigurationView.GetSinkData(sinkName); return(GetType(data.TypeName)); }
/// <summary> /// Creates node with specified configuration data. /// </summary> protected SinkNode(SinkData sinkData) : base() { if (sinkData == null) { throw new ArgumentNullException("sinkData"); } this.sinkData = sinkData; }
public SinkData AllocateSink(MyDefinitionId id) { var td = Type(id); var sink = new SinkData(this, id); td.Sinks.Add(sink); return(sink); }
private MsmqSinkData GetMsmqSinkDataFromCursor() { SinkData sinkData = loggingConfigurationView.GetSinkData(ConfigurationName); ArgumentValidation.CheckExpectedType(sinkData, typeof(MsmqSinkData)); return((MsmqSinkData)sinkData); }
private EmailSinkData GetEmailSinkDataFromView() { SinkData sinkData = loggingConfigurationView.GetSinkData(ConfigurationName); ArgumentValidation.CheckExpectedType(sinkData, typeof(EmailSinkData)); return((EmailSinkData)sinkData); }
private DatabaseSink CreateSink(SinkData sinkData) { DatabaseSink databaseSink = new DatabaseSink(); databaseSink.Initialize(new TestLoggingConfigurationView(sinkData, Context)); return(databaseSink); }
public override void OnBeforeRemovedFromContainer() { if (_operationalSink != null) { FreeSink(_operationalSink); _operationalSink = null; } base.OnBeforeRemovedFromContainer(); _resourceSink.OnBeforeRemovedFromContainer(); }
public override void OnAddedToContainer() { base.OnAddedToContainer(); _resourceSink.OnAddedToContainer(); if (Entity is IMyFunctionalBlock) { _operationalSink = AllocateSink(ConstantDefs.ElectricityId); _operationalSink.RequiredPower = _operationalSink.MaxPower = 50e-3f; // 50 W } }
public void FreeSink(SinkData sink) { var td = Type(sink.Id); td.Sinks.Remove(sink); if (td.Sinks.Count == 0) { _sinks.Remove(sink.Id); } }
/// <summary> /// Gets the <see cref="SinkData"></see> associated with the named logging sink /// </summary> /// <param name="sinkName">Name of the sink as defined in configuration</param> /// <returns><see cref="SinkData"></see> defined for named logging sink</returns> public virtual SinkData GetSinkData(string sinkName) { ArgumentValidation.CheckForNullReference(sinkName, "sinkName"); ArgumentValidation.CheckForEmptyString(sinkName, "sinkName"); DistributorSettings settings = GetDistributorSettings(); SinkData sinkData = settings.SinkDataCollection[sinkName]; if (null == sinkData) { throw new ConfigurationException(SR.ExceptionNoSinkDefined(sinkName)); } return(sinkData); }
public TestLogSinkConfigurationView(SinkData data) : base(new ConfigurationContext(new ConfigurationDictionary())) { this.data = data; }
public TestLoggingConfigurationView(SinkData data, ConfigurationContext context) : base(context) { this.data = data; }
public void UpdateIncomingMessageSinksCompanyServiceNetworkTest() { var managementClient = new ManagementClient(ManagementApi); managementClient.User.Register(new Register { Email = Guid.NewGuid() + "@test.hu", Name = "test user", Password = "******" }); var companyId = managementClient.Company.Create(new Company { Name = "company" }); var serviceId = managementClient.Service.Create(new Service { CompanyId = companyId, Name = "árvíztűrő tükörfúrógép" }); var networkId = managementClient.Network.Create(new Network { CompanyId = companyId, ServiceId = serviceId, Name = "árvíztűrő tükörfúrógép" }); var telemetryDataSinkParameters = new List <TelemetryDataSinkParameters> { new TelemetryDataSinkParameters { SinkName = SinkData, Parameters = new Dictionary <string, string>() }, new TelemetryDataSinkParameters { SinkName = SinkTimeSeries, Parameters = new Dictionary <string, string>() } }; managementClient.Company.UpdateIncomingTelemetryDataSinks(companyId, telemetryDataSinkParameters); managementClient.Service.UpdateIncomingTelemetryDataSinks(serviceId, telemetryDataSinkParameters); managementClient.Network.UpdateIncomingTelemetryDataSinks(networkId, telemetryDataSinkParameters); var company = managementClient.Company.Get(companyId); var service = managementClient.Service.Get(serviceId); var network = managementClient.Network.Get(networkId); Assert.AreEqual(2, company.TelemetryDataSinkSettings.Incoming.Count); Assert.IsTrue(company.TelemetryDataSinkSettings.Incoming.Any(i => i.SinkName == SinkData.ToLowerInvariant())); Assert.IsTrue(company.TelemetryDataSinkSettings.Incoming.Any(i => i.SinkName == SinkTimeSeries.ToLowerInvariant())); Assert.AreEqual(2, service.TelemetryDataSinkSettings.Incoming.Count); Assert.IsTrue(service.TelemetryDataSinkSettings.Incoming.Any(i => i.SinkName == SinkData.ToLowerInvariant())); Assert.IsTrue(service.TelemetryDataSinkSettings.Incoming.Any(i => i.SinkName == SinkTimeSeries.ToLowerInvariant())); Assert.AreEqual(2, network.TelemetryDataSinkSettings.Incoming.Count); Assert.IsTrue(network.TelemetryDataSinkSettings.Incoming.Any(i => i.SinkName == SinkData.ToLowerInvariant())); Assert.IsTrue(network.TelemetryDataSinkSettings.Incoming.Any(i => i.SinkName == SinkTimeSeries.ToLowerInvariant())); }