orientdb-binary 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +2 -0
- data/Gemfile +5 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +64 -0
- data/lib/orientdb_binary.rb +25 -0
- data/lib/orientdb_binary/base.rb +40 -0
- data/lib/orientdb_binary/config.rb +5 -0
- data/lib/orientdb_binary/connection.rb +17 -0
- data/lib/orientdb_binary/database.rb +24 -0
- data/lib/orientdb_binary/database_operations/base_operations.rb +70 -0
- data/lib/orientdb_binary/database_operations/data_cluster.rb +116 -0
- data/lib/orientdb_binary/database_operations/data_segment.rb +31 -0
- data/lib/orientdb_binary/database_operations/query.rb +58 -0
- data/lib/orientdb_binary/database_operations/record.rb +105 -0
- data/lib/orientdb_binary/database_operations/transaction.rb +8 -0
- data/lib/orientdb_binary/operation_types.rb +51 -0
- data/lib/orientdb_binary/parser/deserializer.rb +161 -0
- data/lib/orientdb_binary/parser/serializer.rb +83 -0
- data/lib/orientdb_binary/protocols/base.rb +42 -0
- data/lib/orientdb_binary/protocols/bindata_primitives.rb +46 -0
- data/lib/orientdb_binary/protocols/command.rb +166 -0
- data/lib/orientdb_binary/protocols/config_get.rb +22 -0
- data/lib/orientdb_binary/protocols/config_list.rb +24 -0
- data/lib/orientdb_binary/protocols/config_set.rb +22 -0
- data/lib/orientdb_binary/protocols/connect.rb +26 -0
- data/lib/orientdb_binary/protocols/datacluster_add.rb +26 -0
- data/lib/orientdb_binary/protocols/datacluster_count.rb +26 -0
- data/lib/orientdb_binary/protocols/datacluster_datarange.rb +23 -0
- data/lib/orientdb_binary/protocols/datacluster_drop.rb +22 -0
- data/lib/orientdb_binary/protocols/datacluster_lh_cluster_is_used.rb +20 -0
- data/lib/orientdb_binary/protocols/datasegment_add.rb +24 -0
- data/lib/orientdb_binary/protocols/datasegment_drop.rb +23 -0
- data/lib/orientdb_binary/protocols/db_close.rb +16 -0
- data/lib/orientdb_binary/protocols/db_countrecords.rb +20 -0
- data/lib/orientdb_binary/protocols/db_create.rb +23 -0
- data/lib/orientdb_binary/protocols/db_drop.rb +22 -0
- data/lib/orientdb_binary/protocols/db_exist.rb +23 -0
- data/lib/orientdb_binary/protocols/db_freeze.rb +21 -0
- data/lib/orientdb_binary/protocols/db_list.rb +26 -0
- data/lib/orientdb_binary/protocols/db_open.rb +43 -0
- data/lib/orientdb_binary/protocols/db_release.rb +21 -0
- data/lib/orientdb_binary/protocols/db_reload.rb +26 -0
- data/lib/orientdb_binary/protocols/db_size.rb +20 -0
- data/lib/orientdb_binary/protocols/errors.rb +28 -0
- data/lib/orientdb_binary/protocols/record_create.rb +35 -0
- data/lib/orientdb_binary/protocols/record_delete.rb +25 -0
- data/lib/orientdb_binary/protocols/record_load.rb +65 -0
- data/lib/orientdb_binary/protocols/record_update.rb +27 -0
- data/lib/orientdb_binary/protocols/shutdown.rb +21 -0
- data/lib/orientdb_binary/server.rb +71 -0
- data/orientdb-binary.gemspec +26 -0
- data/test/database/test_database.rb +193 -0
- data/test/database/test_deserializer.rb +140 -0
- data/test/database/test_serializer.rb +55 -0
- data/test/server/test_server.rb +73 -0
- data/test/test_helper.rb +9 -0
- metadata +162 -0
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'minitest/spec'
|
2
|
+
require 'minitest/autorun'
|
3
|
+
|
4
|
+
describe OrientdbBinary::Parser do
|
5
|
+
|
6
|
+
describe 'Serializer' do
|
7
|
+
before do
|
8
|
+
@parser = OrientdbBinary::Parser::Serializer.new
|
9
|
+
end
|
10
|
+
|
11
|
+
describe "parsing sets" do
|
12
|
+
before do
|
13
|
+
@should_be = "doc_with_set@a_set:<\"one\",\"two\",3,#12:1>"
|
14
|
+
record = {
|
15
|
+
:@class => "doc_with_set",
|
16
|
+
a_set: Set.new(["one", "two", 3, "#12:1"])
|
17
|
+
}
|
18
|
+
@result = @parser.serialize_document(record)
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should be set" do
|
22
|
+
assert_equal @result, @should_be
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe "parsing arrays" do
|
27
|
+
before do
|
28
|
+
@should_be = "doc_with_array@an_array:[\"one\",\"two\",3,#12:1]"
|
29
|
+
record = {
|
30
|
+
:@class => "doc_with_array",
|
31
|
+
an_array: ["one", "two", 3, "#12:1"]
|
32
|
+
}
|
33
|
+
@result = @parser.serialize_document(record)
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should be array" do
|
37
|
+
assert_equal @result, @should_be
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe "parsing hashes" do
|
42
|
+
before do
|
43
|
+
@should_be = "a_hash:{one:1,two:\"two\"}"
|
44
|
+
record = {
|
45
|
+
a_hash: {one: 1, two: "two"}
|
46
|
+
}
|
47
|
+
@result = @parser.serialize_document(record)
|
48
|
+
end
|
49
|
+
|
50
|
+
it "should be hash" do
|
51
|
+
assert_equal @result, @should_be
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
require 'minitest/spec'
|
2
|
+
require 'minitest/autorun'
|
3
|
+
|
4
|
+
describe OrientdbBinary::Server do
|
5
|
+
before do
|
6
|
+
@server = OrientdbBinary::Server.new(TestHelper::SERVER)
|
7
|
+
@server.connect(TestHelper::SERVER_USER)
|
8
|
+
end
|
9
|
+
|
10
|
+
after do
|
11
|
+
@server.disconnect
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "connection" do
|
15
|
+
it "should set session" do
|
16
|
+
assert @server.session > -1
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should be connected" do
|
20
|
+
assert @server.connected?
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should return socket" do
|
24
|
+
assert_instance_of TCPSocket, @server.socket
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe "configuration" do
|
29
|
+
it "should list configuration options" do
|
30
|
+
assert @server.config_list[:config_list].length > 0
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should get configuration option" do
|
34
|
+
option = @server.config_list[:config_list].last
|
35
|
+
assert_equal @server.get_config(option[:option_key])[:option_value], option[:option_value]
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should set configuration option" do
|
39
|
+
option = @server.config_list[:config_list].last
|
40
|
+
new_value = "15001"
|
41
|
+
@server.set_config(option[:option_key], new_value)
|
42
|
+
assert_equal @server.get_config(option[:option_key])[:option_value], new_value
|
43
|
+
# set it back
|
44
|
+
@server.set_config(option[:option_key], option[:option_value])
|
45
|
+
assert_equal @server.get_config(option[:option_key])[:option_value], option[:option_value]
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
describe "database" do
|
50
|
+
before do
|
51
|
+
if @server.db_exists? TestHelper::TEST_DB[:db]
|
52
|
+
@server.db_drop TestHelper::TEST_DB[:db], TestHelper::TEST_DB[:storage]
|
53
|
+
end
|
54
|
+
assert(!@server.db_exists?(TestHelper::TEST_DB[:db]))
|
55
|
+
end
|
56
|
+
|
57
|
+
after do
|
58
|
+
if @server.db_exists? TestHelper::TEST_DB[:db]
|
59
|
+
@server.db_drop TestHelper::TEST_DB[:db], TestHelper::TEST_DB[:storage]
|
60
|
+
end
|
61
|
+
assert(!@server.db_exists?(TestHelper::TEST_DB[:db]))
|
62
|
+
end
|
63
|
+
|
64
|
+
it "should create database" do
|
65
|
+
@server.db_create(TestHelper::TEST_DB[:db], 'document', TestHelper::TEST_DB[:storage])
|
66
|
+
assert @server.db_exists? TestHelper::TEST_DB[:db]
|
67
|
+
end
|
68
|
+
|
69
|
+
it "should list databases" do
|
70
|
+
assert @server.list[:databases].has_key?(:GratefulDeadConcerts)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
data/test/test_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,162 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: orientdb-binary
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.6.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Michal Ostrowski
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-02-16 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.5'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.5'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.9'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.9'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: simplecov
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.8'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.8'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bindata
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.8'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.8'
|
69
|
+
description: Graph Database OrientDB native client for Ruby
|
70
|
+
email:
|
71
|
+
- ostrowski.michal@gmail.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- Gemfile
|
78
|
+
- LICENSE.txt
|
79
|
+
- README.md
|
80
|
+
- Rakefile
|
81
|
+
- lib/orientdb_binary.rb
|
82
|
+
- lib/orientdb_binary/base.rb
|
83
|
+
- lib/orientdb_binary/config.rb
|
84
|
+
- lib/orientdb_binary/connection.rb
|
85
|
+
- lib/orientdb_binary/database.rb
|
86
|
+
- lib/orientdb_binary/database_operations/base_operations.rb
|
87
|
+
- lib/orientdb_binary/database_operations/data_cluster.rb
|
88
|
+
- lib/orientdb_binary/database_operations/data_segment.rb
|
89
|
+
- lib/orientdb_binary/database_operations/query.rb
|
90
|
+
- lib/orientdb_binary/database_operations/record.rb
|
91
|
+
- lib/orientdb_binary/database_operations/transaction.rb
|
92
|
+
- lib/orientdb_binary/operation_types.rb
|
93
|
+
- lib/orientdb_binary/parser/deserializer.rb
|
94
|
+
- lib/orientdb_binary/parser/serializer.rb
|
95
|
+
- lib/orientdb_binary/protocols/base.rb
|
96
|
+
- lib/orientdb_binary/protocols/bindata_primitives.rb
|
97
|
+
- lib/orientdb_binary/protocols/command.rb
|
98
|
+
- lib/orientdb_binary/protocols/config_get.rb
|
99
|
+
- lib/orientdb_binary/protocols/config_list.rb
|
100
|
+
- lib/orientdb_binary/protocols/config_set.rb
|
101
|
+
- lib/orientdb_binary/protocols/connect.rb
|
102
|
+
- lib/orientdb_binary/protocols/datacluster_add.rb
|
103
|
+
- lib/orientdb_binary/protocols/datacluster_count.rb
|
104
|
+
- lib/orientdb_binary/protocols/datacluster_datarange.rb
|
105
|
+
- lib/orientdb_binary/protocols/datacluster_drop.rb
|
106
|
+
- lib/orientdb_binary/protocols/datacluster_lh_cluster_is_used.rb
|
107
|
+
- lib/orientdb_binary/protocols/datasegment_add.rb
|
108
|
+
- lib/orientdb_binary/protocols/datasegment_drop.rb
|
109
|
+
- lib/orientdb_binary/protocols/db_close.rb
|
110
|
+
- lib/orientdb_binary/protocols/db_countrecords.rb
|
111
|
+
- lib/orientdb_binary/protocols/db_create.rb
|
112
|
+
- lib/orientdb_binary/protocols/db_drop.rb
|
113
|
+
- lib/orientdb_binary/protocols/db_exist.rb
|
114
|
+
- lib/orientdb_binary/protocols/db_freeze.rb
|
115
|
+
- lib/orientdb_binary/protocols/db_list.rb
|
116
|
+
- lib/orientdb_binary/protocols/db_open.rb
|
117
|
+
- lib/orientdb_binary/protocols/db_release.rb
|
118
|
+
- lib/orientdb_binary/protocols/db_reload.rb
|
119
|
+
- lib/orientdb_binary/protocols/db_size.rb
|
120
|
+
- lib/orientdb_binary/protocols/errors.rb
|
121
|
+
- lib/orientdb_binary/protocols/record_create.rb
|
122
|
+
- lib/orientdb_binary/protocols/record_delete.rb
|
123
|
+
- lib/orientdb_binary/protocols/record_load.rb
|
124
|
+
- lib/orientdb_binary/protocols/record_update.rb
|
125
|
+
- lib/orientdb_binary/protocols/shutdown.rb
|
126
|
+
- lib/orientdb_binary/server.rb
|
127
|
+
- orientdb-binary.gemspec
|
128
|
+
- test/database/test_database.rb
|
129
|
+
- test/database/test_deserializer.rb
|
130
|
+
- test/database/test_serializer.rb
|
131
|
+
- test/server/test_server.rb
|
132
|
+
- test/test_helper.rb
|
133
|
+
homepage: http://orientdb-binary.espresse.net
|
134
|
+
licenses:
|
135
|
+
- MIT
|
136
|
+
metadata: {}
|
137
|
+
post_install_message:
|
138
|
+
rdoc_options: []
|
139
|
+
require_paths:
|
140
|
+
- lib
|
141
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
147
|
+
requirements:
|
148
|
+
- - ">="
|
149
|
+
- !ruby/object:Gem::Version
|
150
|
+
version: '0'
|
151
|
+
requirements: []
|
152
|
+
rubyforge_project:
|
153
|
+
rubygems_version: 2.2.1
|
154
|
+
signing_key:
|
155
|
+
specification_version: 4
|
156
|
+
summary: OrientDB native client for Ruby 2
|
157
|
+
test_files:
|
158
|
+
- test/database/test_database.rb
|
159
|
+
- test/database/test_deserializer.rb
|
160
|
+
- test/database/test_serializer.rb
|
161
|
+
- test/server/test_server.rb
|
162
|
+
- test/test_helper.rb
|