예제 #1
0
        private void EvaluateLogMethod(ClassificationDeclaration classificationDeclaration)
        {
            RollbarConfig loggerConfig = ProvideRollbarConfig();

            object payload = null;

            switch (classificationDeclaration.PayloadType)
            {
            case PayloadType.Message:
            {
                payload = ProvideObjectToLog(classificationDeclaration);
            }
            break;

            case PayloadType.Exception:
            {
                payload = ProvideObjectToLog(classificationDeclaration);
            }
            break;

            default:
                break;
            }
            Assert.IsNotNull(payload);

            // Let's give things change to stabilize:
            //Thread.Sleep(TimeSpan.FromSeconds(2));

            using (var rollbar = RollbarFactory.CreateNew().Configure(loggerConfig))
            {
                for (int i = 0; i < Constants.TotalMeasurementSamples; i++)
                {
                    switch (classificationDeclaration.MethodVariant)
                    {
                    case MethodVariant.Async:
                    {
                        ILogger logger = rollbar;
                        using (PerformanceUtil.GetPerformanceTimer(classificationDeclaration))
                        {
                            logger.Log(ErrorLevel.Warning, payload);
                        }
                        break;
                    }

                    case MethodVariant.AsyncWaited:
                    {
                        ILogger logger = rollbar;
                        using (PerformanceUtil.GetPerformanceTimer(classificationDeclaration))
                        {
                            //TODO: implement and add SynchronousPackage around the payload object!!!
                            logger.Log(ErrorLevel.Warning, new ObjectPackage(payload, true));
                            //logger.Log(ErrorLevel.Warning, payload);
                        }
                        break;
                    }

                    case MethodVariant.Blocking:
                    {
                        // NOTE: for blocking call we want to eliminate effect of
                        // the max reporting rate restriction, so that the wait time
                        // that is a result of the rate limit is not counted against
                        // the blocking call:
                        BlockUntilRollbarQueuesAreEmpty();
                        Thread.Sleep(TimeSpan.FromSeconds(60 / rollbar.Config.MaxReportsPerMinute));

                        ILogger logger = rollbar.AsBlockingLogger(Constants.RollbarBlockingTimeout);
                        using (PerformanceUtil.GetPerformanceTimer(classificationDeclaration))
                        {
                            logger.Log(ErrorLevel.Critical, payload);
                        }
                        break;
                    }

                    default:
                        // nothing to do...
                        break;
                    }
                }

                //BlockUntilRollbarQueuesAreEmpty();
                //Thread.Sleep(TimeSpan.FromMilliseconds(250));
                //if (classificationDeclaration.MethodVariant == MethodVariant.Async)
                //{
                //    // NOTE: for async call we want to make sure the logger's instance is not
                //    // disposed until all the buffered payloads delivered to the Rollbar API.
                //    // This delay ios needed until issue #197 is resolved...
                //    BlockUntilRollbarQueuesAreEmpty();
                //}
            }
        }
