sessionvoc-open 1.7.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,96 @@
1
+ # Copyright:: 2011 triAGENS GmbH
2
+ # Author:: Oliver Kiessler (mailto:kiessler@inceedo.com)
3
+ require 'helper'
4
+
5
+ class TestSessionvocDataConversion < Test::Unit::TestCase
6
+ should "perform type conversion on trans data" do
7
+ sid = client.new_session
8
+ assert_not_nil sid
9
+ assert_not_nil client.datainfo
10
+
11
+ mock_session_hash = {'transData' => {}, 'sid' => sid}
12
+ session_data = client.enforce_value_type('transData', 'message', 'test', mock_session_hash)
13
+ assert_not_nil session_data
14
+ assert_equal session_data['transData']['message'], 'test'
15
+ end
16
+
17
+ should "fail to perform data conversion due to an unknown scope" do
18
+ sid = client.new_session
19
+ assert_not_nil sid
20
+ mock_session_hash = {'transData' => {}, 'sid' => sid}
21
+ assert_raise Sessionvoc::Open::DataConversionException do
22
+ client.enforce_value_type('someData', 'message', 'test', mock_session_hash)
23
+ end
24
+ end
25
+
26
+ should "fail to perform data conversion due to a missing sid" do
27
+ mock_session_hash = {'transData' => {}, 'sid' => nil}
28
+ assert_raise Sessionvoc::Open::InvalidSidException do
29
+ client.enforce_value_type('transData', 'message', 'test', mock_session_hash)
30
+ end
31
+ end
32
+
33
+ should "fail to perform data conversion due to an unknown attribute" do
34
+ sid = client.new_session
35
+ assert_not_nil sid
36
+ mock_session_hash = {'transData' => {}, 'sid' => sid}
37
+ assert_raise Sessionvoc::Open::DataConversionException do
38
+ client.enforce_value_type('transData', 'foo', 'test', mock_session_hash)
39
+ end
40
+ end
41
+
42
+ should "perform type conversion on user data" do
43
+ sid = client.new_session
44
+ assert_not_nil sid
45
+ assert_not_nil client.datainfo
46
+
47
+ mock_session_hash = {'userData' => {}, 'sid' => sid}
48
+ session_data = client.enforce_value_type('userData', 'name', 'Kiessler', mock_session_hash)
49
+ assert_not_nil session_data
50
+ assert_equal session_data['userData']['name'], 'Kiessler'
51
+ end
52
+
53
+ should "perform DT_NULL conversions" do
54
+ assert_nil client.convert("foo", "bar", :DT_NULL)
55
+ end
56
+
57
+ should "perform DT_BOOLEAN conversions" do
58
+ assert client.convert("foo", "true", :DT_BOOLEAN)
59
+ assert client.convert("foo", "1", :DT_BOOLEAN)
60
+ assert !client.convert("foo", "false", :DT_BOOLEAN)
61
+ assert !client.convert("foo", "0", :DT_BOOLEAN)
62
+ assert !client.convert("foo", "bar", :DT_BOOLEAN)
63
+ end
64
+
65
+ should "perform DT_CHAR conversions" do
66
+ assert_equal client.convert("foo", "bar", :DT_CHAR), "b"
67
+ end
68
+
69
+ should "perform DT_STRING conversions" do
70
+ assert_equal client.convert("foo", "bar", :DT_STRING), "bar"
71
+ assert_equal client.convert("foo", 1, :DT_STRING), "1"
72
+ assert_equal client.convert("foo", 1.1, :DT_STRING), "1.1"
73
+ assert_equal client.convert("foo", true, :DT_STRING), "true"
74
+ end
75
+
76
+ should "perform DT_INTEGER conversions" do
77
+ assert_equal client.convert("foo", "433", :DT_INTEGER), 433
78
+ assert_equal client.convert("foo", 43333, :DT_INTEGER), 43333
79
+ assert_equal client.convert("foo", "34749857984", :DT_LONG_INTEGER), 34749857984
80
+ assert_equal client.convert("foo", 34749857984, :DT_LONG_INTEGER), 34749857984
81
+ end
82
+
83
+ should "perform DT_FLOAT conversions" do
84
+ assert_equal client.convert("foo", "43.3", :DT_FLOAT), 43.3
85
+ assert_equal client.convert("foo", 4333.3, :DT_FLOAT), 4333.3
86
+ assert_equal client.convert("foo", "34749857984.2", :DT_DOUBLE), 34749857984.2
87
+ assert_equal client.convert("foo", 34749857984.2, :DT_DOUBLE), 34749857984.2
88
+ end
89
+
90
+ should "perform DT_UNSIGNED_INTEGER conversions" do
91
+ assert_equal client.convert("foo", "433", :DT_UNSIGNED_INTEGER), 433
92
+ assert_nil client.convert("foo", -43333, :DT_UNSIGNED_INTEGER)
93
+ assert_equal client.convert("foo", "34749857984", :DT_UNSIGNED_LONG_INTEGER), 34749857984
94
+ assert_nil client.convert("foo", -34749857984, :DT_UNSIGNED_LONG_INTEGER)
95
+ end
96
+ end
@@ -0,0 +1,118 @@
1
+ # Copyright:: 2011 triAGENS GmbH
2
+ # Author:: Oliver Kiessler (mailto:kiessler@inceedo.com)
3
+ require 'helper'
4
+
5
+ class TestSessionvocFormData < Test::Unit::TestCase
6
+ should "create form data" do
7
+ sid = client.new_session
8
+ assert_not_nil sid
9
+ fid = client.create_form_data(sid)
10
+ assert_not_nil fid
11
+ assert fid.is_a?(String)
12
+ assert fid.length > 0
13
+ end
14
+
15
+ should "fail to create form data due to a non-existent sid" do
16
+ sid = client.new_session
17
+ assert non_sid != sid
18
+ assert_raise Sessionvoc::Open::InvalidSidException do
19
+ fid = client.create_form_data(non_sid)
20
+ end
21
+ end
22
+
23
+ should "delete form data" do
24
+ sid, fid = create_form
25
+ assert client.delete_form_data(sid, fid)
26
+ end
27
+
28
+ should "fail to delete form data due to a non-existent fid" do
29
+ sid, fid = create_form
30
+ assert_raise Sessionvoc::Open::FormDataCantBeDestroyedException do
31
+ client.delete_form_data(sid, non_fid)
32
+ end
33
+ end
34
+
35
+ should "get form data" do
36
+ sid, fid = create_form
37
+
38
+ form_data = client.get_form_data(sid, fid)
39
+ assert_nil form_data
40
+
41
+ form_data = {'foo' => 'bar', 'number' => 1, 'success' => false, 'subobject' => {'foo' => 'bar'}}
42
+ client.update_form_data(sid, fid, form_data)
43
+
44
+ form_data = client.get_form_data(sid, fid)
45
+ assert_not_nil form_data
46
+ assert_equal form_data['foo'], 'bar'
47
+ assert_equal form_data['number'], 1
48
+ assert !form_data['success']
49
+ assert_not_nil form_data['subobject']
50
+ assert form_data['subobject'].is_a?(Hash)
51
+ assert_equal form_data['subobject']['foo'], 'bar'
52
+ end
53
+
54
+ should "fail to get form data due to a non-existent fid" do
55
+ sid, fid = create_form
56
+ assert_raise Sessionvoc::Open::InvalidFidException do
57
+ client.get_form_data(sid, non_fid)
58
+ end
59
+ end
60
+
61
+ should "update form data" do
62
+ sid, fid = create_form
63
+
64
+ form_data = {'foo' => 'bar'}
65
+ client.update_form_data(sid, fid, form_data)
66
+
67
+ form_data = client.get_form_data(sid, fid)
68
+ assert_not_nil form_data
69
+ assert_equal form_data['foo'], 'bar'
70
+
71
+ form_data = {'foo' => 'bar2'}
72
+ client.update_form_data(sid, fid, form_data)
73
+
74
+ form_data = client.get_form_data(sid, fid)
75
+ assert_not_nil form_data
76
+ assert_equal form_data['foo'], 'bar2'
77
+
78
+ form_data = {}
79
+ client.update_form_data(sid, fid, form_data)
80
+
81
+ form_data = client.get_form_data(sid, fid)
82
+ assert_equal form_data, {}
83
+
84
+ form_data = nil
85
+ client.update_form_data(sid, fid, form_data)
86
+
87
+ form_data = client.get_form_data(sid, fid)
88
+ assert_nil form_data
89
+ end
90
+
91
+ should "create a form data by passing a self generated fid" do
92
+ sid = client.new_session
93
+ form_data = {'foo' => 'bar'}
94
+ fid = non_fid
95
+ client.update_form_data(sid, fid, form_data)
96
+
97
+ form_data = client.get_form_data(sid, fid)
98
+ assert_not_nil form_data
99
+ assert_equal form_data['foo'], 'bar'
100
+ end
101
+
102
+ should "fail to update form data due to a non-existent sid" do
103
+ form_data = {'foo' => 'bar'}
104
+ fid = non_fid
105
+ assert_raise Sessionvoc::Open::InvalidSidException do
106
+ client.update_form_data(non_sid, fid, form_data)
107
+ end
108
+ end
109
+
110
+ private
111
+ def create_form
112
+ sid = client.new_session
113
+ assert_not_nil sid
114
+ fid = client.create_form_data(sid)
115
+ assert_not_nil fid
116
+ [sid, fid]
117
+ end
118
+ end
@@ -0,0 +1,17 @@
1
+ # Copyright:: 2011 triAGENS GmbH
2
+ # Author:: Oliver Kiessler (mailto:kiessler@inceedo.com)
3
+ require 'helper'
4
+
5
+ class TestSessionvocMetaData < Test::Unit::TestCase
6
+ should "read the data info" do
7
+ meta_data = client.datainfo
8
+ assert_not_nil meta_data
9
+ assert meta_data.has_key?("types")
10
+ assert meta_data.has_key?("access")
11
+ assert meta_data["access"].has_key?("form")
12
+ assert meta_data["access"].has_key?("transData")
13
+ assert meta_data["access"].has_key?("session")
14
+ assert meta_data["access"].has_key?("form")
15
+ assert meta_data["access"].has_key?("login")
16
+ end
17
+ end
@@ -0,0 +1,73 @@
1
+ # Copyright:: 2011 triAGENS GmbH
2
+ # Author:: Oliver Kiessler (mailto:kiessler@inceedo.com)
3
+ require 'helper'
4
+
5
+ class TestSessionvocSession < Test::Unit::TestCase
6
+ should "create a new session" do
7
+ sid = client.new_session
8
+ assert_not_nil sid
9
+ assert sid.is_a?(String)
10
+ assert sid.length > 0
11
+ end
12
+
13
+ should "get an existing session" do
14
+ sid = client.new_session
15
+ assert_not_nil sid
16
+ session_data = client.get_session(sid)
17
+ assert_not_nil session_data
18
+ assert session_data.has_key?("urlSecret")
19
+ assert session_data.has_key?("userData")
20
+ assert session_data.has_key?("sid")
21
+ assert session_data.has_key?("uid")
22
+ assert session_data.has_key?("transData")
23
+ end
24
+
25
+ should "fail to get an existing due to a non-existing sid" do
26
+ sid = client.new_session
27
+ assert non_sid != sid
28
+ assert_raise Sessionvoc::Open::InvalidSidException do
29
+ session_data = client.get_session(non_sid)
30
+ end
31
+ end
32
+
33
+ should "delete an existing session" do
34
+ sid = client.new_session
35
+ assert_not_nil sid
36
+ session_data = client.get_session(sid)
37
+ assert_not_nil session_data
38
+ client.delete_session(sid)
39
+ end
40
+
41
+ should "fail to delete a session due to a non-existing sid" do
42
+ sid = client.new_session
43
+ assert non_sid != sid
44
+ assert_raise Sessionvoc::Open::InvalidSidException do
45
+ client.delete_session(non_sid)
46
+ end
47
+ end
48
+
49
+ should "update a session with transdata" do
50
+ sid = client.new_session
51
+ assert_not_nil sid
52
+
53
+ assert_not_nil client.update(sid, {'transData' => {'message' => 'Hello from RUnit!'}})
54
+ session_data = client.get_session(sid)
55
+ assert_not_nil session_data
56
+ assert_not_nil session_data['transData']
57
+ assert_equal session_data['transData']['message'], 'Hello from RUnit!'
58
+
59
+ assert_not_nil client.update(sid, {'transData' => {'message' => ''}})
60
+ session_data = client.get_session(sid)
61
+ assert_not_nil session_data
62
+ assert_not_nil session_data['transData']
63
+ assert_equal session_data['transData']['message'], ''
64
+ end
65
+
66
+ should "fail to update a session due to a non-existing sid" do
67
+ sid = client.new_session
68
+ assert non_sid != sid
69
+ assert_raise Sessionvoc::Open::InvalidSidException do
70
+ client.update(non_sid, {'transData' => {'message' => 'Hello from RUnit!'}})
71
+ end
72
+ end
73
+ end
data/uninstall.rb ADDED
@@ -0,0 +1,4 @@
1
+ # Copyright:: 2011 triAGENS GmbH
2
+ # Author:: Oliver Kiessler (mailto:kiessler@inceedo.com)
3
+
4
+ # Uninstall hook code here
metadata ADDED
@@ -0,0 +1,228 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sessionvoc-open
3
+ version: !ruby/object:Gem::Version
4
+ hash: 13
5
+ prerelease:
6
+ segments:
7
+ - 1
8
+ - 7
9
+ - 3
10
+ version: 1.7.3
11
+ platform: ruby
12
+ authors:
13
+ - triAGENS GmbH
14
+ - Oliver Kiessler
15
+ autorequire:
16
+ bindir: bin
17
+ cert_chain: []
18
+
19
+ date: 2011-05-03 00:00:00 +02:00
20
+ default_executable:
21
+ dependencies:
22
+ - !ruby/object:Gem::Dependency
23
+ type: :runtime
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
32
+ version: "0"
33
+ name: httparty
34
+ version_requirements: *id001
35
+ prerelease: false
36
+ - !ruby/object:Gem::Dependency
37
+ type: :runtime
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ hash: 3
44
+ segments:
45
+ - 0
46
+ version: "0"
47
+ name: json
48
+ version_requirements: *id002
49
+ prerelease: false
50
+ - !ruby/object:Gem::Dependency
51
+ type: :development
52
+ requirement: &id003 !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ hash: 3
58
+ segments:
59
+ - 0
60
+ version: "0"
61
+ name: shoulda
62
+ version_requirements: *id003
63
+ prerelease: false
64
+ - !ruby/object:Gem::Dependency
65
+ type: :development
66
+ requirement: &id004 !ruby/object:Gem::Requirement
67
+ none: false
68
+ requirements:
69
+ - - ~>
70
+ - !ruby/object:Gem::Version
71
+ hash: 23
72
+ segments:
73
+ - 1
74
+ - 0
75
+ - 0
76
+ version: 1.0.0
77
+ name: bundler
78
+ version_requirements: *id004
79
+ prerelease: false
80
+ - !ruby/object:Gem::Dependency
81
+ type: :development
82
+ requirement: &id005 !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ~>
86
+ - !ruby/object:Gem::Version
87
+ hash: 7
88
+ segments:
89
+ - 1
90
+ - 5
91
+ - 2
92
+ version: 1.5.2
93
+ name: jeweler
94
+ version_requirements: *id005
95
+ prerelease: false
96
+ - !ruby/object:Gem::Dependency
97
+ type: :development
98
+ requirement: &id006 !ruby/object:Gem::Requirement
99
+ none: false
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ hash: 3
104
+ segments:
105
+ - 0
106
+ version: "0"
107
+ name: rcov
108
+ version_requirements: *id006
109
+ prerelease: false
110
+ - !ruby/object:Gem::Dependency
111
+ type: :runtime
112
+ requirement: &id007 !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ hash: 11
118
+ segments:
119
+ - 0
120
+ - 7
121
+ - 4
122
+ version: 0.7.4
123
+ name: httparty
124
+ version_requirements: *id007
125
+ prerelease: false
126
+ - !ruby/object:Gem::Dependency
127
+ type: :runtime
128
+ requirement: &id008 !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ">="
132
+ - !ruby/object:Gem::Version
133
+ hash: 11
134
+ segments:
135
+ - 1
136
+ - 4
137
+ - 6
138
+ version: 1.4.6
139
+ name: json
140
+ version_requirements: *id008
141
+ prerelease: false
142
+ description: Rails 3 Plugin to integrate with SessionVOC. In order to manage user sessions efficiently the SessionVOC provides the functions login, logout, read and write of a session. Furthermore it has the ability to synchronize with one or more persistent relational databases.
143
+ email: kiessler@inceedo.com
144
+ executables: []
145
+
146
+ extensions: []
147
+
148
+ extra_rdoc_files:
149
+ - LICENSE.txt
150
+ - README.md
151
+ files:
152
+ - .document
153
+ - Gemfile
154
+ - Gemfile.lock
155
+ - LICENSE.txt
156
+ - README.md
157
+ - Rakefile
158
+ - VERSION
159
+ - config.yml.sample
160
+ - examples/example.sql
161
+ - examples/example.xml
162
+ - init.rb
163
+ - install.rb
164
+ - lib/sessionvoc-open.rb
165
+ - lib/sessionvoc-store/open/controller_methods.rb
166
+ - lib/sessionvoc-store/open/railtie.rb
167
+ - lib/sessionvoc-store/open/sessionvoc_store.rb
168
+ - lib/sessionvoc/open/authentification.rb
169
+ - lib/sessionvoc/open/base.rb
170
+ - lib/sessionvoc/open/client.rb
171
+ - lib/sessionvoc/open/configuration.rb
172
+ - lib/sessionvoc/open/data_conversion.rb
173
+ - lib/sessionvoc/open/exceptions.rb
174
+ - lib/sessionvoc/open/form_data.rb
175
+ - lib/sessionvoc/open/meta_data.rb
176
+ - lib/sessionvoc/open/session.rb
177
+ - sessionvoc-open.gemspec
178
+ - test/config.yml
179
+ - test/helper.rb
180
+ - test/test_sessionvoc_authentification.rb
181
+ - test/test_sessionvoc_base.rb
182
+ - test/test_sessionvoc_data_conversion.rb
183
+ - test/test_sessionvoc_form_data.rb
184
+ - test/test_sessionvoc_meta_data.rb
185
+ - test/test_sessionvoc_session.rb
186
+ - uninstall.rb
187
+ has_rdoc: true
188
+ homepage: http://www.worldofvoc.com/products/sessionvoc/summary/
189
+ licenses:
190
+ - Apache License Version 2.0, January 2004
191
+ post_install_message:
192
+ rdoc_options: []
193
+
194
+ require_paths:
195
+ - lib
196
+ required_ruby_version: !ruby/object:Gem::Requirement
197
+ none: false
198
+ requirements:
199
+ - - ">="
200
+ - !ruby/object:Gem::Version
201
+ hash: 3
202
+ segments:
203
+ - 0
204
+ version: "0"
205
+ required_rubygems_version: !ruby/object:Gem::Requirement
206
+ none: false
207
+ requirements:
208
+ - - ">="
209
+ - !ruby/object:Gem::Version
210
+ hash: 3
211
+ segments:
212
+ - 0
213
+ version: "0"
214
+ requirements: []
215
+
216
+ rubyforge_project:
217
+ rubygems_version: 1.6.2
218
+ signing_key:
219
+ specification_version: 3
220
+ summary: The SessionVOC is a noSQL database optimized for the management of user sessions.
221
+ test_files:
222
+ - test/helper.rb
223
+ - test/test_sessionvoc_authentification.rb
224
+ - test/test_sessionvoc_base.rb
225
+ - test/test_sessionvoc_data_conversion.rb
226
+ - test/test_sessionvoc_form_data.rb
227
+ - test/test_sessionvoc_meta_data.rb
228
+ - test/test_sessionvoc_session.rb