bson 1.8.3.rc0-java → 1.8.3.rc1-java

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of bson might be problematic. Click here for more details.

data.tar.gz.sig CHANGED
Binary file
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.8.3.rc0
1
+ 1.8.3.rc1
@@ -132,7 +132,7 @@ module BSON
132
132
 
133
133
  # Returns the array stored in the buffer.
134
134
  # Implemented to ensure an API compatible with BSON extension.
135
- def unpack(arg)
135
+ def unpack
136
136
  @buf.to_a
137
137
  end
138
138
 
@@ -398,7 +398,7 @@ module BSON
398
398
  self.class.serialize_key(buf, key)
399
399
  end
400
400
 
401
- def serialize_dbref_element(buf, key, val)
401
+ def serialize_dbref_element(buf, key, val) # this does NOT use the BSON "\x0C" DBPointer type
402
402
  oh = BSON::OrderedHash.new
403
403
  oh['$ref'] = val.namespace
404
404
  oh['$id'] = val.object_id
@@ -58,6 +58,68 @@ class BSONTest < Test::Unit::TestCase
58
58
  assert_equal doc, @encoder.deserialize(bson)
59
59
  end
60
60
 
61
+ def test_interface
62
+ doc = { 'a' => 1 }
63
+ bson = BSON.serialize(doc)
64
+ assert_equal doc, BSON.deserialize(bson)
65
+ end
66
+
67
+ def test_read_bson_document
68
+ bson_file_data_h_star = ["21000000075f6964005115883c3d75c94d3aa18b63016100000000000000f03f00"]
69
+ strio = StringIO.new(bson_file_data_h_star.pack('H*'))
70
+ bson = BSON.read_bson_document(strio)
71
+ doc = {"_id"=>BSON::ObjectId('5115883c3d75c94d3aa18b63'), "a"=>1.0}
72
+ assert_equal doc, bson
73
+ end
74
+
75
+ def test_bson_ruby_interface
76
+ doc = { 'a' => 1 }
77
+ buf = BSON_RUBY.serialize(doc)
78
+ bson = BSON::BSON_RUBY.new
79
+ bson.instance_variable_set(:@buf, buf)
80
+ assert_equal [12, 0, 0, 0, 16, 97, 0, 1, 0, 0, 0, 0], bson.to_a
81
+ assert_equal "\f\x00\x00\x00\x10a\x00\x01\x00\x00\x00\x00", bson.to_s
82
+ assert_equal [12, 0, 0, 0, 16, 97, 0, 1, 0, 0, 0, 0], bson.unpack
83
+ end
84
+
85
+ def test_bson_ruby_hex_dump
86
+ doc = { 'a' => 1 }
87
+ buf = BSON_RUBY.serialize(doc)
88
+ bson = BSON_RUBY.new
89
+ bson.instance_variable_set(:@buf, buf)
90
+ doc_hex_dump = " 0: 0C 00 00 00 10 61 00 01\n 8: 00 00 00 00"
91
+ assert_equal doc_hex_dump, bson.hex_dump
92
+ end
93
+
94
+ def test_bson_ruby_dbref_not_used
95
+ buf = BSON::ByteBuffer.new
96
+ val = ns = 'namespace'
97
+
98
+ # Make a hole for the length
99
+ len_pos = buf.position
100
+ buf.put_int(0)
101
+
102
+ # Save the string
103
+ start_pos = buf.position
104
+ BSON::BSON_RUBY.serialize_cstr(buf, val)
105
+ end_pos = buf.position
106
+
107
+ # Put the string size in front
108
+ buf.put_int(end_pos - start_pos, len_pos)
109
+
110
+ # Go back to where we were
111
+ buf.position = end_pos
112
+
113
+ oid = ObjectId.new
114
+ buf.put_array(oid.to_a)
115
+ buf.rewind
116
+
117
+ bson = BSON::BSON_RUBY.new
118
+ bson.instance_variable_set(:@buf, buf)
119
+
120
+ assert_equal DBRef.new(ns, oid).to_s, bson.deserialize_dbref_data(buf).to_s
121
+ end
122
+
61
123
  def test_require_hash
62
124
  assert_raise_error InvalidDocument, "takes a Hash" do
63
125
  BSON.serialize('foo')
@@ -191,8 +253,14 @@ class BSONTest < Test::Unit::TestCase
191
253
  end
192
254
 
193
255
  def test_code
194
- doc = {'$where' => Code.new('this.a.b < this.b')}
256
+ code = Code.new('this.a.b < this.b')
257
+ assert_equal 17, code.length
258
+ assert_match /<BSON::Code:.*@data="this.a.b < this.b".*>/, code.inspect
259
+ doc = {'$where' => code}
195
260
  assert_doc_pass(doc)
261
+ code = 'this.c.d < this.e'.to_bson_code # core_ext.rb
262
+ assert_equal BSON::Code, code.class
263
+ assert_equal code, code.to_bson_code
196
264
  end
197
265
 
198
266
  def test_code_with_symbol
@@ -343,8 +411,11 @@ class BSONTest < Test::Unit::TestCase
343
411
 
344
412
  def test_dbref
345
413
  oid = ObjectId.new
414
+ ns = 'namespace'
346
415
  doc = {}
347
- doc['dbref'] = DBRef.new('namespace', oid)
416
+ dbref = DBRef.new(ns, oid)
417
+ assert_equal({"$id"=>oid, "$ns"=>ns}, dbref.to_hash)
418
+ doc['dbref'] = dbref
348
419
  bson = @encoder.serialize(doc)
349
420
  doc2 = @encoder.deserialize(bson)
350
421
 
@@ -15,6 +15,16 @@ class ByteBufferTest < Test::Unit::TestCase
15
15
  assert_equal 0, @buf.length
16
16
  end
17
17
 
18
+ def test_initialize_with_string_and_clear
19
+ @buf = ByteBuffer.new("a")
20
+ assert_equal 1, @buf.size
21
+ assert_equal 1, @buf.position
22
+ @buf.clear
23
+ assert_equal 0, @buf.position
24
+ assert_equal "", @buf.to_s
25
+ assert_equal 0, @buf.size
26
+ end
27
+
18
28
  def test_nil_get_returns_one_byte
19
29
  @buf.put_array([1, 2, 3, 4])
20
30
  @buf.rewind
@@ -202,5 +212,4 @@ class ByteBufferTest < Test::Unit::TestCase
202
212
  assert_not_equal @buf, 123
203
213
  assert_not_equal @buf, nil
204
214
  end
205
-
206
215
  end
@@ -2,6 +2,11 @@ require 'test_helper'
2
2
 
3
3
  class TimestampTest < Test::Unit::TestCase
4
4
 
5
+ def test_timestamp_to_s
6
+ t1 = Timestamp.new(5000, 200)
7
+ assert_equal "seconds: 5000, increment: 200", t1.to_s
8
+ end
9
+
5
10
  def test_timestamp_equality
6
11
  t1 = Timestamp.new(5000, 200)
7
12
  t2 = Timestamp.new(5000, 200)
metadata CHANGED
@@ -1,116 +1,110 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: bson
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
4
  prerelease: 6
5
- version: 1.8.3.rc0
5
+ version: 1.8.3.rc1
6
6
  platform: java
7
- authors:
8
- - Tyler Brock
9
- - Gary Murakami
10
- - Emily Stolfo
11
- - Brandon Black
12
- - Durran Jordan
13
- autorequire:
7
+ authors:
8
+ - Tyler Brock
9
+ - Gary Murakami
10
+ - Emily Stolfo
11
+ - Brandon Black
12
+ - Durran Jordan
13
+ autorequire:
14
14
  bindir: bin
15
- cert_chain:
16
- - |
17
- -----BEGIN CERTIFICATE-----
18
- MIIDODCCAiCgAwIBAgIBADANBgkqhkiG9w0BAQUFADBCMRQwEgYDVQQDDAtkcml2
19
- ZXItcnVieTEVMBMGCgmSJomT8ixkARkWBTEwZ2VuMRMwEQYKCZImiZPyLGQBGRYD
20
- Y29tMB4XDTEzMDIwMTE0MTEzN1oXDTE0MDIwMTE0MTEzN1owQjEUMBIGA1UEAwwL
21
- ZHJpdmVyLXJ1YnkxFTATBgoJkiaJk/IsZAEZFgUxMGdlbjETMBEGCgmSJomT8ixk
22
- ARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANFdSAa8fRm1
23
- bAM9za6Z0fAH4g02bqM1NGnw8zJQrE/PFrFfY6IFCT2AsLfOwr1maVm7iU1+kdVI
24
- IQ+iI/9+E+ArJ+rbGV3dDPQ+SLl3mLT+vXjfjcxMqI2IW6UuVtt2U3Rxd4QU0kdT
25
- JxmcPYs5fDN6BgYc6XXgUjy3m+Kwha2pGctdciUOwEfOZ4RmNRlEZKCMLRHdFP8j
26
- 4WTnJSGfXDiuoXICJb5yOPOZPuaapPSNXp93QkUdsqdKC32I+KMpKKYGBQ6yisfA
27
- 5MyVPPCzLR1lP5qXVGJPnOqUAkvEUfCahg7EP9tI20qxiXrR6TSEraYhIFXL0EGY
28
- u8KAcPHm5KkCAwEAAaM5MDcwCQYDVR0TBAIwADAdBgNVHQ4EFgQUW3dZsX70mlSM
29
- CiPrZxAGA1vwfNcwCwYDVR0PBAQDAgSwMA0GCSqGSIb3DQEBBQUAA4IBAQCIa/Y6
30
- xS7YWBxkn9WP0EMnJ3pY9vef9DTmLSi/2j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nOqUAkvEUfCahg7EP9tI20qxiXrR6TSEraYhIFXL0EGY
28
+ u8KAcPHm5KkCAwEAAaM5MDcwCQYDVR0TBAIwADAdBgNVHQ4EFgQUW3dZsX70mlSM
29
+ CiPrZxAGA1vwfNcwCwYDVR0PBAQDAgSwMA0GCSqGSIb3DQEBBQUAA4IBAQCIa/Y6
30
+ xS7YWBxkn9WP0EMnJ3pY9vef9DTmLSi/2jz8PzwlKQ89zNTrqSUD8LoQZmBqCJBt
31
+ dKSQ/RUnaHJuxh8HWvWubP8EBYTuf+I1DFnRv648IF3MR1tCQumVL0XcYMvZcxBj
32
+ a/p+8DomWTQqUdNbNoGywwjtVBWfDdwFV8Po1XcN/AtpILOJQd9J77INIGGCHxZo
33
+ 6SOHHaNknlE9H0w6q0SVxZKZI8/+2c447V0NrHIw1Qhe0tAGJ9V1u3ky8gyxe0SM
34
+ 8v7zLF2XliYbfurYIwkcXs8yPn8ggApBIy9bX6VJxRs/l2+UvqzaHIFaFy/F8/GP
35
+ RNTuXsVG5NDACo7Q
36
+ -----END CERTIFICATE-----
37
+ date: 2013-02-27 00:00:00.000000000 Z
39
38
  dependencies: []
40
-
41
39
  description: A Ruby BSON implementation for MongoDB. For more information about Mongo, see http://www.mongodb.org. For more information on BSON, see http://www.bsonspec.org.
42
40
  email: mongodb-dev@googlegroups.com
43
- executables:
44
- - b2json
45
- - j2bson
41
+ executables:
42
+ - b2json
43
+ - j2bson
46
44
  extensions: []
47
-
48
45
  extra_rdoc_files: []
