public void Setup()
        {
            config = new Configuration();
            ;
            source = new Configuration.source();
            source.aliases.Add(new Configuration.source.elementAlias {alias = "theAlias", elementName = "theelemtnname"});
            source.conversions.Add(new Configuration.source.conversion {elementName = "LogTime", type = "DateTime"});
            source.composites.Add(new Configuration.source.composite
                                      {elementName = "LogTime", elements = new[] {"date", "time"}});
            source.multiColumnElements.Add(new Configuration.source.mulitColumnElement
                                               {elementName = "Endtime-UTC", colSpan = 2});
            source.staticElements.Add(new Configuration.source.staticElement
                                          {elementName = "MyName", elementValue = "Dillon"});
            source.drop.Add("el1");
            source.drop.Add("el2");
            source.entryLimit = 100;

            config.sources.Add(source);

            cl = new W3CLogReaderFactory(Substitute.For<Logger>());
        }
        public void Confirm_source_Defaults()
        {
            var vanillaSource = new Configuration.source();

            vanillaSource.aliases.Any().ShouldBe(false);
            vanillaSource.conversions.Any().ShouldBe(false);
            vanillaSource.composites.Any().ShouldBe(false);
            vanillaSource.drop.Any().ShouldBe(false);
            vanillaSource.multiColumnElements.Any().ShouldBe(false);
            vanillaSource.staticElements.Any().ShouldBe(false);
            vanillaSource.templates.Any().ShouldBe(false);

            vanillaSource.batchSize.GetValueOrDefault().ShouldBe(0);
            vanillaSource.enabled.GetValueOrDefault().ShouldBe(false);
            vanillaSource.entryLimit.GetValueOrDefault().ShouldBe(0);
            vanillaSource.id.ShouldBe(null);
            vanillaSource.logAll.GetValueOrDefault().ShouldBe(false);
            vanillaSource.logDirectory.ShouldBe(null);

            vanillaSource.destination.ShouldBe(null);
        }
        public void Should_Over_Lay_Default()
        {
            var baseSource = new Configuration.source();
            var overlay = new Configuration.source();

            baseSource.enabled.GetValueOrDefault().ShouldBe(false);
            overlay.enabled = true;
            baseSource.Overlay(overlay);
            baseSource.enabled.GetValueOrDefault().ShouldBe(true);

            baseSource.batchSize.GetValueOrDefault().ShouldBe(0);
            overlay.batchSize = 69;
            baseSource.Overlay(overlay);
            baseSource.batchSize.GetValueOrDefault().ShouldBe(69);

            baseSource.id.IsNullOrEmpty().ShouldBe(true);
            overlay.id = "anid";
            baseSource.Overlay(overlay);
            baseSource.id.ShouldBe("anid");

            baseSource.logDirectory.IsNullOrEmpty().ShouldBe(true);
            overlay.logDirectory = "logdir";
            baseSource.Overlay(overlay);
            baseSource.logDirectory.ShouldBe("logdir");

            baseSource.entryLimit.GetValueOrDefault().ShouldBe(0);
            overlay.entryLimit = 1000;
            baseSource.Overlay(overlay);
            baseSource.entryLimit.ShouldBe(1000);

            baseSource.destination.IsNull().ShouldBe(true);
            overlay.destination = new Configuration.source.logDestination();
            baseSource.Overlay(overlay);
            baseSource.destination.ShouldBe(overlay.destination);

            baseSource.logAll.GetValueOrDefault().ShouldBe(false);
            overlay.logAll = true;
            baseSource.Overlay(overlay);
            baseSource.logAll.ShouldBe(true);
        }
Ejemplo n.º 4
0
        public void SetUp()
        {
            _logger = new FakeLogger();
            _logFetcher = new LogFetcher();
            _stateRecorder = new FakeStateRecorder();
            _logPersisterFactory = Substitute.For<LogPersisterFactory>();
            _logPersister = new FakePersister(); //Substitute.For<ILogPersister>();
            _logPersisterFactory.GetPersister(Arg.Any<string>(), Arg.Any<string>(), Arg.Any<string>()).Returns(
                _logPersister);
            _logProcessor = new LogProcessor(new W3CLogReaderFactory(_logger), _logFetcher, _stateRecorder,
                                             _logPersisterFactory, _logger);

            _source = new Configuration.source();
            _source.destination = new Configuration.source.logDestination();
            _source.id = "int.test";
            _source.conversions.Add(new Configuration.source.conversion {elementName = "sc-status", type = "int"});

            _source.logDirectory = "../../Logs/";
            _source.destination.mongoConnectionString = "blarg";
            _source.destination.mongoCollection = "blarg";
            _source.destination.mongoDatabase = "blarg";
        }
 public void Setup()
 {
     source = new Configuration.source();
 }