norikra 0.1.0-java → 0.1.1-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +5 -3
- data/lib/norikra/field.rb +57 -31
- data/lib/norikra/fieldset.rb +1 -1
- data/lib/norikra/version.rb +1 -1
- data/spec/field_spec.rb +14 -14
- data/spec/fieldset_spec.rb +18 -7
- data/spec/typedef_manager_spec.rb +6 -6
- data/spec/typedef_spec.rb +26 -26
- metadata +2 -2
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Norikra
|
2
2
|
|
3
|
-
Norikra is
|
3
|
+
Norikra is an open-source Stream Processing Server with SQL.
|
4
4
|
* Schema-less event streams (called as 'target')
|
5
5
|
* SQL processing with window specifier supports, and JOINs, SubQueries
|
6
6
|
* Complex input/output events with nested Hashes and Arrays, and Query supports
|
@@ -68,10 +68,10 @@ For other languages:
|
|
68
68
|
|
69
69
|
For example, think about event streams related with one web service (ex: 'www'). At first, define `target` with mandantory fields (in other words, minimal fields set for variations of 'www' events).
|
70
70
|
|
71
|
-
norikra-client target
|
71
|
+
norikra-client target open www path:string status:integer referer:string agent:string userid:integer
|
72
72
|
norikra-client target list
|
73
73
|
|
74
|
-
Supported types are `string`, `boolean`, `
|
74
|
+
Supported types are `string`, `boolean`, `integer`, `float` and `hash`, `array`.
|
75
75
|
|
76
76
|
You can register queries when you want.
|
77
77
|
|
@@ -120,6 +120,8 @@ TBD
|
|
120
120
|
|
121
121
|
* v0.1.0:
|
122
122
|
* First release for production
|
123
|
+
* v0.1.1:
|
124
|
+
* Fix types more explicitly for users ('int/long' -> 'integer', 'float/double' -> 'float')
|
123
125
|
|
124
126
|
## Copyright
|
125
127
|
|
data/lib/norikra/field.rb
CHANGED
@@ -2,6 +2,14 @@ require 'norikra/error'
|
|
2
2
|
|
3
3
|
module Norikra
|
4
4
|
class Field
|
5
|
+
### norikra types
|
6
|
+
# string
|
7
|
+
# boolean (alias: bool)
|
8
|
+
# integer (alias: int, long)
|
9
|
+
# float (alias: double)
|
10
|
+
# hash
|
11
|
+
# array
|
12
|
+
|
5
13
|
### esper types
|
6
14
|
### http://esper.codehaus.org/esper-4.9.0/doc/reference/en-US/html/epl_clauses.html#epl-syntax-datatype
|
7
15
|
# string A single character to an unlimited number of characters.
|
@@ -27,11 +35,49 @@ module Norikra
|
|
27
35
|
### expected java.lang.Class or java.util.Map or the name of a previously-declared Map or ObjectArray type
|
28
36
|
#### Correct type name is 'int'. see and run 'junks/esper-test.rb'
|
29
37
|
|
30
|
-
attr_accessor :name, :type, :optional, :escaped_name, :container_name, :container_type
|
38
|
+
attr_accessor :name, :type, :esper_type, :optional, :escaped_name, :container_name, :container_type
|
39
|
+
|
40
|
+
def self.esper_type_map(type)
|
41
|
+
case type.to_s.downcase
|
42
|
+
when 'string' then 'string'
|
43
|
+
when 'boolean', 'bool' then 'boolean'
|
44
|
+
when 'integer', 'int', 'long' then 'long'
|
45
|
+
when 'float', 'double' then 'double'
|
46
|
+
when 'hash', 'array'
|
47
|
+
raise Norikra::ArgumentError, "#{type} is norikra internal type, not for esper"
|
48
|
+
when 'byte'
|
49
|
+
raise Norikra::ArgumentError, "byte is not supported in Norikra"
|
50
|
+
else
|
51
|
+
raise Norikra::ArgumentError, "unknown type:#{type}"
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def self.container_type?(type)
|
56
|
+
case type.to_s.downcase
|
57
|
+
when 'hash','array' then true
|
58
|
+
else
|
59
|
+
false
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def self.valid_type(type)
|
64
|
+
case type.to_s.downcase
|
65
|
+
when 'string' then 'string'
|
66
|
+
when 'boolean', 'bool' then 'boolean'
|
67
|
+
when 'integer', 'int', 'long' then 'integer'
|
68
|
+
when 'float', 'double' then 'float'
|
69
|
+
when 'hash' then 'hash'
|
70
|
+
when 'array' then 'array'
|
71
|
+
when 'byte'
|
72
|
+
raise Norikra::ArgumentError, "byte is not supported in Norikra"
|
73
|
+
else
|
74
|
+
raise Norikra::ArgumentError, "invalid field type '#{type}'"
|
75
|
+
end
|
76
|
+
end
|
31
77
|
|
32
78
|
def initialize(name, type, optional=nil)
|
33
79
|
@name = name.to_s
|
34
|
-
@type = self.class.valid_type
|
80
|
+
@type = self.class.valid_type(type)
|
35
81
|
@optional = optional
|
36
82
|
|
37
83
|
@escaped_name = self.class.escape_name(@name)
|
@@ -49,12 +95,16 @@ module Norikra
|
|
49
95
|
define_value_accessor(@name, @chained_access)
|
50
96
|
end
|
51
97
|
|
98
|
+
def chained_access?
|
99
|
+
@chained_access
|
100
|
+
end
|
101
|
+
|
52
102
|
def container_field?
|
53
|
-
@type
|
103
|
+
self.class.container_type?(@type)
|
54
104
|
end
|
55
105
|
|
56
|
-
def
|
57
|
-
@
|
106
|
+
def esper_type
|
107
|
+
self.class.esper_type_map(@type)
|
58
108
|
end
|
59
109
|
|
60
110
|
def self.escape_name(name)
|
@@ -122,38 +172,14 @@ module Norikra
|
|
122
172
|
@optional
|
123
173
|
end
|
124
174
|
|
125
|
-
def self.container_type?(type)
|
126
|
-
case type.to_s.downcase
|
127
|
-
when 'hash' then true
|
128
|
-
when 'array' then true
|
129
|
-
else
|
130
|
-
false
|
131
|
-
end
|
132
|
-
end
|
133
|
-
|
134
|
-
def self.valid_type?(type)
|
135
|
-
case type.to_s.downcase
|
136
|
-
when 'string' then 'string'
|
137
|
-
when 'boolean' then 'boolean'
|
138
|
-
when 'int' then 'int'
|
139
|
-
when 'long' then 'long'
|
140
|
-
when 'float' then 'float'
|
141
|
-
when 'double' then 'double'
|
142
|
-
when 'hash' then 'hash'
|
143
|
-
when 'array' then 'array'
|
144
|
-
else
|
145
|
-
raise Norikra::ArgumentError, "invalid field type '#{type}'"
|
146
|
-
end
|
147
|
-
end
|
148
|
-
|
149
175
|
# def value(event) # by define_value_accessor
|
150
176
|
|
151
177
|
def format(value, element_path=nil) #element_path ex: 'fname.fchild', 'fname.$0', 'f.fchild.$2'
|
152
178
|
case @type
|
153
179
|
when 'string' then value.to_s
|
154
180
|
when 'boolean' then value =~ /^(true|false)$/i ? ($1.downcase == 'true') : (!!value)
|
155
|
-
when '
|
156
|
-
when '
|
181
|
+
when 'integer' then value.to_i
|
182
|
+
when 'float' then value.to_f
|
157
183
|
when 'hash', 'array'
|
158
184
|
raise RuntimeError, "container field not permitted to access directly, maybe BUG. name:#{@name},type:#{@type}"
|
159
185
|
else
|
data/lib/norikra/fieldset.rb
CHANGED
data/lib/norikra/version.rb
CHANGED
data/spec/field_spec.rb
CHANGED
@@ -76,23 +76,23 @@ describe Norikra::Field do
|
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
79
|
-
describe '.valid_type
|
79
|
+
describe '.valid_type' do
|
80
80
|
it 'returns normalized type strings' do
|
81
|
-
expect(Norikra::Field.valid_type
|
82
|
-
expect(Norikra::Field.valid_type
|
83
|
-
expect(Norikra::Field.valid_type
|
84
|
-
expect(Norikra::Field.valid_type
|
85
|
-
|
86
|
-
expect(Norikra::Field.valid_type
|
87
|
-
expect(Norikra::Field.valid_type
|
88
|
-
expect(Norikra::Field.valid_type
|
89
|
-
expect(Norikra::Field.valid_type
|
90
|
-
expect(Norikra::Field.valid_type
|
91
|
-
expect(Norikra::Field.valid_type
|
81
|
+
expect(Norikra::Field.valid_type('String')).to eql('string')
|
82
|
+
expect(Norikra::Field.valid_type('STRING')).to eql('string')
|
83
|
+
expect(Norikra::Field.valid_type(:string)).to eql('string')
|
84
|
+
expect(Norikra::Field.valid_type('string')).to eql('string')
|
85
|
+
|
86
|
+
expect(Norikra::Field.valid_type('boolean')).to eql('boolean')
|
87
|
+
expect(Norikra::Field.valid_type('BOOLEAN')).to eql('boolean')
|
88
|
+
expect(Norikra::Field.valid_type('Int')).to eql('integer')
|
89
|
+
expect(Norikra::Field.valid_type('lonG')).to eql('integer')
|
90
|
+
expect(Norikra::Field.valid_type('FLOAT')).to eql('float')
|
91
|
+
expect(Norikra::Field.valid_type('Double')).to eql('float')
|
92
92
|
end
|
93
93
|
|
94
94
|
it 'raises ArgumentError for unknown type string' do
|
95
|
-
expect { Norikra::Field.valid_type
|
95
|
+
expect { Norikra::Field.valid_type('foo') }.to raise_error(Norikra::ArgumentError)
|
96
96
|
end
|
97
97
|
end
|
98
98
|
|
@@ -103,7 +103,7 @@ describe Norikra::Field do
|
|
103
103
|
end
|
104
104
|
|
105
105
|
it 'value of type is normalized with .valid_type?' do
|
106
|
-
expect(Norikra::Field.new('foo', 'String').type).to eql(Norikra::Field.valid_type
|
106
|
+
expect(Norikra::Field.new('foo', 'String').type).to eql(Norikra::Field.valid_type('String'))
|
107
107
|
end
|
108
108
|
|
109
109
|
it 'default value of optional is nil' do
|
data/spec/fieldset_spec.rb
CHANGED
@@ -10,7 +10,7 @@ describe Norikra::FieldSet do
|
|
10
10
|
it 'accepts String as type' do
|
11
11
|
set = Norikra::FieldSet.new({'x' => 'string', 'y' => 'long'})
|
12
12
|
expect(set.fields['x'].type).to eql('string')
|
13
|
-
expect(set.fields['y'].type).to eql('
|
13
|
+
expect(set.fields['y'].type).to eql('integer')
|
14
14
|
end
|
15
15
|
|
16
16
|
it 'sets optional specification nil as defaults' do
|
@@ -31,15 +31,16 @@ describe Norikra::FieldSet do
|
|
31
31
|
|
32
32
|
it 'sets summary as comma-separated labeled field-type string with sorted field order' do
|
33
33
|
set = Norikra::FieldSet.new({'x' => 'string', 'y' => 'long'})
|
34
|
-
expect(set.summary).to eql('x:string,y:
|
34
|
+
expect(set.summary).to eql('x:string,y:integer')
|
35
35
|
|
36
36
|
set = Norikra::FieldSet.new({'x' => 'string', 'y' => 'long', 'a' => 'Boolean'})
|
37
|
-
expect(set.summary).to eql('a:boolean,x:string,y:
|
37
|
+
expect(set.summary).to eql('a:boolean,x:string,y:integer')
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
41
|
context 'initialized with some fields' do
|
42
42
|
set = Norikra::FieldSet.new({'x' => 'string', 'y' => 'long', 'a' => 'Boolean'})
|
43
|
+
set2 = Norikra::FieldSet.new({'a' => 'string', 'b' => 'int', 'c' => 'float', 'd' => 'bool', 'e' => 'integer'})
|
43
44
|
|
44
45
|
describe '#dup' do
|
45
46
|
it 'make duplicated object with different internal instance' do
|
@@ -175,7 +176,7 @@ describe Norikra::FieldSet do
|
|
175
176
|
x.update_summary
|
176
177
|
|
177
178
|
expect(x.summary).not_to eql(oldsummary)
|
178
|
-
expect(x.summary).to eql('a:boolean,x:
|
179
|
+
expect(x.summary).to eql('a:boolean,x:integer,y:integer')
|
179
180
|
end
|
180
181
|
end
|
181
182
|
|
@@ -185,12 +186,12 @@ describe Norikra::FieldSet do
|
|
185
186
|
expect(x.fields['a'].type).to eql('boolean')
|
186
187
|
expect(x.fields['x'].type).to eql('string')
|
187
188
|
|
188
|
-
expect(x.fields['y'].type).to eql('
|
189
|
+
expect(x.fields['y'].type).to eql('integer')
|
189
190
|
expect(x.fields['y'].optional).to be_nil
|
190
191
|
|
191
192
|
x.update([Norikra::Field.new('y', 'int'), Norikra::Field.new('a','string')], false)
|
192
193
|
|
193
|
-
expect(x.fields['y'].type).to eql('
|
194
|
+
expect(x.fields['y'].type).to eql('integer')
|
194
195
|
expect(x.fields['y'].optional).to eql(false)
|
195
196
|
|
196
197
|
expect(x.fields['x'].type).to eql('string')
|
@@ -202,7 +203,7 @@ describe Norikra::FieldSet do
|
|
202
203
|
expect(x.fields.size).to eql(3)
|
203
204
|
x.update([Norikra::Field.new('z', 'string')], true)
|
204
205
|
expect(x.fields.size).to eql(4)
|
205
|
-
expect(x.summary).to eql('a:boolean,x:string,y:
|
206
|
+
expect(x.summary).to eql('a:boolean,x:string,y:integer,z:string')
|
206
207
|
end
|
207
208
|
end
|
208
209
|
|
@@ -214,6 +215,16 @@ describe Norikra::FieldSet do
|
|
214
215
|
expect(d['a']).to eql('boolean')
|
215
216
|
expect(d['x']).to eql('string')
|
216
217
|
expect(d['y']).to eql('long')
|
218
|
+
|
219
|
+
s = Norikra::FieldSet.new({'a' => 'string', 'b' => 'int', 'c' => 'float', 'd' => 'bool', 'e' => 'integer'})
|
220
|
+
d = s.definition
|
221
|
+
expect(d).to be_instance_of(Hash)
|
222
|
+
expect(d.size).to eql(5)
|
223
|
+
expect(d['a']).to eql('string')
|
224
|
+
expect(d['b']).to eql('long')
|
225
|
+
expect(d['c']).to eql('double')
|
226
|
+
expect(d['d']).to eql('boolean')
|
227
|
+
expect(d['e']).to eql('long')
|
217
228
|
end
|
218
229
|
end
|
219
230
|
|
@@ -51,7 +51,7 @@ describe Norikra::TypedefManager do
|
|
51
51
|
expect(manager.typedefs['sample'].fields['a'].optional?).to be_false
|
52
52
|
expect(manager.typedefs['sample'].fields['b'].type).to eql('string')
|
53
53
|
expect(manager.typedefs['sample'].fields['b'].optional?).to be_false
|
54
|
-
expect(manager.typedefs['sample'].fields['c'].type).to eql('
|
54
|
+
expect(manager.typedefs['sample'].fields['c'].type).to eql('float')
|
55
55
|
expect(manager.typedefs['sample'].fields['c'].optional?).to be_false
|
56
56
|
end
|
57
57
|
|
@@ -63,7 +63,7 @@ describe Norikra::TypedefManager do
|
|
63
63
|
describe '#reserve' do
|
64
64
|
it 'does not fail' do
|
65
65
|
manager.reserve('sample', 'x', 'long')
|
66
|
-
expect(manager.typedefs['sample'].fields['x'].type).to eql('
|
66
|
+
expect(manager.typedefs['sample'].fields['x'].type).to eql('integer')
|
67
67
|
expect(manager.typedefs['sample'].fields['x'].optional?).to be_true
|
68
68
|
end
|
69
69
|
end
|
@@ -220,7 +220,7 @@ describe Norikra::TypedefManager do
|
|
220
220
|
it 'returns fieldset instance with all required(non-optional) fields of target, and fields of query requires' do
|
221
221
|
r = manager.generate_query_fieldset('sample', ['a', 'b','f'])
|
222
222
|
expect(r.fields.size).to eql(4) # a,b,c,f
|
223
|
-
expect(r.summary).to eql('a:string,b:string,c:
|
223
|
+
expect(r.summary).to eql('a:string,b:string,c:float,f:boolean')
|
224
224
|
end
|
225
225
|
end
|
226
226
|
|
@@ -235,7 +235,7 @@ describe Norikra::TypedefManager do
|
|
235
235
|
expect(r).to eql({
|
236
236
|
a: {name: 'a', type: 'string', optional: false},
|
237
237
|
b: {name: 'b', type: 'string', optional: false},
|
238
|
-
c: {name: 'c', type: '
|
238
|
+
c: {name: 'c', type: 'float', optional: false},
|
239
239
|
z: {name: 'z', type: 'boolean', optional: true},
|
240
240
|
})
|
241
241
|
|
@@ -243,8 +243,8 @@ describe Norikra::TypedefManager do
|
|
243
243
|
expect(r).to eql({
|
244
244
|
a: {name: 'a', type: 'string', optional: false},
|
245
245
|
b: {name: 'b', type: 'string', optional: false},
|
246
|
-
c: {name: 'c', type: '
|
247
|
-
d: {name: 'd', type: '
|
246
|
+
c: {name: 'c', type: 'float', optional: false},
|
247
|
+
d: {name: 'd', type: 'float', optional: false},
|
248
248
|
})
|
249
249
|
end
|
250
250
|
end
|
data/spec/typedef_spec.rb
CHANGED
@@ -36,7 +36,7 @@ describe Norikra::Typedef do
|
|
36
36
|
expect(t.fields['k'].optional?).to be_true
|
37
37
|
|
38
38
|
t.reserve('l', 'long', false)
|
39
|
-
expect(t.fields['l'].type).to eql('
|
39
|
+
expect(t.fields['l'].type).to eql('integer')
|
40
40
|
expect(t.fields['l'].optional?).to be_false
|
41
41
|
end
|
42
42
|
|
@@ -107,7 +107,7 @@ describe Norikra::Typedef do
|
|
107
107
|
expect(t.fields['a'].type).to eql('string')
|
108
108
|
expect(t.fields['a'].optional?).to be_false
|
109
109
|
|
110
|
-
expect(t.fields['b'].type).to eql('
|
110
|
+
expect(t.fields['b'].type).to eql('integer')
|
111
111
|
expect(t.fields['b'].optional?).to be_false
|
112
112
|
end
|
113
113
|
|
@@ -152,7 +152,7 @@ describe Norikra::Typedef do
|
|
152
152
|
|
153
153
|
t.reserve('c', 'double', true)
|
154
154
|
expect(t.fields.size).to eql(3)
|
155
|
-
expect(t.fields['c'].type).to eql('
|
155
|
+
expect(t.fields['c'].type).to eql('float')
|
156
156
|
expect(t.fields['c'].optional?).to be_true
|
157
157
|
end
|
158
158
|
end
|
@@ -169,7 +169,7 @@ describe Norikra::Typedef do
|
|
169
169
|
expect(t.consistent?(set)).to be_true
|
170
170
|
|
171
171
|
set = Norikra::FieldSet.new({'a' => 'string', 'b' => 'int'})
|
172
|
-
expect(t.consistent?(set)).to
|
172
|
+
expect(t.consistent?(set)).to be_true
|
173
173
|
|
174
174
|
set = Norikra::FieldSet.new({'a' => 'string'})
|
175
175
|
expect(t.consistent?(set)).to be_false
|
@@ -203,7 +203,7 @@ describe Norikra::Typedef do
|
|
203
203
|
describe '#push' do
|
204
204
|
it 'does not accepts fieldset which conflicts pre-defined fields' do
|
205
205
|
t = Norikra::Typedef.new({'a' => 'string', 'b' => 'long'})
|
206
|
-
expect { t.push(:query, Norikra::FieldSet.new({'a'=>'string','b'=>'
|
206
|
+
expect { t.push(:query, Norikra::FieldSet.new({'a'=>'string','b'=>'float'})) }.to raise_error(Norikra::ArgumentError)
|
207
207
|
expect { t.push(:data, Norikra::FieldSet.new({'a'=>'string'})) }.to raise_error(Norikra::ArgumentError)
|
208
208
|
end
|
209
209
|
|
@@ -219,7 +219,7 @@ describe Norikra::Typedef do
|
|
219
219
|
set_a = Norikra::FieldSet.new({'a'=>'string','b'=>'long','c'=>'double'})
|
220
220
|
t.push(:data, set_a)
|
221
221
|
expect(t.fields.size).to eql(3)
|
222
|
-
expect(t.fields['c'].type).to eql('
|
222
|
+
expect(t.fields['c'].type).to eql('float')
|
223
223
|
expect(t.fields['c'].optional?).to be_true
|
224
224
|
|
225
225
|
t.push(:query, Norikra::FieldSet.new({'a'=>'string','b'=>'long','d'=>'string'}))
|
@@ -420,10 +420,10 @@ describe Norikra::Typedef do
|
|
420
420
|
expect(t.datafieldsets.include?(r)).to be_false
|
421
421
|
|
422
422
|
expect(r.fields['a'].type).to eql('string')
|
423
|
-
expect(r.fields['b'].type).to eql('
|
423
|
+
expect(r.fields['b'].type).to eql('integer')
|
424
424
|
expect(r.fields['c'].type).to eql('boolean')
|
425
|
-
expect(r.fields['d'].type).to eql('
|
426
|
-
expect(r.summary).to eql('a:string,b:
|
425
|
+
expect(r.fields['d'].type).to eql('float')
|
426
|
+
expect(r.summary).to eql('a:string,b:integer,c:boolean,d:float')
|
427
427
|
end
|
428
428
|
|
429
429
|
it 'returns fieldset that contains fields as string for unknowns for event with some unknown fields' do
|
@@ -433,10 +433,10 @@ describe Norikra::Typedef do
|
|
433
433
|
expect(t.datafieldsets.include?(r)).to be_false
|
434
434
|
|
435
435
|
expect(r.fields['a'].type).to eql('string')
|
436
|
-
expect(r.fields['b'].type).to eql('
|
436
|
+
expect(r.fields['b'].type).to eql('integer')
|
437
437
|
expect(r.fields['c'].type).to eql('string')
|
438
438
|
expect(r.fields['d'].type).to eql('string')
|
439
|
-
expect(r.summary).to eql('a:string,b:
|
439
|
+
expect(r.summary).to eql('a:string,b:integer,c:string,d:string')
|
440
440
|
end
|
441
441
|
end
|
442
442
|
|
@@ -461,10 +461,10 @@ describe Norikra::Typedef do
|
|
461
461
|
expect(t.datafieldsets.include?(r)).to be_false
|
462
462
|
|
463
463
|
expect(r.fields['a'].type).to eql('string')
|
464
|
-
expect(r.fields['b'].type).to eql('
|
464
|
+
expect(r.fields['b'].type).to eql('integer')
|
465
465
|
expect(r.fields['c'].type).to eql('boolean')
|
466
|
-
expect(r.fields['d'].type).to eql('
|
467
|
-
expect(r.summary).to eql('a:string,b:
|
466
|
+
expect(r.fields['d'].type).to eql('float')
|
467
|
+
expect(r.summary).to eql('a:string,b:integer,c:boolean,d:float')
|
468
468
|
end
|
469
469
|
|
470
470
|
it 'returns fieldset that contains fields already known only for event with some unknown fields' do
|
@@ -474,15 +474,15 @@ describe Norikra::Typedef do
|
|
474
474
|
expect(t.datafieldsets.include?(r1)).to be_false
|
475
475
|
|
476
476
|
expect(r1.fields['a'].type).to eql('string')
|
477
|
-
expect(r1.fields['b'].type).to eql('
|
478
|
-
expect(r1.summary).to eql('a:string,b:
|
477
|
+
expect(r1.fields['b'].type).to eql('integer')
|
478
|
+
expect(r1.summary).to eql('a:string,b:integer')
|
479
479
|
|
480
480
|
r2 = t.refer({'a'=>'hoge','b'=>'2000','c'=>'true','d'=>'3.14', 'e' => 'yeeeeeees!'}, true)
|
481
481
|
expect(t.datafieldsets.include?(r2)).to be_false
|
482
482
|
|
483
483
|
expect(r2.fields['a'].type).to eql('string')
|
484
|
-
expect(r2.fields['b'].type).to eql('
|
485
|
-
expect(r2.summary).to eql('a:string,b:
|
484
|
+
expect(r2.fields['b'].type).to eql('integer')
|
485
|
+
expect(r2.summary).to eql('a:string,b:integer')
|
486
486
|
end
|
487
487
|
|
488
488
|
it 'returns fieldset that contains fields already known or waiting fields for event with some unknown fields' do
|
@@ -493,17 +493,17 @@ describe Norikra::Typedef do
|
|
493
493
|
expect(t.datafieldsets.include?(r1)).to be_false
|
494
494
|
|
495
495
|
expect(r1.fields['a'].type).to eql('string')
|
496
|
-
expect(r1.fields['b'].type).to eql('
|
496
|
+
expect(r1.fields['b'].type).to eql('integer')
|
497
497
|
expect(r1.fields['d'].type).to eql('string')
|
498
|
-
expect(r1.summary).to eql('a:string,b:
|
498
|
+
expect(r1.summary).to eql('a:string,b:integer,d:string')
|
499
499
|
|
500
500
|
r2 = t.refer({'a'=>'hoge','b'=>'2000','c'=>'true','d'=>'3.14', 'e' => 'yeeeeeees!'}, true)
|
501
501
|
expect(t.datafieldsets.include?(r2)).to be_false
|
502
502
|
|
503
503
|
expect(r2.fields['a'].type).to eql('string')
|
504
|
-
expect(r2.fields['b'].type).to eql('
|
504
|
+
expect(r2.fields['b'].type).to eql('integer')
|
505
505
|
expect(r1.fields['d'].type).to eql('string')
|
506
|
-
expect(r2.summary).to eql('a:string,b:
|
506
|
+
expect(r2.summary).to eql('a:string,b:integer,d:string')
|
507
507
|
end
|
508
508
|
end
|
509
509
|
end
|
@@ -520,8 +520,8 @@ describe Norikra::Typedef do
|
|
520
520
|
r = t.dump
|
521
521
|
expect(r.keys.sort).to eql([:a, :b, :c, :d])
|
522
522
|
expect(r[:a]).to eql({name: 'a', type: 'string', optional: false})
|
523
|
-
expect(r[:b]).to eql({name: 'b', type: '
|
524
|
-
expect(r[:c]).to eql({name: 'c', type: '
|
523
|
+
expect(r[:b]).to eql({name: 'b', type: 'integer', optional: false})
|
524
|
+
expect(r[:c]).to eql({name: 'c', type: 'float', optional: true})
|
525
525
|
expect(r[:d]).to eql({name: 'd', type: 'string', optional: true})
|
526
526
|
|
527
527
|
t2 = Norikra::Typedef.new(r)
|
@@ -540,8 +540,8 @@ describe Norikra::Typedef do
|
|
540
540
|
r = t.dump
|
541
541
|
expect(r.keys.sort).to eql([:a, :b, :c, :d, :e, :f])
|
542
542
|
expect(r[:a]).to eql({name: 'a', type: 'string', optional: false})
|
543
|
-
expect(r[:b]).to eql({name: 'b', type: '
|
544
|
-
expect(r[:c]).to eql({name: 'c', type: '
|
543
|
+
expect(r[:b]).to eql({name: 'b', type: 'integer', optional: false})
|
544
|
+
expect(r[:c]).to eql({name: 'c', type: 'float', optional: true})
|
545
545
|
expect(r[:d]).to eql({name: 'd', type: 'string', optional: true})
|
546
546
|
expect(r[:e]).to eql({name: 'e', type: 'array', optional: true})
|
547
547
|
expect(r[:f]).to eql({name: 'f', type: 'hash', optional: true})
|
metadata
CHANGED
@@ -2,14 +2,14 @@
|
|
2
2
|
name: norikra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.1.
|
5
|
+
version: 0.1.1
|
6
6
|
platform: java
|
7
7
|
authors:
|
8
8
|
- TAGOMORI Satoshi
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-11-
|
12
|
+
date: 2013-11-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mizuno
|