jcapote-atomlog 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/test/helper.rb ADDED
@@ -0,0 +1,9 @@
1
+ $:.unshift File.dirname(__FILE__)
2
+ require 'atom_log'
3
+ require 'test/unit'
4
+
5
+ TEST_PARSER = AtomLog::Parser.new('test/fixtures/test.log')
6
+ FAIL_PARSER = AtomLog::Parser.new('this/does/not/exist')
7
+ TEST_LOG_LINE = 'I, [Wed Mar 03 02:34:24 JST 1999 895701 #19074] INFO -- Main: test'
8
+ ANOTHER_LOG_LINE = 'I, [2009-02-23T17:26:09.959833 #627] INFO -- : test'
9
+
@@ -0,0 +1,23 @@
1
+ require 'test/helper'
2
+
3
+ class TestGenerator < Test::Unit::TestCase
4
+
5
+ def test_object_works
6
+ a = AtomLog::Generator.new('test/fixtures/test.log')
7
+ assert a
8
+ end
9
+
10
+ def test_line_to_xml
11
+ a = AtomLog::Generator.new('test/fixtures/test.log')
12
+ line = AtomLog::Parser.parse_log_line(TEST_LOG_LINE)
13
+ xml_line = a.line_to_xml(line)
14
+ assert xml_line
15
+ end
16
+
17
+ def test_to_atom
18
+ a = AtomLog::Generator.new('test/fixtures/test.log')
19
+ assert a.to_atom
20
+ end
21
+
22
+
23
+ end
@@ -0,0 +1,46 @@
1
+ require 'test/helper'
2
+
3
+ class TestParser < Test::Unit::TestCase
4
+
5
+ def test_object_works
6
+ assert TEST_PARSER
7
+ end
8
+
9
+ def test_parse_date
10
+ res = AtomLog::Parser.parse_log_line(TEST_LOG_LINE)
11
+ res2 = AtomLog::Parser.parse_log_line(ANOTHER_LOG_LINE)
12
+ assert_equal "Wed Mar 03 02:34:24 JST 1999 895701", res[:date]
13
+ assert_equal "2009-02-23T17:26:09.959833", res2[:date]
14
+ end
15
+
16
+ def test_parse_severity_id
17
+ res = AtomLog::Parser.parse_log_line(TEST_LOG_LINE)
18
+ assert_equal "I", res[:severity_id]
19
+ end
20
+
21
+ def test_parse_pid
22
+ res = AtomLog::Parser.parse_log_line(TEST_LOG_LINE)
23
+ assert_equal "19074", res[:pid]
24
+ end
25
+
26
+ def test_parse_severity
27
+ res = AtomLog::Parser.parse_log_line(TEST_LOG_LINE)
28
+ res2 = AtomLog::Parser.parse_log_line(ANOTHER_LOG_LINE)
29
+ assert_equal "INFO", res2[:severity]
30
+ assert_equal "INFO", res[:severity]
31
+ end
32
+
33
+ def atest_parse_msg
34
+ res = AtomLog::Parser.parse_log_line(TEST_LOG_LINE)
35
+ res2 = AtomLog::Parser.parse_log_line(ANOTHER_LOG_LINE)
36
+ assert_equal "test", res[:msg]
37
+ assert_equal "test.", res[:msg]
38
+
39
+ end
40
+
41
+ def test_parse_arr_not_empty
42
+ res = TEST_PARSER.parse
43
+ assert res
44
+ end
45
+
46
+ end
metadata ADDED
@@ -0,0 +1,63 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jcapote-atomlog
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.2
5
+ platform: ruby
6
+ authors:
7
+ - jcapote
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-02-26 00:00:00 -08:00
13
+ default_executable: log2atom
14
+ dependencies: []
15
+
16
+ description: A library for parsing ruby's Logger format into an Atom feed
17
+ email: jcapote@gmail.com
18
+ executables:
19
+ - log2atom
20
+ extensions: []
21
+
22
+ extra_rdoc_files: []
23
+
24
+ files:
25
+ - README.markdown
26
+ - VERSION.yml
27
+ - bin/log2atom
28
+ - lib/generator.rb
29
+ - lib/parser.rb
30
+ - test/fixtures
31
+ - test/fixtures/test.log
32
+ - test/helper.rb
33
+ - test/test_generator.rb
34
+ - test/test_parser.rb
35
+ has_rdoc: true
36
+ homepage: http://github.com/jcapote/atomlog
37
+ post_install_message:
38
+ rdoc_options:
39
+ - --inline-source
40
+ - --charset=UTF-8
41
+ require_paths:
42
+ - lib
43
+ required_ruby_version: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: "0"
48
+ version:
49
+ required_rubygems_version: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: "0"
54
+ version:
55
+ requirements: []
56
+
57
+ rubyforge_project:
58
+ rubygems_version: 1.2.0
59
+ signing_key:
60
+ specification_version: 2
61
+ summary: A library for parsing ruby's Logger format into an Atom feed
62
+ test_files: []
63
+