mongo-lyon 1.2.4

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.
Files changed (87) hide show
  1. data/LICENSE.txt +190 -0
  2. data/README.md +344 -0
  3. data/Rakefile +202 -0
  4. data/bin/mongo_console +34 -0
  5. data/docs/1.0_UPGRADE.md +21 -0
  6. data/docs/CREDITS.md +123 -0
  7. data/docs/FAQ.md +116 -0
  8. data/docs/GridFS.md +158 -0
  9. data/docs/HISTORY.md +225 -0
  10. data/docs/REPLICA_SETS.md +72 -0
  11. data/docs/TUTORIAL.md +247 -0
  12. data/docs/WRITE_CONCERN.md +28 -0
  13. data/lib/mongo.rb +77 -0
  14. data/lib/mongo/collection.rb +872 -0
  15. data/lib/mongo/connection.rb +875 -0
  16. data/lib/mongo/cursor.rb +449 -0
  17. data/lib/mongo/db.rb +607 -0
  18. data/lib/mongo/exceptions.rb +68 -0
  19. data/lib/mongo/gridfs/grid.rb +106 -0
  20. data/lib/mongo/gridfs/grid_ext.rb +57 -0
  21. data/lib/mongo/gridfs/grid_file_system.rb +145 -0
  22. data/lib/mongo/gridfs/grid_io.rb +394 -0
  23. data/lib/mongo/gridfs/grid_io_fix.rb +38 -0
  24. data/lib/mongo/repl_set_connection.rb +342 -0
  25. data/lib/mongo/util/conversions.rb +89 -0
  26. data/lib/mongo/util/core_ext.rb +60 -0
  27. data/lib/mongo/util/pool.rb +185 -0
  28. data/lib/mongo/util/server_version.rb +71 -0
  29. data/lib/mongo/util/support.rb +82 -0
  30. data/lib/mongo/util/uri_parser.rb +181 -0
  31. data/lib/mongo/version.rb +3 -0
  32. data/mongo.gemspec +34 -0
  33. data/test/auxillary/1.4_features.rb +166 -0
  34. data/test/auxillary/authentication_test.rb +68 -0
  35. data/test/auxillary/autoreconnect_test.rb +41 -0
  36. data/test/auxillary/repl_set_auth_test.rb +58 -0
  37. data/test/auxillary/slave_connection_test.rb +36 -0
  38. data/test/auxillary/threaded_authentication_test.rb +101 -0
  39. data/test/bson/binary_test.rb +15 -0
  40. data/test/bson/bson_test.rb +614 -0
  41. data/test/bson/byte_buffer_test.rb +190 -0
  42. data/test/bson/hash_with_indifferent_access_test.rb +38 -0
  43. data/test/bson/json_test.rb +17 -0
  44. data/test/bson/object_id_test.rb +154 -0
  45. data/test/bson/ordered_hash_test.rb +197 -0
  46. data/test/collection_test.rb +893 -0
  47. data/test/connection_test.rb +303 -0
  48. data/test/conversions_test.rb +120 -0
  49. data/test/cursor_fail_test.rb +75 -0
  50. data/test/cursor_message_test.rb +43 -0
  51. data/test/cursor_test.rb +457 -0
  52. data/test/db_api_test.rb +715 -0
  53. data/test/db_connection_test.rb +15 -0
  54. data/test/db_test.rb +287 -0
  55. data/test/grid_file_system_test.rb +244 -0
  56. data/test/grid_io_test.rb +120 -0
  57. data/test/grid_test.rb +200 -0
  58. data/test/load/thin/load.rb +24 -0
  59. data/test/load/unicorn/load.rb +23 -0
  60. data/test/replica_sets/connect_test.rb +86 -0
  61. data/test/replica_sets/connection_string_test.rb +32 -0
  62. data/test/replica_sets/count_test.rb +35 -0
  63. data/test/replica_sets/insert_test.rb +53 -0
  64. data/test/replica_sets/pooled_insert_test.rb +55 -0
  65. data/test/replica_sets/query_secondaries.rb +96 -0
  66. data/test/replica_sets/query_test.rb +51 -0
  67. data/test/replica_sets/replication_ack_test.rb +66 -0
  68. data/test/replica_sets/rs_test_helper.rb +27 -0
  69. data/test/safe_test.rb +68 -0
  70. data/test/support/hash_with_indifferent_access.rb +199 -0
  71. data/test/support/keys.rb +45 -0
  72. data/test/support_test.rb +19 -0
  73. data/test/test_helper.rb +83 -0
  74. data/test/threading/threading_with_large_pool_test.rb +90 -0
  75. data/test/threading_test.rb +87 -0
  76. data/test/tools/auth_repl_set_manager.rb +14 -0
  77. data/test/tools/repl_set_manager.rb +266 -0
  78. data/test/unit/collection_test.rb +130 -0
  79. data/test/unit/connection_test.rb +98 -0
  80. data/test/unit/cursor_test.rb +99 -0
  81. data/test/unit/db_test.rb +96 -0
  82. data/test/unit/grid_test.rb +49 -0
  83. data/test/unit/pool_test.rb +9 -0
  84. data/test/unit/repl_set_connection_test.rb +72 -0
  85. data/test/unit/safe_test.rb +125 -0
  86. data/test/uri_test.rb +91 -0
  87. metadata +202 -0
