neo4j-core 5.0.0.rc.3 → 5.0.0.rc.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: efd3a180ba80337ada8311b1ca7dbf2c9d3a1d5b
4
- data.tar.gz: feaef1009aca073d05b6ac7e54b22a746c76d552
3
+ metadata.gz: af03b69f505c6ef9e583acb0e392daa6550c30c5
4
+ data.tar.gz: d6d91dec745200ebb3877f3bd76b597408fa66ab
5
5
  SHA512:
6
- metadata.gz: a141d208d880c0aa0ef8ac89c9264dffc382b84ce7c9703f376bb9fb8cf87fa8d19d28e25128c9312d9174d04cf24c3d6bb00482d8cd74d168d0478a98f7bc72
7
- data.tar.gz: 8bfa569810bcacd5d96246864570ff642d50cfa7832bff07e4f14b4bb84b1bf01d4880ed496ce3539f87df834a17856836821e36dbe63593c1096e891ab5187d
6
+ metadata.gz: e6a95cc4aa65f54ea657b87225c9a9bd50e27653d658f56f468594eb03df9f7118b75063e618597197a3d77cd1e8c90489061b18e181bcf0a014ef7ca6f416e5
7
+ data.tar.gz: f5a5a49f5880f493567b1e9cffded59b7666d2e81046e13fc58fc9e9ae7a9a46669dcd4cf7281d5a097fb2c39bf6929250a0c2e807849f38a1795d25d2def5de
@@ -143,15 +143,15 @@ module Neo4j
143
143
 
144
144
  private
145
145
 
146
- def key_value_string(key, value, previous_keys = [], force_equals = false)
146
+ def key_value_string(key, value, previous_keys = [], is_set = false)
147
147
  param = (previous_keys << key).join(UNDERSCORE)
148
148
  param.tr_s!('^a-zA-Z0-9', UNDERSCORE)
149
149
  param.gsub!(/^_+|_+$/, '')
150
150
 
151
- value = value.first if value.is_a?(Array) && value.size == 1
151
+ value = value.first if !is_set && value.is_a?(Array) && value.size == 1
152
152
  @params[param.to_sym] = value
153
153
 
154
- if !value.is_a?(Array) || force_equals
154
+ if !value.is_a?(Array) || is_set
155
155
  "#{key} = {#{param}}"
156
156
  else
157
157
  "#{key} IN {#{param}}"
@@ -399,7 +399,7 @@ module Neo4j
399
399
  "#{key}.#{value}"
400
400
  when Array
401
401
  value.map do |v|
402
- v.is_a?(Hash) ? from_key_and_value(key, v) : "#{key}.#{v}"
402
+ v.is_a?(Hash) ? from_key_and_value(key, v) : "#{key}.#{v}"
403
403
  end
404
404
  when Hash
405
405
  value.map { |k, v| "#{key}.#{k} #{v.upcase}" }
@@ -1,5 +1,5 @@
1
1
  module Neo4j
2
2
  module Core
3
- VERSION = '5.0.0.rc.3'
3
+ VERSION = '5.0.0.rc.4'
4
4
  end
5
5
  end
@@ -13,8 +13,15 @@ module Neo4j
13
13
  factory = Java::OrgNeo4jGraphdbFactory::HighlyAvailableGraphDatabaseFactory.new
14
14
  db_service = factory.newHighlyAvailableDatabaseBuilder(db_location)
15
15
 
16
- fail Error, 'Need properties file for HA configuration' unless properties_file
17
- db_service.loadPropertiesFromFile(properties_file)
16
+ case
17
+ when properties_file
18
+ db_service.loadPropertiesFromFile(properties_file)
19
+ when properties_map
20
+ db_service.setConfig(properties_map)
21
+ else
22
+ fail Error, 'Need properties for HA configuration'
23
+ end
24
+
18
25
  @graph_db = db_service.newGraphDatabase
19
26
  Neo4j::Session._notify_listeners(:session_available, self)
20
27
  end
@@ -9,7 +9,7 @@ module Neo4j
9
9
  class EmbeddedImpermanentSession < EmbeddedSession
10
10
  def start
11
11
  fail Error, 'Embedded Neo4j db is already running' if running?
12
- # puts "Start test impermanent embedded Neo4j db at #{db_location}"
12
+ puts 'Start test impermanent embedded Neo4j db'
13
13
  @graph_db = Java::OrgNeo4jTest::TestGraphDatabaseFactory.new.newImpermanentDatabase
14
14
  Neo4j::Session._notify_listeners(:session_available, self)
15
15
  end
@@ -11,7 +11,7 @@ module Neo4j
11
11
  class Error < StandardError
12
12
  end
13
13
 
14
- attr_reader :graph_db, :db_location, :properties_file
14
+ attr_reader :graph_db, :db_location, :properties_file, :properties_map
15
15
  extend Forwardable
16
16
  extend Neo4j::Core::TxMethods
17
17
  def_delegator :@graph_db, :begin_tx
@@ -20,6 +20,10 @@ module Neo4j
20
20
  @db_location = db_location
21
21
  @auto_commit = !!config[:auto_commit]
22
22
  @properties_file = config[:properties_file]
23
+ if config[:properties_map]
24
+ props = config[:properties_map].each_with_object({}) { |(k, v), m| m[k.to_s.to_java] = v.to_s.to_java }
25
+ @properties_map = java.util.HashMap.new(props)
26
+ end
23
27
  Neo4j::Session.register(self)
24
28
  end
25
29
 
@@ -43,6 +47,8 @@ module Neo4j
43
47
  factory = Java::OrgNeo4jGraphdbFactory::GraphDatabaseFactory.new
44
48
  db_service = factory.newEmbeddedDatabaseBuilder(db_location)
45
49
  db_service.loadPropertiesFromFile(properties_file) if properties_file
50
+ db_service.setConfig(properties_map) if properties_map
51
+
46
52
  @graph_db = db_service.newGraphDatabase
47
53
  Neo4j::Session._notify_listeners(:session_available, self)
48
54
  @engine = Java::OrgNeo4jCypherJavacompat::ExecutionEngine.new(@graph_db)
@@ -31,7 +31,7 @@ module Neo4j
31
31
  # (see Neo4j::Node#create_rel)
32
32
  def create_rel(type, other_node, props = nil)
33
33
  q = @session.query.match(:a, :b).where(a: {neo_id: neo_id}, b: {neo_id: other_node.neo_id})
34
- .create("(a)-[r:`#{type}`]->(b)").break.set_props(r: props).return(r: :neo_id)
34
+ .create("(a)-[r:`#{type}`]->(b)").break.set(r: props).return(r: :neo_id)
35
35
 
36
36
  id = @session._query_or_fail(q, true)
37
37
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neo4j-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0.rc.3
4
+ version: 5.0.0.rc.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andreas Ronge, Chris Grigg, Brian Underwood
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-23 00:00:00.000000000 Z
11
+ date: 2015-06-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty