示例#1
0
        public void Init()
        {
            Metric.Config.WithHttpEndpoint("http://localhost:2581/").WithSystemCounters();

            //XXX use config to get this info
            var registryFactory = LogRegistryFactory.Create();

            var parserFactory = LogParserFactory.GetParserForFileExtension("xml");

            IPrinterFactory printerFactory;

            if (config.ExtraConfigs != null && config.ExtraConfigs.ContainsKey("printToFile") && !string.IsNullOrWhiteSpace(config.ExtraConfigs["printToFile"]))
            {
                // Note: this just sets a default. Configs can change the file
                printerFactory = PrinterFactory.CrateFileFactory(config.ExtraConfigs["printToFile"]);
            }
            else
            {
                printerFactory = PrinterFactory.CrateConsoleFactory();
            }

            registry = registryFactory.Create();

            logFileParser = parserFactory.Create(registry, config);
            printer       = printerFactory.Create(registry, config);
        }
示例#2
0
        private static Log.Internal.IRegistryStorage LogRegistryFactoryStorageTest(RegistrySelectionCriteria criteria)
        {
            var factory = LogRegistryFactory.Create();

            Assert.That(factory, Is.Not.Null);

            var factoryType       = typeof(LogRegistryFactory).GetNestedType("LogRegistryFactoryFinder", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
            var selectionCriteria = factoryType.GetMethod("PickStorage", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);

            return(selectionCriteria.Invoke(factory, new object[] { criteria }) as Log.Internal.IRegistryStorage);
        }
示例#3
0
        public void LogRegistryFactoryProducesRegistry()
        {
            var factory = LogRegistryFactory.Create();

            Assert.That(factory, Is.Not.Null);

            var registry = factory.Create();

            Assert.That(registry, Is.Not.Null);
            Assert.That(registry, Is.TypeOf <Log.Internal.LogRegistry>());
        }