Пример #1
0
        public void Stack_Run_Success()
        {
            var config = ConfigurationTests.CreateCollectorConfig("1000");

            config.Type      = TYPE_SERIAL_COLLECTOR;
            config.StackType = TYPE_SERIAL_STACK;
            var collector = CollectorFactory.CreateCollector(config) as AbstractCollector;

            collector.Should().NotBeNull();

            var stack = collector.CreateStack(config.Readers[0].Id);

            stack.Done.Should().BeFalse();
            stack.Reader.Done.Should().BeFalse();
            foreach (var publisher in stack.Publishers)
            {
                publisher.Done.Should().BeFalse();
            }
            foreach (var transformer in stack.Transformers)
            {
                transformer.Done.Should().BeFalse();
            }

            stack.Run(new Dictionary <string, string>()).Wait();
            stack.Done.Should().BeTrue();
            stack.Reader.Done.Should().BeTrue();
            foreach (var publisher in stack.Publishers)
            {
                publisher.Done.Should().BeTrue();
            }
            foreach (var transformer in stack.Transformers)
            {
                transformer.Done.Should().BeTrue();
            }
        }
Пример #2
0
        public void Collector_Run_Success()
        {
            var config    = ConfigurationTests.CreateCollectorConfig("1000");
            var collector = CollectorFactory.CreateCollector(config);

            collector.Should().NotBeNull();

            collector.Run().Wait();

            (collector as MockCollector).GetTotalEventCount().Should().Be(3);
        }
Пример #3
0
        public void SerialCollector_Run_Success()
        {
            var config = ConfigurationTests.CreateCollectorConfig("1000");

            config.Type      = TYPE_SERIAL_COLLECTOR;
            config.StackType = TYPE_SERIAL_STACK;
            var collector = CollectorFactory.CreateCollector(config) as AbstractCollector;

            collector.Should().NotBeNull();

            collector.Run().Wait();

            collector.GetTotalEventCount().Should().Be(3);
        }
Пример #4
0
        public void Reader_Run_TransformerInvoked()
        {
            var config    = ConfigurationTests.CreateCollectorConfig("1000");
            var collector = CollectorFactory.CreateCollector(config);

            var endpointConfig = ConfigurationTests.CreateEndPointConfig("1", "FileName", "c://temp//temp.log");
            var readerConfig   = ConfigurationTests.CreateReaderConfig("2", "1");
            var handler        = new MockHandler();
            var reader         = CollectorFactory.CreateReader(readerConfig.Type, readerConfig.Id, endpointConfig, handler) as MockReader;

            reader.Should().NotBeNull();

            reader.Run(new Dictionary <string, string>()).Wait();

            handler.Invoked.Should().BeTrue();
        }
Пример #5
0
        public void Stack_Kill_Success()
        {
            var config = ConfigurationTests.CreateCollectorConfig("1000");

            config.Type            = TYPE_SERIAL_COLLECTOR;
            config.StackType       = TYPE_SERIAL_STACK;
            config.Readers[0].Type = TYPE_INFINITE_READER;
            var collector = CollectorFactory.CreateCollector(config) as AbstractCollector;

            collector.Should().NotBeNull();

            var stack = collector.CreateStack(config.Readers[0].Id);

            stack.Run(new Dictionary <string, string>());

            stack.Kill();

            stack.Done.Should().BeTrue();
            stack.Reader.Done.Should().BeTrue();
        }
Пример #6
0
        public void Transformer_HandleData_PublisherInvoked()
        {
            var mapperConfig = ConfigurationTests.CreateMapperConfig("3", "4");
            var tconfig      = ConfigurationTests.CreateTransformerConfig("4", mapperConfig, "2");
            var handler      = new MockTransformationHandler();

            var transformer = CollectorFactory.CreateTransformer(tconfig, handler);

            transformer.Should().NotBeNull();

            List <IEntityCollection> data = new List <IEntityCollection>();
            IEntityCollection        row  = new EntityCollection();

            row.Entities.Add("foo", "bar");
            data.Add(row);

            transformer.HandleData("2", data, new Dictionary <string, string>()).Wait();

            handler.Invoked.Should().BeTrue();
            handler.Data.Count.Should().BeGreaterThan(0);
        }