예제 #2
0
        public void TestRollbarConfigEqualityMethod()
        {
            RollbarConfig rConfig = new RollbarConfig("12345")
            {
                Environment = "env1"
            };

            // test the same config instance references:
            Assert.IsTrue(rConfig.Equals(rConfig), "Same instances are always equal.");

            RollbarConfig rConfigSimilar = new RollbarConfig("12345")
            {
                Environment = "env1"
            };                                                                                  // same as rConfig...
            RollbarConfig rConfigOneDiff = new RollbarConfig("12345")
            {
                Environment = "env2"
            };
            RollbarConfig rConfigAnotherDiff = new RollbarConfig("02345")
            {
                Environment = "env1"
            };
            RollbarConfig rConfigTwoDiffs = new RollbarConfig("02345")
            {
                Environment = "env2"
            };
            RollbarConfig rConfigOneNullifed = new RollbarConfig("12345")
            {
                Environment = null
            };

            // test different config instances simple properties:
            Assert.IsTrue(rConfig.Equals(rConfigSimilar), "Simple properties: Similar instances are always equal.");
            Assert.IsFalse(rConfig.Equals(rConfigOneDiff), "Simple properties: One different property value makes unequal.");
            Assert.IsFalse(rConfig.Equals(rConfigAnotherDiff), "Simple properties: Another different property value makes unequal.");
            Assert.IsFalse(rConfig.Equals(rConfigTwoDiffs), "Simple properties: Multiple different property values make unequal.");
            Assert.IsFalse(rConfig.Equals(rConfigOneNullifed), "Simple properties: Nullified property of one config instance makes unequal.");

            // test structured/complex properties:
            Person person = new Person()
            {
                UserName = "******", Email = "*****@*****.**",
            };
            Person personSimilar = new Person()
            {
                UserName = "******", Email = "*****@*****.**",
            };
            Person personOneDiff = new Person()
            {
                UserName = "******", Email = "*****@*****.**",
            };
            Person personOneNull = new Person()
            {
                UserName = "******", Email = null,
            };

            rConfig.Person = person;
            Assert.IsTrue(rConfig.Equals(rConfig), "Structured properties: Same instances are always equal.");
            rConfigSimilar.Person = person;
            Assert.IsTrue(rConfig.Equals(rConfigSimilar), "Structured properties: Similar #1 instances are always equal.");
            rConfigSimilar.Person = personSimilar;
            Assert.IsTrue(rConfig.Equals(rConfigSimilar), "Structured properties: Similar #2 instances are always equal.");
            rConfigSimilar.Person = personOneDiff;
            Assert.IsFalse(rConfig.Equals(rConfigSimilar), "Structured properties: One different property value makes unequal.");
            rConfigSimilar.Person = personOneNull;
            Assert.IsFalse(rConfig.Equals(rConfigSimilar), "Structured properties: Nullified property of one config instance makes unequal.");
        }
예제 #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RollbarTarget"/> class.
 /// </summary>
 public RollbarTarget(RollbarConfig rollbarConfig)
 {
     RollbarConfig       = rollbarConfig;
     OptimizeBufferReuse = true;
     Layout = "${message}";
 }
예제 #4
0
 /// <summary>
 /// Loads the provided configuration object based on found configuration store (if any).
 /// </summary>
 /// <param name="config">The configuration.</param>
 /// <returns><c>true</c> if configuration was found, <c>false</c> otherwise.</returns>
 public bool Load(RollbarConfig config)
 {
     return(this._loader != null && this._loader.Load(config));
 }
