orientdb 0.0.11-jruby → 0.0.12-jruby

Sign up to get free protection for your applications and to get access to all the features.
data/.rvmrc CHANGED
@@ -1 +1 @@
1
- rvm use jruby
1
+ rvm use jruby-1.6.0.RC1
data/README.rdoc CHANGED
@@ -16,7 +16,7 @@ Let's get the gem installed and test out the interactive console.
16
16
  shell> gem install orientdb
17
17
  shell> orientdb_console
18
18
 
19
- >> db = OrientDB::Database.connect "remote:localhost/demo", 'admin', 'admin'
19
+ >> db = OrientDB::DocumentDatabase.connect "remote:localhost/demo", 'admin', 'admin'
20
20
  => #<OrientDB::Database:0x6a346239 @proxy_object=#<Java::ComOrientechnologiesOrientCoreDbDocument::ODatabaseDocumentTx:0x14860315>
21
21
  >> customer = db.get_class "Customer"
22
22
  => #<OrientDB::OClass:Customer name:string>
data/Rakefile CHANGED
@@ -31,6 +31,18 @@ rescue LoadError
31
31
  end
32
32
 
33
33
  require 'rspec/core/rake_task'
34
+
35
+ #
36
+ # Test a local database:
37
+ # rake spec
38
+ #
39
+ # Test a remote database:
40
+ # ORIENTDB_TEST_URL=remote:localhost/test ORIENTDB_TEST_USERNAME=admin ORIENTDB_TEST_PASSWORD=admin ORIENTDB_TEST_POOLED=true rake spec
41
+ #
42
+ # Test a pooled remote database:
43
+ # ORIENTDB_TEST_URL=remote:localhost/test ORIENTDB_TEST_USERNAME=admin ORIENTDB_TEST_PASSWORD=admin ORIENTDB_TEST_POOLED=true rake spec
44
+ #
45
+ desc "Run specs"
34
46
  RSpec::Core::RakeTask.new(:spec)
35
47
 
36
48
  desc "Run all examples using rcov"
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.11
1
+ 0.0.12
data/bin/orientdb_console CHANGED
@@ -11,8 +11,9 @@ if ARGV.include?('test:db')
11
11
  puts ">> TEST_DB PATH : #{TEST_DB_PATH}"
12
12
 
13
13
  require 'fileutils'
14
+ FileUtils.remove_dir TEST_DB_PATH
14
15
  FileUtils.mkdir_p TEST_DB_PATH
15
- DB = OrientDB::Database.new("local:#{TEST_DB_PATH}/test").create
16
+ DB = OrientDB::DocumentDatabase.new("local:#{TEST_DB_PATH}/test").create
16
17
  end
17
18
 
18
19
  include OrientDB
@@ -1,29 +1,30 @@
1
1
  module OrientDB
2
2
 
3
- ClusterType = com.orientechnologies.orient.core.storage.OStorage::CLUSTER_TYPE
4
- Database = com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx
5
- DatabasePool = com.orientechnologies.orient.core.db.document.ODatabaseDocumentPool
6
- Document = com.orientechnologies.orient.core.record.impl.ODocument
7
- IndexType = com.orientechnologies.orient.core.metadata.schema.OProperty::INDEX_TYPE
8
- OClass = com.orientechnologies.orient.core.metadata.schema.OClass
9
- LocalStorage = com.orientechnologies.orient.core.storage.impl.local.OStorageLocal
10
- LocalCluster = com.orientechnologies.orient.core.storage.impl.local.OClusterLocal
11
- LogicalCluster = com.orientechnologies.orient.core.storage.impl.local.OClusterLogical
12
- Property = com.orientechnologies.orient.core.metadata.schema.OProperty
13
- RecordList = com.orientechnologies.orient.core.db.record.ORecordTrackedList
14
- RecordMap = com.orientechnologies.orient.core.db.record.ORecordTrackedMap
15
- RecordSet = com.orientechnologies.orient.core.db.record.ORecordTrackedSet
16
- RemoteStorage = com.orientechnologies.orient.client.remote.OStorageRemote
17
- Schema = com.orientechnologies.orient.core.metadata.schema.OSchema
18
- SchemaType = com.orientechnologies.orient.core.metadata.schema.OType
19
- SQLSynchQuery = com.orientechnologies.orient.core.sql.query.OSQLSynchQuery
20
- SQLCommand = com.orientechnologies.orient.core.sql.OCommandSQL
21
- User = com.orientechnologies.orient.core.metadata.security.OUser
3
+ ClusterType = com.orientechnologies.orient.core.storage.OStorage::CLUSTER_TYPE
4
+ DocumentDatabase = com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx
5
+ DocumentDatabasePool = com.orientechnologies.orient.core.db.document.ODatabaseDocumentPool
6
+ DocumentDatabasePooled = com.orientechnologies.orient.core.db.document.ODatabaseDocumentTxPooled
7
+ Document = com.orientechnologies.orient.core.record.impl.ODocument
8
+ IndexType = com.orientechnologies.orient.core.metadata.schema.OProperty::INDEX_TYPE
9
+ OClass = com.orientechnologies.orient.core.metadata.schema.OClass
10
+ LocalStorage = com.orientechnologies.orient.core.storage.impl.local.OStorageLocal
11
+ LocalCluster = com.orientechnologies.orient.core.storage.impl.local.OClusterLocal
12
+ LogicalCluster = com.orientechnologies.orient.core.storage.impl.local.OClusterLogical
13
+ Property = com.orientechnologies.orient.core.metadata.schema.OProperty
14
+ RecordList = com.orientechnologies.orient.core.db.record.ORecordTrackedList
15
+ RecordMap = com.orientechnologies.orient.core.db.record.ORecordTrackedMap
16
+ RecordSet = com.orientechnologies.orient.core.db.record.ORecordTrackedSet
17
+ RemoteStorage = com.orientechnologies.orient.client.remote.OStorageRemote
18
+ Schema = com.orientechnologies.orient.core.metadata.schema.OSchema
19
+ SchemaType = com.orientechnologies.orient.core.metadata.schema.OType
20
+ SQLSynchQuery = com.orientechnologies.orient.core.sql.query.OSQLSynchQuery
21
+ SQLCommand = com.orientechnologies.orient.core.sql.OCommandSQL
22
+ User = com.orientechnologies.orient.core.metadata.security.OUser
22
23
 
23
- STORAGE_TYPES = %w{ LOGICAL MEMORY PHYSICAL }.inject({}) { |h, s| h[s.downcase.to_sym] = ClusterType.const_get s; h }
24
- INDEX_TYPES = %w{ FULLTEXT NOTUNIQUE UNIQUE }.inject({}) { |h, s| h[s.downcase.to_sym] = IndexType.const_get s; h }
24
+ STORAGE_TYPES = %w{ LOGICAL MEMORY PHYSICAL }.inject({}) { |h, s| h[s.downcase.to_sym] = ClusterType.const_get s; h }
25
+ INDEX_TYPES = %w{ FULLTEXT NOTUNIQUE UNIQUE }.inject({}) { |h, s| h[s.downcase.to_sym] = IndexType.const_get s; h }
25
26
 
26
- FIELD_TYPES = {
27
+ FIELD_TYPES = {
27
28
  :binary => "BINARY",
28
29
  :bool => "BOOLEAN",
29
30
  :boolean => "BOOLEAN",
@@ -1,98 +1,117 @@
1
- class OrientDB::Database
1
+ module OrientDB
2
+ module DocumentDatabaseMixin
2
3
 
3
- def auth(username, password)
4
- open username, password
5
- end
4
+ def run_command(sql_command = nil)
5
+ sql_command = prepare_sql_command sql_command
6
+ command(sql_command).execute(true)
7
+ end
6
8
 
7
- alias_method :native_command, :command
9
+ def prepare_sql_command(sql_command)
10
+ return if sql_command.nil?
11
+ case sql_command
12
+ when OrientDB::SQLCommand
13
+ sql_command
14
+ when String
15
+ OrientDB::SQLCommand.new sql_command
16
+ else
17
+ raise "Unknown command type"
18
+ end
19
+ end
8
20
 
9
- def command(sql_command = nil)
10
- sql_command = prepare_sql_command sql_command
11
- exc_cmd = sql_command.execute
12
- native_command exc_cmd
13
- end
21
+ def all(sql_query = nil)
22
+ sql_query = prepare_sql_query sql_query
23
+ query sql_query
24
+ end
14
25
 
15
- def prepare_sql_command(sql_command)
16
- return if sql_command.nil?
17
- case sql_command
18
- when SQLCommand
19
- sql_command
20
- when String
21
- SQLCommand.new sql_command
22
- else
23
- raise "Unknown command type"
26
+ def first(sql_query = nil)
27
+ sql_query = prepare_sql_query(sql_query).setLimit(1)
28
+ query(sql_query).first
24
29
  end
25
- end
26
30
 
27
- alias_method :native_query, :query
31
+ def prepare_sql_query(sql_query)
32
+ return if sql_query.nil?
33
+ case sql_query
34
+ when OrientDB::SQLSynchQuery
35
+ sql_query
36
+ when OrientDB::SQL::Query
37
+ sql_query.to_sql_synch_query
38
+ when String
39
+ OrientDB::SQLSynchQuery.new(sql_query)
40
+ else
41
+ raise "Unknown query type"
42
+ end
43
+ end
28
44
 
29
- def query(sql_query = nil)
30
- sql_query = prepare_sql_query sql_query
31
- native_query sql_query
32
- end
45
+ def schema
46
+ metadata.schema
47
+ end
33
48
 
34
- def first(sql_query = nil)
35
- sql_query = prepare_sql_query(sql_query).setLimit(1)
36
- query(sql_query).first
37
- end
49
+ def get_class(klass_name)
50
+ schema.get_class klass_name.to_s
51
+ end
38
52
 
39
- def prepare_sql_query(sql_query)
40
- return if sql_query.nil?
41
- case sql_query
42
- when OrientDB::SQLSynchQuery
43
- sql_query
44
- when OrientDB::SQL::Query
45
- sql_query.to_sql_synch_query
46
- when String
47
- OrientDB::SQLSynchQuery.new(sql_query)
48
- else
49
- raise "Unknown query type"
53
+ def create_class(klass_name, fields = {})
54
+ OrientDB::OClass.create self, klass_name.to_s, fields
50
55
  end
51
- end
52
56
 
53
- def schema
54
- metadata.schema
55
- end
57
+ def get_or_create_class(klass_name, fields = {})
58
+ get_class(klass_name) || create_class(klass_name, fields)
59
+ end
56
60
 
57
- def get_class(klass_name)
58
- schema.get_class klass_name.to_s
59
- end
61
+ def drop_class(klass_name)
62
+ schema.remove_class(klass_name) if schema.exists_class(klass_name)
63
+ end
60
64
 
61
- def create_class(klass_name, fields = {})
62
- OrientDB::OClass.create self, klass_name.to_s, fields
63
- end
65
+ def recreate_class(klass_name, fields = {})
66
+ run_command("DELETE FROM #{klass_name}") rescue nil
67
+ drop_class(klass_name) rescue nil
68
+ create_class klass_name, fields
69
+ end
64
70
 
65
- def get_or_create_class(klass_name, fields = {})
66
- get_class(klass_name) || create_class(klass_name, fields)
67
- end
71
+ def all_in_class(klass_name)
72
+ browse_class(klass_name.to_s).map
73
+ end
68
74
 
69
- alias :each_in_class :browseClass
75
+ def all_in_cluster(cluster_name)
76
+ browse_cluster(cluster_name.to_s).map
77
+ end
70
78
 
71
- def all_in_class(klass_name)
72
- browse_class(klass_name.to_s).map
73
79
  end
74
80
 
75
- alias :each_in_cluster :browseCluster
81
+ class DocumentDatabase
76
82
 
77
- def all_in_cluster(cluster_name)
78
- browse_cluster(cluster_name.to_s).map
79
- end
83
+ include DocumentDatabaseMixin
80
84
 
81
- class << self
85
+ def self.create(database_url)
86
+ new(database_url).create
87
+ end
82
88
 
83
- def create(database_url)
84
- obj = new(database_url)
85
- obj.create
86
- obj
89
+ def self.connect(database_url, username, password)
90
+ new(database_url).open(username, password)
87
91
  end
88
92
 
89
- def connect(database_url, username, password)
90
- obj = new(database_url)
91
- obj.auth(username, password)
92
- obj
93
+ alias :each_in_class :browseClass
94
+ alias :each_in_cluster :browseCluster
95
+
96
+ end
97
+
98
+ class DocumentDatabasePool
99
+
100
+ def self.connect(url, username, password)
101
+ global.acquire(url, username, password)
93
102
  end
94
103
 
95
104
  end
105
+
106
+ class DocumentDatabasePooled
107
+
108
+ include DocumentDatabaseMixin
109
+
110
+ alias :each_in_class :browseClass
111
+ alias :each_in_cluster :browseCluster
112
+
113
+ end
114
+
96
115
  end
97
116
 
98
117
 
@@ -84,13 +84,13 @@ module OrientDB
84
84
  else
85
85
  if use_cluster
86
86
  cluster = db.storage.get_cluster use_cluster
87
- klass = db.schema.create_class name, use_cluster
87
+ klass = db.schema.create_class name, cluster
88
88
  elsif add_cluster && !db.storage.cluster_names.include?(name.downcase)
89
89
  cluster = db.storage.add_cluster name.downcase, STORAGE_TYPES[:physical]
90
90
  klass = db.schema.create_class name, cluster
91
91
  else
92
92
  klass = db.schema.create_class name
93
- cluster = db.storage.get_cluster klass.cluster_ids.first
93
+ cluster = db.storage.get_cluster klass.cluster_ids.first rescue nil
94
94
  end
95
95
  end
96
96
 
data/lib/orientdb/sql.rb CHANGED
@@ -17,20 +17,15 @@ module OrientDB
17
17
  end
18
18
 
19
19
  def add(*conds)
20
- puts "add : #{conds.inspect}"
21
20
  conds.each do |cond|
22
21
  case cond
23
22
  when ConditionExpression
24
- puts "ConditionExpression : #{cond.class.name} : #{cond.inspect}"
25
23
  conditions << cond.to_s
26
24
  when Hash
27
- puts "Hash : #{cond.class.name} : #{cond.inspect}"
28
25
  cond.each { |k, v| conditions << "#{k} = #{Query.quote(v)}" }
29
26
  when Array
30
- puts "Array : #{cond.class.name} : #{cond.inspect}"
31
27
  cond.each { |x| conditions << x.to_s }
32
28
  else
33
- puts "else : #{cond.class.name} : #{cond.inspect}"
34
29
  conditions << cond.to_s
35
30
  end
36
31
  end
data/lib/orientdb.rb CHANGED
@@ -4,7 +4,7 @@ $: << File.dirname(__FILE__)
4
4
  $: << File.expand_path('../../jars/', __FILE__)
5
5
 
6
6
  require 'java'
7
- require 'orientdb-client-0.9.24'
7
+ require "orientdb-client-0.9.24"
8
8
 
9
9
  module OrientDB
10
10
 
data/orientdb.gemspec CHANGED
@@ -5,12 +5,12 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{orientdb}
8
- s.version = "0.0.11"
8
+ s.version = "0.0.12"
9
9
  s.platform = %q{jruby}
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 1.3.6") if s.respond_to? :required_rubygems_version=
12
12
  s.authors = ["Adrian Madrid"]
13
- s.date = %q{2011-01-18}
13
+ s.date = %q{2011-01-20}
14
14
  s.default_executable = %q{orientdb_console}
15
15
  s.description = %q{Simple JRuby wrapper for the OrientDB.}
16
16
  s.email = ["aemadrid@gmail.com"]
@@ -38,7 +38,6 @@ Gem::Specification.new do |s|
38
38
  "lib/orientdb.rb",
39
39
  "lib/orientdb/constants.rb",
40
40
  "lib/orientdb/database.rb",
41
- "lib/orientdb/database_pool.rb",
42
41
  "lib/orientdb/document.rb",
43
42
  "lib/orientdb/ext.rb",
44
43
  "lib/orientdb/oclass.rb",
@@ -63,14 +62,13 @@ Gem::Specification.new do |s|
63
62
  s.homepage = %q{http://rubygems.org/gems/orientdb}
64
63
  s.require_paths = ["lib"]
65
64
  s.rubyforge_project = %q{orientdb}
66
- s.rubygems_version = %q{1.3.6}
65
+ s.rubygems_version = %q{1.4.2}
67
66
  s.summary = %q{JRuby wrapper for OrientDB}
68
67
 
69
68
  if s.respond_to? :specification_version then
70
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
71
69
  s.specification_version = 3
72
70
 
73
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
71
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
74
72
  s.add_development_dependency(%q<awesome_print>, [">= 0"])
75
73
  s.add_development_dependency(%q<rspec>, [">= 2.4"])
76
74
  else
@@ -2,21 +2,21 @@ require File.expand_path("../spec_helper", __FILE__)
2
2
 
3
3
  describe "OrientDB" do
4
4
 
5
- describe "Database" do
5
+ describe "DocumentDatabase" do
6
6
 
7
7
  before :all do
8
8
  create_classes
9
9
  end
10
10
 
11
11
  it "should create a valid simple table" do
12
- exp_class = "#<OrientDB::OClass:person name=string>"
12
+ exp_class = "#<OrientDB::OClass:person name=#<orientdb::schematype:string>>"
13
13
  exp_props = ["#<OrientDB::Propery:name type=string indexed=false mandatory=false not_null=false>"]
14
14
  @person_class.to_s.should == exp_class
15
15
  @person_class.properties.map { |x| x.to_s }.should == exp_props
16
16
  end
17
17
 
18
18
  it "should create a valid simple descendant table" do
19
- exp_class = "#<OrientDB::OClass:customer super=person tab=float name=string>"
19
+ exp_class = "#<OrientDB::OClass:customer super=person tab=#<orientdb::schematype:float> name=#<orientdb::schematype:string>>"
20
20
  exp_props = [
21
21
  "#<OrientDB::Propery:tab type=decimal indexed=false mandatory=false not_null=false>",
22
22
  "#<OrientDB::Propery:name type=string indexed=false mandatory=false not_null=false>"
@@ -26,7 +26,7 @@ describe "OrientDB" do
26
26
  end
27
27
 
28
28
  it "should create a complex table" do
29
- exp_class = "#<OrientDB::OClass:invoice number=integer(idx) customer=link sold_on=date total=float lines=linklist>"
29
+ exp_class = "#<OrientDB::OClass:invoice number=#<orientdb::schematype:integer>(idx) customer=#<orientdb::schematype:link> sold_on=#<orientdb::schematype:date> total=#<orientdb::schematype:float> lines=#<orientdb::schematype:linklist>>"
30
30
  exp_props = [
31
31
  "#<OrientDB::Propery:number type=int indexed=true mandatory=true not_null=false>",
32
32
  "#<OrientDB::Propery:customer type=link indexed=false mandatory=false not_null=true>",
@@ -72,7 +72,7 @@ describe "OrientDB" do
72
72
  end
73
73
 
74
74
  it "should get all rows for a class" do
75
- DB.query('SELECT FROM employee').map.should == @employees
75
+ DB.all('SELECT FROM employee').map { |x| x.name }.sort.should == @employees.map { |x| x.name }.sort
76
76
  end
77
77
 
78
78
  it "should create a valid query and return the right results" do
@@ -87,7 +87,7 @@ describe "OrientDB" do
87
87
 
88
88
  it "should find rows by values in arrays" do
89
89
  qry = DB.prepare_sql_query "SELECT * FROM #{@oclass} WHERE 'admin' IN groups"
90
- DB.query(qry).map.should == [@e1, @e2, @e4]
90
+ DB.all(qry).map { |x| x.name }.sort.should == [@e1, @e2, @e4].map { |x| x.name }.sort
91
91
  end
92
92
 
93
93
  end
@@ -43,22 +43,18 @@ describe "OrientDB" do
43
43
 
44
44
  it "should create simple documents" do
45
45
  @hammer.should be_a_kind_of OrientDB::Document
46
- @hammer.to_s.should == "#<OrientDB::Document:product:8:0 title:\"Hammer\" price:3.25 sku:\"H509\">"
47
46
  @h_fields.each { |k, v| @hammer[k].should == v }
48
47
 
49
48
  @nail.should be_a_kind_of OrientDB::Document
50
- @nail.to_s.should == "#<OrientDB::Document:product:8:1 title:\"Nail\" price:0.25 sku:\"N034\">"
51
49
  @n_fields.each { |k, v| @nail.send(k).should == v }
52
50
  end
53
51
 
54
52
  it "should create embedded documents" do
55
53
  @line1.should be_a_kind_of OrientDB::Document
56
- @line1.to_s.should == "#<OrientDB::Document:invoice_line:9:0 product:#<OrientDB::Document:product:8:0 title:\"Hammer\" price:3.25 sku:\"H509\"> price:3.25 quantity:1>"
57
54
  @line1.product.should == @hammer
58
55
  @line1.price.should == @hammer.price
59
56
 
60
57
  @line2.should be_a_kind_of OrientDB::Document
61
- @line2.to_s.should == "#<OrientDB::Document:invoice_line:9:1 product:#<OrientDB::Document:product:8:1 title:\"Nail\" price:0.25 sku:\"N034\"> price:0.25 quantity:10>"
62
58
  @line2.product.should == @nail
63
59
  @line2.price.should == @nail.price
64
60
  end
@@ -3,7 +3,7 @@ require File.expand_path("../spec_helper", __FILE__)
3
3
  describe "OrientDB" do
4
4
 
5
5
  it "should create a valid database" do
6
- DB.should be_a_kind_of OrientDB::Database
6
+ DB.should be_a_kind_of OrientDB::DocumentDatabase
7
7
  DB.name.should == "test"
8
8
  end
9
9
 
data/spec/spec_helper.rb CHANGED
@@ -4,48 +4,60 @@ unless defined?(SPEC_HELPER_LOADED)
4
4
 
5
5
  require 'spec_basic_helper'
6
6
 
7
- TEST_DB_PATH = "#{TEMP_DIR}/databases/db_#{rand(999) + 1}"
8
- FileUtils.mkdir_p TEST_DB_PATH
9
- puts ">> TEST_DB PATH : #{TEST_DB_PATH}"
7
+ TEST_URL = ENV["ORIENTDB_TEST_URL"]
8
+ TEST_USERNAME = ENV["ORIENTDB_TEST_USERNAME"]
9
+ TEST_PASSWORD = ENV["ORIENTDB_TEST_PASSWORD"]
10
+ TEST_POOLED = ENV["ORIENTDB_TEST_POOLED"].to_s[0, 1].downcase == 't'
10
11
 
11
- DB = OrientDB::Database.new("local:#{TEST_DB_PATH}/test").create
12
+ puts "ENV :: TEST_URL : #{TEST_URL} | TEST_USERNAME : #{TEST_USERNAME} | TEST_PASSWORD : #{TEST_PASSWORD} | TEST_POOLED : #{TEST_POOLED}"
13
+
14
+ if TEST_URL && TEST_USERNAME && TEST_PASSWORD
15
+ if TEST_POOLED
16
+ puts ">> Testing [#{TEST_URL[0,TEST_URL.index(':')]}] Pooled Database :: TEST_DB URL : #{TEST_URL} : #{TEST_USERNAME} : #{TEST_PASSWORD}"
17
+ DB = OrientDB::DocumentDatabasePool.connect(TEST_URL, TEST_USERNAME, TEST_PASSWORD)
18
+ else
19
+ puts ">> Testing [#{TEST_URL[0,TEST_URL.index(':')]}] Database :: TEST_DB URL : #{TEST_URL} : #{TEST_USERNAME} : #{TEST_PASSWORD}"
20
+ DB = OrientDB::DocumentDatabase.connect(TEST_URL, TEST_USERNAME, TEST_PASSWORD)
21
+ end
22
+ else
23
+ TEST_DB_PATH = "#{TEMP_DIR}/databases/db_#{rand(999) + 1}"
24
+ puts ">> Testing [local] Database :: TEST_DB PATH : #{TEST_DB_PATH}"
25
+ FileUtils.remove_dir "#{TEMP_DIR}/databases/"
26
+ FileUtils.mkdir_p TEST_DB_PATH
27
+ puts ">> TEST_DB PATH : #{TEST_DB_PATH}"
28
+ DB = OrientDB::DocumentDatabase.new("local:#{TEST_DB_PATH}/test").create
29
+ end
12
30
 
13
31
  module Helpers
14
32
  def create_classes
15
33
  # People
16
- @person_class = DB.create_class :person, :name => :string
34
+ @person_class = DB.recreate_class :person, :name => :string
17
35
  # Customers
18
- @customer_class = DB.create_class :customer,
19
- :super => @person_class,
20
- :tab => :float
36
+ @customer_class = DB.recreate_class :customer,
37
+ :super => @person_class,
38
+ :tab => :float
21
39
  # Employees
22
- @employee_class = DB.create_class :employee,
23
- :super => @person_class,
24
- :age => :int,
25
- :groups => [:embedded_list, :string]
26
- @employee_class.truncate
27
- @customer_class.truncate
28
- @person_class.truncate
40
+ @employee_class = DB.recreate_class :employee,
41
+ :super => @person_class,
42
+ :age => :int,
43
+ :groups => [:embedded_list, :string]
29
44
  # Products
30
- @product_class = DB.create_class :product,
31
- :sku => :string,
32
- :title => :string,
33
- :price => :float
34
- @product_class.truncate
45
+ @product_class = DB.recreate_class :product,
46
+ :sku => :string,
47
+ :title => :string,
48
+ :price => :float
35
49
  # Invoice Lines
36
- @line_class = DB.create_class :invoice_line,
37
- :product => @product_class,
38
- :quantity => :int,
39
- :price => :float
40
- @line_class.truncate
50
+ @line_class = DB.recreate_class :invoice_line,
51
+ :product => @product_class,
52
+ :quantity => :int,
53
+ :price => :float
41
54
  # Invoices
42
- @invoice_class = DB.create_class :invoice,
43
- :number => {:type => :int, :mandatory => true, :index => true},
44
- :customer => {:type => @customer_class, :not_null => true},
45
- :sold_on => :date,
46
- :total => {:type => :float}, # , :min => java.lang.Float.new('0.01'), :max => java.lang.Float.new('1000.0')
47
- :lines => [:link_list, @line_class]
48
- @invoice_class.truncate
55
+ @invoice_class = DB.recreate_class :invoice,
56
+ :number => {:type => :int, :mandatory => true, :index => true},
57
+ :customer => {:type => @customer_class, :not_null => true},
58
+ :sold_on => :date,
59
+ :total => {:type => :float}, # , :min => java.lang.Float.new('0.01'), :max => java.lang.Float.new('1000.0')
60
+ :lines => [:link_list, @line_class]
49
61
  end
50
62
  end
51
63
 
metadata CHANGED
@@ -1,12 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: orientdb
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 0
8
- - 11
9
- version: 0.0.11
4
+ prerelease:
5
+ version: 0.0.12
10
6
  platform: jruby
11
7
  authors:
12
8
  - Adrian Madrid
@@ -14,18 +10,17 @@ autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
12
 
17
- date: 2011-01-18 00:00:00 -07:00
13
+ date: 2011-01-20 00:00:00 -07:00
18
14
  default_executable: orientdb_console
19
15
  dependencies:
20
16
  - !ruby/object:Gem::Dependency
21
17
  name: awesome_print
22
18
  prerelease: false
23
19
  requirement: &id001 !ruby/object:Gem::Requirement
20
+ none: false
24
21
  requirements:
25
22
  - - ">="
26
23
  - !ruby/object:Gem::Version
27
- segments:
28
- - 0
29
24
  version: "0"
30
25
  type: :development
31
26
  version_requirements: *id001
@@ -33,12 +28,10 @@ dependencies:
33
28
  name: rspec
34
29
  prerelease: false
35
30
  requirement: &id002 !ruby/object:Gem::Requirement
31
+ none: false
36
32
  requirements:
37
33
  - - ">="
38
34
  - !ruby/object:Gem::Version
39
- segments:
40
- - 2
41
- - 4
42
35
  version: "2.4"
43
36
  type: :development
44
37
  version_requirements: *id002
@@ -71,7 +64,6 @@ files:
71
64
  - lib/orientdb.rb
72
65
  - lib/orientdb/constants.rb
73
66
  - lib/orientdb/database.rb
74
- - lib/orientdb/database_pool.rb
75
67
  - lib/orientdb/document.rb
76
68
  - lib/orientdb/ext.rb
77
69
  - lib/orientdb/oclass.rb
@@ -102,25 +94,21 @@ rdoc_options: []
102
94
  require_paths:
103
95
  - lib
104
96
  required_ruby_version: !ruby/object:Gem::Requirement
97
+ none: false
105
98
  requirements:
106
99
  - - ">="
107
100
  - !ruby/object:Gem::Version
108
- segments:
109
- - 0
110
101
  version: "0"
111
102
  required_rubygems_version: !ruby/object:Gem::Requirement
103
+ none: false
112
104
  requirements:
113
105
  - - ">="
114
106
  - !ruby/object:Gem::Version
115
- segments:
116
- - 1
117
- - 3
118
- - 6
119
107
  version: 1.3.6
120
108
  requirements: []
121
109
 
122
110
  rubyforge_project: orientdb
123
- rubygems_version: 1.3.6
111
+ rubygems_version: 1.4.2
124
112
  signing_key:
125
113
  specification_version: 3
126
114
  summary: JRuby wrapper for OrientDB
@@ -1,11 +0,0 @@
1
- module OrientDB
2
-
3
- class DatabasePool
4
-
5
- def initialize(database_url, username, password)
6
- self.class.global.acquire database_url, username, password
7
- end
8
-
9
- end
10
-
11
- end