norikra 1.1.1-java → 1.1.2-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f4eae89361b3c3818371a494f12743a92f35bee9
4
- data.tar.gz: d1646809b16f1697fb8539c55492b9f673cf7b7a
3
+ metadata.gz: 90c6be383b83590b832fb6271a3642a42295ae6f
4
+ data.tar.gz: 23555f2d09692459ef6fa17b85a47af61129e769
5
5
  SHA512:
6
- metadata.gz: b2c5171c76436c2ef9e43c3e17291f2e5de780c855416e070cf7c9c47bf1505ee48acb7a13f9de31694d8e6934ed4ebeffbc98cab7ac52bef9a2b857b3dd6d24
7
- data.tar.gz: 6567dbcc6ab87147580c459a11ab985bd6b94d1cdd04c70000dc399a202c0ba064407039083e4ff38d7939a134f6b053fbd69a68289c8aeeb6e55b4990c23217
6
+ metadata.gz: b93442c3b3e202a880fa75f90065770b1b44b210789684b16889b24b7c10f91144488e6f2564b25e78ae0850c2a8f24c711e83c0c8b8d8a90608ee5c2e0b249e
7
+ data.tar.gz: b34e828cd14c7c4fb00a2d83c17131590be520e15559c9caef5e429d46a92b311e027a12a283721de81000efbb12d79b752df3e1559a4890bef4cabf93788b2d
data/.travis.yml CHANGED
@@ -1,13 +1,13 @@
1
1
  language: ruby
2
2
  rvm:
3
3
  - jruby-19mode
4
- - jruby-head
4
+ # - jruby-head
5
5
  jdk:
6
6
  - oraclejdk8
7
7
  - oraclejdk7
8
8
  - openjdk7
9
9
  - openjdk6
10
- matrix:
11
- exclude:
12
- - rvm: jruby-head
13
- jdk: openjdk6
10
+ # matrix:
11
+ # exclude:
12
+ # - rvm: jruby-head
13
+ # jdk: openjdk6
data/Changes.md CHANGED
@@ -3,6 +3,20 @@
3
3
  Changes of norikra.
4
4
 
5
5
  ## v1
6
+ * v1.1.2
7
+ * Enable `-javaagent` option
8
+ * Fix default/pre-set threads
9
+ * Update RSpec dependency to latest
10
+ * Reject field names, starting with numeric characters
11
+ * Reject non-JSON object input events
12
+ * Fix Bug:
13
+ * to show wrong output events from queries
14
+ * missing header column of list of queries in WebUI
15
+ * v1.1.1
16
+ * Fix bug not to sort suspended queries correctly
17
+ * v1.1.0
18
+ * Add API/WebUI controls to suspend/resume queries
19
+ * Add `STDOUT()` query group to show query result easilly
6
20
  * v1.0.8:
7
21
  * Fix bug not to read command line options for time/route threads
8
22
  * v1.0.7:
data/README.md CHANGED
@@ -70,6 +70,8 @@ See: http://norikra.github.io/
70
70
 
71
71
  ## Changes
72
72
 
73
+ * v1.1
74
+ * Suspend/Resume queries
73
75
  * v1.0
74
76
  * Esper-5.0 bundle
75
77
  * Pattern support
data/lib/norikra/cli.rb CHANGED
@@ -144,6 +144,8 @@ module Norikra
144
144
  jruby_options.push('-J-X' + $1)
145
145
  elsif arg =~ /^-verbose:gc$/
146
146
  jruby_options.push('-J-verbose:gc')
147
+ elsif arg =~ /^-javaagent:(.+)$/
148
+ jruby_options.push('-J-javaagent:' + $1)
147
149
  else
148
150
  argv.push(arg)
149
151
  end
@@ -4,6 +4,9 @@ require 'norikra/error'
4
4
  require 'norikra/target'
5
5
  require 'norikra/listener'
6
6
 
7
+ require 'norikra/query'
8
+ require 'norikra/suspended_query'
9
+
7
10
  require 'norikra/logger'
8
11
  include Norikra::Log
9
12
 
@@ -221,6 +224,23 @@ module Norikra
221
224
  remove_suspended_query(suspended_query)
222
225
  end
223
226
 
227
+ def event_filter(event)
228
+ unless event.is_a?(Hash)
229
+ error "Invalid input event: Non-Hash (JSON) object: #{event.class}"
230
+ return nil
231
+ end
232
+ event.keys.each do |k|
233
+ if ! k.is_a?(String)
234
+ warn "Invalid key in event: Non-String field key: #{k.class}"
235
+ event.delete(k)
236
+ elsif k =~ /^\d/
237
+ warn "Invalid key in event: Starting with numeric char: #{k.to_s}"
238
+ event.delete(k)
239
+ end
240
+ end
241
+ event
242
+ end
243
+
224
244
  def send(target_name, events)
225
245
  trace "send messages", :target => target_name, :events => events
226
246
 
@@ -236,8 +256,13 @@ module Norikra
236
256
 
237
257
  if @typedef_manager.lazy?(target.name)
238
258
  info "opening lazy target", :target => target
239
- debug "generating base fieldset from event", :target => target.name, :event => events.first
240
- base_fieldset = @typedef_manager.generate_base_fieldset(target.name, events.first)
259
+
260
+ first_event = event_filter(events.first)
261
+ if first_event.nil? # non-hash object
262
+ raise Norikra::ClientError, "Input data must be JSON object"
263
+ end
264
+ debug "generating base fieldset from event", :target => target.name, :event => first_event
265
+ base_fieldset = @typedef_manager.generate_base_fieldset(target.name, first_event)
241
266
 
242
267
  debug "registering base fieldset", :target => target.name, :base => base_fieldset
243
268
  register_base_fieldset(target.name, base_fieldset)
@@ -249,7 +274,10 @@ module Norikra
249
274
 
250
275
  strict_refer = (not target.auto_field?)
251
276
 
252
- events.each do |event|
277
+ events.each do |input_event|
278
+ event = event_filter(input_event)
279
+ next if event.nil? # non-hash object
280
+
253
281
  fieldset = @typedef_manager.refer(target_name, event, strict_refer)
254
282
 
255
283
  unless registered_data_fieldset[fieldset.summary]
data/lib/norikra/field.rb CHANGED
@@ -44,7 +44,7 @@ module Norikra
44
44
  when 'integer', 'int', 'long' then 'long'
45
45
  when 'float', 'double' then 'double'
46
46
  when 'hash', 'array'
47
- raise Norikra::ArgumentError, "#{type} is norikra internal type, not for esper"
47
+ raise Norikra::ArgumentError, "#{type} is container field. Don't specify it at open, use it directly."
48
48
  when 'byte'
49
49
  raise Norikra::ArgumentError, "byte is not supported in Norikra"
50
50
  else
data/lib/norikra/query.rb CHANGED
@@ -465,43 +465,4 @@ module Norikra
465
465
  def dup; self; end
466
466
  def dup_with_stream_name(actual_name); self; end
467
467
  end
468
-
469
- class SuspendedQuery
470
- attr_accessor :name, :group, :expression, :targets
471
-
472
- def initialize(query)
473
- @name = query.name
474
- @group = query.group
475
- @expression = query.expression
476
- @targets = query.targets
477
- end
478
-
479
- def <=>(other)
480
- if @group.nil? || other.group.nil?
481
- if @group.nil? && other.group.nil?
482
- @name <=> other.name
483
- else
484
- @group.to_s <=> other.group.to_s
485
- end
486
- else
487
- if @group == other.group
488
- self.name <=> other.name
489
- else
490
- self.group <=> other.group
491
- end
492
- end
493
- end
494
-
495
- def suspended?
496
- true
497
- end
498
-
499
- def to_hash
500
- {'name' => @name, 'group' => @group, 'expression' => @expression, 'targets' => @targets, 'suspended' => true}
501
- end
502
-
503
- def create
504
- Query.new(name: @name, group: @group, expression: @expression)
505
- end
506
- end
507
468
  end
@@ -21,26 +21,26 @@ module Norikra
21
21
  MICRO_PREDEFINED = {
22
22
  :engine => { inbound: { threads: 0, capacity: 0 }, outbound: { threads: 0, capacity: 0 },
23
23
  route_exec: { threads: 0, capacity: 0 }, timer_exec: { threads: 0, capacity: 0 }, },
24
- :rpc => { threads: 2 },
24
+ :rpc => { threads: 2 }, # for desktop
25
25
  :web => { threads: 2 },
26
26
  }
27
27
  SMALL_PREDEFINED = {
28
- :engine => { inbound: { threads: 1, capacity: 0 }, outbound: { threads: 1, capacity: 0 },
29
- route_exec: { threads: 1, capacity: 0 }, timer_exec: { threads: 1, capacity: 0 }, },
30
- :rpc => { threads: 2 },
31
- :web => { threads: 2 },
28
+ :engine => { inbound: { threads: 2, capacity: 0 }, outbound: { threads: 2, capacity: 0 },
29
+ route_exec: { threads: 2, capacity: 0 }, timer_exec: { threads: 2, capacity: 0 }, },
30
+ :rpc => { threads: 9 }, # 4core HT
31
+ :web => { threads: 9 },
32
32
  }
33
33
  MIDDLE_PREDEFINED = {
34
- :engine => { inbound: { threads: 4, capacity: 0 }, outbound: { threads: 2, capacity: 0 },
35
- route_exec: { threads: 2, capacity: 0 }, timer_exec: { threads: 2, capacity: 0 }, },
36
- :rpc => { threads: 4 },
37
- :web => { threads: 2 },
34
+ :engine => { inbound: { threads: 4, capacity: 0 }, outbound: { threads: 4, capacity: 0 },
35
+ route_exec: { threads: 4, capacity: 0 }, timer_exec: { threads: 4, capacity: 0 }, },
36
+ :rpc => { threads: 17 }, # 4core HT 2CPU
37
+ :web => { threads: 17 },
38
38
  }
39
39
  LARGE_PREDEFINED = {
40
- :engine => { inbound: { threads: 6, capacity: 0 }, outbound: { threads: 6, capacity: 0 },
41
- route_exec: { threads: 4, capacity: 0 }, timer_exec: { threads: 4, capacity: 0 }, },
42
- :rpc => { threads: 8 },
43
- :web => { threads: 2 },
40
+ :engine => { inbound: { threads: 8, capacity: 0 }, outbound: { threads: 8, capacity: 0 },
41
+ route_exec: { threads: 8, capacity: 0 }, timer_exec: { threads: 8, capacity: 0 }, },
42
+ :rpc => { threads: 49 }, # 6core HT 4CPU
43
+ :web => { threads: 49 },
44
44
  }
45
45
 
46
46
  def self.threading_configuration(conf)
@@ -0,0 +1,43 @@
1
+ require 'norikra/error'
2
+ require 'norikra/query'
3
+
4
+ module Norikra
5
+ class SuspendedQuery
6
+ attr_accessor :name, :group, :expression, :targets
7
+
8
+ def initialize(query)
9
+ @name = query.name
10
+ @group = query.group
11
+ @expression = query.expression
12
+ @targets = query.targets
13
+ end
14
+
15
+ def <=>(other)
16
+ if @group.nil? || other.group.nil?
17
+ if @group.nil? && other.group.nil?
18
+ @name <=> other.name
19
+ else
20
+ @group.to_s <=> other.group.to_s
21
+ end
22
+ else
23
+ if @group == other.group
24
+ self.name <=> other.name
25
+ else
26
+ self.group <=> other.group
27
+ end
28
+ end
29
+ end
30
+
31
+ def suspended?
32
+ true
33
+ end
34
+
35
+ def to_hash
36
+ {'name' => @name, 'group' => @group, 'expression' => @expression, 'targets' => @targets, 'suspended' => true}
37
+ end
38
+
39
+ def create
40
+ Query.new(name: @name, group: @group, expression: @expression)
41
+ end
42
+ end
43
+ end
@@ -1,3 +1,3 @@
1
1
  module Norikra
2
- VERSION = "1.1.1"
2
+ VERSION = "1.1.2"
3
3
  end
@@ -67,8 +67,7 @@ class Norikra::WebUI::Handler < Sinatra::Base
67
67
  input_data,session[:input_data] = session[:input_data],nil
68
68
 
69
69
  queries = engine.queries.sort + engine.suspended_queries.sort
70
- pooled_events = Hash[* queries.map{|q| [q.name, engine.output_pool.pool.fetch(q.name, []).size.to_s]}.flatten]
71
-
70
+ pooled_events = Hash[* queries.map{|q| [q.name, engine.output_pool.pool.fetch(q.name, []).map(&:size).reduce(&:+).to_s]}.flatten]
72
71
  engine_targets = engine.targets.sort