예제 #5
0
        /// <summary>
        /// Loads the application settings.
        /// </summary>
        /// <param name="rollbarConfig">The configuration.</param>
        /// <param name="rollbarConfigSection">The application settings.</param>
        /// <returns>false when the configuration was not found, otherwise true.</returns>
        public static bool LoadAppSettings(RollbarConfig rollbarConfig, RollbarConfigSection rollbarConfigSection)
        {
            if (rollbarConfigSection == null)
            {
                return(false);
            }

            if (!string.IsNullOrWhiteSpace(rollbarConfigSection.AccessToken))
            {
                rollbarConfig.AccessToken = rollbarConfigSection.AccessToken;
            }
            if (!string.IsNullOrWhiteSpace(rollbarConfigSection.Environment))
            {
                rollbarConfig.Environment = rollbarConfigSection.Environment;
            }
            if (rollbarConfigSection.Enabled.HasValue)
            {
                rollbarConfig.Enabled = rollbarConfigSection.Enabled.Value;
            }
            if (rollbarConfigSection.Transmit.HasValue)
            {
                rollbarConfig.Transmit = rollbarConfigSection.Transmit.Value;
            }
            if (rollbarConfigSection.RethrowExceptionsAfterReporting.HasValue)
            {
                rollbarConfig.RethrowExceptionsAfterReporting = rollbarConfigSection.RethrowExceptionsAfterReporting.Value;
            }
            if (rollbarConfigSection.MaxReportsPerMinute.HasValue)
            {
                rollbarConfig.MaxReportsPerMinute = rollbarConfigSection.MaxReportsPerMinute.Value;
            }
            if (rollbarConfigSection.ReportingQueueDepth.HasValue)
            {
                rollbarConfig.ReportingQueueDepth = rollbarConfigSection.ReportingQueueDepth.Value;
            }
            if (rollbarConfigSection.MaxItems.HasValue)
            {
                rollbarConfig.MaxItems = rollbarConfigSection.MaxItems.Value;
            }
            if (rollbarConfigSection.CaptureUncaughtExceptions.HasValue)
            {
                rollbarConfig.CaptureUncaughtExceptions = rollbarConfigSection.CaptureUncaughtExceptions.Value;
            }
            if (rollbarConfigSection.LogLevel.HasValue)
            {
                rollbarConfig.LogLevel = rollbarConfigSection.LogLevel.Value;
            }
            if (rollbarConfigSection.ScrubFields != null && rollbarConfigSection.ScrubFields.Length > 0)
            {
                rollbarConfig.ScrubFields =
                    string.IsNullOrEmpty(rollbarConfigSection.ScrubFields) ? new string[0]
                    : rollbarConfigSection.ScrubFields.Split(listValueSplitters, StringSplitOptions.RemoveEmptyEntries);
            }
            if (rollbarConfigSection.ScrubWhitelistFields != null && rollbarConfigSection.ScrubWhitelistFields.Length > 0)
            {
                rollbarConfig.ScrubWhitelistFields =
                    string.IsNullOrEmpty(rollbarConfigSection.ScrubWhitelistFields) ? new string[0]
                    : rollbarConfigSection.ScrubWhitelistFields.Split(listValueSplitters, StringSplitOptions.RemoveEmptyEntries);
            }
            if (!string.IsNullOrWhiteSpace(rollbarConfigSection.EndPoint))
            {
                rollbarConfig.EndPoint = rollbarConfigSection.EndPoint;
            }
            if (!string.IsNullOrWhiteSpace(rollbarConfigSection.ProxyAddress))
            {
                rollbarConfig.ProxyAddress = rollbarConfigSection.ProxyAddress;
            }
            if (!string.IsNullOrWhiteSpace(rollbarConfigSection.ProxyUsername))
            {
                rollbarConfig.ProxyUsername = rollbarConfigSection.ProxyUsername;
            }
            if (!string.IsNullOrWhiteSpace(rollbarConfigSection.ProxyPassword))
            {
                rollbarConfig.ProxyPassword = rollbarConfigSection.ProxyPassword;
            }
            if (rollbarConfigSection.PersonDataCollectionPolicies.HasValue)
            {
                rollbarConfig.PersonDataCollectionPolicies = rollbarConfigSection.PersonDataCollectionPolicies.Value;
            }
            if (rollbarConfigSection.IpAddressCollectionPolicy.HasValue)
            {
                rollbarConfig.IpAddressCollectionPolicy = rollbarConfigSection.IpAddressCollectionPolicy.Value;
            }

            return(true);
        }