49
-
50
- files:
51
- - bson.gemspec
52
- - LICENSE
53
- - VERSION
54
- - bin/b2json
55
- - bin/j2bson
56
- - lib/bson.rb
57
- - lib/bson/bson_c.rb
58
- - lib/bson/bson_java.rb
59
- - lib/bson/bson_ruby.rb
60
- - lib/bson/byte_buffer.rb
61
- - lib/bson/exceptions.rb
62
- - lib/bson/ordered_hash.rb
63
- - lib/bson/support/hash_with_indifferent_access.rb
64
- - lib/bson/types/binary.rb
65
- - lib/bson/types/code.rb
66
- - lib/bson/types/dbref.rb
67
- - lib/bson/types/min_max_keys.rb
68
- - lib/bson/types/object_id.rb
69
- - lib/bson/types/timestamp.rb
70
- - ext/jbson/target/jbson.jar
71
- - ext/jbson/lib/java-bson.jar
72
- - test/bson/binary_test.rb
73
- - test/bson/bson_test.rb
74
- - test/bson/byte_buffer_test.rb
75
- - test/bson/hash_with_indifferent_access_test.rb
76
- - test/bson/json_test.rb
77
- - test/bson/object_id_test.rb
78
- - test/bson/ordered_hash_test.rb
79
- - test/bson/timestamp_test.rb
46
+ files:
47
+ - bson.gemspec
48
+ - LICENSE
49
+ - VERSION
50
+ - bin/b2json
51
+ - bin/j2bson
52
+ - lib/bson.rb
53
+ - lib/bson/bson_c.rb
54
+ - lib/bson/bson_java.rb
55
+ - lib/bson/bson_ruby.rb
56
+ - lib/bson/byte_buffer.rb
57
+ - lib/bson/exceptions.rb
58
+ - lib/bson/ordered_hash.rb
59
+ - lib/bson/support/hash_with_indifferent_access.rb
60
+ - lib/bson/types/binary.rb
61
+ - lib/bson/types/code.rb
62
+ - lib/bson/types/dbref.rb
63
+ - lib/bson/types/min_max_keys.rb
64
+ - lib/bson/types/object_id.rb
65
+ - lib/bson/types/timestamp.rb
66
+ - ext/jbson/target/jbson.jar
67
+ - ext/jbson/lib/java-bson.jar
68
+ - test/bson/binary_test.rb
69
+ - test/bson/bson_test.rb
70
+ - test/bson/byte_buffer_test.rb
71
+ - test/bson/hash_with_indifferent_access_test.rb
72
+ - test/bson/json_test.rb
73
+ - test/bson/object_id_test.rb
74
+ - test/bson/ordered_hash_test.rb
75
+ - test/bson/timestamp_test.rb
80
76
  homepage: http://www.mongodb.org
81
77
  licenses: []
82
-
83
- post_install_message:
78
+ post_install_message:
84
79
  rdoc_options: []
85
-
86
- require_paths:
87
- - lib
88
- required_ruby_version: !ruby/object:Gem::Requirement
80
+ require_paths:
81
+ - lib
82
+ required_ruby_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ version: !binary |-
87
+ MA==
89
88
  none: false
90
- requirements:
91
- - - ">="
92
- - !ruby/object:Gem::Version
93
- version: "0"
94
- required_rubygems_version: !ruby/object:Gem::Requirement
89
+ required_rubygems_version: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - !binary |-
92
+ Pg==
93
+ - !ruby/object:Gem::Version
94
+ version: 1.3.1
95
95
  none: false
96
- requirements:
97
- - - ">"
98
- - !ruby/object:Gem::Version
99
- version: 1.3.1
100
96
  requirements: []
101
-
102
97
  rubyforge_project: bson
103
98
  rubygems_version: 1.8.24
104
- signing_key:
99
+ signing_key:
105
100
  specification_version: 3
106
101
  summary: Ruby implementation of BSON
107
- test_files:
108
- - test/bson/binary_test.rb
109
- - test/bson/bson_test.rb
110
- - test/bson/byte_buffer_test.rb
111
- - test/bson/hash_with_indifferent_access_test.rb
112
- - test/bson/json_test.rb
113
- - test/bson/object_id_test.rb
114
- - test/bson/ordered_hash_test.rb
115
- - test/bson/timestamp_test.rb
116
- has_rdoc: yard
102
+ test_files:
103
+ - test/bson/binary_test.rb
104
+ - test/bson/bson_test.rb
105
+ - test/bson/byte_buffer_test.rb
106
+ - test/bson/hash_with_indifferent_access_test.rb
107
+ - test/bson/json_test.rb
108
+ - test/bson/object_id_test.rb
109
+ - test/bson/ordered_hash_test.rb
110
+ - test/bson/timestamp_test.rb
metadata.gz.sig CHANGED
Binary file