neo4j-java-driver 4.3.0-java → 4.3.1-java

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
  SHA256:
3
- metadata.gz: 4994dc680ba3cabb50d4a43bad5f5bdae465187f134e9d4200db7c74f9738440
4
- data.tar.gz: 342c65dee92f9c271e10ef75674584712745068e8192656a62cc5ff501012df1
3
+ metadata.gz: 0a6cd0aaaceead12534ad80f1a13b10cf3007a19d81ec38e0fbac49459288b17
4
+ data.tar.gz: 68c815539b9b430218d8a75f2fcf693440afed8deae43e02f8b7c08b0fd5ab8c
5
5
  SHA512:
6
- metadata.gz: 45e2ca8031c98c137a1c5d963e213734dddfe888ab452b5bd1d64988c603bd58fdbf3d97bcdf05686f98cc4d10585eaf522311a017ab2cef4d7a164331680a75
7
- data.tar.gz: 06ed87adc45817031f402d9e546b8fb9bdaf05084cd3c92d4f7a63e1988543e86decaba4581aa09daa94320024d8a6015da561c4fdeaf09f73e833a0fb97da32
6
+ metadata.gz: 4175c8bda63b2b0f74fd4ddfb0707fe108313c38afcf9b53776e9039065b1c13f5f25ce5a66f6a96bd49b0a15e19bd07f6e8609a2a36efad78681fe32ef03245
7
+ data.tar.gz: 2b9597522dcfb507a38fd473ca9c1f5400b925eecc31488e6fe82cf6825db8ec2bb7b0c9fc516497ad76124a608216422847553345ff1870be1cc5bc32050e4b
data/README.md CHANGED
@@ -75,9 +75,27 @@ To run the tests the following tools need to be installed:
75
75
  $ pip3 install --user git+https://github.com/klobuczek/boltkit@1.3#egg=boltkit
76
76
  $ neoctrl-install -e 4.0.2 servers
77
77
  $ neoctrl-configure servers/neo4j-enterprise-4.0.2 dbms.directories.import= dbms.default_listen_address=::
78
- $ neoctrl-set-initial-password password servers/neo4j-enterprise-4.0.2
78
+ $ neoctrl-set-initial-password pass servers/neo4j-enterprise-4.0.2
79
79
  $ neoctrl-start servers/neo4j-enterprise-4.0.2
80
80
 
81
+ To run the test using ruby driver:
82
+ ```console
83
+ $ driver=ruby bin/setup
84
+ $ driver=ruby rspec spec
85
+ ```
86
+
87
+ To run the test using java driver:
88
+ ```console
89
+ $ driver=java bin/setup
90
+ $ driver=java rspec spec
91
+ ```
92
+
93
+ In case of heap space memory error (`org.neo4j.driver.exceptions.DatabaseException: Java heap space`), you should limit the dbms memory, for example:
94
+
95
+ ```console
96
+ $ neoctrl-configure servers/neo4j-enterprise-4.0.2 dbms.memory.pagecache.size=600m dbms.memory.heap.max_size=600m dbms.memory.heap.initial_size=600m dbms.directories.import= dbms.connectors.default_listen_address=::
97
+ ```
98
+
81
99
  ## Contributing
82
100
 
83
101
  Suggestions, improvements, bug reports and pull requests are welcome on GitHub at https://github.com/neo4jrb/neo4j-ruby-driver.
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Neo4j::Driver::Ext
4
+ module AsyncConverter
5
+ include ExceptionMapper
6
+
7
+ private
8
+
9
+ def to_future(completion_stage)
10
+ Concurrent::Promises.resolvable_future.tap do |future|
11
+ completion_stage.then_apply(&future.method(:fulfill)).exceptionally { |e| future.reject(mapped_exception(e)) }
12
+ end
13
+ end
14
+ end
15
+ end
@@ -4,18 +4,12 @@ module Neo4j
4
4
  module Driver
5
5
  module Ext
6
6
  module ExceptionCheckable
7
+ include ExceptionMapper
8
+
7
9
  def check
8
10
  yield
9
- rescue Java::OrgNeo4jDriverExceptions::Neo4jException => e
10
- e.reraise
11
- rescue Java::OrgNeo4jDriverExceptions::NoSuchRecordException => e
12
- raise Neo4j::Driver::Exceptions::NoSuchRecordException, e.message
13
- rescue Java::OrgNeo4jDriverExceptions::UntrustedServerException => e
14
- raise Neo4j::Driver::Exceptions::UntrustedServerException, e.message
15
- rescue Java::JavaLang::IllegalStateException => e
16
- raise Neo4j::Driver::Exceptions::IllegalStateException, e.message
17
- rescue Java::JavaLang::IllegalArgumentException => e
18
- raise ArgumentError, e.message
11
+ rescue Java::JavaLang::RuntimeException => e
12
+ raise mapped_exception(e)
19
13
  end
