示例#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();
        }