コード例 #1
0
        public void TestDataFile_ExtractsAllRecords()
        {
            var stream   = new MemoryStream(File.ReadAllBytes("IisLog.txt"));
            var parser   = new IisLogParser();
            var entities = parser.Parse(stream,
                                        new Uri(
                                            "http://shipish/e277461e28dd4309af674f083094c568/Test.Presentation.Web.Api/Test.Presentation.Web.Api_IN_0/Web/W3SVC1273337584/u_ex15020701.log", UriKind.Absolute)).ToArray();

            Assert.Equal(entities[0].Properties["s-computername"].StringValue, "RD00155D4A0E2E");
            Assert.Equal(entities[0].Properties["cs-method"].StringValue, "GET");
            Assert.Equal(entities[1].Properties["cs-uri-stem"].StringValue, "/product/catalogue/v2/productgroups/ctl/4650127");
        }
コード例 #2
0
ファイル: IisLogTests.cs プロジェクト: lulzzz/ConveyorBelt
        public void TestDataFile_ExtractsAllRecords()
        {
            var parser   = new IisLogParser();
            var entities = parser.Parse(() => new MemoryStream(File.ReadAllBytes("IisLog.txt")), new Uri("http://shipish/e277461e28dd4309af674f083094c568/Test.Presentation.Web.Api/Test.Presentation.Web.Api_IN_0/Web/W3SVC1273337584/u_ex15020701.log", UriKind.Absolute), new DiagnosticsSourceSummary()).ToArray();

            Assert.Equal("5RD00155D4A0E2E", entities[0]["s-computername"]);
            Assert.Equal("GET", entities[0]["cs-method"]);
            Assert.Equal("store=AU", entities[0]["cs-uri-query"]);
            Assert.Equal("/product/catalogue/v2/productgroups/ctl/4650127", entities[1]["cs-uri-stem"]);
            Assert.Equal("2016-09-16T05:59:59", entities[0]["@timestamp"]);
            Assert.Equal(GetRowKey(5), entities[0]["RowKey"]);
            Assert.Equal(GetRowKey(29), entities[20]["RowKey"]);
            Assert.Equal(GetRowKey(30), entities[21]["RowKey"]);
            Assert.Equal(114, entities.Length);
        }
コード例 #3
0
ファイル: IisLogTests.cs プロジェクト: lulzzz/ConveyorBelt
        public void TestDataFile_ExtractsAllRecordsInBrokenOffsetRange()
        {
            var parser   = new IisLogParser();
            var entities = parser.Parse(
                () => new MemoryStream(File.ReadAllBytes("IisLog.txt")),
                new Uri("http://shipish/e277461e28dd4309af674f083094c568/Test.Presentation.Web.Api/Test.Presentation.Web.Api_IN_0/Web/W3SVC1273337584/u_ex15020701.log", UriKind.Absolute),
                new DiagnosticsSourceSummary(),
                new ParseCursor(RowOffsets[5] + 1)
            {
                EndPosition = RowOffsets[7]
            }).ToArray();

            Assert.Equal("2016-09-16T05:59:59", entities[0]["@timestamp"]);
            Assert.Equal("6RD00155D4A0E2E", entities[0]["s-computername"]);
            Assert.Equal("GET", entities[0]["cs-method"]);
            Assert.Equal("store=US", entities[0]["cs-uri-query"]);
            Assert.Equal(1, entities.Length);
            Assert.Equal(GetRowKey(6), entities[0]["RowKey"]);
        }
コード例 #4
0
ファイル: IisLogTests.cs プロジェクト: lulzzz/ConveyorBelt
        public void TestDataFile_ExtractsAllRecordsStartingFromOffsetWithChangingHeaders()
        {
            var parser   = new IisLogParser();
            var entities = parser.Parse(
                () => new MemoryStream(File.ReadAllBytes("IisLog.txt")),
                new Uri("http://shipish/e277461e28dd4309af674f083094c568/Test.Presentation.Web.Api/Test.Presentation.Web.Api_IN_0/Web/W3SVC1273337584/u_ex15020701.log", UriKind.Absolute),
                new DiagnosticsSourceSummary(),
                new ParseCursor(RowOffsets[30])).ToArray();

            Assert.Equal("2016-09-16T05:00:00", entities[0]["@timestamp"]);
            Assert.Equal("2016-09-16T05:00:01", entities.Last()["@timestamp"]);
            Assert.Equal("30RD00155D4A0E2E", entities[0]["s-computername"]);
            Assert.Equal("GET", entities[0]["cs-method"]);
            Assert.Equal("store=US", entities[0]["cs-uri-query"]);
            Assert.Equal("/product/catalogue/v2/productgroups/ctl/6385565", entities[0]["cs-uri-stem"]);
            Assert.Equal("94", entities[0]["time-taken"]);

            Assert.Equal(93, entities.Length);
            Assert.Equal(GetRowKey(30), entities[0]["RowKey"]);
            Assert.Equal(GetRowKey(31), entities[1]["RowKey"]);
        }