73
72
  targets = engine_targets.map{|t|
74
73
  {
data/norikra.gemspec CHANGED
@@ -30,7 +30,7 @@ Gem::Specification.new do |spec|
30
30
 
31
31
  spec.add_development_dependency "bundler", "~> 1.3"
32
32
  spec.add_development_dependency "rake"
33
- spec.add_development_dependency "rspec", "~> 2.0"
33
+ spec.add_development_dependency "rspec"
34
34
  spec.add_development_dependency "spork"
35
35
  spec.add_development_dependency "pry"
36
36
  end
data/spec/field_spec.rb CHANGED
@@ -64,15 +64,15 @@ describe Norikra::Field do
64
64
 
65
65
  describe '.container_type?' do
66
66
  it 'returns true for only "hash" and "array"' do
67
- expect(Norikra::Field.container_type?('')).to be_false
68
- expect(Norikra::Field.container_type?('string')).to be_false
69
- expect(Norikra::Field.container_type?('int')).to be_false
70
- expect(Norikra::Field.container_type?('long')).to be_false
71
-
72
- expect(Norikra::Field.container_type?('Hash')).to be_true
73
- expect(Norikra::Field.container_type?('hash')).to be_true
74
- expect(Norikra::Field.container_type?('Array')).to be_true
75
- expect(Norikra::Field.container_type?('array')).to be_true
67
+ expect(Norikra::Field.container_type?('')).to be_falsy
68
+ expect(Norikra::Field.container_type?('string')).to be_falsy
69
+ expect(Norikra::Field.container_type?('int')).to be_falsy
70
+ expect(Norikra::Field.container_type?('long')).to be_falsy
71
+
72
+ expect(Norikra::Field.container_type?('Hash')).to be_truthy
73
+ expect(Norikra::Field.container_type?('hash')).to be_truthy
74
+ expect(Norikra::Field.container_type?('Array')).to be_truthy
75
+ expect(Norikra::Field.container_type?('array')).to be_truthy
76
76
  end
77
77
  end
78
78
 
@@ -21,12 +21,12 @@ describe Norikra::FieldSet do
21
21
 
22
22
  it 'accepts second argument as optional specification' do
23
23
  set = Norikra::FieldSet.new({'x' => 'string', 'y' => 'long'}, false)
24
- expect(set.fields['x'].optional?).to be_false
25
- expect(set.fields['y'].optional?).to be_false
24
+ expect(set.fields['x'].optional?).to be_falsy
25
+ expect(set.fields['y'].optional?).to be_falsy
26
26
 
27
27
  set = Norikra::FieldSet.new({'x' => 'string', 'y' => 'long'}, true)
28
- expect(set.fields['x'].optional?).to be_true
29
- expect(set.fields['y'].optional?).to be_true
28
+ expect(set.fields['x'].optional?).to be_truthy
29
+ expect(set.fields['y'].optional?).to be_truthy
30
30
  end
31
31
 
32
32
  it 'sets summary as comma-separated labeled field-type string with sorted field order' do
@@ -57,11 +57,11 @@ describe Norikra::FieldSet do
57
57
  expect(q_set1.dup.instance_eval{ @query_unique_keys }).to eql(['set1', 'g1'])
58
58
  expect(q_set2.dup.instance_eval{ @query_unique_keys }).to eql(['set2', nil])
59
59
 
60
- expect(q_set2 == q_set3).to be_false
60
+ expect(q_set2 == q_set3).to be_falsy
61
61
 
62
- expect(q_set1 == q_set1.dup).to be_true
63
- expect(q_set2 == q_set2.dup).to be_true
64
- expect(q_set3 == q_set3.dup).to be_true
62
+ expect(q_set1 == q_set1.dup).to be_truthy
63
+ expect(q_set2 == q_set2.dup).to be_truthy
64
+ expect(q_set3 == q_set3.dup).to be_truthy
65
65
  end
66
66
  end
67
67
 
@@ -246,13 +246,13 @@ describe Norikra::FieldSet do
246
246
  describe '#subset?' do
247
247
  it 'returns true when other instance has all fields of self' do
248
248
  other = Norikra::FieldSet.new({'a' => 'boolean', 'x' => 'string'})
249
- expect(set.subset?(other)).to be_false
249
+ expect(set.subset?(other)).to be_falsy
250
250
 
251
251
  other.update([Norikra::Field.new('y', 'long')], false)
252
- expect(set.subset?(other)).to be_true
252
+ expect(set.subset?(other)).to be_truthy
253
253
 
254
254
  other.update([Norikra::Field.new('z', 'double')], false)
255
- expect(set.subset?(other)).to be_true
255
+ expect(set.subset?(other)).to be_truthy
256
256
  end
257
257
  end
258
258
 
@@ -25,7 +25,7 @@ describe Norikra::OutputPool do
25
25
  t = Time.now.to_i
26
26
  pool.push('TestTable query1',nil,[[t, {'count'=>1}],[t ,{'count'=>2}]])
27
27
 
28
- pool.pool.keys.should eql(['TestTable query1'])
28
+ expect(pool.pool.keys).to eql(['TestTable query1'])
29
29
  events = pool.pool['TestTable query1']
30
30
 
31
31
  expect(events.size).to eq(1) # pool event bucket size is equal to times of #push
data/spec/query_spec.rb CHANGED
@@ -22,7 +22,7 @@ describe Norikra::Query do
22
22
  expect(q.fields('TestTable')).to eql(['param','path','size'].sort)
23
23
  expect(q.fields(nil)).to eql([])
24
24
 
25
- expect(q.invalid?).to be_false
25
+ expect(q.invalid?).to be_falsy
26
26
  end
27
27
  end
28
28
 
@@ -89,7 +89,7 @@ describe Norikra::Query do
89
89
  expect(q.fields('TestTable')).to eql([])
90
90
  expect(q.fields(nil)).to eql([])
91
91
 
92
- expect(q.invalid?).to be_false
92
+ expect(q.invalid?).to be_falsy
93
93
  end
94
94
  end
95
95
 
@@ -108,7 +108,7 @@ describe Norikra::Query do
108
108
  expect(q.fields('TestTable')).to eql(['name.string', 'param','path','size'].sort)
109
109
  expect(q.fields(nil)).to eql([])
110
110
 
111
- expect(q.invalid?).to be_false
111
+ expect(q.invalid?).to be_falsy
112
112
  end
113
113
  end
114
114
 
@@ -127,7 +127,7 @@ describe Norikra::Query do
127
127
  expect(q.fields('TestTable')).to eql(['path', 'size'].sort)
128
128
  expect(q.fields(nil)).to eql([])
129
129
 
130
- expect(q.invalid?).to be_false
130
+ expect(q.invalid?).to be_falsy
131
131
  end
132
132
  end
133
133
 
@@ -146,7 +146,7 @@ describe Norikra::Query do
146
146
  expect(q.fields('StreamB')).to eql(['size','header'].sort)
147
147
  expect(q.fields(nil)).to eql(['product'])
148
148
 
149
- expect(q.invalid?).to be_false
149
+ expect(q.invalid?).to be_falsy
150
150
  end
151
151
 
152
152
  it 'returns query instances collectly parsed, with field accessing views' do
@@ -163,7 +163,7 @@ describe Norikra::Query do
163
163
  expect(q.fields('StreamB')).to eql(['size','header','ts2'].sort)
164
164
  expect(q.fields(nil)).to eql(['product'])
165
165
 
166
- expect(q.invalid?).to be_false
166
+ expect(q.invalid?).to be_falsy
167
167
  end
168
168
  end
169
169
 
@@ -182,7 +182,7 @@ describe Norikra::Query do
182
182
  expect(q.fields('Zones')).to eql(['name','zoneName','zoneId'].sort)
183
183
  expect(q.fields(nil)).to eql([])
184
184
 
185
- expect(q.invalid?).to be_false
185
+ expect(q.invalid?).to be_falsy
186
186
  end
187
187
  end
188
188
 
@@ -201,7 +201,7 @@ describe Norikra::Query do
201
201
  expect(q.fields('Zones')).to eql(['name','zoneName','zoneId'].sort)
202
202
  expect(q.fields(nil)).to eql([])
203
203
 
204
- expect(q.invalid?).to be_false
204
+ expect(q.invalid?).to be_falsy
205
205
  end
206
206
  end
207
207
 
@@ -220,7 +220,7 @@ describe Norikra::Query do
220
220
  expect(q.fields('SMA20Stream')).to eql(['movAgv','ticker'].sort)
221
221
  expect(q.fields(nil)).to eql([])
222
222
 
223
- expect(q.invalid?).to be_false
223
+ expect(q.invalid?).to be_falsy
224
224
  end
225
225
  end
226
226
 
@@ -239,7 +239,7 @@ describe Norikra::Query do
239
239
  expect(q.fields('TestTable')).to eql(['params.path', 'size', 'opts.$0'].sort)
240
240
  expect(q.fields(nil)).to eql([])
241
241
 
242
- expect(q.invalid?).to be_false
242
+ expect(q.invalid?).to be_falsy
243
243
  end
244
244
  end
245
245
 
@@ -258,7 +258,7 @@ describe Norikra::Query do
258
258
  expect(q.fields('TestTable')).to eql(['params.$$path.$1', 'size.$0.bytes', 'opts.num.$0'].sort)
259
259
  expect(q.fields(nil)).to eql([])
260
260
 
261
- expect(q.invalid?).to be_false
261
+ expect(q.invalid?).to be_falsy
262
262
  end
263
263
 
264
264
  it 'can parse with nested function calls correctly' do
@@ -272,7 +272,7 @@ describe Norikra::Query do
272
272
  q = Norikra::Query.new(:name => 'TestTable query8.2', :expression => expression)
273
273
  expect(q.fields).to eql(['path.f1'])
274
274
 
275
- expect(q.invalid?).to be_false
275
+ expect(q.invalid?).to be_falsy
276
276
  end
277
277
  end
278
278
 
@@ -284,7 +284,7 @@ describe Norikra::Query do
284
284
  expect(q.fields('TestTable')).to eql(['path.source', 'ts'].sort)
285
285
  expect(q.fields(nil)).to eql([])
286
286
 
287
- expect(q.invalid?).to be_false
287
+ expect(q.invalid?).to be_falsy
288
288
  end
289
289
  end
290
290
 
@@ -304,7 +304,7 @@ describe Norikra::Query do
304
304
  expect(q.fields('EventA')).to eql(['name', 'content', 'type', 'source'].sort)
305
305
  expect(q.fields(nil)).to eql([])
306
306
 
307
- expect(q.invalid?).to be_false
307
+ expect(q.invalid?).to be_falsy
308
308
  end
309
309
  end
310
310
 
@@ -314,7 +314,7 @@ describe Norikra::Query do
314
314
  q = Norikra::Query.new(
315
315
  name: 'Invalid query 1', expression: expression
316
316
  )
317
- expect(q.invalid?).to be_true
317
+ expect(q.invalid?).to be_truthy
318
318
  end
319
319
  end
320
320
  end
@@ -340,11 +340,11 @@ describe Norikra::Query do
340
340
 
341
341
  describe '.stdout?' do
342
342
  it 'returns true if group name is "STDOUT()"' do
343
- expect(Norikra::Query.stdout?(nil)).to be_false
344
- expect(Norikra::Query.stdout?("")).to be_false
345
- expect(Norikra::Query.stdout?("foo")).to be_false
346
- expect(Norikra::Query.stdout?("STDOUT")).to be_false
347
- expect(Norikra::Query.stdout?("STDOUT()")).to be_true
343
+ expect(Norikra::Query.stdout?(nil)).to be_falsy
344
+ expect(Norikra::Query.stdout?("")).to be_falsy
345
+ expect(Norikra::Query.stdout?("foo")).to be_falsy
346
+ expect(Norikra::Query.stdout?("STDOUT")).to be_falsy
347
+ expect(Norikra::Query.stdout?("STDOUT()")).to be_truthy
348
348
  end
349
349
  end
350
350
 
@@ -376,7 +376,7 @@ describe Norikra::Query do
376
376
  it 'returns false, always' do
377
377
  e1 = 'SELECT max(num) AS max FROM TestTable1.win:time(5 sec)'
378
378
  q1 = Norikra::Query.new(:name => 'q1', :group => nil, :expression => e1)
379
- expect(q1.suspended?).to be_false
379
+ expect(q1.suspended?).to be_falsy
380
380
  end
381
381
  end
382
382
 
@@ -743,22 +743,20 @@ describe Norikra::Query do
743
743
 
744
744
  describe '.imported_java_class?' do
745
745
  it 'can do judge passed name exists under java package tree or not' do
746
- expect(Norikra::Query.imported_java_class?('String')).to be_true
747
- expect(Norikra::Query.imported_java_class?('Long')).to be_true
748
- expect(Norikra::Query.imported_java_class?('Void')).to be_true
749
- expect(Norikra::Query.imported_java_class?('BigDecimal')).to be_true
750
- expect(Norikra::Query.imported_java_class?('Format')).to be_true
751
- expect(Norikra::Query.imported_java_class?('Normalizer')).to be_true
752
- expect(Norikra::Query.imported_java_class?('Date')).to be_true
753
- expect(Norikra::Query.imported_java_class?('HashSet')).to be_true
754
- expect(Norikra::Query.imported_java_class?('Random')).to be_true
755
- expect(Norikra::Query.imported_java_class?('Timer')).to be_true
756
-
757
- expect(Norikra::Query.imported_java_class?('unexpected')).to be_false
758
- expect(Norikra::Query.imported_java_class?('parameter')).to be_false
759
- expect(Norikra::Query.imported_java_class?('param')).to be_false
746
+ expect(Norikra::Query.imported_java_class?('String')).to be_truthy
747
+ expect(Norikra::Query.imported_java_class?('Long')).to be_truthy
748
+ expect(Norikra::Query.imported_java_class?('Void')).to be_truthy
749
+ expect(Norikra::Query.imported_java_class?('BigDecimal')).to be_truthy
750
+ expect(Norikra::Query.imported_java_class?('Format')).to be_truthy
751
+ expect(Norikra::Query.imported_java_class?('Normalizer')).to be_truthy
752
+ expect(Norikra::Query.imported_java_class?('Date')).to be_truthy
753
+ expect(Norikra::Query.imported_java_class?('HashSet')).to be_truthy
754
+ expect(Norikra::Query.imported_java_class?('Random')).to be_truthy
755
+ expect(Norikra::Query.imported_java_class?('Timer')).to be_truthy
756
+
757
+ expect(Norikra::Query.imported_java_class?('unexpected')).to be_falsy
758
+ expect(Norikra::Query.imported_java_class?('parameter')).to be_falsy
759
+ expect(Norikra::Query.imported_java_class?('param')).to be_falsy
760
760
  end
761
761
  end
762
762
  end
763
-
764
- #TODO: write specs about Norikra::SuspendedQuery
@@ -0,0 +1,58 @@
1
+ require_relative './spec_helper'
2
+
3
+ require 'norikra/suspended_query'
4
+ require 'norikra/query'
5
+
6
+ include Norikra::SpecHelper
7
+
8
+ describe Norikra::SuspendedQuery do
9
+ context 'when instanciate' do
10
+ describe '#initialize' do
11
+ it 'get query and just store its attributes' do
12
+ q1 = Norikra::Query.new(name: 'name1', group: nil, expression: 'SELECT n,m FROM t')
13
+ s1 = Norikra::SuspendedQuery.new(q1)
14
+ expect(s1.name).to eql(q1.name)
15
+ expect(s1.group).to eql(q1.group)
16
+ expect(s1.expression).to eql(q1.expression)
17
+ expect(s1.targets).to eql(q1.targets)
18
+
19
+ expect(q1.suspended?).to be_falsy
20
+ expect(s1.suspended?).to be_truthy
21
+
22
+ q2 = Norikra::Query.new(name: 'name2', group: 'testing', expression: 'SELECT n,m,q.a FROM t, q')
23
+ s2 = Norikra::SuspendedQuery.new(q2)
24
+ expect(s2.name).to eql(q2.name)
25
+ expect(s2.group).to eql(q2.group)
26
+ expect(s2.expression).to eql(q2.expression)
27
+ expect(s2.targets).to eql(q2.targets)
28
+
29
+ expect(q2.suspended?).to be_falsy
30
+ expect(s2.suspended?).to be_truthy
31
+ end
32
+ end
33
+
34
+ describe '.<=>' do
35
+ it 'returns sort order by group,name' do
36
+ q1 = Norikra::Query.new(:name => '211', :group => 'a1', :expression => 'select x from y')
37
+ q2 = Norikra::SuspendedQuery.new(Norikra::Query.new(:name => '111', :group => 'a1', :expression => 'select x from y'))
38
+ q3 = Norikra::Query.new(:name => '011', :group => 'b1', :expression => 'select x from y')
39
+ q4 = Norikra::Query.new(:name => '011', :group => 'a1', :expression => 'select x from y')
40
+ q5 = Norikra::SuspendedQuery.new(Norikra::Query.new(:name => '999', :group => nil, :expression => 'select x from y'))
41
+ q6 = Norikra::Query.new(:name => '899', :group => nil, :expression => 'select x from y')
42
+
43
+ expect([q1,q2,q3,q4,q5,q6].sort).to eql([q6,q5,q4,q2,q1,q3])
44
+ end
45
+
46
+ it 'must be stable for sort' do
47
+ q1 = Norikra::Query.new(name: "hoge", group: nil, expression: "select hoge from pos")
48
+ s1 = Norikra::SuspendedQuery.new(q1)
49
+ q2 = Norikra::Query.new(name: "test1", group: nil, expression: "select hoge,count(*)\r\nfrom pos\r\nwhere age >= 20\r\ngroup by hoge")
50
+ s2 = Norikra::SuspendedQuery.new(q2)
51
+ q3 = Norikra::Query.new(name: "test2", group: "sweep1", expression: "select moge\r\nfrom pos.win:time_batch(5 sec)\r\nwhere x=1\r\n")
52
+ s3 = Norikra::SuspendedQuery.new(q3)
53
+ expect([s1,s2,s3].sort).to eql([s1, s2, s3])
54
+ end
55
+ end
56
+
57
+ end
58
+ end
data/spec/target_spec.rb CHANGED
@@ -6,19 +6,19 @@ require 'norikra/target'
6
6
  describe Norikra::Target do
7
7
  describe '.valid?' do
8
8
  it 'raises Norikra::ArgumentError for invalid name' do
9
- expect(Norikra::Target.valid?('foobar')).to be_true
10
- expect(Norikra::Target.valid?('FooBar')).to be_true
11
- expect(Norikra::Target.valid?('foo_bar')).to be_true
12
- expect(Norikra::Target.valid?('foo_bar_baz')).to be_true
9
+ expect(Norikra::Target.valid?('foobar')).to be_truthy
10
+ expect(Norikra::Target.valid?('FooBar')).to be_truthy
11
+ expect(Norikra::Target.valid?('foo_bar')).to be_truthy
12
+ expect(Norikra::Target.valid?('foo_bar_baz')).to be_truthy
13
13
 
14
- expect(Norikra::Target.valid?('')).to be_false
15
- expect(Norikra::Target.valid?('.')).to be_false
16
- expect(Norikra::Target.valid?('_')).to be_false
17
- expect(Norikra::Target.valid?('_a_')).to be_false
18
- expect(Norikra::Target.valid?('foo_')).to be_false
19
- expect(Norikra::Target.valid?('_Foo')).to be_false
20
- expect(Norikra::Target.valid?('foo bar')).to be_false
21
- expect(Norikra::Target.valid?('_Foo')).to be_false
14
+ expect(Norikra::Target.valid?('')).to be_falsy
15
+ expect(Norikra::Target.valid?('.')).to be_falsy
16
+ expect(Norikra::Target.valid?('_')).to be_falsy
17
+ expect(Norikra::Target.valid?('_a_')).to be_falsy
18
+ expect(Norikra::Target.valid?('foo_')).to be_falsy
19
+ expect(Norikra::Target.valid?('_Foo')).to be_falsy
20
+ expect(Norikra::Target.valid?('foo bar')).to be_falsy
21
+ expect(Norikra::Target.valid?('_Foo')).to be_falsy
22
22
  end
23
23
  end
24
24
 
@@ -29,14 +29,14 @@ describe Norikra::Target do
29
29
  t3 = Norikra::Target.new("target3")
30
30
  tt = Norikra::Target.new("target1")
31
31
 
32
- expect(t1 == tt).to be_true
33
- expect(t2 == tt).to be_false
34
- expect(t3 == tt).to be_false
32
+ expect(t1 == tt).to be_truthy
33
+ expect(t2 == tt).to be_falsy
34
+ expect(t3 == tt).to be_falsy
35
35
 
36
- expect([t1, t2, t3].include?(tt)).to be_true
37
- expect([t2, t3].include?(tt)).to be_false
36
+ expect([t1, t2, t3].include?(tt)).to be_truthy
37
+ expect([t2, t3].include?(tt)).to be_falsy
38
38
 
39
- expect([t1, t2, t3].include?("target1")).to be_true
39
+ expect([t1, t2, t3].include?("target1")).to be_truthy
40
40
  end
41
41
  end
42
42
  end
@@ -11,7 +11,7 @@ describe Norikra::TypedefManager do
11
11
 
12
12
  describe '#lazy?' do
13
13
  it 'returns true' do
14
- expect(manager.lazy?('sample')).to be_true
14
+ expect(manager.lazy?('sample')).to be_truthy
15
15
  end
16
16
  end
17
17
 
@@ -21,11 +21,11 @@ describe Norikra::TypedefManager do
21
21
  expect(r).to be_instance_of(Norikra::FieldSet)
22
22
 
23
23
  expect(r.fields['a'].type).to eql('string')
24
- expect(r.fields['a'].optional?).to be_false
24
+ expect(r.fields['a'].optional?).to be_falsy
25
25
  expect(r.fields['b'].type).to eql('string')
26
- expect(r.fields['b'].optional?).to be_false
26
+ expect(r.fields['b'].optional?).to be_falsy
27
27
  expect(r.fields['x'].type).to eql('string')
28
- expect(r.fields['x'].optional?).to be_false
28
+ expect(r.fields['x'].optional?).to be_falsy
29
29
  end
30
30
  end
31
31
 
@@ -33,7 +33,7 @@ describe Norikra::TypedefManager do
33
33
  it 'does not fail, and target will become non-lazy status' do
34
34
  r = manager.generate_base_fieldset('sample', {'a'=>'foo','b'=>'bar','x'=>'yeeeees!'})
35
35
  manager.activate('sample', r)
36
- expect(manager.lazy?('sample')).to be_false
36
+ expect(manager.lazy?('sample')).to be_falsy
37
37
  end
38
38
  end
39
39
  end
@@ -48,23 +48,23 @@ describe Norikra::TypedefManager do
48
48
 
49
49
  it 'three fields are defined as non-optional fields' do
50
50
  expect(manager.typedefs['sample'].fields['a'].type).to eql('string')
51
- expect(manager.typedefs['sample'].fields['a'].optional?).to be_false
51
+ expect(manager.typedefs['sample'].fields['a'].optional?).to be_falsy
52
52
  expect(manager.typedefs['sample'].fields['b'].type).to eql('string')
53
- expect(manager.typedefs['sample'].fields['b'].optional?).to be_false
53
+ expect(manager.typedefs['sample'].fields['b'].optional?).to be_falsy
54
54
  expect(manager.typedefs['sample'].fields['c'].type).to eql('float')
55
- expect(manager.typedefs['sample'].fields['c'].optional?).to be_false
55
+ expect(manager.typedefs['sample'].fields['c'].optional?).to be_falsy
56
56
  end
57
57
 
58
58
  describe '#lazy?' do
59
59
  it 'returns false' do
60
- expect(manager.lazy?('sample')).to be_false
60
+ expect(manager.lazy?('sample')).to be_falsy
61
61
  end
62
62
  end
63
63
  describe '#reserve' do
64
64
  it 'does not fail' do
65
65
  manager.reserve('sample', 'x', 'long')
66
66
  expect(manager.typedefs['sample'].fields['x'].type).to eql('integer')
67
- expect(manager.typedefs['sample'].fields['x'].optional?).to be_true
67
+ expect(manager.typedefs['sample'].fields['x'].optional?).to be_truthy
68
68
  end
69
69
  end
70
70
 
@@ -72,25 +72,25 @@ describe Norikra::TypedefManager do
72
72
  context 'with query with single target' do
73
73
  it 'returns boolean which matches target or not' do
74
74
  q1 = Norikra::Query.new(:name => 'test', :expression => 'select a from sample.win:time(5 sec) where c > 1.0 and z')
75
- expect(manager.ready?(q1)).to be_true
75
+ expect(manager.ready?(q1)).to be_truthy
76
76
  q2 = Norikra::Query.new(:name => 'test', :expression => 'select a from sample.win:time(5 sec) where c > 1.0 and d > 2.0')
77
- expect(manager.ready?(q2)).to be_false
77
+ expect(manager.ready?(q2)).to be_falsy
78
78
  q3 = Norikra::Query.new(:name => 'test', :expression => 'select a from sample2.win:time(5 sec) where c > 1.0 and d > 2.0')
79
- expect(manager.ready?(q3)).to be_false
79
+ expect(manager.ready?(q3)).to be_falsy
80
80
  end
81
81
  end
82
82
 
83
83
  context 'with query with multi targets, including unexisting target' do
84
84
  it 'returns false' do
85
85
  q = Norikra::Query.new(:name => 'test', :expression => 'select x.a,y.a from sample.win:time(5 sec) as x, sample2.win:time(5 sec) as y where x.c > 1.0 and y.d > 1.0')
86
- expect(manager.ready?(q)).to be_false
86
+ expect(manager.ready?(q)).to be_falsy
87
87
  end
88
88
  end
89
89
 
90
90
  context 'with query with multi targets, all of them are exisitng' do
91
91
  it 'returns true' do
92
92
  q = Norikra::Query.new(:name => 'test', :expression => 'select x.a,d from sample.win:time(5 sec) as x, sample_next.win:time(5 sec) as y where x.c > 1.0 and y.d > 1.0')
93
- expect(manager.ready?(q)).to be_true
93
+ expect(manager.ready?(q)).to be_truthy
94
94
  end
95
95
  end
96
96
  end
@@ -161,10 +161,10 @@ describe Norikra::TypedefManager do
161
161
  manager.bind_fieldset('sample', :query, set_query_base)
162
162
  expect(set_query_base.target).to eql('sample')
163
163
  expect(set_query_base.level).to eql(:query)
164
- expect(manager.typedefs['sample'].queryfieldsets.include?(set_query_base)).to be_true
164
+ expect(manager.typedefs['sample'].queryfieldsets.include?(set_query_base)).to be_truthy
165
165
 
166
166
  manager.unbind_fieldset('sample', :query, set_query_base)
167
- expect(manager.typedefs['sample'].queryfieldsets.include?(set_query_base)).to be_false
167
+ expect(manager.typedefs['sample'].queryfieldsets.include?(set_query_base)).to be_falsy
168
168
  end
169
169
  end
170
170
 
@@ -192,9 +192,9 @@ describe Norikra::TypedefManager do
192
192
 
193
193
  list = manager.subsets('sample', Norikra::FieldSet.new(base.merge({'d'=>'string','e'=>'string','g'=>'string'})))
194
194
  expect(list.size).to eql(3) # set_d, set_e, baseset
195
- expect(list.include?(set_d)).to be_true
196
- expect(list.include?(set_e)).to be_true
197
- expect(list.include?(set_f)).to be_false
195
+ expect(list.include?(set_d)).to be_truthy
196
+ expect(list.include?(set_e)).to be_truthy
197
+ expect(list.include?(set_f)).to be_falsy
198
198
  end
199
199
  end
200
200
 
@@ -210,9 +210,9 @@ describe Norikra::TypedefManager do
210
210
 
211
211
  list = manager.supersets('sample', Norikra::FieldSet.new({'one'=>'int','three'=>'double'}))
212
212
  expect(list.size).to eql(2) # set_x, set_z
213
- expect(list.include?(set_x)).to be_true
214
- expect(list.include?(set_y)).to be_false
215
- expect(list.include?(set_z)).to be_true
213
+ expect(list.include?(set_x)).to be_truthy
214
+ expect(list.include?(set_y)).to be_falsy
215
+ expect(list.include?(set_z)).to be_truthy
216
216
  end
217
217
  end
218
218
 
data/spec/typedef_spec.rb CHANGED
@@ -23,7 +23,7 @@ describe Norikra::Typedef do
23
23
  describe '#lazy?' do
24
24
  it 'returns true' do
25
25
  t = Norikra::Typedef.new
26
- expect(t.lazy?).to be_true
26
+ expect(t.lazy?).to be_truthy
27
27
  end
28
28
  end
29
29
 
@@ -33,11 +33,11 @@ describe Norikra::Typedef do
33
33
 
34
34
  t.reserve('k', 'string')
35
35
  expect(t.fields['k'].type).to eql('string')
36
- expect(t.fields['k'].optional?).to be_true
36
+ expect(t.fields['k'].optional?).to be_truthy
37
37
 
38
38
  t.reserve('l', 'long', false)
39
39
  expect(t.fields['l'].type).to eql('integer')
40
- expect(t.fields['l'].optional?).to be_false
40
+ expect(t.fields['l'].optional?).to be_falsy
41
41
  end
42
42
 
43
43
  it 'remove waiting field' do
@@ -60,7 +60,7 @@ describe Norikra::Typedef do
60
60
  set.level = :base
61
61
  t.activate(set)
62
62
  expect(t.fields.size).to eql(3)
63
- expect(t.fields['a'].optional?).to be_false
63
+ expect(t.fields['a'].optional?).to be_falsy
64
64
  expect(t.fields.object_id).not_to eql(set.fields.object_id)
65
65
  expect(t.baseset.object_id).not_to eql(set.object_id)
66
66
  end
@@ -105,10 +105,10 @@ describe Norikra::Typedef do
105
105
  t = Norikra::Typedef.new({'a' => 'string', 'b' => 'long'})
106
106
 
107
107
  expect(t.fields['a'].type).to eql('string')
108
- expect(t.fields['a'].optional?).to be_false
108
+ expect(t.fields['a'].optional?).to be_falsy
109
109
 
110
110
  expect(t.fields['b'].type).to eql('integer')
111
- expect(t.fields['b'].optional?).to be_false
111
+ expect(t.fields['b'].optional?).to be_falsy
112
112
  end
113
113
 
114
114
  it 'has container fields with chained access fields' do
@@ -122,20 +122,20 @@ describe Norikra::Typedef do
122
122
  describe '#lazy?' do
123
123
  it 'returns false' do
124
124
  t = Norikra::Typedef.new({'a' => 'string', 'b' => 'long'})
125
- expect(t.lazy?).to be_false
125
+ expect(t.lazy?).to be_falsy
126
126
  end
127
127
  end
128
128
 
129
129
  describe '#field_defined?' do
130
130
  it 'returns boolean to indicate all fields specified exists or not' do
131
131
  t = Norikra::Typedef.new({'a' => 'string', 'b' => 'long'})
132
- expect(t.field_defined?(['a','b'])).to be_true
133
- expect(t.field_defined?(['a'])).to be_true
134
- expect(t.field_defined?(['b'])).to be_true
135
- expect(t.field_defined?([])).to be_true
136
- expect(t.field_defined?(['a','b','c'])).to be_false
137
- expect(t.field_defined?(['a','c'])).to be_false
138
- expect(t.field_defined?(['c'])).to be_false
132
+ expect(t.field_defined?(['a','b'])).to be_truthy
133
+ expect(t.field_defined?(['a'])).to be_truthy
134
+ expect(t.field_defined?(['b'])).to be_truthy
135
+ expect(t.field_defined?([])).to be_truthy
136
+ expect(t.field_defined?(['a','b','c'])).to be_falsy
137
+ expect(t.field_defined?(['a','c'])).to be_falsy
138
+ expect(t.field_defined?(['c'])).to be_falsy
139
139
  end
140
140
  end
141
141
 
@@ -148,12 +148,12 @@ describe Norikra::Typedef do
148
148
  t.reserve('b', 'boolean', false)
149
149
  expect(t.fields.size).to eql(2)
150
150
  expect(t.fields['b'].type).to eql('boolean')
151
- expect(t.fields['b'].optional?).to be_false
151
+ expect(t.fields['b'].optional?).to be_falsy
152
152
 
153
153
  t.reserve('c', 'double', true)
154
154
  expect(t.fields.size).to eql(3)
155
155
  expect(t.fields['c'].type).to eql('float')
156
- expect(t.fields['c'].optional?).to be_true
156
+ expect(t.fields['c'].optional?).to be_truthy
157
157
  end
158
158
  end
159
159
 
@@ -163,16 +163,16 @@ describe Norikra::Typedef do
163
163
  t = Norikra::Typedef.new({'a' => 'string', 'b' => 'long'})
164
164
 
165
165
  set = Norikra::FieldSet.new({'a' => 'string', 'b' => 'long'})
166
- expect(t.consistent?(set)).to be_true
166
+ expect(t.consistent?(set)).to be_truthy
167
167
 
168
168
  set = Norikra::FieldSet.new({'a' => 'string', 'b' => 'long', 'c' => 'double'})
169
- expect(t.consistent?(set)).to be_true
169
+ expect(t.consistent?(set)).to be_truthy
170
170
 
171
171
  set = Norikra::FieldSet.new({'a' => 'string', 'b' => 'int'})
172
- expect(t.consistent?(set)).to be_true
172
+ expect(t.consistent?(set)).to be_truthy
173
173
 
174
174
  set = Norikra::FieldSet.new({'a' => 'string'})
175
- expect(t.consistent?(set)).to be_false
175
+ expect(t.consistent?(set)).to be_falsy
176
176
  end
177
177
  end
178
178
 
@@ -183,19 +183,19 @@ describe Norikra::Typedef do
183
183
  t.reserve('d', 'boolean', true) # optional
184
184
 
185
185
  set = Norikra::FieldSet.new({'a' => 'string', 'b' => 'long'})
186
- expect(t.consistent?(set)).to be_false
186
+ expect(t.consistent?(set)).to be_falsy
187
187
 
188
188
  set = Norikra::FieldSet.new({'a' => 'string', 'b' => 'long', 'c' => 'double'})
189
- expect(t.consistent?(set)).to be_true
189
+ expect(t.consistent?(set)).to be_truthy
190
190
 
191
191
  set = Norikra::FieldSet.new({'a' => 'string', 'b' => 'long', 'c' => 'double', 'd' => 'boolean'})
192
- expect(t.consistent?(set)).to be_true
192
+ expect(t.consistent?(set)).to be_truthy
193
193
 
194
194
  set = Norikra::FieldSet.new({'a' => 'string', 'b' => 'long', 'c' => 'double', 'd' => 'string'})
195
- expect(t.consistent?(set)).to be_false
195
+ expect(t.consistent?(set)).to be_falsy
196
196
 
197
197
  set = Norikra::FieldSet.new({'a' => 'string', 'b' => 'long', 'c' => 'double', 'd' => 'boolean', 'e' => 'string'})
198
- expect(t.consistent?(set)).to be_true
198
+ expect(t.consistent?(set)).to be_truthy
199
199
  end
200
200
  end
201
201
  end
@@ -220,12 +220,12 @@ describe Norikra::Typedef do
220
220
  t.push(:data, set_a)
221
221
  expect(t.fields.size).to eql(3)
222
222
  expect(t.fields['c'].type).to eql('float')
223
- expect(t.fields['c'].optional?).to be_true
223
+ expect(t.fields['c'].optional?).to be_truthy
224
224
 
225
225
  t.push(:query, Norikra::FieldSet.new({'a'=>'string','b'=>'long','d'=>'string'}))
226
226
  expect(t.fields.size).to eql(4)
227
227
  expect(t.fields['d'].type).to eql('string')
228
- expect(t.fields['d'].optional?).to be_true
228
+ expect(t.fields['d'].optional?).to be_truthy
229
229
  end
230
230
 
231
231
  it 'deletes waiting fields' do
@@ -438,7 +438,7 @@ describe Norikra::Typedef do
438
438
  t.reserve('d','double',true)
439
439
 
440
440
  r = t.refer({'a'=>'hoge','b'=>'2000','c'=>'true','d'=>'3.14'})
441
- expect(t.datafieldsets.include?(r)).to be_false
441
+ expect(t.datafieldsets.include?(r)).to be_falsy
442
442
 
443
443
  expect(r.fields['a'].type).to eql('string')
444
444
  expect(r.fields['b'].type).to eql('integer')
@@ -451,7 +451,7 @@ describe Norikra::Typedef do
451
451
  t = Norikra::Typedef.new({'a' => 'string', 'b' => 'long'})
452
452
 
453
453
  r = t.refer({'a'=>'hoge','b'=>'2000','c'=>'true','d'=>'3.14'})
454
- expect(t.datafieldsets.include?(r)).to be_false
454
+ expect(t.datafieldsets.include?(r)).to be_falsy
455
455
 
456
456
  expect(r.fields['a'].type).to eql('string')
457
457
  expect(r.fields['b'].type).to eql('integer')
@@ -479,7 +479,7 @@ describe Norikra::Typedef do
479
479
  t.reserve('d','double',true)
480
480
 
481
481
  r = t.refer({'a'=>'hoge','b'=>'2000','c'=>'true','d'=>'3.14'}, true)
482
- expect(t.datafieldsets.include?(r)).to be_false
482
+ expect(t.datafieldsets.include?(r)).to be_falsy
483
483
 
484
484
  expect(r.fields['a'].type).to eql('string')
485
485
  expect(r.fields['b'].type).to eql('integer')
@@ -492,14 +492,14 @@ describe Norikra::Typedef do
492
492
  t = Norikra::Typedef.new({'a' => 'string', 'b' => 'long'})
493
493
 
494
494
  r1 = t.refer({'a'=>'hoge','b'=>'2000','c'=>'true','d'=>'3.14'}, true)
495
- expect(t.datafieldsets.include?(r1)).to be_false
495
+ expect(t.datafieldsets.include?(r1)).to be_falsy
496
496
 
497
497
  expect(r1.fields['a'].type).to eql('string')
498
498
  expect(r1.fields['b'].type).to eql('integer')
499
499
  expect(r1.summary).to eql('a:string,b:integer')
500
500
 
501
501
  r2 = t.refer({'a'=>'hoge','b'=>'2000','c'=>'true','d'=>'3.14', 'e' => 'yeeeeeees!'}, true)
502
- expect(t.datafieldsets.include?(r2)).to be_false
502
+ expect(t.datafieldsets.include?(r2)).to be_falsy
503
503
 
504
504
  expect(r2.fields['a'].type).to eql('string')
505
505
  expect(r2.fields['b'].type).to eql('integer')
@@ -511,7 +511,7 @@ describe Norikra::Typedef do
511
511
  t.waiting_fields = ['d']
512
512
 
513
513
  r1 = t.refer({'a'=>'hoge','b'=>'2000','c'=>'true','d'=>'3.14'}, true)
514
- expect(t.datafieldsets.include?(r1)).to be_false
514
+ expect(t.datafieldsets.include?(r1)).to be_falsy
515
515
 
516
516
  expect(r1.fields['a'].type).to eql('string')
517
517
  expect(r1.fields['b'].type).to eql('integer')
@@ -519,7 +519,7 @@ describe Norikra::Typedef do
519
519
  expect(r1.summary).to eql('a:string,b:integer,d:string')
520
520
 
521
521
  r2 = t.refer({'a'=>'hoge','b'=>'2000','c'=>'true','d'=>'3.14', 'e' => 'yeeeeeees!'}, true)
522
- expect(t.datafieldsets.include?(r2)).to be_false
522
+ expect(t.datafieldsets.include?(r2)).to be_falsy
523
523
 
524
524
  expect(r2.fields['a'].type).to eql('string')
525
525
  expect(r2.fields['b'].type).to eql('integer')
data/views/index.erb CHANGED
@@ -66,7 +66,7 @@
66
66
  <% if queries.size > 0 %>
67
67
  <table class="table">
68
68
  <tr>
69
- <th>Group</th><th>Query name</th><th>Targets</th><th>Query</th><th style="text-align:right;">Events</th><th></th><th></th><th></th>
69
+ <th>Group</th><th>Query name</th><th>Targets</th><th></th><th>Query</th><th style="text-align:right;">Events</th><th></th><th></th><th></th>
70
70
  </tr>
71
71
  <% queries.each_with_index do |query, index| %>
72
72
  <tr class="<%= query.suspended? ? "suspended" : "" %>">
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: norikra
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: java
6
6
  authors:
7
7
  - TAGOMORI Satoshi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-19 00:00:00.000000000 Z
11
+ date: 2014-12-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mizuno
@@ -154,14 +154,14 @@ dependencies:
154
154
  name: rspec
155
155
  version_requirements: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - ~>
157
+ - - '>='
158
158
  - !ruby/object:Gem::Version
159
- version: '2.0'
159
+ version: '0'
160
160
  requirement: !ruby/object:Gem::Requirement
161
161
  requirements:
162
- - - ~>
162
+ - - '>='
163
163
  - !ruby/object:Gem::Version
164
- version: '2.0'
164
+ version: '0'
165
165
  prerelease: false
166
166
  type: :development
167
167
  - !ruby/object:Gem::Dependency
@@ -245,6 +245,7 @@ files:
245
245
  - lib/norikra/rubyudf.rb
246
246
  - lib/norikra/server.rb
247
247
  - lib/norikra/stats.rb
248
+ - lib/norikra/suspended_query.rb
248
249
  - lib/norikra/target.rb
249
250
  - lib/norikra/typedef.rb
250
251
  - lib/norikra/typedef_manager.rb
@@ -280,6 +281,7 @@ files:
280
281
  - spec/query_spec.rb
281
282
  - spec/spec_helper.rb
282
283
  - spec/stats_spec.rb
284
+ - spec/suspended_query_spec.rb
283
285
  - spec/target_spec.rb
284
286
  - spec/typedef_manager_spec.rb
285
287
  - spec/typedef_spec.rb
@@ -319,6 +321,7 @@ test_files:
319
321
  - spec/query_spec.rb
320
322
  - spec/spec_helper.rb
321
323
  - spec/stats_spec.rb
324
+ - spec/suspended_query_spec.rb
322
325
  - spec/target_spec.rb
323
326
  - spec/typedef_manager_spec.rb
324
327
  - spec/typedef_spec.rb