예제 #6
0
        public void TestAppenderReconfiguration()
        {
            Person[] expectedPersons = new Person[]
            {
                null,
                new Person("Person1"),
                new Person("Person2"),
            };

            RollbarAppender appender = new RollbarAppender(
                RollbarUnitTestSettings.AccessToken,
                RollbarUnitTestSettings.Environment,
                TimeSpan.FromSeconds(3)
                );

            string repositoryName = typeof(RollbarAppenderFixture).Name;
            var    repository     = LoggerManager.CreateRepository(repositoryName);
            string loggerName     = typeof(RollbarAppenderFixture).Name;

            BasicConfigurator.Configure(repository, appender);
            ILog log = LogManager.GetLogger(repositoryName, loggerName);


            log.Info("Via log4net");

            RollbarConfig newConfig = new RollbarConfig();

            newConfig.Reconfigure(appender.RollbarConfig);
            newConfig.Person = expectedPersons[1];
            appender.RollbarConfig.Reconfigure(newConfig);
            log.Info("Via log4net");

            newConfig = new RollbarConfig();
            newConfig.Reconfigure(appender.RollbarConfig);
            newConfig.Person      = expectedPersons[2];
            newConfig.ScrubFields = new string[]
            {
                "log4net:UserName",
                "log4net:HostName",
                "log4net:Identity",
            };
            appender.RollbarConfig.Reconfigure(newConfig);
            log.Info("Via log4net");

            // wait until all the payloads are processed and transmitted
            Thread.Sleep(TimeSpan.FromSeconds(5));

            Assert.IsTrue(this._rollbarCommEvents.Count == 3 || this._rollbarCommErrorEvents.Count == 3, "Either comm successes or errors are captured...");

            if (this._rollbarCommErrorEvents.Count == 3)
            {
                //this scenario happens on the CI server (Azure Pipelines):
                foreach (var commErrorEvent in this._rollbarCommErrorEvents)
                {
                    Assert.IsTrue(
                        commErrorEvent.Error.Message.Contains(
                            "Preliminary ConnectivityMonitor detected offline status!"),
                        "Matching error message."
                        );
                }
                Assert.IsFalse(this._rollbarCommErrorEvents[0].Payload.Contains("\"person\":{\"id\":"), "checking this._rollbarCommErrorEvents[0].Payload");
                Assert.IsTrue(this._rollbarCommErrorEvents[1].Payload.Contains(expectedPersons[1].Id), "checking this._rollbarCommErrorEvents[1].Payload");
                Assert.IsTrue(this._rollbarCommErrorEvents[2].Payload.Contains(expectedPersons[2].Id), "checking this._rollbarCommErrorEvents[2].Payload");
            }
            else
            {
                Assert.IsFalse(this._rollbarCommEvents[0].Payload.Contains("\"person\":{\"id\":"), "checking this._rollbarCommEvents[0].Payload");
                Assert.IsTrue(this._rollbarCommEvents[1].Payload.Contains(expectedPersons[1].Id), "checking this._rollbarCommEvents[1].Payload");
                Assert.IsTrue(this._rollbarCommEvents[2].Payload.Contains(expectedPersons[2].Id), "checking this._rollbarCommEvents[2].Payload");
            }
        }
 //public
 public void Connect(RollbarConfig config)
 {
     _config = config;
 }
