bson 1.7.0-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.

@@ -0,0 +1,30 @@
1
+ require File.join(File.dirname(__FILE__), '..', '..', 'lib', 'bson')
2
+ require 'rubygems' if RUBY_VERSION < '1.9.0'
3
+ gem 'test-unit'
4
+ require 'test/unit'
5
+
6
+ def silently
7
+ warn_level = $VERBOSE
8
+ $VERBOSE = nil
9
+ result = yield
10
+ $VERBOSE = warn_level
11
+ result
12
+ end
13
+
14
+ require 'bson_ext/cbson' if !(RUBY_PLATFORM =~ /java/) && ENV['C_EXT']
15
+
16
+ class Test::Unit::TestCase
17
+ include BSON
18
+
19
+ def assert_raise_error(klass, message)
20
+ begin
21
+ yield
22
+ rescue => e
23
+ assert_equal klass, e.class
24
+ assert e.message.include?(message), "#{e.message} does not include #{message}."
25
+ else
26
+ flunk "Expected assertion #{klass} but none was raised."
27
+ end
28
+ end
29
+
30
+ end
@@ -0,0 +1,46 @@
1
+ require File.expand_path("../test_helper", __FILE__)
2
+
3
+ class TimestampTest < Test::Unit::TestCase
4
+
5
+ def test_timestamp_equality
6
+ t1 = Timestamp.new(5000, 200)
7
+ t2 = Timestamp.new(5000, 200)
8
+ assert_equal t2, t1
9
+ end
10
+
11
+ def test_timestamp_range
12
+ t = 1;
13
+ while(t < 1_000_000_000 ) do
14
+ ts = Timestamp.new(t, 0)
15
+ doc = {:ts => ts}
16
+ bson = BSON::BSON_CODER.serialize(doc)
17
+ assert_equal doc[:ts], BSON::BSON_CODER.deserialize(bson)['ts']
18
+ t = t * 10
19
+ end
20
+ end
21
+
22
+ def test_timestamp_32bit_compatibility
23
+ max_32bit_fixnum = (1 << 30) - 1
24
+ test_val = max_32bit_fixnum + 10
25
+
26
+ ts = Timestamp.new(test_val, test_val)
27
+ doc = {:ts => ts}
28
+ bson = BSON::BSON_CODER.serialize(doc)
29
+ assert_equal doc[:ts], BSON::BSON_CODER.deserialize(bson)['ts']
30
+ end
31
+
32
+ def test_implements_array_for_backward_compatibility
33
+ silently do
34
+ ts = Timestamp.new(5000, 200)
35
+ assert_equal 200, ts[0]
36
+ assert_equal 5000, ts[1]
37
+
38
+ array = ts.map {|t| t }
39
+ assert_equal 2, array.length
40
+
41
+ assert_equal 200, array[0]
42
+ assert_equal 5000, array[1]
43
+ end
44
+ end
45
+
46
+ end
metadata ADDED
@@ -0,0 +1,91 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bson
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 1
7
+ - 7
8
+ - 0
9
+ version: 1.7.0
10
+ platform: java
11
+ authors:
12
+ - Jim Menard
13
+ - Mike Dirolf
14
+ - Kyle Banker
15
+ autorequire:
16
+ bindir: bin
17
+ cert_chain: []
18
+
19
+ date: 2012-08-29 00:00:00 -03:00
20
+ default_executable:
21
+ dependencies: []
22
+
23
+ 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.
24
+ email: mongodb-dev@googlegroups.com
25
+ executables:
26
+ - b2json
27
+ - j2bson
28
+ extensions: []
29
+
30
+ extra_rdoc_files: []
31
+
32
+ files:
33
+ - LICENSE.txt
34
+ - lib/bson.rb
35
+ - lib/bson/bson_c.rb
36
+ - lib/bson/bson_java.rb
37
+ - lib/bson/bson_ruby.rb
38
+ - lib/bson/byte_buffer.rb
39
+ - lib/bson/exceptions.rb
40
+ - lib/bson/ordered_hash.rb
41
+ - lib/bson/types/binary.rb
42
+ - lib/bson/types/code.rb
43
+ - lib/bson/types/dbref.rb
44
+ - lib/bson/types/min_max_keys.rb
45
+ - lib/bson/types/object_id.rb
46
+ - lib/bson/types/timestamp.rb
47
+ - lib/bson/version.rb
48
+ - bin/b2json
49
+ - bin/j2bson
50
+ - ext/java/jar/jbson.jar
51
+ - ext/java/jar/mongo-2.6.5.jar
52
+ has_rdoc: true
53
+ homepage: http://www.mongodb.org
54
+ licenses: []
55
+
56
+ post_install_message:
57
+ rdoc_options: []
58
+
59
+ require_paths:
60
+ - lib
61
+ required_ruby_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ segments:
66
+ - 0
67
+ version: "0"
68
+ required_rubygems_version: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ segments:
73
+ - 0
74
+ version: "0"
75
+ requirements: []
76
+
77
+ rubyforge_project: nowarning
78
+ rubygems_version: 1.3.6
79
+ signing_key:
80
+ specification_version: 3
81
+ summary: Ruby implementation of BSON
82
+ test_files:
83
+ - test/bson/binary_test.rb
84
+ - test/bson/bson_test.rb
85
+ - test/bson/byte_buffer_test.rb
86
+ - test/bson/hash_with_indifferent_access_test.rb
87
+ - test/bson/json_test.rb
88
+ - test/bson/object_id_test.rb
89
+ - test/bson/ordered_hash_test.rb
90
+ - test/bson/test_helper.rb
91
+ - test/bson/timestamp_test.rb