data/test/uri_test.rb ADDED
@@ -0,0 +1,91 @@
1
+ require './test/test_helper'
2
+
3
+ class TestThreading < Test::Unit::TestCase
4
+ include Mongo
5
+
6
+ def test_uri_without_port
7
+ parser = Mongo::URIParser.new('mongodb://localhost')
8
+ assert_equal 1, parser.nodes.length
9
+ assert_equal 'localhost', parser.nodes[0][0]
10
+ assert_equal 27017, parser.nodes[0][1]
11
+ end
12
+
13
+ def test_basic_uri
14
+ parser = Mongo::URIParser.new('mongodb://localhost:27018')
15
+ assert_equal 1, parser.nodes.length
16
+ assert_equal 'localhost', parser.nodes[0][0]
17
+ assert_equal 27018, parser.nodes[0][1]
18
+ end
19
+
20
+ def test_multiple_uris
21
+ parser = Mongo::URIParser.new('mongodb://a.example.com:27018,b.example.com')
22
+ assert_equal 2, parser.nodes.length
23
+ assert_equal 'a.example.com', parser.nodes[0][0]
24
+ assert_equal 27018, parser.nodes[0][1]
25
+ assert_equal 'b.example.com', parser.nodes[1][0]
26
+ assert_equal 27017, parser.nodes[1][1]
27
+ end
28
+
29
+ def test_complex_passwords
30
+ parser = Mongo::URIParser.new('mongodb://bob:secret.word@a.example.com:27018/test')
31
+ assert_equal "bob", parser.auths[0]["username"]
32
+ assert_equal "secret.word", parser.auths[0]["password"]
33
+
34
+ parser = Mongo::URIParser.new('mongodb://bob:s-_3#%R.t@a.example.com:27018/test')
35
+ assert_equal "bob", parser.auths[0]["username"]
36
+ assert_equal "s-_3#%R.t", parser.auths[0]["password"]
37
+ end
38
+
39
+ def test_passwords_contain_no_commas
40
+ assert_raise MongoArgumentError do
41
+ Mongo::URIParser.new('mongodb://bob:a,b@a.example.com:27018/test')
42
+ end
43
+ end
44
+
45
+ def test_multiple_uris_with_auths
46
+ parser = Mongo::URIParser.new('mongodb://bob:secret@a.example.com:27018/test,joe:secret2@b.example.com/test2')
47
+ assert_equal 2, parser.nodes.length
48
+ assert_equal 'a.example.com', parser.nodes[0][0]
49
+ assert_equal 27018, parser.nodes[0][1]
50
+ assert_equal 'b.example.com', parser.nodes[1][0]
51
+ assert_equal 27017, parser.nodes[1][1]
52
+ assert_equal 2, parser.auths.length
53
+ assert_equal "bob", parser.auths[0]["username"]
54
+ assert_equal "secret", parser.auths[0]["password"]
55
+ assert_equal "test", parser.auths[0]["db_name"]
56
+ assert_equal "joe", parser.auths[1]["username"]
57
+ assert_equal "secret2", parser.auths[1]["password"]
58
+ assert_equal "test2", parser.auths[1]["db_name"]
59
+ end
60
+
61
+ def test_opts_basic
62
+ parser = Mongo::URIParser.new('mongodb://localhost:27018?connect=direct;slaveok=true;safe=true')
63
+ assert_equal 'direct', parser.connect
64
+ assert parser.slaveok
65
+ assert parser.safe
66
+ end
67
+
68
+ def test_opts_with_amp_separator
69
+ parser = Mongo::URIParser.new('mongodb://localhost:27018?connect=direct&slaveok=true&safe=true')
70
+ assert_equal 'direct', parser.connect
71
+ assert parser.slaveok
72
+ assert parser.safe
73
+ end
74
+
75
+ def test_opts_safe
76
+ parser = Mongo::URIParser.new('mongodb://localhost:27018?safe=true;w=2;wtimeout=200;fsync=true')
77
+ assert parser.safe
78
+ assert_equal 2, parser.w
79
+ assert_equal 200, parser.wtimeout
80
+ assert parser.fsync
81
+ end
82
+
83
+ def test_opts_replica_set
84
+ assert_raise_error MongoArgumentError, "specify that connect=replicaset" do
85
+ Mongo::URIParser.new('mongodb://localhost:27018?replicaset=foo')
86
+ end
87
+ parser = Mongo::URIParser.new('mongodb://localhost:27018?connect=replicaset;replicaset=foo')
88
+ assert_equal 'foo', parser.replicaset
89
+ assert_equal 'replicaset', parser.connect
90
+ end
91
+ end
metadata ADDED
@@ -0,0 +1,202 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mongo-lyon
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.2.4
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Jim Menard
9
+ - Mike Dirolf
10
+ - Kyle Banker
11
+ autorequire:
12
+ bindir: bin
13
+ cert_chain: []
14
+ date: 2011-06-02 00:00:00.000000000Z
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: bson
18
+ requirement: &2156269960 !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - ! '>='
22
+ - !ruby/object:Gem::Version
23
+ version: 1.2.4
24
+ type: :runtime
25
+ prerelease: false
26
+ version_requirements: *2156269960
27
+ description: A Ruby driver for MongoDB. For more information about Mongo, see http://www.mongodb.org.
28
+ email: mongodb-dev@googlegroups.com
29
+ executables:
30
+ - mongo_console
31
+ extensions: []
32
+ extra_rdoc_files:
33
+ - README.md
34
+ files:
35
+ - README.md
36
+ - Rakefile
37
+ - mongo.gemspec
38
+ - LICENSE.txt
39
+ - lib/mongo.rb
40
+ - lib/mongo/collection.rb
41
+ - lib/mongo/connection.rb
42
+ - lib/mongo/cursor.rb
43
+ - lib/mongo/db.rb
44
+ - lib/mongo/exceptions.rb
45
+ - lib/mongo/gridfs/grid.rb
46
+ - lib/mongo/gridfs/grid_ext.rb
47
+ - lib/mongo/gridfs/grid_file_system.rb
48
+ - lib/mongo/gridfs/grid_io.rb
49
+ - lib/mongo/gridfs/grid_io_fix.rb
50
+ - lib/mongo/repl_set_connection.rb
51
+ - lib/mongo/util/conversions.rb
52
+ - lib/mongo/util/core_ext.rb
53
+ - lib/mongo/util/pool.rb
54
+ - lib/mongo/util/server_version.rb
55
+ - lib/mongo/util/support.rb
56
+ - lib/mongo/util/uri_parser.rb
57
+ - lib/mongo/version.rb
58
+ - docs/1.0_UPGRADE.md
59
+ - docs/CREDITS.md
60
+ - docs/FAQ.md
61
+ - docs/GridFS.md
62
+ - docs/HISTORY.md
63
+ - docs/REPLICA_SETS.md
64
+ - docs/TUTORIAL.md
65
+ - docs/WRITE_CONCERN.md
66
+ - bin/mongo_console
67
+ - test/auxillary/1.4_features.rb
68
+ - test/auxillary/authentication_test.rb
69
+ - test/auxillary/autoreconnect_test.rb
70
+ - test/auxillary/repl_set_auth_test.rb
71
+ - test/auxillary/slave_connection_test.rb
72
+ - test/auxillary/threaded_authentication_test.rb
73
+ - test/bson/binary_test.rb
74
+ - test/bson/bson_test.rb
75
+ - test/bson/byte_buffer_test.rb
76
+ - test/bson/hash_with_indifferent_access_test.rb
77
+ - test/bson/json_test.rb
78
+ - test/bson/object_id_test.rb
79
+ - test/bson/ordered_hash_test.rb
80
+ - test/collection_test.rb
81
+ - test/connection_test.rb
82
+ - test/conversions_test.rb
83
+ - test/cursor_fail_test.rb
84
+ - test/cursor_message_test.rb
85
+ - test/cursor_test.rb
86
+ - test/db_api_test.rb
87
+ - test/db_connection_test.rb
88
+ - test/db_test.rb
89
+ - test/grid_file_system_test.rb
90
+ - test/grid_io_test.rb
91
+ - test/grid_test.rb
92
+ - test/load/thin/load.rb
93
+ - test/load/unicorn/load.rb
94
+ - test/replica_sets/connect_test.rb
95
+ - test/replica_sets/connection_string_test.rb
96
+ - test/replica_sets/count_test.rb
97
+ - test/replica_sets/insert_test.rb
98
+ - test/replica_sets/pooled_insert_test.rb
99
+ - test/replica_sets/query_secondaries.rb
100
+ - test/replica_sets/query_test.rb
101
+ - test/replica_sets/replication_ack_test.rb
102
+ - test/replica_sets/rs_test_helper.rb
103
+ - test/safe_test.rb
104
+ - test/support/hash_with_indifferent_access.rb
105
+ - test/support/keys.rb
106
+ - test/support_test.rb
107
+ - test/test_helper.rb
108
+ - test/threading/threading_with_large_pool_test.rb
109
+ - test/threading_test.rb
110
+ - test/tools/auth_repl_set_manager.rb
111
+ - test/tools/repl_set_manager.rb
112
+ - test/unit/collection_test.rb
113
+ - test/unit/connection_test.rb
114
+ - test/unit/cursor_test.rb
115
+ - test/unit/db_test.rb
116
+ - test/unit/grid_test.rb
117
+ - test/unit/pool_test.rb
118
+ - test/unit/repl_set_connection_test.rb
119
+ - test/unit/safe_test.rb
120
+ - test/uri_test.rb
121
+ homepage: http://www.mongodb.org
122
+ licenses: []
123
+ post_install_message:
124
+ rdoc_options:
125
+ - --main
126
+ - README.md
127
+ - --inline-source
128
+ require_paths:
129
+ - lib
130
+ required_ruby_version: !ruby/object:Gem::Requirement
131
+ none: false
132
+ requirements:
133
+ - - ! '>='
134
+ - !ruby/object:Gem::Version
135
+ version: '0'
136
+ required_rubygems_version: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ! '>='
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ requirements: []
143
+ rubyforge_project:
144
+ rubygems_version: 1.8.3
145
+ signing_key:
146
+ specification_version: 3
147
+ summary: Ruby driver for the MongoDB
148
+ test_files:
149
+ - test/auxillary/1.4_features.rb
150
+ - test/auxillary/authentication_test.rb
151
+ - test/auxillary/autoreconnect_test.rb
152
+ - test/auxillary/repl_set_auth_test.rb
153
+ - test/auxillary/slave_connection_test.rb
154
+ - test/auxillary/threaded_authentication_test.rb
155
+ - test/bson/binary_test.rb
156
+ - test/bson/bson_test.rb
157
+ - test/bson/byte_buffer_test.rb
158
+ - test/bson/hash_with_indifferent_access_test.rb
159
+ - test/bson/json_test.rb
160
+ - test/bson/object_id_test.rb
161
+ - test/bson/ordered_hash_test.rb
162
+ - test/collection_test.rb
163
+ - test/connection_test.rb
164
+ - test/conversions_test.rb
165
+ - test/cursor_fail_test.rb
166
+ - test/cursor_message_test.rb
167
+ - test/cursor_test.rb
168
+ - test/db_api_test.rb
169
+ - test/db_connection_test.rb
170
+ - test/db_test.rb
171
+ - test/grid_file_system_test.rb
172
+ - test/grid_io_test.rb
173
+ - test/grid_test.rb
174
+ - test/load/thin/load.rb
175
+ - test/load/unicorn/load.rb
176
+ - test/replica_sets/connect_test.rb
177
+ - test/replica_sets/connection_string_test.rb
178
+ - test/replica_sets/count_test.rb
179
+ - test/replica_sets/insert_test.rb
180
+ - test/replica_sets/pooled_insert_test.rb
181
+ - test/replica_sets/query_secondaries.rb
182
+ - test/replica_sets/query_test.rb
183
+ - test/replica_sets/replication_ack_test.rb
184
+ - test/replica_sets/rs_test_helper.rb
185
+ - test/safe_test.rb
186
+ - test/support/hash_with_indifferent_access.rb
187
+ - test/support/keys.rb
188
+ - test/support_test.rb
189
+ - test/test_helper.rb
190
+ - test/threading/threading_with_large_pool_test.rb
191
+ - test/threading_test.rb
192
+ - test/tools/auth_repl_set_manager.rb
193
+ - test/tools/repl_set_manager.rb
194
+ - test/unit/collection_test.rb
195
+ - test/unit/connection_test.rb
196
+ - test/unit/cursor_test.rb
197
+ - test/unit/db_test.rb
198
+ - test/unit/grid_test.rb
199
+ - test/unit/pool_test.rb
200
+ - test/unit/repl_set_connection_test.rb
201
+ - test/unit/safe_test.rb
202
+ - test/uri_test.rb