예제 #8
0
        public void AllowsProxySettingsReconfiguration()
        {
            using (IRollbar logger = this.ProvideDisposableRollbar())
            {
                IRollbarConfig initialConfig = logger.Config;

                Assert.AreSame(initialConfig, logger.Config);
                logger.Configure(initialConfig);
                Assert.AreSame(initialConfig, logger.Config);

                int errorCount = 0;
                logger.AsBlockingLogger(TimeSpan.FromSeconds(3)).Info("test 1");
                this.ExpectedCommunicationEventsTotal++;
                Assert.AreEqual(0, errorCount);

                RollbarConfig newConfig = new RollbarConfig("seed");
                newConfig.Reconfigure(initialConfig);
                Assert.AreNotSame(initialConfig, newConfig);
                logger.Configure(newConfig);
                logger.AsBlockingLogger(TimeSpan.FromSeconds(3)).Info("test 2");
                this.ExpectedCommunicationEventsTotal++;
                Assert.AreEqual(0, errorCount);

                newConfig.ProxyAddress  = "www.fakeproxy.com";
                newConfig.ProxyUsername = "******";
                newConfig.ProxyPassword = "******";
                logger.Configure(newConfig);
                Assert.IsFalse(string.IsNullOrEmpty(logger.Config.ProxyAddress));
                Assert.IsFalse(string.IsNullOrEmpty(logger.Config.ProxyUsername));
                Assert.IsFalse(string.IsNullOrEmpty(logger.Config.ProxyPassword));
                try
                {
                    // the fake proxy settings will cause a timeout exception here:
                    this.ExpectedCommunicationErrorsTotal++;
                    logger.AsBlockingLogger(TimeSpan.FromSeconds(3)).Info("test 3 with fake proxy");
                }
                catch
                {
                    errorCount++;
                }
                Assert.AreEqual(1, errorCount);

                newConfig.ProxyAddress  = null;
                newConfig.ProxyUsername = null;
                newConfig.ProxyPassword = null;
                logger.Configure(newConfig);
                Assert.IsTrue(string.IsNullOrEmpty(logger.Config.ProxyAddress));
                Assert.IsTrue(string.IsNullOrEmpty(logger.Config.ProxyUsername));
                Assert.IsTrue(string.IsNullOrEmpty(logger.Config.ProxyPassword));
                try
                {
                    // the fake proxy settings are gone, so, next call is expected to succeed:
                    this.ExpectedCommunicationEventsTotal++;
                    logger.AsBlockingLogger(TimeSpan.FromSeconds(15)).Info("test 4");
                }
                catch
                {
                    errorCount++;
                }
                Assert.AreEqual(1, errorCount);
            }
        }
        public void QueueRegisterationTest()
        {
            // we need to make sure we are starting clean:
            while (RollbarQueueController.Instance.GetQueuesCount() > 0)
            {
                Thread.Sleep(TimeSpan.FromMilliseconds(250));
            }

            RollbarConfig loggerConfig1 =
                new RollbarConfig(RollbarUnitTestSettings.AccessToken)
            {
                Environment = RollbarUnitTestSettings.Environment,
            };
            RollbarConfig loggerConfig2 =
                new RollbarConfig(RollbarUnitTestSettings.AccessToken.Replace('0', '1'))
            {
                Environment = RollbarUnitTestSettings.Environment,
            };

            Assert.AreNotEqual(loggerConfig1.AccessToken, loggerConfig2.AccessToken);

            int initialCount  = RollbarQueueController.Instance.GetQueuesCount();
            int initialCount1 = RollbarQueueController.Instance.GetQueuesCount(loggerConfig1.AccessToken);
            int initialCount2 = RollbarQueueController.Instance.GetQueuesCount(loggerConfig2.AccessToken);

            Assert.AreEqual(initialCount + 0, RollbarQueueController.Instance.GetQueuesCount());
            Assert.AreEqual(initialCount1 + 0,
                            RollbarQueueController.Instance.GetQueuesCount(loggerConfig1.AccessToken));
            Assert.AreEqual(initialCount2 + 0,
                            RollbarQueueController.Instance.GetQueuesCount(loggerConfig2.AccessToken));

            using (var logger1 = RollbarFactory.CreateNew().Configure(loggerConfig1))
            {
                Assert.AreEqual(initialCount + 1, RollbarQueueController.Instance.GetQueuesCount());
                Assert.AreEqual(initialCount1 + 1,
                                RollbarQueueController.Instance.GetQueuesCount(loggerConfig1.AccessToken));
                Assert.AreEqual(initialCount2 + 0,
                                RollbarQueueController.Instance.GetQueuesCount(loggerConfig2.AccessToken));

                using (var logger2 = RollbarFactory.CreateNew().Configure(loggerConfig1))
                {
                    Assert.AreEqual(initialCount + 2, RollbarQueueController.Instance.GetQueuesCount());
                    Assert.AreEqual(initialCount1 + 2,
                                    RollbarQueueController.Instance.GetQueuesCount(loggerConfig1.AccessToken));
                    Assert.AreEqual(initialCount2 + 0,
                                    RollbarQueueController.Instance.GetQueuesCount(loggerConfig2.AccessToken));

                    using (var logger3 = RollbarFactory.CreateNew().Configure(loggerConfig2))
                    {
                        Assert.AreEqual(initialCount + 3, RollbarQueueController.Instance.GetQueuesCount());
                        Assert.AreEqual(initialCount1 + 2,
                                        RollbarQueueController.Instance.GetQueuesCount(loggerConfig1.AccessToken));
                        Assert.AreEqual(initialCount2 + 1,
                                        RollbarQueueController.Instance.GetQueuesCount(loggerConfig2.AccessToken));
                    }

                    // an unused queue does not get removed immediately (but eventually) - so let's wait for it for a few processing cycles:
                    while ((initialCount + 2) != RollbarQueueController.Instance.GetQueuesCount())
                    {
                        Thread.Sleep(TimeSpan.FromMilliseconds(250));
                    }

                    // if everything is good, we should get here way before this test method times out:
                    Assert.AreEqual(initialCount + 2, RollbarQueueController.Instance.GetQueuesCount());
                    Assert.AreEqual(initialCount1 + 2,
                                    RollbarQueueController.Instance.GetQueuesCount(loggerConfig1.AccessToken));
                    Assert.AreEqual(initialCount2 + 0,
                                    RollbarQueueController.Instance.GetQueuesCount(loggerConfig2.AccessToken));
                }

                // an unused queue does not get removed immediately (but eventually) - so let's wait for it for a few processing cycles:
                while ((initialCount + 1) != RollbarQueueController.Instance.GetQueuesCount())
                {
                    Thread.Sleep(TimeSpan.FromMilliseconds(250));
                }

                // if everything is good, we should get here way before this test method times out:
                Assert.AreEqual(initialCount + 1, RollbarQueueController.Instance.GetQueuesCount());
                Assert.AreEqual(initialCount1 + 1,
                                RollbarQueueController.Instance.GetQueuesCount(loggerConfig1.AccessToken));
                Assert.AreEqual(initialCount2 + 0,
                                RollbarQueueController.Instance.GetQueuesCount(loggerConfig2.AccessToken));
            }

            // an unused queue does not get removed immediately (but eventually) - so let's wait for it for a few processing cycles:
            while ((initialCount + 0) != RollbarQueueController.Instance.GetQueuesCount())
            {
                Thread.Sleep(TimeSpan.FromMilliseconds(250));
            }

            // if everything is good, we should get here way before this test method times out:
            Assert.AreEqual(initialCount + 0, RollbarQueueController.Instance.GetQueuesCount());
            Assert.AreEqual(initialCount1 + 0,
                            RollbarQueueController.Instance.GetQueuesCount(loggerConfig1.AccessToken));
            Assert.AreEqual(initialCount2 + 0,
                            RollbarQueueController.Instance.GetQueuesCount(loggerConfig2.AccessToken));
        }
        public RollbarClient(RollbarConfig config)
        {
            Assumption.AssertNotNull(config, nameof(config));

            Config = config;
        }
