lwes 0.7.0 → 0.8.0pre1

Sign up to get free protection for your applications and to get access to all the features.
@@ -59,9 +59,7 @@ class TestStruct < Test::Unit::TestCase
59
59
  assert_equal "EVENT_BOOL", b.name
60
60
  assert_equal false, b.const_get(:HAVE_ENCODING)
61
61
 
62
- e = assert_raises(RuntimeError) {
63
- LWES::Struct.new(:file=>MULTI_EVENT_ESF)
64
- }
62
+ assert_raises(RuntimeError) { LWES::Struct.new(:file=>MULTI_EVENT_ESF) }
65
63
  end
66
64
 
67
65
  def test_new_with_type_db
@@ -139,6 +137,7 @@ class TestStruct < Test::Unit::TestCase
139
137
  :class=>:Init,
140
138
  :name=>:Event1,
141
139
  :parent=>Dummy)
140
+ assert_kind_of Class, a
142
141
  y = Dummy::Init.new(:t_ip_addr => "192.168.0.1", :t_bool => true)
143
142
  assert_equal "192.168.0.1", y.t_ip_addr
144
143
  assert_equal true, y.t_bool
@@ -149,6 +148,7 @@ class TestStruct < Test::Unit::TestCase
149
148
  :class=> :LWES_Blah,
150
149
  :name=>:Event1,
151
150
  :defaults => { :enc => 1 })
151
+ assert_kind_of Class, a
152
152
  y = LWES_Blah.new
153
153
  assert_equal 1, y.enc
154
154
  end
@@ -158,6 +158,7 @@ class TestStruct < Test::Unit::TestCase
158
158
  :class=> :LWES_Foo,
159
159
  :name=>:Event1,
160
160
  :defaults => { :enc => 1 })
161
+ assert_kind_of Class, a
161
162
  y = LWES_Foo.new(:enc => 2)
162
163
  assert_equal 2, y.enc
163
164
  end
@@ -166,6 +167,7 @@ class TestStruct < Test::Unit::TestCase
166
167
  a = LWES::Struct.new(:file=>ESF_FILE,
167
168
  :class=> :LWES_New,
168
169
  :name=>:Event1)
170
+ assert_kind_of Class, a
169
171
  y = LWES_Foo.new(true, -16, -32, -64, "127.0.0.1", "HI", 16, 32, 64)
170
172
  assert_equal(true, y.t_bool)
171
173
  assert_equal(-16, y.t_int16)
@@ -183,6 +185,7 @@ class TestStruct < Test::Unit::TestCase
183
185
  :class=> :LWES_Skip,
184
186
  :name=>:Event1,
185
187
  :skip => %w(SenderIP SenderPort SiteID ReceiptTime))
188
+ assert_kind_of Class, a
186
189
  y = LWES_Skip.new
187
190
  assert ! y.respond_to?(:SenderIP)
188
191
  assert ! y.respond_to?(:SenderPort)
@@ -197,6 +200,7 @@ class TestStruct < Test::Unit::TestCase
197
200
  :class=> :LWES_SkipRe,
198
201
  :name=>:Event1,
199
202
  :skip => %r(\AS))
203
+ assert_kind_of Class, a
200
204
  y = LWES_SkipRe.new
201
205
  assert ! y.respond_to?(:SenderIP)
202
206
  assert ! y.respond_to?(:SenderPort)
@@ -68,10 +68,11 @@ class TestTypeDB < Test::Unit::TestCase
68
68
  Abcde::A::B::C::Event::Bool
69
69
  Abcde::A::B::C::Event::String)
70
70
  assert_equal expect, classes.map { |i| i.to_s }
71
+ Abcde.__send__ :remove_const, :A
71
72
  end
72
73
 
73
- def test_invalid_file_arg_error
74
- assert_raises(ArgumentError) { LWES::TypeDB.new(nil) }
74
+ def test_invalid_file_type_error
75
+ assert_raises(TypeError) { LWES::TypeDB.new(nil) }
75
76
  end
76
77
 
77
78
  def test_empty_struct_ok
@@ -81,6 +82,6 @@ class TestTypeDB < Test::Unit::TestCase
81
82
  tdb = LWES::TypeDB.new("#{File.dirname(__FILE__)}/meta_only.esf")
82
83
  classes = tdb.create_classes!
83
84
  assert_equal %w(Meta::Info::Only), classes.map { |x| x.to_s }
85
+ Object.__send__ :remove_const, :Meta
84
86
  end
85
-
86
87
  end
@@ -0,0 +1,47 @@
1
+ require "#{File.expand_path(File.dirname(__FILE__))}/../test_helper"
2
+ require 'tempfile'
3
+
4
+ module Abcde;
5
+ end
6
+
7
+ class TestTypeDBEvents < Test::Unit::TestCase
8
+ def test_create_classes
9
+ tdb = LWES::TypeDB.new("#{File.dirname(__FILE__)}/test2.esf")
10
+ tmp = Module.new
11
+ classes = tdb.create_classes!(:parent => tmp, :sparse => true)
12
+ classes.each { |k| assert_equal LWES::Event, k.superclass }
13
+ end
14
+
15
+ def test_namespaced_esf
16
+ tdb = LWES::TypeDB.new("#{File.dirname(__FILE__)}/namespaced.esf")
17
+ classes = tdb.create_classes!(:parent => Abcde, :sparse => true)
18
+ expect = %w(Abcde::A::B::C::Event
19
+ Abcde::A::B::C::Event::Bool
20
+ Abcde::A::B::C::Event::String)
21
+ assert_equal expect, classes.map { |i| i.to_s }
22
+ Abcde.__send__ :remove_const, :A
23
+ # LWES::Event::CLASSES.clear
24
+ end
25
+
26
+ def test_empty_struct_ok
27
+ # even with LWES 0.22.3, the "ERROR" message is non-fatal
28
+ # the next version (as of lwes trunk r344) will no longer
29
+ # spew a non-fatal "ERROR" message.
30
+ tdb = LWES::TypeDB.new("#{File.dirname(__FILE__)}/meta_only.esf")
31
+ classes = tdb.create_classes! :sparse => true
32
+ assert_equal %w(Meta::Info::Only), classes.map { |x| x.to_s }
33
+ Object.__send__ :remove_const, :Meta
34
+ end
35
+
36
+ def teardown
37
+ new_classes = LWES::Event::CLASSES
38
+ new_classes.each_key do |k|
39
+ begin
40
+ object.const_get k
41
+ Object.__send__ :remove_const, k.to_sym
42
+ rescue NameError
43
+ end
44
+ end
45
+ new_classes.clear
46
+ end
47
+ end
metadata CHANGED
@@ -1,12 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lwes
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 7
8
- - 0
9
- version: 0.7.0
4
+ prerelease: 5
5
+ version: 0.8.0pre1
10
6
  platform: ruby
