nfagent 0.9.31 → 0.9.50

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,6 @@
1
+
2
+ require 'mocha'
3
+ require 'timecop'
4
+ require 'active_support'
5
+ require File.dirname(__FILE__) + '/../lib/nfagent'
6
+
@@ -0,0 +1,20 @@
1
+
2
+ require 'test/test_helper'
3
+
4
+ class TestMapperProxy < ActiveSupport::TestCase
5
+ setup do
6
+ NFAgent::Config.plugin_directory = File.dirname(__FILE__) + '/../test/plugins/'
7
+ end
8
+
9
+ test "instantiate just once" do
10
+ MyMapper.expects(:new).at_most_once
11
+ NFAgent::Config.mapper = nil
12
+ NFAgent::MapperProxy.instance
13
+ NFAgent::MapperProxy.instance
14
+ NFAgent::MapperProxy.instance
15
+ end
16
+
17
+ test "mapper method" do
18
+ assert_equal 'acme', NFAgent::MapperProxy.find_account_id('dan', '192.168.0.10')
19
+ end
20
+ end
@@ -0,0 +1,8 @@
1
+
2
+ require 'test/test_helper'
3
+
4
+ class NFAgentTest < ActiveSupport::TestCase
5
+ test "just return true" do
6
+ assert true
7
+ end
8
+ end
@@ -0,0 +1,77 @@
1
+
2
+ require 'test/test_helper'
3
+
4
+ class TestPayload < ActiveSupport::TestCase
5
+ setup do
6
+ FileUtils.rm_f(Dir.glob("test/sandbox/dumps/*"))
7
+ end
8
+
9
+ test "to_hash" do
10
+ payload = NFAgent::Payload.new do |p|
11
+ p.data = "data"
12
+ p.checksum = "checksum"
13
+ p.line_count = 10
14
+ p.chunk_expired = false
15
+ end
16
+ assert_equal({ 'payload' => 'data', 'checksum' => 'checksum', 'line_count' => 10, 'chunk_expired' => false }, payload.to_hash)
17
+ # Check key
18
+ payload = NFAgent::Payload.new do |p|
19
+ p.data = "data"
20
+ p.checksum = "checksum"
21
+ p.line_count = 10
22
+ p.chunk_expired = false
23
+ p.key = '1234'
24
+ end
25
+ assert_equal({ 'payload' => 'data', 'checksum' => 'checksum', 'line_count' => 10, 'chunk_expired' => false, 'key' => '1234' }, payload.to_hash)
26
+ end
27
+
28
+ test "write-to-disk" do
29
+ payload = NFAgent::Payload.new do |p|
30
+ p.data = "data"
31
+ p.checksum = "checksum"
32
+ p.line_count = 10
33
+ p.chunk_expired = false
34
+ end
35
+ payload.write_to_disk("test/sandbox/dumps")
36
+ assert File.exists?("test/sandbox/dumps/checksum-0")
37
+ # And read back in
38
+ payload = NFAgent::Payload.read_from_file("checksum-0", "test/sandbox/dumps/")
39
+ assert_equal "data", payload.data
40
+ assert_equal 0, payload.attempt
41
+ assert !payload.key
42
+ end
43
+
44
+ test "write-to-disk with non-zero attempt number" do
45
+ payload = NFAgent::Payload.new do |p|
46
+ p.data = "data"
47
+ p.checksum = "checksum"
48
+ p.line_count = 10
49
+ p.chunk_expired = false
50
+ p.attempt = 10
51
+ end
52
+ payload.write_to_disk("test/sandbox/dumps")
53
+ assert File.exists?("test/sandbox/dumps/checksum-10")
54
+ # And read back in
55
+ payload = NFAgent::Payload.read_from_file("checksum-10", "test/sandbox/dumps/")
56
+ assert_equal "data", payload.data
57
+ assert_equal 10, payload.attempt
58
+ end
59
+
60
+ test "write-to-disk with key" do
61
+ payload = NFAgent::Payload.new do |p|
62
+ p.data = "data"
63
+ p.checksum = "checksum"
64
+ p.line_count = 10
65
+ p.chunk_expired = false
66
+ p.key = '1234'
67
+ end
68
+ payload.write_to_disk("test/sandbox/dumps")
69
+ assert File.exists?("test/sandbox/dumps/checksum-0-1234")
70
+ # And read back in
71
+ payload = NFAgent::Payload.read_from_file("checksum-0-1234", "test/sandbox/dumps/")
72
+ assert_equal "data", payload.data
73
+ assert_equal 0, payload.attempt
74
+ assert_equal '1234', payload.key
75
+ end
76
+
77
+ end
@@ -0,0 +1,13 @@
1
+
2
+ require 'test/test_helper'
3
+
4
+ class TestPlugin < ActiveSupport::TestCase
5
+ setup do
6
+ end
7
+
8
+ test "load" do
9
+ assert_raise(NameError) { Object.const_get("MissingMapper") }
10
+ NFAgent::Plugin.load_plugins
11
+ Object.const_get("MyMapper")
12
+ end
13
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nfagent
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.31
4
+ version: 0.9.50
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-17 00:00:00.000000000 Z
12
+ date: 2013-03-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: svutil
@@ -18,7 +18,7 @@ dependencies:
18
18
  requirements:
19
19
  - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
- version: 0.0.12
21
+ version: 0.1.3
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ! '>='
28
28
  - !ruby/object:Gem::Version
29
- version: 0.0.12
29
+ version: 0.1.3
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: eventmachine
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -43,6 +43,38 @@ dependencies:
43
43
  - - ! '>='
