diff --git a/src/fr/devinsy/statoolinfos/metrics/httpaccess/HttpAccessLogAnalyzer.java b/src/fr/devinsy/statoolinfos/metrics/httpaccess/HttpAccessLogAnalyzer.java index 1cd1113..e334a59 100644 --- a/src/fr/devinsy/statoolinfos/metrics/httpaccess/HttpAccessLogAnalyzer.java +++ b/src/fr/devinsy/statoolinfos/metrics/httpaccess/HttpAccessLogAnalyzer.java @@ -307,7 +307,21 @@ public class HttpAccessLogAnalyzer /** * Checks if is page. - * + * + *
+ * null => false + * "" => false + * " " => false + * "GET /foo" => true + * "GET /foo42" => true + * "GET /foo.cgi" => true + * "GET /foo.htm" => true + * "GET /foo.html" => true + * "GET /foo.php" => true + * "GET /foo.xhtml" => true + * "GET /foo.jpg" => false + *+ * * @param request * the request * @return true, if is page diff --git a/test/fr/devinsy/statoolinfos/metrics/httpaccess/HttpAccessLogsAnalyzerTest.java b/test/fr/devinsy/statoolinfos/metrics/httpaccess/HttpAccessLogsAnalyzerTest.java index 1978c51..3535da9 100644 --- a/test/fr/devinsy/statoolinfos/metrics/httpaccess/HttpAccessLogsAnalyzerTest.java +++ b/test/fr/devinsy/statoolinfos/metrics/httpaccess/HttpAccessLogsAnalyzerTest.java @@ -38,6 +38,27 @@ import fr.devinsy.statoolinfos.util.FilesUtils; */ public class HttpAccessLogsAnalyzerTest { + /** + * Checks if is page test 01. + */ + @Test + public void isPageTest01() + { + Assert.assertFalse(HttpAccessLogAnalyzer.isPage(null)); + Assert.assertFalse(HttpAccessLogAnalyzer.isPage("")); + Assert.assertFalse(HttpAccessLogAnalyzer.isPage(" ")); + + Assert.assertTrue(HttpAccessLogAnalyzer.isPage("GET /foo")); + Assert.assertTrue(HttpAccessLogAnalyzer.isPage("GET /foo42")); + Assert.assertTrue(HttpAccessLogAnalyzer.isPage("GET /foo.html")); + Assert.assertTrue(HttpAccessLogAnalyzer.isPage("GET /foo.HTML")); + Assert.assertTrue(HttpAccessLogAnalyzer.isPage("GET /foo.HtMl")); + Assert.assertTrue(HttpAccessLogAnalyzer.isPage("GET /foo.HtMl")); + + Assert.assertTrue(HttpAccessLogAnalyzer.isPage("GET /foo/bar/foo.php")); + Assert.assertFalse(HttpAccessLogAnalyzer.isPage("GET /foo.jpg")); + } + /** * @throws Exception */