11
7
  authors:
12
8
  - Erik S. Chang
@@ -15,10 +11,20 @@ autorequire:
15
11
  bindir: bin
16
12
  cert_chain: []
17
13
 
18
- date: 2011-01-27 00:00:00 +00:00
14
+ date: 2011-03-04 00:00:00 +00:00
19
15
  default_executable:
20
- dependencies: []
21
-
16
+ dependencies:
17
+ - !ruby/object:Gem::Dependency
18
+ name: rake-compiler
19
+ prerelease: false
20
+ requirement: &id001 !ruby/object:Gem::Requirement
21
+ none: false
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: 0.7.6
26
+ type: :development
27
+ version_requirements: *id001
22
28
  description: |-
23
29
  The LWES Light-Weight Event System is a framework for allowing the exchange of
24
30
  information from many machines to many machines in a controlled, platform
@@ -29,26 +35,32 @@ email: lwes-devel@lists.sourceforge.net
29
35
  executables: []
30
36
 
31
37
  extensions:
32
- - ext/lwes/extconf.rb
38
+ - ext/lwes_ext/extconf.rb
33
39
  extra_rdoc_files: []
34
40
 
35
41
  files:
42
+ - .gitignore
36
43
  - COPYING
37
44
  - ChangeLog
38
45
  - README
39
46
  - Rakefile
40
47
  - examples/demo.rb
41
48
  - examples/my_events.esf
42
- - ext/lwes/emitter.c
43
- - ext/lwes/event.c
44
- - ext/lwes/extconf.rb
45
- - ext/lwes/lwes.c
46
- - ext/lwes/lwes_ruby.h
47
- - ext/lwes/numeric.c
48
- - ext/lwes/type_db.c
49
+ - ext/lwes_ext/.gitignore
50
+ - ext/lwes_ext/emitter.c
51
+ - ext/lwes_ext/event.c
52
+ - ext/lwes_ext/extconf.rb
53
+ - ext/lwes_ext/listener.c
54
+ - ext/lwes_ext/lwes.c
55
+ - ext/lwes_ext/lwes_ruby.h
56
+ - ext/lwes_ext/numeric.c
57
+ - ext/lwes_ext/type_conv.c
58
+ - ext/lwes_ext/type_db.c
49
59
  - lib/lwes.rb
60
+ - lib/lwes/class_maker.rb
50
61
  - lib/lwes/emitter.rb
51
62
  - lib/lwes/event.rb
63
+ - lib/lwes/listener.rb
52
64
  - lib/lwes/struct.rb
53
65
  - lib/lwes/type_db.rb
54
66
  - lwes.gemspec
@@ -60,11 +72,13 @@ files:
60
72
  - test/unit/test_emit_struct.rb
61
73
  - test/unit/test_emitter.rb
62
74
  - test/unit/test_event.rb
75
+ - test/unit/test_listener.rb
63
76
  - test/unit/test_struct.rb
64
77
  - test/unit/test_type_db.rb
65
- - ext/lwes/lwes-0.23.1.tar.gz
78
+ - test/unit/test_type_db_events.rb
79
+ - ext/lwes_ext/lwes-0.23.1.tar.gz
66
80
  has_rdoc: true
67
- homepage: http://www.lwes.org/
81
+ homepage: http://lwes.rubyforge.org/
68
82
  licenses: []
69
83
 
70
84
  post_install_message:
@@ -77,27 +91,25 @@ required_ruby_version: !ruby/object:Gem::Requirement
77
91
  requirements:
78
92
  - - ">="
79
93
  - !ruby/object:Gem::Version
80
- segments:
81
- - 0
82
94
  version: "0"
83
95
  required_rubygems_version: !ruby/object:Gem::Requirement
84
96
  none: false
85
97
  requirements:
86
- - - ">="
98
+ - - ">"
87
99
  - !ruby/object:Gem::Version
88
- segments:
89
- - 0
90
- version: "0"
100
+ version: 1.3.1
91
101
  requirements: []
92
102
 
93
103
  rubyforge_project: lwes
94
- rubygems_version: 1.3.7
104
+ rubygems_version: 1.6.0
95
105
  signing_key:
96
106
  specification_version: 3
97
- summary: Ruby API for the Light Weight Event System
107
+ summary: Ruby bindings for the Light Weight Event System
98
108
  test_files:
99
109
  - test/unit/test_emit_struct.rb
100
110
  - test/unit/test_emitter.rb
101
111
  - test/unit/test_event.rb
112
+ - test/unit/test_listener.rb
102
113
  - test/unit/test_struct.rb
103
114
  - test/unit/test_type_db.rb
115
+ - test/unit/test_type_db_events.rb