예제 #11
0
        /// <summary>
        /// Loads the application settings.
        /// </summary>
        /// <param name="rollbarConfig">The rollbar configuration.</param>
        /// <param name="appSettings">The application settings.</param>
        public static void LoadAppSettings(ref RollbarConfig rollbarConfig, IConfiguration appSettings)
        {
            const string rollbarAppConfigSectionName = "Rollbar";

            AppSettingsUtil.LoadAppSettings(ref rollbarConfig, rollbarAppConfigSectionName, appSettings);
        }
예제 #12
0
        /// <summary>
        /// Loads the application settings.
        /// </summary>
        /// <param name="rollbarConfig">The rollbar configuration.</param>
        /// <param name="appSettingsFolderPath">The application settings folder path.</param>
        /// <param name="appSettingsFileName">Name of the application settings file.</param>
        public static void LoadAppSettings(ref RollbarConfig rollbarConfig, string appSettingsFolderPath, string appSettingsFileName)
        {
            IConfiguration appSettingsConfig = AppSettingsUtil.LoadAppSettings(appSettingsFolderPath, appSettingsFileName);

            AppSettingsUtil.LoadAppSettings(ref rollbarConfig, appSettingsConfig);
        }
예제 #13
0
        public void LoadRollbarAppSettingsTest()
        {
            var sever = new Server();

            RollbarConfig config = new RollbarConfig("default=none");

            Assert.IsNull(config.Person);
            Assert.IsNull(config.Server);

            AppSettingsUtility.LoadAppSettings(config, Path.Combine(Environment.CurrentDirectory, "TestData"), "appsettings.json");

            // The test data looks like this:
            //===============================
            //"Rollbar": {
            //    "AccessToken": "17965fa5041749b6bf7095a190001ded",
            //    "Environment": "unit-tests",
            //    "Enabled": true,
            //    "MaxReportsPerMinute": 160,
            //    "ReportingQueueDepth": 120,
            //    "LogLevel": "Info",
            //    "ScrubFields": [
            //      "ThePassword",
            //      "TheSecret"
            //    ],
            //    "Server": {
            //      "Root": "C://Blah/Blah",
            //      "Cpu": "x64"
            //    },
            //    "Person": {
            //      "UserName": "******"
            //    },
            //    "PersonDataCollectionPolicies": "Username, Email",
            //    "IpAddressCollectionPolicy": "CollectAnonymized",
            //  }

            Assert.AreEqual("17965fa5041749b6bf7095a190001ded", config.AccessToken);
            Assert.AreEqual("unit-tests", config.Environment);
            Assert.AreEqual(true, config.Enabled);
            Assert.AreEqual(160, config.MaxReportsPerMinute);
            Assert.AreEqual(120, config.ReportingQueueDepth);
            Assert.AreEqual(ErrorLevel.Info, config.LogLevel.Value);
            Assert.IsTrue(config.ScrubFields.Length >= 2);
            Assert.AreEqual("jbond", config.Person.UserName);
            Assert.AreEqual(
                PersonDataCollectionPolicies.Username | PersonDataCollectionPolicies.Email
                , config.PersonDataCollectionPolicies
                );
            Assert.AreEqual(
                IpAddressCollectionPolicy.CollectAnonymized
                , config.IpAddressCollectionPolicy
                );

            Assert.IsNotNull(config.Server);
            Assert.IsTrue(config.Server.ContainsKey("cpu"));
            Assert.IsTrue(config.Server.ContainsKey("root"));
            Assert.IsFalse(config.Server.ContainsKey("Cpu"));
            Assert.IsFalse(config.Server.ContainsKey("Root"));
            Assert.AreEqual(config.Server["cpu"], config.Server.Cpu);
            Assert.AreEqual(config.Server["root"], config.Server.Root);
            Assert.AreEqual("x64", config.Server.Cpu);
            Assert.AreEqual("C://Blah/Blah", config.Server.Root);
        }
 /// <summary>
 /// Loads the specified configuration.
 /// </summary>
 /// <param name="config">The configuration.</param>
 /// <returns><c>true</c> if configuration was found, <c>false</c> otherwise.</returns>
 public static bool Load(RollbarConfig config)
 {
     return(RollbarConfigUtility.configurationLoader.Load(config));
 }
예제 #15
0
 /// <summary>
 /// Loads the application settings.
 /// </summary>
 /// <param name="rollbarConfig">The Rollbar configuration.</param>
 /// <returns>false when the configuration was not found, otherwise true.</returns>
 public static bool LoadAppSettings(RollbarConfig rollbarConfig)
 {
     return(AppConfigUtility.LoadAppSettings(rollbarConfig, RollbarConfigSection.GetConfiguration()));
 }
예제 #16
0
        /// <summary>
        /// Loads the application settings.
        /// </summary>
        /// <param name="config">The configuration.</param>
        public static void LoadAppSettings(ref RollbarConfig config)
        {
            IConfiguration appSettingsConfig = AppSettingsUtil.LoadAppSettings();

            AppSettingsUtil.LoadAppSettings(ref config, appSettingsConfig);
        }
예제 #17
0
 /// <summary>
 /// Loads the provided configuration object based on found configuration store (if any).
 /// </summary>
 /// <param name="config">The configuration.</param>
 /// <returns><c>true</c> if configuration was found, <c>false</c> otherwise.</returns>
 public bool Load(RollbarConfig config)
 {
     return(AppConfigUtility.LoadAppSettings(config));
 }