norikra-listener-mock 0.0.4-java → 0.1.0-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/norikra/listener/mock.rb +25 -5
- data/norikra-listener-mock.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f4b79e5a0d324765bb732838e99796eaefaeabfd
|
4
|
+
data.tar.gz: d2e5964e6ee952ea01ef50997044f45f1ba2c609
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b0bb586aae9333d508fe016dc8c51f3391272d838bc8435dc3ccfdfae43d166087e5ae6cb12562df288e0bb536553040c5ba3259f6be96b184cd96074c47ac1d
|
7
|
+
data.tar.gz: b85c2bd862c1d392f5575253b85124aabbee9a3cf88778d9e2ba01a59f827484c5c5fa42b421930af1ba38ff2e342a4cc85ac7fb92400411d8cd0e5d69f5ac6d
|
@@ -4,20 +4,40 @@ require "json"
|
|
4
4
|
module Norikra
|
5
5
|
module Listener
|
6
6
|
class Mock < Norikra::Listener::Base
|
7
|
-
def self.
|
8
|
-
|
7
|
+
def self.label
|
8
|
+
"MOCK"
|
9
9
|
end
|
10
10
|
|
11
|
-
def initialize(query_name, query_group
|
11
|
+
def initialize(argument, query_name, query_group)
|
12
12
|
super
|
13
|
-
@
|
13
|
+
@stdout = STDOUT
|
14
|
+
end
|
15
|
+
|
16
|
+
def process_sync(news, olds)
|
17
|
+
news.each do |event|
|
18
|
+
@stdout.puts "#{@query_name}\t#{@argument}\t" + JSON.dump(event)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
class MockAsync < Norikra::Listener::Base
|
24
|
+
def self.label
|
25
|
+
"MOCK_ASYNC"
|
26
|
+
end
|
27
|
+
|
28
|
+
attr_accessor :stdout
|
29
|
+
|
30
|
+
def initialize(argument, query_name, query_group)
|
31
|
+
super
|
32
|
+
@stdout = STDOUT
|
33
|
+
@repeat = @argument.to_i
|
14
34
|
end
|
15
35
|
|
16
36
|
def process_async(events) # [ [unixtime, {event} ], ...
|
17
37
|
# write events to STDOUT specified times, in background
|
18
38
|
events.each do |time, e|
|
19
39
|
@repeat.times do |i|
|
20
|
-
|
40
|
+
@stdout.puts "#{@query_name}\t#{i + 1}\t#{Time.at(time)}\t" + JSON.dump(e)
|
21
41
|
end
|
22
42
|
end
|
23
43
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: norikra-listener-mock
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- TAGOMORI Satoshi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|