44
44
  - !ruby/object:Gem::Version
45
45
  version: 0.12.8
46
+ - !ruby/object:Gem::Dependency
47
+ name: squiggle
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: 0.0.8
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: 0.0.8
62
+ - !ruby/object:Gem::Dependency
63
+ name: rdoc
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: '3.10'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: '3.10'
46
78
  - !ruby/object:Gem::Dependency
47
79
  name: newgem
48
80
  requirement: !ruby/object:Gem::Requirement
@@ -50,7 +82,7 @@ dependencies:
50
82
  requirements:
51
83
  - - ! '>='
52
84
  - !ruby/object:Gem::Version
53
- version: 1.5.3
85
+ version: 1.5.2
54
86
  type: :development
55
87
  prerelease: false
56
88
  version_requirements: !ruby/object:Gem::Requirement
@@ -58,7 +90,7 @@ dependencies:
58
90
  requirements:
59
91
  - - ! '>='
60
92
  - !ruby/object:Gem::Version
61
- version: 1.5.3
93
+ version: 1.5.2
62
94
  - !ruby/object:Gem::Dependency
63
95
  name: hoe
64
96
  requirement: !ruby/object:Gem::Requirement
@@ -83,48 +115,65 @@ executables:
83
115
  - squid_log_writer
84
116
  extensions: []
85
117
  extra_rdoc_files:
86
- - PostInstall.txt
87
118
  - History.txt
88
119
  - Manifest.txt
89
- - README.txt
120
+ - PostInstall.txt
121
+ - README.rdoc
90
122
  - nfagent.init.ubuntu.txt
91
123
  - nfagent.init.redhat.txt
92
124
  files:
125
+ - History.txt
126
+ - Manifest.txt
127
+ - PostInstall.txt
128
+ - README.rdoc
93
129
  - Rakefile
130
+ - script/console
131
+ - script/destroy
132
+ - script/generate
133
+ - test/test_chunk.rb
134
+ - test/test_chunk_handler.rb
135
+ - test/test_client.rb
136
+ - test/test_config.rb
137
+ - test/test_helper.rb
138
+ - test/test_mapper_proxy.rb
139
+ - test/test_nfagent.rb
140
+ - test/test_payload.rb
141
+ - test/test_plugin.rb
142
+ - test/config
143
+ - test/plugins/my_mapper.rb
94
144
  - lib/nfagent.rb
95
- - lib/nfagent/cli.rb
96
145
  - lib/nfagent/base64.rb
97
- - lib/nfagent/encoder.rb
98
- - lib/nfagent/server.rb
99
- - lib/nfagent/chunk_handler.rb
100
- - lib/nfagent/log.rb
101
- - lib/nfagent/info.rb
102
- - lib/nfagent/event.rb
103
- - lib/nfagent/payload.rb
104
- - lib/nfagent/poller.rb
105
146
  - lib/nfagent/chunk.rb
147
+ - lib/nfagent/chunk_handler.rb
148
+ - lib/nfagent/cli.rb
106
149
  - lib/nfagent/client.rb
107
150
  - lib/nfagent/client_response.rb
108
151
  - lib/nfagent/config.rb
152
+ - lib/nfagent/encoder.rb
153
+ - lib/nfagent/event.rb
154
+ - lib/nfagent/info.rb
155
+ - lib/nfagent/log.rb
156
+ - lib/nfagent/mapper_proxy.rb
157
+ - lib/nfagent/object_extra.rb
158
+ - lib/nfagent/payload.rb
159
+ - lib/nfagent/plugin.rb
160
+ - lib/nfagent/poller.rb
161
+ - lib/nfagent/server.rb
162
+ - lib/nfagent/submitter.rb
109
163
  - lib/nfagent/tail.rb
110
164
  - lib/nfagent/tests.rb
111
- - lib/nfagent/submitter.rb
112
165
  - bin/nfagent
113
166
  - bin/squid_log_writer
114
- - PostInstall.txt
115
- - History.txt
116
- - Manifest.txt
117
- - README.txt
118
167
  - nfagent.conf
119
168
  - nfagent.init.ubuntu.txt
120
169
  - nfagent.init.redhat.txt
121
170
  - .gemtest
122
- homepage: http://netfox.com
171
+ homepage: http://github.com/#{github_username}/#{project_name}
123
172
  licenses: []
124
173
  post_install_message: PostInstall.txt
125
174
  rdoc_options:
126
175
  - --main
127
- - README.txt
176
+ - README.rdoc
128
177
  require_paths:
129
178
  - lib
130
179
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -133,6 +182,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
133
182
  - - ! '>='
134
183
  - !ruby/object:Gem::Version
135
184
  version: '0'
185
+ segments:
186
+ - 0
187
+ hash: 3602518525496297623
136
188
  required_rubygems_version: !ruby/object:Gem::Requirement
137
189
  none: false
138
190
  requirements:
@@ -145,4 +197,13 @@ rubygems_version: 1.8.24
145
197
  signing_key:
146
198
  specification_version: 3
147
199
  summary: Logging Agent for NetFox Online
148
- test_files: []
200
+ test_files:
201
+ - test/test_chunk.rb
202
+ - test/test_chunk_handler.rb
203
+ - test/test_client.rb
204
+ - test/test_config.rb
205
+ - test/test_helper.rb
206
+ - test/test_mapper_proxy.rb
207
+ - test/test_nfagent.rb
208
+ - test/test_payload.rb
209
+ - test/test_plugin.rb