20
14
 
21
15
  def reverse_check
@@ -1,44 +1,56 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- java_import org.neo4j.driver.exceptions.AuthenticationException
4
- java_import org.neo4j.driver.exceptions.ClientException
5
- java_import org.neo4j.driver.exceptions.DatabaseException
6
- java_import org.neo4j.driver.exceptions.ProtocolException
7
- java_import org.neo4j.driver.exceptions.ResultConsumedException
8
- java_import org.neo4j.driver.exceptions.SecurityException
9
- java_import org.neo4j.driver.exceptions.ServiceUnavailableException
10
- java_import org.neo4j.driver.exceptions.SessionExpiredException
11
- java_import org.neo4j.driver.exceptions.TransientException
12
- java_import org.neo4j.driver.exceptions.UntrustedServerException
13
-
14
3
  module Neo4j
15
4
  module Driver
16
5
  module Ext
17
6
  module ExceptionMapper
18
- def reraise
19
- raise mapped_exception(self)
20
- end
7
+ java_import org.neo4j.driver.exceptions.AuthenticationException
8
+ java_import org.neo4j.driver.exceptions.AuthorizationExpiredException
9
+ java_import org.neo4j.driver.exceptions.ClientException
10
+ java_import org.neo4j.driver.exceptions.ConnectionReadTimeoutException
11
+ java_import org.neo4j.driver.exceptions.DatabaseException
12
+ java_import org.neo4j.driver.exceptions.DiscoveryException
13
+ java_import org.neo4j.driver.exceptions.FatalDiscoveryException
14
+ java_import org.neo4j.driver.exceptions.ProtocolException
15
+ java_import org.neo4j.driver.exceptions.ResultConsumedException
16
+ java_import org.neo4j.driver.exceptions.SecurityException
17
+ java_import org.neo4j.driver.exceptions.ServiceUnavailableException
18
+ java_import org.neo4j.driver.exceptions.SessionExpiredException
19
+ java_import org.neo4j.driver.exceptions.TransactionNestingException
20
+ java_import org.neo4j.driver.exceptions.TransientException
21
+ java_import org.neo4j.driver.exceptions.UntrustedServerException
21
22
 
22
23
  def mapped_exception(exception)
23
- mapped_exception_class(exception)&.new(*exception.arguments) || exception
24
+ mapped_neo4j_exception_class(exception)&.new(*arguments(exception)) ||
25
+ mapped_runtime_exception_class(exception)&.new(exception.message) || exception
24
26
  end
25
27
 
26
- def arguments
27
- [code, message, suppressed.map(&method(:mapped_exception))]
28
+ def arguments(e)
29
+ [e.code, e.message, e.suppressed.map(&method(:mapped_exception))]
28
30
  end
29
31
 
30
32
  private
31
33
 
32
- def mapped_exception_class(exception)
33
- case exception
34
+ def mapped_neo4j_exception_class(exception_class)
35
+ case exception_class
34
36
  when AuthenticationException
35
37
  Neo4j::Driver::Exceptions::AuthenticationException
38
+ when AuthorizationExpiredException
39
+ Neo4j::Driver::Exceptions::AuthorizationExpiredException
40
+ when FatalDiscoveryException
41
+ Neo4j::Driver::Exceptions::FatalDiscoveryException
36
42
  when ResultConsumedException
37
43
  Neo4j::Driver::Exceptions::ResultConsumedException
44
+ when TransactionNestingException
45
+ Neo4j::Driver::Exceptions::TransactionNestingException
38
46
  when ClientException
39
47
  Neo4j::Driver::Exceptions::ClientException
48
+ when ConnectionReadTimeoutException
49
+ Neo4j::Driver::Exceptions::ConnectionReadTimeoutException
40
50
  when DatabaseException
41
51
  Neo4j::Driver::Exceptions::DatabaseException
52
+ when DiscoveryException
53
+ Neo4j::Driver::Exceptions::DiscoveryException
42
54
  when ProtocolException
43
55
  Neo4j::Driver::Exceptions::ProtocolException
44
56
  when SecurityException
@@ -53,6 +65,21 @@ module Neo4j
53
65
  nil
54
66
  end
55
67
  end
68
+
69
+ def mapped_runtime_exception_class(exception_class)
70
+ case exception_class
71
+ when Java::OrgNeo4jDriverExceptions::NoSuchRecordException
72
+ Neo4j::Driver::Exceptions::NoSuchRecordException
73
+ when Java::OrgNeo4jDriverExceptions::UntrustedServerException
74
+ Neo4j::Driver::Exceptions::UntrustedServerException
75
+ when Java::JavaLang::IllegalStateException
76
+ Neo4j::Driver::Exceptions::IllegalStateException
77
+ when Java::JavaLang::IllegalArgumentException
78
+ ArgumentError
79
+ else
80
+ nil
81
+ end
82
+ end
56
83
  end
57
84
  end
58
85
  end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Neo4j
4
+ module Driver
5
+ module Ext
6
+ module Internal
7
+ module Async
8
+ module InternalAsyncSession
9
+ include ConfigConverter
10
+ include RunOverride
11
+ include AsyncConverter
12
+
13
+ def run_async(statement, parameters = {}, config = {})
14
+ to_future(
15
+ java_method(:runAsync, [org.neo4j.driver.Query, org.neo4j.driver.TransactionConfig])
16
+ .call(to_statement(statement, parameters), to_java_config(Neo4j::Driver::TransactionConfig, config)))
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Neo4j::Driver::Ext
4
+ module Internal
5
+ module Cursor
6
+ module DisposableAsyncResultCursor
7
+ include AsyncConverter
8
+
9
+ def next_async
10
+ to_future(super)
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -7,6 +7,7 @@ module Neo4j
7
7
  extend AutoClosable
8
8
  include ConfigConverter
9
9
  include ExceptionCheckable
10
+ include AsyncConverter
10
11
 
11
12
  auto_closable :session
12
13
 
@@ -15,6 +16,15 @@ module Neo4j
15
16
  .call(to_java_config(Neo4j::Driver::SessionConfig, session_config))
16
17
  end
17
18
 
19
+ def async_session(**session_config)
20
+ java_method(:async_session, [org.neo4j.driver.SessionConfig])
21
+ .call(to_java_config(Neo4j::Driver::SessionConfig, session_config))
22
+ end
23
+
24
+ def close_async
25
+ to_future(super)
26
+ end
27
+
18
28
  def verify_connectivity
19
29
  check { super }
20
30
  end
@@ -15,9 +15,9 @@ module Neo4j
15
15
  check { super }
16
16
  end
17
17
 
18
- # def rollback
19
- # check { super }
20
- # end
18
+ def rollback
19
+ check { super }
20
+ end
21
21
  end
22
22
  end
23
23
  end
@@ -31,6 +31,10 @@ module Neo4j
31
31
  # Workaround for missing zeitwerk support as of jruby-9.2.13.0
32
32
  module Ext
33
33
  module Internal
34
+ module Async
35
+ end
36
+ module Cursor
37
+ end
34
38
  module Summary
35
39
  end
36
40
  end
@@ -56,6 +60,7 @@ Java::OrgNeo4jDriverInternal::InternalRelationship.prepend Neo4j::Driver::Ext::I
56
60
  Java::OrgNeo4jDriverInternal::InternalResult.prepend Neo4j::Driver::Ext::InternalResult
57
61
  Java::OrgNeo4jDriverInternal::InternalSession.prepend Neo4j::Driver::Ext::InternalSession
58
62
  Java::OrgNeo4jDriverInternal::InternalTransaction.prepend Neo4j::Driver::Ext::InternalTransaction
63
+ Java::OrgNeo4jDriverInternalAsync::InternalAsyncSession.prepend Neo4j::Driver::Ext::Internal::Async::InternalAsyncSession
64
+ Java::OrgNeo4jDriverInternalCursor::DisposableAsyncResultCursor.prepend Neo4j::Driver::Ext::Internal::Cursor::DisposableAsyncResultCursor
59
65
  Java::OrgNeo4jDriverInternalSummary::InternalResultSummary.prepend Neo4j::Driver::Ext::Internal::Summary::InternalResultSummary
60
66
  Java::OrgNeo4jDriverInternalValue::ValueAdapter.include Neo4j::Driver::Ext::RubyConverter
61
- Java::OrgNeo4jDriverExceptions::Neo4jException.include Neo4j::Driver::Ext::ExceptionMapper
data/lib/loader.rb CHANGED
@@ -8,6 +8,7 @@ class Loader
8
8
  loader.tag = 'neo4j-ruby-driver'
9
9
  loader.push_dir(File.expand_path(__dir__))
10
10
  loader.push_dir(File.dirname(File.dirname(caller_locations(1..1).first.path)))
11
+ yield loader if block_given?
11
12
  loader.ignore(File.expand_path('neo4j-*-driver_jars.rb', __dir__))
12
13
  loader.ignore(File.expand_path('neo4j_ruby_driver.rb', __dir__))
13
14
  loader.ignore(File.expand_path('org', __dir__))
@@ -3,7 +3,7 @@
3
3
  module Neo4j
4
4
  module Driver
5
5
  module Exceptions
6
- class AuthenticationException < Neo4jException
6
+ class AuthenticationException < SecurityException
7
7
  end
8
8
  end
9
9
  end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Neo4j
4
+ module Driver
5
+ module Exceptions
6
+ class AuthorizationExpiredException < SecurityException
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Neo4j
4
+ module Driver
5
+ module Exceptions
6
+ class ConnectionReadTimeoutException < SecurityException
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Neo4j
4
+ module Driver
5
+ module Exceptions
6
+ class DiscoveryException < Neo4jException
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Neo4j
4
+ module Driver
5
+ module Exceptions
6
+ class FatalDiscoveryException < ClientException
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Neo4j
4
+ module Driver
5
+ module Exceptions
6
+ class TransactionNestingException < ClientException
7
+ end
8
+ end
9
+ end
10
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Neo4j
4
4
  module Driver
5
- VERSION = '4.3.0'
5
+ VERSION = '4.3.1'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neo4j-java-driver
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.3.0
4
+ version: 4.3.1
5
5
  platform: java
6
6
  authors:
7
7
  - Heinrich Klobuczek
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-25 00:00:00.000000000 Z
11
+ date: 2021-09-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -210,12 +210,15 @@ files:
210
210
  - LICENSE.txt
211
211
  - README.md
212
212
  - jruby/neo4j/driver.rb
213
+ - jruby/neo4j/driver/ext/async_converter.rb
213
214
  - jruby/neo4j/driver/ext/auth_tokens.rb
214
215
  - jruby/neo4j/driver/ext/bookmark.rb
215
216
  - jruby/neo4j/driver/ext/config_converter.rb
216
217
  - jruby/neo4j/driver/ext/exception_checkable.rb
217
218
  - jruby/neo4j/driver/ext/exception_mapper.rb
218
219
  - jruby/neo4j/driver/ext/graph_database.rb
220
+ - jruby/neo4j/driver/ext/internal/async/internal_async_session.rb
221
+ - jruby/neo4j/driver/ext/internal/cursor/disposable_async_result_cursor.rb
219
222
  - jruby/neo4j/driver/ext/internal/summary/internal_result_summary.rb
220
223
  - jruby/neo4j/driver/ext/internal_driver.rb
221
224
  - jruby/neo4j/driver/ext/internal_entity.rb
@@ -236,8 +239,12 @@ files:
236
239
  - lib/loader.rb
237
240
  - lib/neo4j/driver/auto_closable.rb
238
241
  - lib/neo4j/driver/exceptions/authentication_exception.rb
242
+ - lib/neo4j/driver/exceptions/authorization_expired_exception.rb
239
243
  - lib/neo4j/driver/exceptions/client_exception.rb
244
+ - lib/neo4j/driver/exceptions/connection_read_timeout_exception.rb
240
245
  - lib/neo4j/driver/exceptions/database_exception.rb
246
+ - lib/neo4j/driver/exceptions/discovery_exception.rb
247
+ - lib/neo4j/driver/exceptions/fatal_discovery_exception.rb
241
248
  - lib/neo4j/driver/exceptions/illegal_state_exception.rb
242
249
  - lib/neo4j/driver/exceptions/neo4j_exception.rb
243
250
  - lib/neo4j/driver/exceptions/no_such_record_exception.rb
@@ -246,6 +253,7 @@ files:
246
253
  - lib/neo4j/driver/exceptions/security_exception.rb
247
254
  - lib/neo4j/driver/exceptions/service_unavailable_exception.rb
248
255
  - lib/neo4j/driver/exceptions/session_expired_exception.rb
256
+ - lib/neo4j/driver/exceptions/transaction_nesting_exception.rb
249
257
  - lib/neo4j/driver/exceptions/transient_exception.rb
250
258
  - lib/neo4j/driver/exceptions/untrusted_server_exception.rb
251
259
  - lib/neo4j/driver/internal/duration_normalizer.rb
@@ -281,8 +289,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
281
289
  - !ruby/object:Gem::Version
282
290
  version: '0'
283
291
  requirements:
284
- - jar org.neo4j.driver, neo4j-java-driver, 4.3.2
285
- rubygems_version: 3.1.6
292
+ - jar org.neo4j.driver, neo4j-java-driver, 4.3.4
293
+ rubygems_version: 3.2.14
286
294
  signing_key:
287
295
  specification_version: 4
288
296
  summary: ''