From 1a242dd2f902ae4b616ac9abfbbf92491223c69e Mon Sep 17 00:00:00 2001 From: Pontus Melke Date: Tue, 5 Sep 2017 12:08:01 +0200 Subject: [PATCH] Better parameter handling in BOLT When reading data from the wire Bolt has full knowledge of types and can thus create a MapValue directly without Cypher needing to do the translation of `Object` -> `AnyValue`. --- .../bolt/v1/messaging/BoltMessageRouter.java | 3 +- .../messaging/BoltRequestMessageHandler.java | 3 +- .../messaging/BoltRequestMessageReader.java | 3 +- .../neo4j/bolt/v1/messaging/Neo4jPack.java | 2 +- .../bolt/v1/runtime/BoltStateMachine.java | 14 +-- .../v1/runtime/ExecutionPlanConverter.java | 2 +- .../bolt/v1/runtime/StatementProcessor.java | 5 +- .../v1/runtime/TransactionStateMachine.java | 18 +-- .../runtime/TransactionStateMachineSPI.java | 4 +- .../bolt/v1/runtime/bookmarking/Bookmark.java | 42 ++++--- .../org/neo4j/bolt/testing/BoltMatchers.java | 2 +- .../messaging/BoltRequestMessageRecorder.java | 3 +- .../v1/messaging/BoltRequestMessageTest.java | 10 +- .../messaging/BoltRequestMessageWriter.java | 7 +- .../v1/messaging/BoltResponseMessageTest.java | 2 +- .../bolt/v1/messaging/Neo4jPackTest.java | 2 +- .../bolt/v1/messaging/message/RunMessage.java | 15 ++- .../v1/messaging/util/MessageMatchers.java | 2 +- .../bolt/v1/runtime/BoltStateMachineTest.java | 13 +- .../runtime/ExecutionPlanConverterTest.java | 2 +- .../neo4j/bolt/v1/runtime/MachineRoom.java | 5 +- .../neo4j/bolt/v1/runtime/ResetFuzzTest.java | 11 +- .../runtime/TransactionStateMachineTest.java | 56 +++++---- .../v1/runtime/bookmarking/BookmarkTest.java | 55 +++++---- .../integration/BoltConnectionAuthIT.java | 7 +- .../runtime/integration/BoltConnectionIT.java | 28 +++-- .../v1/runtime/integration/TransactionIT.java | 58 ++++----- .../integration/AuthenticationIT.java | 55 +++++---- .../integration/TransportSessionIT.java | 3 +- .../socket/FragmentedMessageDeliveryTest.java | 4 +- .../internal/javacompat/ExecutionEngine.java | 15 +++ .../javacompat/ValueToObjectSerializer.java | 1 + .../cypher/internal/ExecutionEngine.scala | 10 +- .../v2_3/ExecutionResultWrapper.scala | 2 +- .../v3_1/ExecutionResultWrapper.scala | 2 +- .../v3_2/ExecutionResultWrapper.scala | 2 +- .../commands/expressions/PointFunction.scala | 2 +- .../expressions/ShortestPathExpression.scala | 2 +- .../procs/ProcedureExecutionResult.scala | 4 +- .../runtime/helpers/ValueConversion.scala | 2 +- .../v3_3/runtime/pipes/AllNodesScanPipe.scala | 2 +- .../runtime/pipes/CachingExpandInto.scala | 2 +- .../v3_3/runtime/pipes/CreateNodePipe.scala | 2 +- .../pipes/CreateRelationshipPipe.scala | 2 +- .../v3_3/runtime/pipes/ExpandAllPipe.scala | 2 +- .../FullPruningVarLengthExpandPipe.scala | 2 +- .../v3_3/runtime/pipes/IdSeekIterator.scala | 2 +- .../runtime/pipes/NodeByLabelScanPipe.scala | 2 +- .../pipes/NodeIndexContainsScanPipe.scala | 2 +- .../runtime/pipes/NodeIndexScanPipe.scala | 2 +- .../runtime/pipes/NodeIndexSeekPipe.scala | 2 +- .../runtime/pipes/OptionalExpandAllPipe.scala | 2 +- .../pipes/PruningVarLengthExpandPipe.scala | 2 +- .../v3_3/runtime/pipes/StartPipe.scala | 2 +- .../runtime/pipes/VarLengthExpandPipe.scala | 2 +- .../pipes/matching/PatternRelationship.scala | 2 +- .../internal/compatibility/valueHelper.scala | 2 +- .../v3_3/TransactionBoundQueryContext.scala | 3 +- .../javacompat/ExecutionEngineTest.java | 3 +- .../org/neo4j/cypher/KillQueryTest.scala | 5 +- .../v3_3/MatchingContextTest.scala | 2 +- .../runtime/ImplicitValueConversion.scala | 2 +- .../runtime/commands/LengthFunctionTest.scala | 2 +- .../expressions/PathValueBuilderTest.scala | 2 +- .../GraphElementPropertyFunctionsTest.scala | 2 +- .../runtime/pipes/ExpandAllPipeTest.scala | 4 +- .../runtime/pipes/ExpandIntoPipeTest.scala | 2 +- .../v3_3/runtime/pipes/FakePipe.scala | 2 +- .../runtime/pipes/NodeByIdSeekPipeTest.scala | 2 +- .../pipes/NodeByLabelScanPipeTest.scala | 2 +- .../runtime/pipes/NodeHashJoinPipeTest.scala | 2 +- .../runtime/pipes/NodeIndexScanPipeTest.scala | 2 +- .../runtime/pipes/NodeIndexSeekPipeTest.scala | 2 +- .../pipes/NodeOuterHashJoinPipeTest.scala | 2 +- .../pipes/OptionalExpandAllPipeTest.scala | 2 +- .../pipes/OptionalExpandIntoPipeTest.scala | 2 +- .../v3_3/runtime/pipes/PipeTestSupport.scala | 2 +- .../pipes/ProjectEndpointsPipeTest.scala | 2 +- .../v3_3/runtime/pipes/QueryStateHelper.scala | 2 +- .../v3_3/runtime/pipes/TopPipeTest.scala | 2 +- .../pipes/TriadicSelectionPipeTest.scala | 2 +- ...DirectedRelationshipByIdSeekPipeTest.scala | 2 +- .../aggregation/PercentileFunctionsTest.scala | 2 +- .../pipes/aggregation/StdevFunctionTest.scala | 2 +- .../v3_3/AllShortestPathsPipeTest.scala | 2 +- .../compiler/v3_3/PathExpressionTest.scala | 2 +- .../compiler/v3_3/QueryStateHelper.scala | 4 +- .../v3_3/SingleShortestPathPipeTest.scala | 2 +- .../pipes/ActualCostCalculationTest.scala | 4 +- .../FullPruningVarLengthExpandPipeTest.scala | 2 +- .../PruningVarLengthExpandPipeTest.scala | 2 +- .../cypher/internal/helpers/GraphIcing.scala | 3 +- .../TransactionBoundPlanContextTest.scala | 5 +- .../TransactionBoundQueryContextTest.scala | 4 +- .../helpers}/BaseToObjectValueWriter.java | 2 +- .../helpers/NodeProxyWrappingNodeValue.java | 2 +- .../RelationshipProxyWrappingEdgeValue.java | 2 +- .../java/org/neo4j/helpers/ValueUtils.java | 2 +- .../kernel/api/QueryRegistryOperations.java | 3 +- .../kernel/api/query/ExecutingQuery.java | 7 +- .../neo4j/kernel/api/query/QuerySnapshot.java | 3 +- .../kernel/impl/api/OperationsFacade.java | 3 +- .../StackingQueryRegistrationOperations.java | 4 +- .../QueryRegistrationOperations.java | 4 +- .../kernel/impl/factory/ClassicCoreSPI.java | 17 ++- .../impl/factory/GraphDatabaseFacade.java | 37 +++--- .../impl/proc/ProcedureGDBFacadeSPI.java | 15 +++ .../Neo4jTransactionalContextFactory.java | 6 +- .../kernel/impl/query/NoQueryEngine.java | 7 ++ .../impl/query/QueryExecutionEngine.java | 4 + .../query/TransactionalContextFactory.java | 5 +- .../kernel/api/query/ExecutingQueryTest.java | 9 +- .../impl/api/ExecutingQueryListTest.java | 5 +- .../query/Neo4jTransactionalContextTest.java | 6 +- .../neo4j/locking/QueryExecutionLocksIT.java | 3 +- .../neo4j/server/database/CypherExecutor.java | 6 +- ...itionalPeriodTransactionMessContainer.java | 3 +- .../neo4j/shell/kernel/apps/cypher/Start.java | 9 +- .../scenarios/ClusterFormationIT.java | 4 +- .../scenarios/ServerGroupsIT.java | 3 +- .../ServerPoliciesLoadBalancingIT.java | 3 +- .../codegen/GeneratedMethodStructure.scala | 2 +- .../v3_3/codegen/CodeGeneratorTest.scala | 2 +- .../codegen/CompiledExecutionResultTest.scala | 3 +- .../v3_3/codegen/ir/CodeGenSugar.scala | 3 +- .../slotted/PrimitiveExecutionContext.scala | 2 +- .../slotted/expressions/NodeFromSlot.scala | 2 +- .../expressions/RelationshipFromSlot.scala | 2 +- .../pipes/VarLengthExpandSlottedPipe.scala | 2 +- .../EnterpriseBuiltInDbmsProcedures.java | 7 +- .../builtinprocs/QueryStatusResult.java | 114 +++++++++++++++++- .../kernel/impl/query/QueryLogFormatter.java | 38 +++++- .../neo4j/kernel/impl/query/QueryLogger.java | 2 +- .../kernel/impl/query/QueryLoggerIT.java | 3 +- .../kernel/impl/query/QueryLoggerTest.java | 3 +- .../auth/BoltAuthScenariosInteractionIT.java | 2 +- .../BoltBuiltInProceduresInteractionIT.java | 2 +- ...tConfiguredAuthScenariosInteractionIT.java | 2 +- .../auth/BoltConfiguredProceduresIT.java | 2 +- .../enterprise/auth/BoltInteraction.java | 3 +- ...UserManagementProceduresInteractionIT.java | 2 +- ...guredAuthScenariosInteractionTestBase.java | 10 +- ...mbeddedBuiltInProceduresInteractionIT.java | 5 +- .../auth/ProcedureInteractionTestBase.java | 2 +- .../java/org/neo4j/ha/HAClusterStartupIT.java | 4 +- 145 files changed, 631 insertions(+), 365 deletions(-) rename community/{cypher/cypher/src/main/java/org/neo4j/cypher/internal/javacompat => kernel/src/main/java/org/neo4j/helpers}/BaseToObjectValueWriter.java (99%) diff --git a/community/bolt/src/main/java/org/neo4j/bolt/v1/messaging/BoltMessageRouter.java b/community/bolt/src/main/java/org/neo4j/bolt/v1/messaging/BoltMessageRouter.java index b2c81fb1664df..753a5e15a42fa 100644 --- a/community/bolt/src/main/java/org/neo4j/bolt/v1/messaging/BoltMessageRouter.java +++ b/community/bolt/src/main/java/org/neo4j/bolt/v1/messaging/BoltMessageRouter.java @@ -29,6 +29,7 @@ import org.neo4j.cypher.result.QueryResult; import org.neo4j.logging.Log; import org.neo4j.values.AnyValue; +import org.neo4j.values.virtual.MapValue; /** * This class is responsible for routing incoming request messages to a worker @@ -86,7 +87,7 @@ public void onReset() throws RuntimeException } @Override - public void onRun( String statement, Map params ) + public void onRun( String statement, MapValue params ) { messageLogger.logRun( statement, () -> params ); worker.enqueue( session -> session.run( statement, params, runHandler ) ); diff --git a/community/bolt/src/main/java/org/neo4j/bolt/v1/messaging/BoltRequestMessageHandler.java b/community/bolt/src/main/java/org/neo4j/bolt/v1/messaging/BoltRequestMessageHandler.java index 6215eda4e6523..f11190d0e3f16 100644 --- a/community/bolt/src/main/java/org/neo4j/bolt/v1/messaging/BoltRequestMessageHandler.java +++ b/community/bolt/src/main/java/org/neo4j/bolt/v1/messaging/BoltRequestMessageHandler.java @@ -22,6 +22,7 @@ import java.util.Map; import org.neo4j.bolt.v1.runtime.Neo4jError; +import org.neo4j.values.virtual.MapValue; /** * Interface defining simple handler methods for each defined @@ -37,7 +38,7 @@ public interface BoltRequestMessageHandler void onReset() throws E; - void onRun( String statement, Map params ) throws E; + void onRun( String statement, MapValue params ) throws E; void onDiscardAll() throws E; diff --git a/community/bolt/src/main/java/org/neo4j/bolt/v1/messaging/BoltRequestMessageReader.java b/community/bolt/src/main/java/org/neo4j/bolt/v1/messaging/BoltRequestMessageReader.java index 3dc7fe7b550d3..7f46dc4630b36 100644 --- a/community/bolt/src/main/java/org/neo4j/bolt/v1/messaging/BoltRequestMessageReader.java +++ b/community/bolt/src/main/java/org/neo4j/bolt/v1/messaging/BoltRequestMessageReader.java @@ -26,6 +26,7 @@ import org.neo4j.bolt.v1.packstream.PackStream; import org.neo4j.bolt.v1.runtime.Neo4jError; import org.neo4j.kernel.api.exceptions.Status; +import org.neo4j.values.virtual.MapValue; /** * Reader for Bolt request messages made available via a {@link Neo4jPack.Unpacker}. @@ -74,7 +75,7 @@ public void read( BoltRequestMessageHandler handler ) t break; case RUN: String statement = unpacker.unpackString(); - Map params = unpacker.unpackToRawMap(); + MapValue params = unpacker.unpackMap(); Optional error = unpacker.consumeError(); if ( error.isPresent() ) { diff --git a/community/bolt/src/main/java/org/neo4j/bolt/v1/messaging/Neo4jPack.java b/community/bolt/src/main/java/org/neo4j/bolt/v1/messaging/Neo4jPack.java index ffe6294a160a7..834c78eee0101 100644 --- a/community/bolt/src/main/java/org/neo4j/bolt/v1/messaging/Neo4jPack.java +++ b/community/bolt/src/main/java/org/neo4j/bolt/v1/messaging/Neo4jPack.java @@ -32,7 +32,7 @@ import org.neo4j.bolt.v1.packstream.PackType; import org.neo4j.bolt.v1.runtime.Neo4jError; import org.neo4j.collection.primitive.PrimitiveLongIntKeyValueArray; -import org.neo4j.cypher.internal.javacompat.BaseToObjectValueWriter; +import org.neo4j.helpers.BaseToObjectValueWriter; import org.neo4j.graphdb.Node; import org.neo4j.graphdb.Relationship; import org.neo4j.graphdb.spatial.Point; diff --git a/community/bolt/src/main/java/org/neo4j/bolt/v1/runtime/BoltStateMachine.java b/community/bolt/src/main/java/org/neo4j/bolt/v1/runtime/BoltStateMachine.java index deef74a9dceed..fb200634d3e88 100644 --- a/community/bolt/src/main/java/org/neo4j/bolt/v1/runtime/BoltStateMachine.java +++ b/community/bolt/src/main/java/org/neo4j/bolt/v1/runtime/BoltStateMachine.java @@ -40,6 +40,7 @@ import org.neo4j.kernel.api.exceptions.TransactionFailureException; import org.neo4j.values.AnyValue; import org.neo4j.values.storable.Values; +import org.neo4j.values.virtual.MapValue; import static org.neo4j.kernel.api.security.AuthToken.PRINCIPAL; import static org.neo4j.values.storable.Values.stringArray; @@ -189,7 +190,7 @@ public void reset( BoltResponseHandler handler ) throws BoltConnectionFatality * {@link #pullAll(BoltResponseHandler) pulled} or {@link #discardAll(BoltResponseHandler) * discarded}. */ - public void run( String statement, Map params, BoltResponseHandler handler ) + public void run( String statement, MapValue params, BoltResponseHandler handler ) throws BoltConnectionFatality { long start = clock.millis(); @@ -389,7 +390,7 @@ public State init( BoltStateMachine machine, String userAgent, { @Override public State run( BoltStateMachine machine, String statement, - Map params ) throws BoltConnectionFatality + MapValue params ) throws BoltConnectionFatality { try { @@ -516,7 +517,7 @@ public State ackFailure( BoltStateMachine machine ) throws BoltConnectionFatalit @Override public State run( BoltStateMachine machine, String statement, - Map params ) + MapValue params ) { machine.ctx.markIgnored(); return FAILED; @@ -570,8 +571,7 @@ public State ackFailure( BoltStateMachine machine ) throws BoltConnectionFatalit } @Override - public State run( BoltStateMachine machine, String statement, Map - params ) throws BoltConnectionFatality + public State run( BoltStateMachine machine, String statement, MapValue params ) throws BoltConnectionFatality { machine.ctx.markIgnored(); return INTERRUPTED; @@ -623,7 +623,7 @@ public State reset( BoltStateMachine machine ) throws BoltConnectionFatality throw new BoltProtocolBreachFatality( msg ); } - public State run( BoltStateMachine machine, String statement, Map params ) throws + public State run( BoltStateMachine machine, String statement, MapValue params ) throws BoltConnectionFatality { String msg = "RUN cannot be handled by a session in the " + name() + " state."; @@ -801,7 +801,7 @@ interface SPI private static class NullStatementProcessor implements StatementProcessor { @Override - public StatementMetadata run( String statement, Map params ) throws KernelException + public StatementMetadata run( String statement, MapValue params ) throws KernelException { throw new UnsupportedOperationException( "Unable to run any statements." ); } diff --git a/community/bolt/src/main/java/org/neo4j/bolt/v1/runtime/ExecutionPlanConverter.java b/community/bolt/src/main/java/org/neo4j/bolt/v1/runtime/ExecutionPlanConverter.java index a2614d7b3203c..91b19d1754c9a 100644 --- a/community/bolt/src/main/java/org/neo4j/bolt/v1/runtime/ExecutionPlanConverter.java +++ b/community/bolt/src/main/java/org/neo4j/bolt/v1/runtime/ExecutionPlanConverter.java @@ -24,8 +24,8 @@ import java.util.List; import java.util.Map; -import org.neo4j.cypher.internal.javacompat.ValueUtils; import org.neo4j.graphdb.ExecutionPlanDescription; +import org.neo4j.helpers.ValueUtils; import org.neo4j.values.AnyValue; import org.neo4j.values.virtual.ListValue; import org.neo4j.values.virtual.MapValue; diff --git a/community/bolt/src/main/java/org/neo4j/bolt/v1/runtime/StatementProcessor.java b/community/bolt/src/main/java/org/neo4j/bolt/v1/runtime/StatementProcessor.java index e57dd35f956d7..a0e3436e20475 100644 --- a/community/bolt/src/main/java/org/neo4j/bolt/v1/runtime/StatementProcessor.java +++ b/community/bolt/src/main/java/org/neo4j/bolt/v1/runtime/StatementProcessor.java @@ -23,12 +23,11 @@ import org.neo4j.function.ThrowingConsumer; import org.neo4j.kernel.api.exceptions.KernelException; import org.neo4j.kernel.api.exceptions.TransactionFailureException; - -import java.util.Map; +import org.neo4j.values.virtual.MapValue; public interface StatementProcessor { - StatementMetadata run( String statement, Map params ) throws KernelException; + StatementMetadata run( String statement, MapValue params ) throws KernelException; void streamResult( ThrowingConsumer resultConsumer ) throws Exception; diff --git a/community/bolt/src/main/java/org/neo4j/bolt/v1/runtime/TransactionStateMachine.java b/community/bolt/src/main/java/org/neo4j/bolt/v1/runtime/TransactionStateMachine.java index 4159f0ae16bf9..816299176881c 100644 --- a/community/bolt/src/main/java/org/neo4j/bolt/v1/runtime/TransactionStateMachine.java +++ b/community/bolt/src/main/java/org/neo4j/bolt/v1/runtime/TransactionStateMachine.java @@ -20,7 +20,6 @@ package org.neo4j.bolt.v1.runtime; import java.time.Clock; -import java.util.Map; import java.util.regex.Pattern; import org.neo4j.bolt.security.auth.AuthenticationResult; @@ -36,6 +35,7 @@ import org.neo4j.kernel.api.exceptions.TransactionFailureException; import org.neo4j.kernel.api.security.SecurityContext; import org.neo4j.kernel.impl.query.QueryExecutionKernelException; +import org.neo4j.values.virtual.MapValue; import static org.neo4j.function.ThrowingAction.noop; @@ -69,7 +69,7 @@ private void before() } @Override - public StatementMetadata run( String statement, Map params ) throws KernelException + public StatementMetadata run( String statement, MapValue params ) throws KernelException { before(); try @@ -153,7 +153,7 @@ enum State { @Override State run( MutableTransactionState ctx, SPI spi, String statement, - Map params ) throws KernelException + MapValue params ) throws KernelException { if ( BEGIN.matcher( statement ).matches() ) @@ -218,7 +218,7 @@ else if ( ROLLBACK.matcher( statement ).matches() ) * transaction to null. */ private BoltResultHandle execute( MutableTransactionState ctx, SPI spi, - String statement, Map params ) + String statement, MapValue params ) throws TransactionFailureException, QueryExecutionKernelException { return executeQuery( ctx, spi, statement, params, () -> @@ -240,7 +240,7 @@ void streamResult( MutableTransactionState ctx, EXPLICIT_TRANSACTION { @Override - State run( MutableTransactionState ctx, SPI spi, String statement, Map params ) + State run( MutableTransactionState ctx, SPI spi, String statement, MapValue params ) throws KernelException { if ( BEGIN.matcher( statement ).matches() ) @@ -289,7 +289,7 @@ else if ( ROLLBACK.matcher( statement ).matches() ) } private BoltResultHandle execute( MutableTransactionState ctx, SPI spi, - String statement, Map params ) + String statement, MapValue params ) throws QueryExecutionKernelException { return executeQuery( ctx, spi, statement, params, @@ -315,7 +315,7 @@ void streamResult( MutableTransactionState ctx, abstract State run( MutableTransactionState ctx, SPI spi, String statement, - Map params ) throws KernelException; + MapValue params ) throws KernelException; abstract void streamResult( MutableTransactionState ctx, ThrowingConsumer resultConsumer ) throws Exception; @@ -370,7 +370,7 @@ void closeTransaction( MutableTransactionState ctx, boolean success ) throws Tra } private static BoltResultHandle executeQuery( MutableTransactionState ctx, SPI spi, String statement, - Map params, ThrowingAction onFail ) + MapValue params, ThrowingAction onFail ) throws QueryExecutionKernelException { return spi.executeQuery( ctx.querySource, ctx.securityContext, statement, params, onFail ); @@ -440,7 +440,7 @@ interface SPI BoltResultHandle executeQuery( BoltQuerySource querySource, SecurityContext securityContext, String statement, - Map params, + MapValue params, ThrowingAction onFail ) throws QueryExecutionKernelException; } } diff --git a/community/bolt/src/main/java/org/neo4j/bolt/v1/runtime/TransactionStateMachineSPI.java b/community/bolt/src/main/java/org/neo4j/bolt/v1/runtime/TransactionStateMachineSPI.java index 6805d292f4516..3c55b2708ce70 100644 --- a/community/bolt/src/main/java/org/neo4j/bolt/v1/runtime/TransactionStateMachineSPI.java +++ b/community/bolt/src/main/java/org/neo4j/bolt/v1/runtime/TransactionStateMachineSPI.java @@ -21,7 +21,6 @@ import java.time.Clock; import java.time.Duration; -import java.util.Map; import java.util.function.Supplier; import org.neo4j.bolt.v1.runtime.TransactionStateMachine.BoltResultHandle; @@ -48,6 +47,7 @@ import org.neo4j.kernel.impl.query.clientconnection.ClientConnectionInfo; import org.neo4j.kernel.impl.transaction.log.TransactionIdStore; import org.neo4j.kernel.internal.GraphDatabaseAPI; +import org.neo4j.values.virtual.MapValue; import static org.neo4j.kernel.api.KernelTransaction.Type.implicit; @@ -125,7 +125,7 @@ public boolean isPeriodicCommit( String query ) public BoltResultHandle executeQuery( BoltQuerySource querySource, SecurityContext securityContext, String statement, - Map params, ThrowingAction onFail ) throws QueryExecutionKernelException + MapValue params, ThrowingAction onFail ) throws QueryExecutionKernelException { InternalTransaction internalTransaction = queryService.beginTransaction( implicit, securityContext ); ClientConnectionInfo sourceDetails = new BoltConnectionInfo( querySource.principalName, diff --git a/community/bolt/src/main/java/org/neo4j/bolt/v1/runtime/bookmarking/Bookmark.java b/community/bolt/src/main/java/org/neo4j/bolt/v1/runtime/bookmarking/Bookmark.java index 94af27c67e79b..396adadbb08b8 100644 --- a/community/bolt/src/main/java/org/neo4j/bolt/v1/runtime/bookmarking/Bookmark.java +++ b/community/bolt/src/main/java/org/neo4j/bolt/v1/runtime/bookmarking/Bookmark.java @@ -19,11 +19,13 @@ */ package org.neo4j.bolt.v1.runtime.bookmarking; -import java.util.List; -import java.util.Map; - import org.neo4j.kernel.api.exceptions.KernelException; import org.neo4j.kernel.api.exceptions.Status; +import org.neo4j.values.AnyValue; +import org.neo4j.values.storable.TextValue; +import org.neo4j.values.storable.Values; +import org.neo4j.values.virtual.ListValue; +import org.neo4j.values.virtual.MapValue; import static java.lang.String.format; @@ -46,7 +48,7 @@ public String toString() return format( BOOKMARK_TX_PREFIX + "%d", txId ); } - public static Bookmark fromParamsOrNull( Map params ) throws BookmarkFormatException + public static Bookmark fromParamsOrNull( MapValue params ) throws BookmarkFormatException { // try to parse multiple bookmarks, if available Bookmark bookmark = parseMultipleBookmarks( params ); @@ -64,24 +66,24 @@ public long txId() return txId; } - private static Bookmark parseMultipleBookmarks( Map params ) throws BookmarkFormatException + private static Bookmark parseMultipleBookmarks( MapValue params ) throws BookmarkFormatException { - Object bookmarksObject = params.get( BOOKMARKS_KEY ); + AnyValue bookmarksObject = params.get( BOOKMARKS_KEY ); - if ( bookmarksObject == null ) + if ( bookmarksObject == Values.NO_VALUE ) { return null; } - else if ( bookmarksObject instanceof List ) + else if ( bookmarksObject instanceof ListValue ) { - List bookmarks = (List) bookmarksObject; + ListValue bookmarks = (ListValue) bookmarksObject; long maxTxId = -1; - for ( Object bookmark : bookmarks ) + for ( AnyValue bookmark : bookmarks ) { - if ( bookmark != null ) + if ( bookmark != Values.NO_VALUE ) { - long txId = txIdFrom( bookmark.toString() ); + long txId = txIdFrom( bookmark ); if ( txId > maxTxId ) { maxTxId = txId; @@ -96,20 +98,24 @@ else if ( bookmarksObject instanceof List ) } } - private static Bookmark parseSingleBookmark( Map params ) throws BookmarkFormatException + private static Bookmark parseSingleBookmark( MapValue params ) throws BookmarkFormatException { - Object bookmarkObject = params.get( BOOKMARK_KEY ); - if ( bookmarkObject == null ) + AnyValue bookmarkObject = params.get( BOOKMARK_KEY ); + if ( bookmarkObject == Values.NO_VALUE ) { return null; } - String bookmarkString = bookmarkObject.toString(); - return new Bookmark( txIdFrom( bookmarkString ) ); + return new Bookmark( txIdFrom( bookmarkObject ) ); } - private static long txIdFrom( String bookmarkString ) throws BookmarkFormatException + private static long txIdFrom( AnyValue bookmark ) throws BookmarkFormatException { + if ( !(bookmark instanceof TextValue) ) + { + throw new BookmarkFormatException( bookmark ); + } + String bookmarkString = ((TextValue) bookmark).stringValue(); if ( !bookmarkString.startsWith( BOOKMARK_TX_PREFIX ) ) { throw new BookmarkFormatException( bookmarkString ); diff --git a/community/bolt/src/test/java/org/neo4j/bolt/testing/BoltMatchers.java b/community/bolt/src/test/java/org/neo4j/bolt/testing/BoltMatchers.java index bb87d45e16a6a..0ef9b9b00aef2 100644 --- a/community/bolt/src/test/java/org/neo4j/bolt/testing/BoltMatchers.java +++ b/community/bolt/src/test/java/org/neo4j/bolt/testing/BoltMatchers.java @@ -30,10 +30,10 @@ import org.neo4j.bolt.v1.runtime.BoltConnectionFatality; import org.neo4j.bolt.v1.runtime.BoltStateMachine; import org.neo4j.bolt.v1.runtime.StatementProcessor; -import org.neo4j.cypher.internal.javacompat.ValueUtils; import org.neo4j.cypher.result.QueryResult; import org.neo4j.function.ThrowingAction; import org.neo4j.function.ThrowingBiConsumer; +import org.neo4j.helpers.ValueUtils; import org.neo4j.kernel.api.exceptions.Status; import org.neo4j.values.AnyValue; import org.neo4j.values.storable.TextValue; diff --git a/community/bolt/src/test/java/org/neo4j/bolt/v1/messaging/BoltRequestMessageRecorder.java b/community/bolt/src/test/java/org/neo4j/bolt/v1/messaging/BoltRequestMessageRecorder.java index ed840d2e3886e..9af7e75f3a83e 100644 --- a/community/bolt/src/test/java/org/neo4j/bolt/v1/messaging/BoltRequestMessageRecorder.java +++ b/community/bolt/src/test/java/org/neo4j/bolt/v1/messaging/BoltRequestMessageRecorder.java @@ -23,6 +23,7 @@ import org.neo4j.bolt.v1.messaging.message.RequestMessage; import org.neo4j.bolt.v1.runtime.Neo4jError; +import org.neo4j.values.virtual.MapValue; import static org.neo4j.bolt.v1.messaging.message.AckFailureMessage.ackFailure; import static org.neo4j.bolt.v1.messaging.message.DiscardAllMessage.discardAll; @@ -52,7 +53,7 @@ public void onReset() throws RuntimeException } @Override - public void onRun( String statement, Map params ) + public void onRun( String statement, MapValue params ) { messages.add( run( statement, params ) ); } diff --git a/community/bolt/src/test/java/org/neo4j/bolt/v1/messaging/BoltRequestMessageTest.java b/community/bolt/src/test/java/org/neo4j/bolt/v1/messaging/BoltRequestMessageTest.java index 5694cdcc6dfd0..73564940e9473 100644 --- a/community/bolt/src/test/java/org/neo4j/bolt/v1/messaging/BoltRequestMessageTest.java +++ b/community/bolt/src/test/java/org/neo4j/bolt/v1/messaging/BoltRequestMessageTest.java @@ -24,16 +24,17 @@ import org.junit.rules.ExpectedException; import java.io.IOException; -import java.util.Map; import org.neo4j.bolt.v1.messaging.message.RecordMessage; import org.neo4j.bolt.v1.messaging.message.RequestMessage; import org.neo4j.bolt.v1.messaging.message.RunMessage; import org.neo4j.bolt.v1.packstream.BufferedChannelInput; import org.neo4j.bolt.v1.packstream.BufferedChannelOutput; +import org.neo4j.helpers.ValueUtils; import org.neo4j.kernel.impl.util.HexPrinter; import org.neo4j.values.AnyValue; import org.neo4j.values.virtual.EdgeValue; +import org.neo4j.values.virtual.MapValue; import org.neo4j.values.virtual.NodeValue; import org.neo4j.values.virtual.VirtualValues; @@ -77,13 +78,14 @@ public void shouldHandleCommonMessages() throws Throwable public void shouldHandleParameterizedStatements() throws Throwable { // Given - Map expected = map( "n", 12L ); + MapValue parameters = ValueUtils.asMapValue( map( "n", 12L ) ); // When - RunMessage msg = serializeAndDeserialize( run( "asd", expected ) ); + RunMessage msg = serializeAndDeserialize( run( "asd", parameters ) ); // Then - assertThat( msg.params().entrySet(), equalTo( expected.entrySet() ) ); + MapValue params = msg.params(); + assertThat( params, equalTo( parameters ) ); } //"B1 71 91 B3 4E 0C 92 |84 55 73 65 72 | 86 42 61 6E\n61 6E 61 A284 6E 61 6D 65 83 42 6F 62 83 61 67\n65 0E" diff --git a/community/bolt/src/test/java/org/neo4j/bolt/v1/messaging/BoltRequestMessageWriter.java b/community/bolt/src/test/java/org/neo4j/bolt/v1/messaging/BoltRequestMessageWriter.java index 39fd70a6b5954..f18c08326d339 100644 --- a/community/bolt/src/test/java/org/neo4j/bolt/v1/messaging/BoltRequestMessageWriter.java +++ b/community/bolt/src/test/java/org/neo4j/bolt/v1/messaging/BoltRequestMessageWriter.java @@ -24,7 +24,8 @@ import org.neo4j.bolt.v1.messaging.message.RequestMessage; import org.neo4j.bolt.v1.runtime.Neo4jError; -import org.neo4j.cypher.internal.javacompat.ValueUtils; +import org.neo4j.helpers.ValueUtils; +import org.neo4j.values.virtual.MapValue; import static org.neo4j.bolt.v1.messaging.BoltRequestMessage.ACK_FAILURE; import static org.neo4j.bolt.v1.messaging.BoltRequestMessage.DISCARD_ALL; @@ -76,12 +77,12 @@ public void onReset() throws IOException } @Override - public void onRun( String statement, Map params ) + public void onRun( String statement, MapValue params ) throws IOException { packer.packStructHeader( 2, RUN.signature() ); packer.pack( statement ); - packer.packRawMap( ValueUtils.asMapValue( params ) ); + packer.packRawMap( params ); onMessageComplete.onMessageComplete(); } diff --git a/community/bolt/src/test/java/org/neo4j/bolt/v1/messaging/BoltResponseMessageTest.java b/community/bolt/src/test/java/org/neo4j/bolt/v1/messaging/BoltResponseMessageTest.java index a4982c9bf4e7b..406e85cf04270 100644 --- a/community/bolt/src/test/java/org/neo4j/bolt/v1/messaging/BoltResponseMessageTest.java +++ b/community/bolt/src/test/java/org/neo4j/bolt/v1/messaging/BoltResponseMessageTest.java @@ -34,7 +34,7 @@ import org.neo4j.bolt.v1.messaging.message.SuccessMessage; import org.neo4j.bolt.v1.packstream.BufferedChannelInput; import org.neo4j.bolt.v1.packstream.BufferedChannelOutput; -import org.neo4j.cypher.internal.javacompat.ValueUtils; +import org.neo4j.helpers.ValueUtils; import org.neo4j.kernel.api.exceptions.Status; import org.neo4j.kernel.impl.util.HexPrinter; import org.neo4j.values.AnyValue; diff --git a/community/bolt/src/test/java/org/neo4j/bolt/v1/messaging/Neo4jPackTest.java b/community/bolt/src/test/java/org/neo4j/bolt/v1/messaging/Neo4jPackTest.java index c46d9c2edea5f..f7c888415047d 100644 --- a/community/bolt/src/test/java/org/neo4j/bolt/v1/messaging/Neo4jPackTest.java +++ b/community/bolt/src/test/java/org/neo4j/bolt/v1/messaging/Neo4jPackTest.java @@ -33,7 +33,7 @@ import org.neo4j.bolt.v1.packstream.PackedInputArray; import org.neo4j.bolt.v1.packstream.PackedOutputArray; import org.neo4j.bolt.v1.runtime.Neo4jError; -import org.neo4j.cypher.internal.javacompat.ValueUtils; +import org.neo4j.helpers.ValueUtils; import org.neo4j.kernel.api.exceptions.Status; import org.neo4j.values.AnyValue; import org.neo4j.values.storable.TextArray; diff --git a/community/bolt/src/test/java/org/neo4j/bolt/v1/messaging/message/RunMessage.java b/community/bolt/src/test/java/org/neo4j/bolt/v1/messaging/message/RunMessage.java index 3fd37e0fd6f06..5c7ede618b524 100644 --- a/community/bolt/src/test/java/org/neo4j/bolt/v1/messaging/message/RunMessage.java +++ b/community/bolt/src/test/java/org/neo4j/bolt/v1/messaging/message/RunMessage.java @@ -20,18 +20,17 @@ package org.neo4j.bolt.v1.messaging.message; import org.neo4j.bolt.v1.messaging.BoltRequestMessageHandler; - -import java.util.HashMap; -import java.util.Map; +import org.neo4j.values.virtual.MapValue; +import org.neo4j.values.virtual.VirtualValues; public class RunMessage implements RequestMessage { - private static Map EMPTY_PARAMETERS = new HashMap<>(); + private static MapValue EMPTY_PARAMETERS = VirtualValues.EMPTY_MAP; /** * Factory method for obtaining RUN messages. */ - public static RunMessage run( String statement, Map parameters ) + public static RunMessage run( String statement, MapValue parameters ) { return new RunMessage( statement, parameters ); } @@ -46,15 +45,15 @@ public static RunMessage run( String statement ) } private final String statement; - private final Map params; + private final MapValue params; - private RunMessage( String statement, Map params ) + private RunMessage( String statement, MapValue params ) { this.statement = statement; this.params = params; } - public Map params() + public MapValue params() { return params; } diff --git a/community/bolt/src/test/java/org/neo4j/bolt/v1/messaging/util/MessageMatchers.java b/community/bolt/src/test/java/org/neo4j/bolt/v1/messaging/util/MessageMatchers.java index be315ed24fc1c..3bceaef3de4d8 100644 --- a/community/bolt/src/test/java/org/neo4j/bolt/v1/messaging/util/MessageMatchers.java +++ b/community/bolt/src/test/java/org/neo4j/bolt/v1/messaging/util/MessageMatchers.java @@ -50,7 +50,7 @@ import org.neo4j.bolt.v1.packstream.BufferedChannelInput; import org.neo4j.bolt.v1.packstream.BufferedChannelOutput; import org.neo4j.bolt.v1.transport.integration.TestNotification; -import org.neo4j.cypher.internal.javacompat.BaseToObjectValueWriter; +import org.neo4j.helpers.BaseToObjectValueWriter; import org.neo4j.cypher.result.QueryResult; import org.neo4j.graphdb.Node; import org.neo4j.graphdb.Notification; diff --git a/community/bolt/src/test/java/org/neo4j/bolt/v1/runtime/BoltStateMachineTest.java b/community/bolt/src/test/java/org/neo4j/bolt/v1/runtime/BoltStateMachineTest.java index 6c69ebfa2bdfd..2829ec9e6a893 100644 --- a/community/bolt/src/test/java/org/neo4j/bolt/v1/runtime/BoltStateMachineTest.java +++ b/community/bolt/src/test/java/org/neo4j/bolt/v1/runtime/BoltStateMachineTest.java @@ -22,7 +22,6 @@ import org.junit.Test; import java.time.Clock; -import java.util.Collections; import org.neo4j.bolt.BoltChannel; import org.neo4j.bolt.testing.BoltResponseRecorder; @@ -78,7 +77,7 @@ public void allStateTransitionsShouldSendExactlyOneResponseToTheClient() throws verifyOneResponse( initialState, BoltStateMachine::ackFailure ); verifyOneResponse( initialState, BoltStateMachine::reset ); verifyOneResponse( initialState, - ( machine, recorder ) -> machine.run( "statement", emptyMap(), recorder ) ); + ( machine, recorder ) -> machine.run( "statement", EMPTY_PARAMS, recorder ) ); verifyOneResponse( initialState, BoltStateMachine::discardAll ); verifyOneResponse( initialState, BoltStateMachine::pullAll ); } @@ -145,7 +144,7 @@ public void shouldResetWithOpenTransactionAndOpenResult() throws Throwable final BoltStateMachine machine = newMachineWithTransaction( READY ); // ...and an open result - machine.run( "RETURN 1", emptyMap(), nullResponseHandler() ); + machine.run( "RETURN 1", EMPTY_PARAMS, nullResponseHandler() ); // Then assertThat( machine, canReset() ); @@ -158,7 +157,7 @@ public void shouldResetWithOpenResult() throws Throwable final BoltStateMachine machine = newMachine( READY ); // ...and an open result - machine.run( "RETURN 1", emptyMap(), nullResponseHandler() ); + machine.run( "RETURN 1", EMPTY_PARAMS, nullResponseHandler() ); // Then assertThat( machine, canReset() ); @@ -184,7 +183,7 @@ public void shouldFailWhenOutOfOrderRollback() throws Throwable final BoltStateMachine machine = newMachine( FAILED ); // When - machine.run( "ROLLBACK", emptyMap(), nullResponseHandler() ); + machine.run( "ROLLBACK", EMPTY_PARAMS, nullResponseHandler() ); // Then assertThat( machine, inState( FAILED ) ); @@ -431,7 +430,7 @@ public void shouldTerminateOnAuthExpiryDuringREADYRun() throws Throwable machine.state = READY; // When & Then - assertException( () -> machine.run( "THIS WILL BE IGNORED", Collections.emptyMap(), nullResponseHandler() ), + assertException( () -> machine.run( "THIS WILL BE IGNORED", EMPTY_PARAMS, nullResponseHandler() ), BoltConnectionAuthFatality.class, "Auth expired!" ); } @@ -469,7 +468,7 @@ public void callResetEvenThoughAlreadyClosed() throws Throwable assertTrue( machine.ctx.closed ); //But someone runs a query and thus opens a new transaction - statementProcessor.run( "RETURN 1", Collections.emptyMap() ); + statementProcessor.run( "RETURN 1", EMPTY_PARAMS ); assertThat( statementProcessor.ctx.currentTransaction, notNullValue() ); // Then, when we close again we should make sure the transaction is closed againg diff --git a/community/bolt/src/test/java/org/neo4j/bolt/v1/runtime/ExecutionPlanConverterTest.java b/community/bolt/src/test/java/org/neo4j/bolt/v1/runtime/ExecutionPlanConverterTest.java index 256583ee995bb..7ad1a25f9d767 100644 --- a/community/bolt/src/test/java/org/neo4j/bolt/v1/runtime/ExecutionPlanConverterTest.java +++ b/community/bolt/src/test/java/org/neo4j/bolt/v1/runtime/ExecutionPlanConverterTest.java @@ -26,8 +26,8 @@ import java.util.Map; import java.util.Set; -import org.neo4j.cypher.internal.javacompat.ValueUtils; import org.neo4j.graphdb.ExecutionPlanDescription; +import org.neo4j.helpers.ValueUtils; import org.neo4j.helpers.collection.Iterators; import org.neo4j.helpers.collection.MapUtil; import org.neo4j.values.storable.DoubleValue; diff --git a/community/bolt/src/test/java/org/neo4j/bolt/v1/runtime/MachineRoom.java b/community/bolt/src/test/java/org/neo4j/bolt/v1/runtime/MachineRoom.java index 89740d95c2231..9348dbea3be0d 100644 --- a/community/bolt/src/test/java/org/neo4j/bolt/v1/runtime/MachineRoom.java +++ b/community/bolt/src/test/java/org/neo4j/bolt/v1/runtime/MachineRoom.java @@ -20,11 +20,12 @@ package org.neo4j.bolt.v1.runtime; import java.time.Clock; -import java.util.Map; import org.neo4j.bolt.BoltChannel; import org.neo4j.bolt.security.auth.AuthenticationException; import org.neo4j.bolt.security.auth.AuthenticationResult; +import org.neo4j.values.virtual.MapValue; +import org.neo4j.values.virtual.VirtualValues; import static java.util.Collections.emptyMap; import static org.hamcrest.MatcherAssert.assertThat; @@ -40,7 +41,7 @@ */ public class MachineRoom { - static final Map EMPTY_PARAMS = emptyMap(); + static final MapValue EMPTY_PARAMS = VirtualValues.EMPTY_MAP; static final String USER_AGENT = "BoltStateMachineTest/0.0"; private MachineRoom() diff --git a/community/bolt/src/test/java/org/neo4j/bolt/v1/runtime/ResetFuzzTest.java b/community/bolt/src/test/java/org/neo4j/bolt/v1/runtime/ResetFuzzTest.java index 6cd0b135d3d4e..f557f49379725 100644 --- a/community/bolt/src/test/java/org/neo4j/bolt/v1/runtime/ResetFuzzTest.java +++ b/community/bolt/src/test/java/org/neo4j/bolt/v1/runtime/ResetFuzzTest.java @@ -21,6 +21,7 @@ import java.io.IOException; import java.time.Clock; +import java.util.Collections; import java.util.LinkedList; import java.util.List; import java.util.Map; @@ -43,7 +44,9 @@ import org.neo4j.bolt.v1.runtime.concurrent.ThreadedWorkerFactory; import org.neo4j.concurrent.Runnables; import org.neo4j.cypher.result.QueryResult; +import org.neo4j.helpers.ValueUtils; import org.neo4j.helpers.collection.Iterables; +import org.neo4j.helpers.collection.MapUtil; import org.neo4j.kernel.api.exceptions.Status; import org.neo4j.kernel.impl.logging.NullLogService; import org.neo4j.kernel.impl.util.Neo4jJobScheduler; @@ -63,7 +66,6 @@ import static org.neo4j.bolt.v1.messaging.message.DiscardAllMessage.discardAll; import static org.neo4j.bolt.v1.messaging.message.PullAllMessage.pullAll; import static org.neo4j.bolt.v1.messaging.message.RunMessage.run; -import static org.neo4j.helpers.collection.MapUtil.map; public class ResetFuzzTest { @@ -100,7 +102,7 @@ public void shouldAlwaysReturnToReadyAfterReset() throws Throwable // given life.start(); BoltWorker boltWorker = workerFactory.newWorker( boltChannel ); - boltWorker.enqueue( session -> session.init( "ResetFuzzTest/0.0", map(), nullResponseHandler() ) ); + boltWorker.enqueue( session -> session.init( "ResetFuzzTest/0.0", Collections.emptyMap(), nullResponseHandler() ) ); NullBoltMessageLogger boltLogger = NullBoltMessageLogger.getInstance(); BoltMessageRouter router = new BoltMessageRouter( @@ -171,6 +173,11 @@ private void dispatchRandomSequenceOfMessages( BoltMessageRouter messageHandler } } + private MapValue map( Object... keyValues ) + { + return ValueUtils.asMapValue( MapUtil.map( keyValues ) ); + } + @After public void cleanup() { diff --git a/community/bolt/src/test/java/org/neo4j/bolt/v1/runtime/TransactionStateMachineTest.java b/community/bolt/src/test/java/org/neo4j/bolt/v1/runtime/TransactionStateMachineTest.java index 1d33d06d5e73c..8aa463b9525fe 100644 --- a/community/bolt/src/test/java/org/neo4j/bolt/v1/runtime/TransactionStateMachineTest.java +++ b/community/bolt/src/test/java/org/neo4j/bolt/v1/runtime/TransactionStateMachineTest.java @@ -22,21 +22,20 @@ import org.junit.Before; import org.junit.Test; -import java.util.Collections; -import java.util.Map; - +import org.neo4j.helpers.ValueUtils; +import org.neo4j.helpers.collection.MapUtil; import org.neo4j.kernel.impl.query.QueryExecutionKernelException; import org.neo4j.time.FakeClock; +import org.neo4j.values.virtual.MapValue; import static java.util.Arrays.asList; -import static java.util.Collections.emptyMap; import static org.junit.Assert.assertEquals; import static org.mockito.Matchers.anyLong; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; import static org.neo4j.bolt.security.auth.AuthenticationResult.AUTH_DISABLED; -import static org.neo4j.helpers.collection.MapUtil.map; +import static org.neo4j.values.virtual.VirtualValues.EMPTY_MAP; public class TransactionStateMachineTest { @@ -56,16 +55,16 @@ public void createMocks() public void shouldTransitionToExplicitTransactionOnBegin() throws Exception { assertEquals( TransactionStateMachine.State.AUTO_COMMIT.run( - mutableState, stateMachineSPI, "begin", Collections.emptyMap() ), + mutableState, stateMachineSPI, "begin", EMPTY_MAP ), TransactionStateMachine.State.EXPLICIT_TRANSACTION ); assertEquals( TransactionStateMachine.State.AUTO_COMMIT.run( - mutableState, stateMachineSPI, "BEGIN", Collections.emptyMap() ), + mutableState, stateMachineSPI, "BEGIN", EMPTY_MAP ), TransactionStateMachine.State.EXPLICIT_TRANSACTION ); assertEquals( TransactionStateMachine.State.AUTO_COMMIT.run( - mutableState, stateMachineSPI, " begin ", Collections.emptyMap() ), + mutableState, stateMachineSPI, " begin ", EMPTY_MAP ), TransactionStateMachine.State.EXPLICIT_TRANSACTION ); assertEquals( TransactionStateMachine.State.AUTO_COMMIT.run( - mutableState, stateMachineSPI, " BeGiN ; ", Collections.emptyMap() ), + mutableState, stateMachineSPI, " BeGiN ; ", EMPTY_MAP ), TransactionStateMachine.State.EXPLICIT_TRANSACTION ); } @@ -73,16 +72,16 @@ public void shouldTransitionToExplicitTransactionOnBegin() throws Exception public void shouldTransitionToAutoCommitOnCommit() throws Exception { assertEquals( TransactionStateMachine.State.EXPLICIT_TRANSACTION.run( - mutableState, stateMachineSPI, "commit", Collections.emptyMap() ), + mutableState, stateMachineSPI, "commit", EMPTY_MAP ), TransactionStateMachine.State.AUTO_COMMIT ); assertEquals( TransactionStateMachine.State.EXPLICIT_TRANSACTION.run( - mutableState, stateMachineSPI, "COMMIT", Collections.emptyMap() ), + mutableState, stateMachineSPI, "COMMIT", EMPTY_MAP ), TransactionStateMachine.State.AUTO_COMMIT ); assertEquals( TransactionStateMachine.State.EXPLICIT_TRANSACTION.run( - mutableState, stateMachineSPI, " commit ", Collections.emptyMap() ), + mutableState, stateMachineSPI, " commit ", EMPTY_MAP ), TransactionStateMachine.State.AUTO_COMMIT ); assertEquals( TransactionStateMachine.State.EXPLICIT_TRANSACTION.run( - mutableState, stateMachineSPI, " CoMmIt ; ", Collections.emptyMap() ), + mutableState, stateMachineSPI, " CoMmIt ; ", EMPTY_MAP ), TransactionStateMachine.State.AUTO_COMMIT ); } @@ -90,16 +89,16 @@ public void shouldTransitionToAutoCommitOnCommit() throws Exception public void shouldTransitionToAutoCommitOnRollback() throws Exception { assertEquals( TransactionStateMachine.State.EXPLICIT_TRANSACTION.run( - mutableState, stateMachineSPI, "rollback", Collections.emptyMap() ), + mutableState, stateMachineSPI, "rollback", EMPTY_MAP ), TransactionStateMachine.State.AUTO_COMMIT ); assertEquals( TransactionStateMachine.State.EXPLICIT_TRANSACTION.run( - mutableState, stateMachineSPI, "ROLLBACK", Collections.emptyMap() ), + mutableState, stateMachineSPI, "ROLLBACK", EMPTY_MAP ), TransactionStateMachine.State.AUTO_COMMIT ); assertEquals( TransactionStateMachine.State.EXPLICIT_TRANSACTION.run( - mutableState, stateMachineSPI, " rollback ", Collections.emptyMap() ), + mutableState, stateMachineSPI, " rollback ", EMPTY_MAP ), TransactionStateMachine.State.AUTO_COMMIT ); assertEquals( TransactionStateMachine.State.EXPLICIT_TRANSACTION.run( - mutableState, stateMachineSPI, " RoLlBaCk ; ", Collections.emptyMap() ), + mutableState, stateMachineSPI, " RoLlBaCk ; ", EMPTY_MAP ), TransactionStateMachine.State.AUTO_COMMIT ); } @@ -109,7 +108,7 @@ public void shouldThrowOnBeginInExplicitTransaction() throws Exception try { TransactionStateMachine.State.EXPLICIT_TRANSACTION.run( - mutableState, stateMachineSPI, "begin", Collections.emptyMap() ); + mutableState, stateMachineSPI, "begin", EMPTY_MAP ); } catch ( QueryExecutionKernelException ex ) { @@ -118,7 +117,7 @@ public void shouldThrowOnBeginInExplicitTransaction() throws Exception try { TransactionStateMachine.State.EXPLICIT_TRANSACTION.run( - mutableState, stateMachineSPI, " BEGIN ", Collections.emptyMap() ); + mutableState, stateMachineSPI, " BEGIN ", EMPTY_MAP ); } catch ( QueryExecutionKernelException ex ) { @@ -132,7 +131,7 @@ public void shouldThrowOnRollbackInAutoCommit() throws Exception try { TransactionStateMachine.State.AUTO_COMMIT.run( - mutableState, stateMachineSPI, "rollback", Collections.emptyMap() ); + mutableState, stateMachineSPI, "rollback", EMPTY_MAP ); } catch ( QueryExecutionKernelException ex ) { @@ -141,7 +140,7 @@ public void shouldThrowOnRollbackInAutoCommit() throws Exception try { TransactionStateMachine.State.AUTO_COMMIT.run( - mutableState, stateMachineSPI, " ROLLBACK ", Collections.emptyMap() ); + mutableState, stateMachineSPI, " ROLLBACK ", EMPTY_MAP ); } catch ( QueryExecutionKernelException ex ) { @@ -155,7 +154,7 @@ public void shouldThrowOnCommitInAutoCommit() throws Exception try { TransactionStateMachine.State.AUTO_COMMIT.run( - mutableState, stateMachineSPI, "commit", Collections.emptyMap() ); + mutableState, stateMachineSPI, "commit", EMPTY_MAP ); } catch ( QueryExecutionKernelException ex ) { @@ -164,7 +163,7 @@ public void shouldThrowOnCommitInAutoCommit() throws Exception try { TransactionStateMachine.State.AUTO_COMMIT.run( - mutableState, stateMachineSPI, " COMMIT ", Collections.emptyMap() ); + mutableState, stateMachineSPI, " COMMIT ", EMPTY_MAP ); } catch ( QueryExecutionKernelException ex ) { @@ -175,7 +174,7 @@ public void shouldThrowOnCommitInAutoCommit() throws Exception @Test public void shouldNotWaitWhenNoBookmarkSupplied() throws Exception { - stateMachine.run( "BEGIN", emptyMap() ); + stateMachine.run( "BEGIN", EMPTY_MAP ); verify( stateMachineSPI, never() ).awaitUpToDate( anyLong() ); } @@ -189,7 +188,7 @@ public void shouldAwaitSingleBookmark() throws Exception @Test public void shouldAwaitMultipleBookmarks() throws Exception { - Map params = map( "bookmarks", asList( + MapValue params = map( "bookmarks", asList( "neo4j:bookmark:v1:tx15", "neo4j:bookmark:v1:tx5", "neo4j:bookmark:v1:tx92", "neo4j:bookmark:v1:tx9" ) ); stateMachine.run( "BEGIN", params ); @@ -199,11 +198,16 @@ public void shouldAwaitMultipleBookmarks() throws Exception @Test public void shouldAwaitMultipleBookmarksWhenBothSingleAndMultipleSupplied() throws Exception { - Map params = map( + MapValue params = map( "bookmark", "neo4j:bookmark:v1:tx42", "bookmarks", asList( "neo4j:bookmark:v1:tx47", "neo4j:bookmark:v1:tx67", "neo4j:bookmark:v1:tx45" ) ); stateMachine.run( "BEGIN", params ); verify( stateMachineSPI ).awaitUpToDate( 67 ); } + + private MapValue map( Object... keyValues ) + { + return ValueUtils.asMapValue( MapUtil.map( keyValues ) ); + } } diff --git a/community/bolt/src/test/java/org/neo4j/bolt/v1/runtime/bookmarking/BookmarkTest.java b/community/bolt/src/test/java/org/neo4j/bolt/v1/runtime/bookmarking/BookmarkTest.java index 4be4d09e1fbc6..d10849d75351b 100644 --- a/community/bolt/src/test/java/org/neo4j/bolt/v1/runtime/bookmarking/BookmarkTest.java +++ b/community/bolt/src/test/java/org/neo4j/bolt/v1/runtime/bookmarking/BookmarkTest.java @@ -21,13 +21,17 @@ import org.junit.Test; +import java.util.Collections; import java.util.HashMap; import java.util.Map; +import org.neo4j.helpers.ValueUtils; +import org.neo4j.values.AnyValue; +import org.neo4j.values.virtual.MapValue; +import org.neo4j.values.virtual.VirtualValues; + import static java.util.Arrays.asList; import static java.util.Collections.emptyList; -import static java.util.Collections.emptyMap; -import static java.util.Collections.singletonMap; import static org.hamcrest.Matchers.instanceOf; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; @@ -36,12 +40,17 @@ public class BookmarkTest { + private MapValue singletonMap( String key, Object value ) + { + return VirtualValues.map( Collections.singletonMap( key, ValueUtils.of( value ) )); + } + @Test public void shouldFormatAndParseSingleBookmarkContainingTransactionId() throws Exception { // given long txId = 1234; - Map params = singletonMap( "bookmark", new Bookmark( txId ).toString() ); + MapValue params = singletonMap( "bookmark", new Bookmark( txId ).toString() ); // when Bookmark bookmark = Bookmark.fromParamsOrNull( params ); @@ -56,7 +65,7 @@ public void shouldFormatAndParseMultipleBookmarksContainingTransactionId() throw // given long txId1 = 1234; long txId2 = 12345; - Map params = singletonMap( "bookmarks", + MapValue params = singletonMap( "bookmarks", asList( new Bookmark( txId1 ).toString(), new Bookmark( txId2 ).toString() ) ); @@ -72,7 +81,7 @@ public void shouldParseAndFormatSingleBookmarkContainingTransactionId() throws E { // given String expected = "neo4j:bookmark:v1:tx1234"; - Map params = singletonMap( "bookmark", expected ); + MapValue params = singletonMap( "bookmark", expected ); // when String actual = new Bookmark( Bookmark.fromParamsOrNull( params ).txId() ).toString(); @@ -87,7 +96,7 @@ public void shouldParseAndFormatMultipleBookmarkContainingTransactionId() throws // given String txId1 = "neo4j:bookmark:v1:tx1234"; String txId2 = "neo4j:bookmark:v1:tx12345"; - Map params = singletonMap( "bookmarks", asList( txId1, txId2 ) ); + MapValue params = singletonMap( "bookmarks", asList( txId1, txId2 ) ); // when String actual = new Bookmark( Bookmark.fromParamsOrNull( params ).txId() ).toString(); @@ -210,7 +219,7 @@ public void shouldFailWhenMultipleBookmarksHaveExtraneousTrailingCharacters() th @Test public void shouldUseMultipleBookmarksWhenGivenBothSingleAndMultiple() throws Exception { - Map params = params( + MapValue params = params( "neo4j:bookmark:v1:tx42", asList( "neo4j:bookmark:v1:tx10", "neo4j:bookmark:v1:tx99", "neo4j:bookmark:v1:tx3" ) ); @@ -222,7 +231,7 @@ public void shouldUseMultipleBookmarksWhenGivenBothSingleAndMultiple() throws Ex @Test public void shouldUseMultipleBookmarksWhenGivenOnlyMultiple() throws Exception { - Map params = params( null, asList( "neo4j:bookmark:v1:tx85", "neo4j:bookmark:v1:tx47", + MapValue params = params( null, asList( "neo4j:bookmark:v1:tx85", "neo4j:bookmark:v1:tx47", "neo4j:bookmark:v1:tx15", "neo4j:bookmark:v1:tx6" ) ); Bookmark bookmark = Bookmark.fromParamsOrNull( params ); @@ -233,7 +242,7 @@ public void shouldUseMultipleBookmarksWhenGivenOnlyMultiple() throws Exception @Test public void shouldUseSingleBookmarkWhenGivenOnlySingle() throws Exception { - Map params = params( "neo4j:bookmark:v1:tx82", null ); + MapValue params = params( "neo4j:bookmark:v1:tx82", null ); Bookmark bookmark = Bookmark.fromParamsOrNull( params ); @@ -243,7 +252,7 @@ public void shouldUseSingleBookmarkWhenGivenOnlySingle() throws Exception @Test public void shouldUseSingleBookmarkWhenGivenBothSingleAndNullAsMultiple() throws Exception { - Map params = params( "neo4j:bookmark:v1:tx58", null ); + MapValue params = params( "neo4j:bookmark:v1:tx58", null ); Bookmark bookmark = Bookmark.fromParamsOrNull( params ); @@ -253,7 +262,7 @@ public void shouldUseSingleBookmarkWhenGivenBothSingleAndNullAsMultiple() throws @Test public void shouldUseSingleBookmarkWhenGivenBothSingleAndEmptyListAsMultiple() throws Exception { - Map params = params( "neo4j:bookmark:v1:tx67", emptyList() ); + MapValue params = params( "neo4j:bookmark:v1:tx67", emptyList() ); Bookmark bookmark = Bookmark.fromParamsOrNull( params ); @@ -263,7 +272,7 @@ public void shouldUseSingleBookmarkWhenGivenBothSingleAndEmptyListAsMultiple() t @Test public void shouldThrowWhenMultipleBookmarksIsNotAList() throws Exception { - Map params = params( "neo4j:bookmark:v1:tx67", new String[]{"neo4j:bookmark:v1:tx68"} ); + MapValue params = params( "neo4j:bookmark:v1:tx67", new String[]{"neo4j:bookmark:v1:tx68"} ); try { @@ -279,7 +288,7 @@ public void shouldThrowWhenMultipleBookmarksIsNotAList() throws Exception @Test public void shouldThrowWhenMultipleBookmarksIsNotAListOfStrings() throws Exception { - Map params = params( + MapValue params = params( "neo4j:bookmark:v1:tx67", asList( new String[]{"neo4j:bookmark:v1:tx50"}, new Object[]{"neo4j:bookmark:v1:tx89"} ) ); @@ -297,7 +306,7 @@ public void shouldThrowWhenMultipleBookmarksIsNotAListOfStrings() throws Excepti @Test public void shouldThrowWhenOneOfMultipleBookmarksIsMalformed() { - Map params = params( + MapValue params = params( "neo4j:bookmark:v1:tx67", asList( "neo4j:bookmark:v1:tx99", "neo4j:bookmark:v1:tx12", "neo4j:bookmark:www:tx99" ) ); @@ -315,7 +324,7 @@ public void shouldThrowWhenOneOfMultipleBookmarksIsMalformed() @Test public void shouldThrowWhenSingleBookmarkIsMalformed() { - Map params = params( "neo4j:strange-bookmark:v1:tx6", null ); + MapValue params = params( "neo4j:strange-bookmark:v1:tx6", null ); try { @@ -331,20 +340,20 @@ public void shouldThrowWhenSingleBookmarkIsMalformed() @Test public void shouldReturnNullWhenNoBookmarks() throws Exception { - assertNull( Bookmark.fromParamsOrNull( emptyMap() ) ); + assertNull( Bookmark.fromParamsOrNull( VirtualValues.EMPTY_MAP ) ); } @Test public void shouldReturnNullWhenGivenEmptyListForMultipleBookmarks() throws Exception { - Map params = params( null, emptyList() ); + MapValue params = params( null, emptyList() ); assertNull( Bookmark.fromParamsOrNull( params ) ); } @Test public void shouldSkipNullsInMultipleBookmarks() throws Exception { - Map params = params( null, + MapValue params = params( null, asList( "neo4j:bookmark:v1:tx3", "neo4j:bookmark:v1:tx5", null, "neo4j:bookmark:v1:tx17" ) ); Bookmark bookmark = Bookmark.fromParamsOrNull( params ); @@ -352,14 +361,14 @@ public void shouldSkipNullsInMultipleBookmarks() throws Exception assertEquals( 17, bookmark.txId() ); } - private static Map params( String bookmark, Object bookmarks ) + private static MapValue params( String bookmark, Object bookmarks ) { - Map result = new HashMap<>(); + Map result = new HashMap<>(); if ( bookmark != null ) { - result.put( "bookmark", bookmark ); + result.put( "bookmark", ValueUtils.of( bookmark ) ); } - result.put( "bookmarks", bookmarks ); - return result; + result.put( "bookmarks", ValueUtils.of( bookmarks ) ); + return VirtualValues.map( result ); } } diff --git a/community/bolt/src/test/java/org/neo4j/bolt/v1/runtime/integration/BoltConnectionAuthIT.java b/community/bolt/src/test/java/org/neo4j/bolt/v1/runtime/integration/BoltConnectionAuthIT.java index ad133fa4469fc..ac0978f8e4070 100644 --- a/community/bolt/src/test/java/org/neo4j/bolt/v1/runtime/integration/BoltConnectionAuthIT.java +++ b/community/bolt/src/test/java/org/neo4j/bolt/v1/runtime/integration/BoltConnectionAuthIT.java @@ -38,6 +38,7 @@ import static org.neo4j.helpers.collection.MapUtil.map; import static org.neo4j.values.storable.Values.TRUE; import static org.neo4j.values.storable.Values.stringValue; +import static org.neo4j.values.virtual.VirtualValues.EMPTY_MAP; public class BoltConnectionAuthIT { @@ -63,7 +64,7 @@ public void shouldGiveCredentialsExpiredStatusOnExpiredCredentials() throws Thro "scheme", "basic", "principal", "neo4j", "credentials", "neo4j" ), recorder ); - machine.run( "CREATE ()", map(), recorder ); + machine.run( "CREATE ()", EMPTY_MAP, recorder ); // Then assertThat( recorder.nextResponse(), succeededWithMetadata( "credentials_expired", TRUE ) ); @@ -87,7 +88,7 @@ public void shouldGiveKernelVersionOnInit() throws Throwable "scheme", "basic", "principal", "neo4j", "credentials", "neo4j" ), recorder ); - machine.run( "CREATE ()", map(), recorder ); + machine.run( "CREATE ()", EMPTY_MAP, recorder ); // Then assertThat( recorder.nextResponse(), succeededWithMetadata( "server", stringValue( version ) ) ); @@ -124,7 +125,7 @@ public void shouldBeAbleToActOnSessionWhenUpdatingCredentials() throws Throwable "credentials", "neo4j", "new_credentials", "secret" ), recorder ); - machine.run( "CREATE ()", map(), recorder ); + machine.run( "CREATE ()", EMPTY_MAP, recorder ); // then assertThat( recorder.nextResponse(), succeeded() ); diff --git a/community/bolt/src/test/java/org/neo4j/bolt/v1/runtime/integration/BoltConnectionIT.java b/community/bolt/src/test/java/org/neo4j/bolt/v1/runtime/integration/BoltConnectionIT.java index e33191b8198ea..f3974e006486c 100644 --- a/community/bolt/src/test/java/org/neo4j/bolt/v1/runtime/integration/BoltConnectionIT.java +++ b/community/bolt/src/test/java/org/neo4j/bolt/v1/runtime/integration/BoltConnectionIT.java @@ -23,8 +23,6 @@ import org.junit.Rule; import org.junit.Test; -import java.util.HashMap; -import java.util.Map; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; @@ -38,9 +36,13 @@ import org.neo4j.bolt.v1.runtime.Neo4jError; import org.neo4j.bolt.v1.runtime.spi.BoltResult; import org.neo4j.cypher.result.QueryResult.Record; +import org.neo4j.helpers.ValueUtils; +import org.neo4j.helpers.collection.MapUtil; import org.neo4j.kernel.api.exceptions.Status; import org.neo4j.values.AnyValue; import org.neo4j.values.storable.LongValue; +import org.neo4j.values.virtual.MapValue; +import org.neo4j.values.virtual.VirtualValues; import static java.util.Collections.emptyMap; import static org.hamcrest.CoreMatchers.equalTo; @@ -55,14 +57,13 @@ import static org.neo4j.bolt.testing.NullResponseHandler.nullResponseHandler; import static org.neo4j.bolt.v1.messaging.BoltResponseMessage.IGNORED; import static org.neo4j.bolt.v1.messaging.BoltResponseMessage.SUCCESS; -import static org.neo4j.helpers.collection.MapUtil.map; import static org.neo4j.values.storable.Values.longValue; import static org.neo4j.values.storable.Values.stringValue; @SuppressWarnings( "unchecked" ) public class BoltConnectionIT { - private static final Map EMPTY_PARAMS = emptyMap(); + private static final MapValue EMPTY_PARAMS = VirtualValues.EMPTY_MAP; private static final String USER_AGENT = "BoltConnectionIT/0.0"; private static final BoltChannel boltChannel = mock( BoltChannel.class ); @Rule @@ -460,9 +461,7 @@ public void shouldSupportUsingPeriodicCommitInSession() throws Exception // Given BoltStateMachine machine = env.newMachine( boltChannel ); machine.init( USER_AGENT, emptyMap(), null ); - Map params = new HashMap<>(); - params.put( "csvFileUrl", createLocalIrisData( machine ) ); - + MapValue params = map( "csvFileUrl", createLocalIrisData( machine ) ); long txIdBeforeQuery = env.lastClosedTxId(); long batch = 40; @@ -508,8 +507,7 @@ public void shouldNotSupportUsingPeriodicCommitInTransaction() throws Exception // Given BoltStateMachine machine = env.newMachine( boltChannel ); machine.init( USER_AGENT, emptyMap(), null ); - Map params = new HashMap<>(); - params.put( "csvFileUrl", createLocalIrisData( machine ) ); + MapValue params = map( "csvFileUrl", createLocalIrisData( machine ) ); runAndPull( machine, "BEGIN" ); // When @@ -614,8 +612,7 @@ private String createLocalIrisData( BoltStateMachine machine ) throws Exception { for ( String className : IRIS_CLASS_NAMES ) { - Map params = new HashMap<>(); - params.put( "className", className ); + MapValue params = map( "className", className ); runAndPull( machine, "CREATE (c:Class {name: {className}}) RETURN c", params ); } @@ -627,12 +624,12 @@ private Object[] runAndPull( BoltStateMachine machine, String statement ) throws return runAndPull( machine, statement, EMPTY_PARAMS, SUCCESS ); } - private Record[] runAndPull( BoltStateMachine machine, String statement, Map params ) throws Exception + private Record[] runAndPull( BoltStateMachine machine, String statement, MapValue params ) throws Exception { return runAndPull( machine, statement, params, SUCCESS ); } - private Record[] runAndPull( BoltStateMachine machine, String statement, Map params, + private Record[] runAndPull( BoltStateMachine machine, String statement, MapValue params, BoltResponseMessage expectedResponse ) throws Exception { BoltResponseRecorder recorder = new BoltResponseRecorder(); @@ -643,6 +640,11 @@ private Record[] runAndPull( BoltStateMachine machine, String statement, Map> getSettingsFunction() + protected Consumer> getSettingsFunction() { return settings -> settings.put( GraphDatabaseSettings.auth_enabled.name(), "true" ); } @@ -130,7 +134,7 @@ public void shouldRespondWithCredentialsExpiredOnFirstUse() throws Throwable // Then assertThat( client, eventuallyReceives( new byte[]{0, 0, 0, 1} ) ); - assertThat( client, eventuallyReceives( msgSuccess( map( "credentials_expired", true , "server", version)) ) ); + assertThat( client, eventuallyReceives( msgSuccess( map( "credentials_expired", true, "server", version ) ) ) ); verifyConnectionOpen(); } @@ -208,13 +212,14 @@ public void shouldFailIfMalformedAuthTokenWrongType() throws Throwable .send( TransportTestUtil.acceptedVersions( 1, 0, 0, 0 ) ) .send( TransportTestUtil.chunk( InitMessage.init( "TestClient/1.1", - map( "principal", singletonList( "neo4j" ), "credentials", "neo4j", "scheme", "basic" ) ) ) ); + map( "principal", singletonList( "neo4j" ), "credentials", "neo4j", "scheme", + "basic" ) ) ) ); // Then assertThat( client, eventuallyReceives( new byte[]{0, 0, 0, 1} ) ); assertThat( client, eventuallyReceives( msgFailure( Status.Security.Unauthorized, "Unsupported authentication token, the value associated with the key `principal` " + - "must be a String but was: ArrayList" ) ) ); + "must be a String but was: ArrayList" ) ) ); assertThat( client, eventuallyDisconnects() ); } @@ -227,7 +232,8 @@ public void shouldFailIfMalformedAuthTokenMissingKey() throws Throwable .send( TransportTestUtil.acceptedVersions( 1, 0, 0, 0 ) ) .send( TransportTestUtil.chunk( InitMessage.init( "TestClient/1.1", - map( "principal", "neo4j", "this-should-have-been-credentials", "neo4j", "scheme", "basic" ) ) ) ); + map( "principal", "neo4j", "this-should-have-been-credentials", "neo4j", "scheme", + "basic" ) ) ) ); // Then assertThat( client, eventuallyReceives( new byte[]{0, 0, 0, 1} ) ); @@ -376,11 +382,11 @@ public void shouldBeAbleToChangePasswordUsingBuiltInProcedure() throws Throwable // Then assertThat( client, eventuallyReceives( new byte[]{0, 0, 0, 1} ) ); - assertThat( client, eventuallyReceives( msgSuccess(map( "credentials_expired", true , "server", version)) ) ); + assertThat( client, eventuallyReceives( msgSuccess( map( "credentials_expired", true, "server", version ) ) ) ); // When client.send( TransportTestUtil.chunk( - RunMessage.run( "CALL dbms.security.changePassword", Collections.singletonMap( "password", "secret" ) ), + RunMessage.run( "CALL dbms.security.changePassword", singletonMap( "password", "secret" ) ), PullAllMessage.pullAll() ) ); // Then @@ -420,11 +426,11 @@ public void shouldBeAuthenticatedAfterChangePasswordUsingBuiltInProcedure() thro // Then assertThat( client, eventuallyReceives( new byte[]{0, 0, 0, 1} ) ); - assertThat( client, eventuallyReceives( msgSuccess( map( "credentials_expired", true , "server", version)) ) ); + assertThat( client, eventuallyReceives( msgSuccess( map( "credentials_expired", true, "server", version ) ) ) ); // When client.send( TransportTestUtil.chunk( - RunMessage.run( "CALL dbms.security.changePassword", Collections.singletonMap( "password", "secret" ) ), + RunMessage.run( "CALL dbms.security.changePassword", singletonMap( "password", "secret" ) ), PullAllMessage.pullAll() ) ); // Then @@ -451,21 +457,21 @@ public void shouldFailWhenReusingTheSamePassword() throws Throwable // Then assertThat( client, eventuallyReceives( new byte[]{0, 0, 0, 1} ) ); - assertThat( client, eventuallyReceives( msgSuccess( map( "credentials_expired", true , "server", version) ) ) ); + assertThat( client, eventuallyReceives( msgSuccess( map( "credentials_expired", true, "server", version ) ) ) ); // When client.send( TransportTestUtil.chunk( - RunMessage.run( "CALL dbms.security.changePassword", Collections.singletonMap( "password", "neo4j" ) ), + RunMessage.run( "CALL dbms.security.changePassword", singletonMap( "password", "neo4j" ) ), PullAllMessage.pullAll() ) ); // Then - assertThat( client, eventuallyReceives( msgFailure(Status.General.InvalidArguments, - "Old password and new password cannot be the same.") ) ); + assertThat( client, eventuallyReceives( msgFailure( Status.General.InvalidArguments, + "Old password and new password cannot be the same." ) ) ); // However you should also be able to recover client.send( TransportTestUtil.chunk( AckFailureMessage.ackFailure(), - RunMessage.run( "CALL dbms.security.changePassword", Collections.singletonMap( "password", "abc" ) ), + RunMessage.run( "CALL dbms.security.changePassword", singletonMap( "password", "abc" ) ), PullAllMessage.pullAll() ) ); assertThat( client, eventuallyReceives( msgIgnored(), msgSuccess(), msgSuccess(), msgSuccess() ) ); } @@ -482,21 +488,21 @@ public void shouldFailWhenSubmittingEmptyPassword() throws Throwable // Then assertThat( client, eventuallyReceives( new byte[]{0, 0, 0, 1} ) ); - assertThat( client, eventuallyReceives( msgSuccess( map( "credentials_expired", true , "server", version) ) ) ); + assertThat( client, eventuallyReceives( msgSuccess( map( "credentials_expired", true, "server", version ) ) ) ); // When client.send( TransportTestUtil.chunk( - RunMessage.run( "CALL dbms.security.changePassword", Collections.singletonMap( "password", "" ) ), + RunMessage.run( "CALL dbms.security.changePassword", singletonMap( "password", "" ) ), PullAllMessage.pullAll() ) ); // Then - assertThat( client, eventuallyReceives( msgFailure(Status.General.InvalidArguments, - "A password cannot be empty.") ) ); + assertThat( client, eventuallyReceives( msgFailure( Status.General.InvalidArguments, + "A password cannot be empty." ) ) ); // However you should also be able to recover client.send( TransportTestUtil.chunk( AckFailureMessage.ackFailure(), - RunMessage.run( "CALL dbms.security.changePassword", Collections.singletonMap( "password", "abc" ) ), + RunMessage.run( "CALL dbms.security.changePassword", singletonMap( "password", "abc" ) ), PullAllMessage.pullAll() ) ); assertThat( client, eventuallyReceives( msgIgnored(), msgSuccess(), msgSuccess(), msgSuccess() ) ); } @@ -513,7 +519,7 @@ public void shouldNotBeAbleToReadWhenPasswordChangeRequired() throws Throwable // Then assertThat( client, eventuallyReceives( new byte[]{0, 0, 0, 1} ) ); - assertThat( client, eventuallyReceives( msgSuccess( map( "credentials_expired", true , "server", version)) ) ); + assertThat( client, eventuallyReceives( msgSuccess( map( "credentials_expired", true, "server", version ) ) ) ); // When client.send( TransportTestUtil.chunk( @@ -551,7 +557,7 @@ protected boolean matchesSafely( ResponseMessage t ) { Assert.assertThat( t, instanceOf( FailureMessage.class ) ); FailureMessage msg = (FailureMessage) t; - if ( !msg.status().equals( Status.Security.Unauthorized ) || + if ( !msg.status().equals( Status.Security.Unauthorized ) || !msg.message().contains( "The client is unauthorized due to authentication failure." ) ) { specialMessage = msg; @@ -564,4 +570,9 @@ public boolean gotSpecialMessage() return specialMessage != null; } } + + private MapValue singletonMap( String key, Object value ) + { + return VirtualValues.map( Collections.singletonMap( key, ValueUtils.of( value ) ) ); + } } diff --git a/community/bolt/src/test/java/org/neo4j/bolt/v1/transport/integration/TransportSessionIT.java b/community/bolt/src/test/java/org/neo4j/bolt/v1/transport/integration/TransportSessionIT.java index 88e6fa49d3538..71a6f28d8824a 100644 --- a/community/bolt/src/test/java/org/neo4j/bolt/v1/transport/integration/TransportSessionIT.java +++ b/community/bolt/src/test/java/org/neo4j/bolt/v1/transport/integration/TransportSessionIT.java @@ -40,6 +40,7 @@ import org.neo4j.graphdb.SeverityLevel; import org.neo4j.graphdb.factory.GraphDatabaseSettings; import org.neo4j.helpers.HostnamePort; +import org.neo4j.helpers.ValueUtils; import org.neo4j.kernel.api.exceptions.Status; import static java.util.Arrays.asList; @@ -404,7 +405,7 @@ public void shouldFailNicelyOnNullKeysInMap() throws Throwable .send( TransportTestUtil.acceptedVersions( 1, 0, 0, 0 ) ) .send( TransportTestUtil.chunk( init( "TestClient/1.1", emptyMap() ), - run( "RETURN {p}", params ), + run( "RETURN {p}", ValueUtils.asMapValue( params ) ), pullAll() ) ); // Then diff --git a/community/bolt/src/test/java/org/neo4j/bolt/v1/transport/socket/FragmentedMessageDeliveryTest.java b/community/bolt/src/test/java/org/neo4j/bolt/v1/transport/socket/FragmentedMessageDeliveryTest.java index 0c0f0f6cb8f05..6d3b84e829461 100644 --- a/community/bolt/src/test/java/org/neo4j/bolt/v1/transport/socket/FragmentedMessageDeliveryTest.java +++ b/community/bolt/src/test/java/org/neo4j/bolt/v1/transport/socket/FragmentedMessageDeliveryTest.java @@ -42,10 +42,10 @@ import org.neo4j.bolt.v1.transport.BoltMessagingProtocolV1Handler; import org.neo4j.kernel.impl.logging.NullLogService; import org.neo4j.kernel.impl.util.HexPrinter; +import org.neo4j.values.virtual.MapValue; import static io.netty.buffer.Unpooled.wrappedBuffer; import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyMapOf; import static org.mockito.Matchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; @@ -136,7 +136,7 @@ private void testPermutation( byte[] unfragmented, ByteBuf[] fragments ) throws // Then the session should've received the specified messages, and the protocol should be in a nice clean state try { - verify( machine ).run( eq( "Mjölnir" ), anyMapOf( String.class, Object.class ), any( BoltResponseHandler.class ) ); + verify( machine ).run( eq( "Mjölnir" ), any(MapValue.class), any( BoltResponseHandler.class ) ); } catch ( AssertionError e ) { diff --git a/community/cypher/cypher/src/main/java/org/neo4j/cypher/internal/javacompat/ExecutionEngine.java b/community/cypher/cypher/src/main/java/org/neo4j/cypher/internal/javacompat/ExecutionEngine.java index a5e218ab3eb4a..ac2f309ae15b7 100644 --- a/community/cypher/cypher/src/main/java/org/neo4j/cypher/internal/javacompat/ExecutionEngine.java +++ b/community/cypher/cypher/src/main/java/org/neo4j/cypher/internal/javacompat/ExecutionEngine.java @@ -29,6 +29,7 @@ import org.neo4j.kernel.impl.query.QueryExecutionKernelException; import org.neo4j.kernel.impl.query.TransactionalContext; import org.neo4j.logging.LogProvider; +import org.neo4j.values.virtual.MapValue; /** * To run a Cypher query, use this class. @@ -52,6 +53,20 @@ public ExecutionEngine( GraphDatabaseQueryService queryService, LogProvider logP inner = new org.neo4j.cypher.internal.ExecutionEngine( queryService, logProvider, compatibilityFactory ); } + @Override + public Result executeQuery( String query, MapValue parameters, TransactionalContext context ) + throws QueryExecutionKernelException + { + try + { + return inner.execute( query, parameters, context ); + } + catch ( CypherException e ) + { + throw new QueryExecutionKernelException( e ); + } + } + @Override public Result executeQuery( String query, Map parameters, TransactionalContext context ) throws QueryExecutionKernelException diff --git a/community/cypher/cypher/src/main/java/org/neo4j/cypher/internal/javacompat/ValueToObjectSerializer.java b/community/cypher/cypher/src/main/java/org/neo4j/cypher/internal/javacompat/ValueToObjectSerializer.java index 4c3f4e08169d0..e2259949ea2e7 100644 --- a/community/cypher/cypher/src/main/java/org/neo4j/cypher/internal/javacompat/ValueToObjectSerializer.java +++ b/community/cypher/cypher/src/main/java/org/neo4j/cypher/internal/javacompat/ValueToObjectSerializer.java @@ -24,6 +24,7 @@ import org.neo4j.graphdb.Node; import org.neo4j.graphdb.Relationship; import org.neo4j.graphdb.spatial.Point; +import org.neo4j.helpers.BaseToObjectValueWriter; import org.neo4j.kernel.impl.core.NodeManager; public class ValueToObjectSerializer extends BaseToObjectValueWriter diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/ExecutionEngine.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/ExecutionEngine.scala index ba224646f5844..da39d205ab453 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/ExecutionEngine.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/ExecutionEngine.scala @@ -90,8 +90,13 @@ class ExecutionEngine(val queryService: GraphDatabaseQueryService, def profile(query: String, javaParams: JavaMap[String, AnyRef], context: TransactionalContext): Result = { // we got deep java parameters => convert to shallow scala parameters for passing into the engine val scalaParams: Map[String, Any] = scalaValues.asShallowScalaMap(javaParams) + profile(query, ValueConversion.asValues(scalaParams), context) + } + + def profile(query: String, mapValue: MapValue, context: TransactionalContext): Result = { + // we got deep java parameters => convert to shallow scala parameters for passing into the engine val (preparedPlanExecution, wrappedContext) = planQuery(context) - preparedPlanExecution.profile(wrappedContext, ValueConversion.asValues(scalaParams)) + preparedPlanExecution.profile(wrappedContext, mapValue) } def execute(query: String, scalaParams: Map[String, Any], context: TransactionalContext): Result = { @@ -103,8 +108,7 @@ class ExecutionEngine(val queryService: GraphDatabaseQueryService, def execute(query: String, javaParams: JavaMap[String, AnyRef], context: TransactionalContext): Result = { // we got deep java parameters => convert to shallow scala parameters for passing into the engine val scalaParams = scalaValues.asShallowScalaMap(javaParams) - val (preparedPlanExecution, wrappedContext) = planQuery(context) - preparedPlanExecution.execute(wrappedContext, ValueConversion.asValues(scalaParams)) + execute(query, ValueConversion.asValues(scalaParams), context) } def execute(query: String, mapParams: MapValue, context: TransactionalContext): Result = { diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v2_3/ExecutionResultWrapper.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v2_3/ExecutionResultWrapper.scala index 3269498a5287a..633e818f24da3 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v2_3/ExecutionResultWrapper.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v2_3/ExecutionResultWrapper.scala @@ -36,13 +36,13 @@ import org.neo4j.cypher.internal.frontend.v2_3.SemanticDirection.{BOTH, INCOMING import org.neo4j.cypher.internal.frontend.v2_3.notification.{InternalNotification, LegacyPlannerNotification, PlannerUnsupportedNotification, RuntimeUnsupportedNotification, _} import org.neo4j.cypher.internal.frontend.v2_3.{InputPosition => InternalInputPosition} import org.neo4j.cypher.internal.frontend.{v2_3, v3_3} -import org.neo4j.cypher.internal.javacompat.ValueUtils import org.neo4j.cypher.internal.{QueryStatistics, compatibility} import org.neo4j.cypher.result.QueryResult import org.neo4j.cypher.result.QueryResult.Record import org.neo4j.graphdb.Result.ResultVisitor import org.neo4j.graphdb._ import org.neo4j.graphdb.impl.notification.{NotificationCode, NotificationDetail} +import org.neo4j.helpers.ValueUtils import org.neo4j.values.AnyValue import scala.collection.JavaConverters._ diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_1/ExecutionResultWrapper.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_1/ExecutionResultWrapper.scala index 740e62e67eb48..957de168e91f6 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_1/ExecutionResultWrapper.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_1/ExecutionResultWrapper.scala @@ -37,13 +37,13 @@ import org.neo4j.cypher.internal.compiler.v3_1.{PlannerName, ExplainMode => Expl import org.neo4j.cypher.internal.frontend.v3_1.SemanticDirection.{BOTH, INCOMING, OUTGOING} import org.neo4j.cypher.internal.frontend.v3_1.notification.{DeprecatedPlannerNotification, InternalNotification, PlannerUnsupportedNotification, RuntimeUnsupportedNotification, _} import org.neo4j.cypher.internal.frontend.v3_3 -import org.neo4j.cypher.internal.javacompat.ValueUtils import org.neo4j.cypher.result.QueryResult import org.neo4j.cypher.result.QueryResult.Record import org.neo4j.graphdb import org.neo4j.graphdb.Result.{ResultRow, ResultVisitor} import org.neo4j.graphdb.impl.notification.{NotificationCode, NotificationDetail} import org.neo4j.graphdb.{InputPosition, Notification, ResourceIterator} +import org.neo4j.helpers.ValueUtils import org.neo4j.values.AnyValue import scala.collection.JavaConverters._ diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_2/ExecutionResultWrapper.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_2/ExecutionResultWrapper.scala index ec63598e9f685..e020d4ff5002f 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_2/ExecutionResultWrapper.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_2/ExecutionResultWrapper.scala @@ -38,13 +38,13 @@ import org.neo4j.cypher.internal.frontend.v3_2.PlannerName import org.neo4j.cypher.internal.frontend.v3_2.SemanticDirection.{BOTH, INCOMING, OUTGOING} import org.neo4j.cypher.internal.frontend.v3_2.notification.{DeprecatedPlannerNotification, InternalNotification, PlannerUnsupportedNotification, RuntimeUnsupportedNotification, _} import org.neo4j.cypher.internal.frontend.v3_3 -import org.neo4j.cypher.internal.javacompat.ValueUtils import org.neo4j.cypher.result.QueryResult import org.neo4j.cypher.result.QueryResult.Record import org.neo4j.graphdb import org.neo4j.graphdb.Result.{ResultRow, ResultVisitor} import org.neo4j.graphdb.impl.notification.{NotificationCode, NotificationDetail} import org.neo4j.graphdb.{Notification, ResourceIterator} +import org.neo4j.helpers.ValueUtils import org.neo4j.values.AnyValue import scala.collection.JavaConverters._ diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/commands/expressions/PointFunction.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/commands/expressions/PointFunction.scala index 2ef7657274f10..0864272a9f681 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/commands/expressions/PointFunction.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/commands/expressions/PointFunction.scala @@ -25,7 +25,7 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.helpers.IsMap import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes.QueryState import org.neo4j.cypher.internal.frontend.v3_3.CypherTypeException -import org.neo4j.cypher.internal.javacompat.ValueUtils +import org.neo4j.helpers.ValueUtils import org.neo4j.values.AnyValue import org.neo4j.values.storable.Values import org.neo4j.values.virtual.MapValue diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/commands/expressions/ShortestPathExpression.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/commands/expressions/ShortestPathExpression.scala index b5da1bba56134..88a6a7462a230 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/commands/expressions/ShortestPathExpression.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/commands/expressions/ShortestPathExpression.scala @@ -26,8 +26,8 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.helpers.Relationship import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes.QueryState import org.neo4j.cypher.internal.frontend.v3_3.helpers.NonEmptyList import org.neo4j.cypher.internal.frontend.v3_3.{ShortestPathCommonEndNodesForbiddenException, SyntaxException} -import org.neo4j.cypher.internal.javacompat.ValueUtils import org.neo4j.graphdb.{Path, PropertyContainer} +import org.neo4j.helpers.ValueUtils import org.neo4j.values.AnyValue import org.neo4j.values.storable.Values import org.neo4j.values.virtual.{NodeValue, VirtualValues} diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/executionplan/procs/ProcedureExecutionResult.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/executionplan/procs/ProcedureExecutionResult.scala index 9040fe855c272..0e97a6348c79a 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/executionplan/procs/ProcedureExecutionResult.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/executionplan/procs/ProcedureExecutionResult.scala @@ -27,14 +27,14 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Inte import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.InternalPlanDescription.Arguments.{Runtime, RuntimeImpl} import org.neo4j.cypher.internal.frontend.v3_3.ProfilerStatisticsNotReadyException import org.neo4j.cypher.internal.frontend.v3_3.symbols.{CypherType, _} -import org.neo4j.cypher.internal.javacompat.ValueUtils -import org.neo4j.cypher.internal.javacompat.ValueUtils.{fromNodeProxy, fromRelationshipProxy, _} import org.neo4j.cypher.internal.spi.v3_3.QueryContext import org.neo4j.cypher.internal.v3_3.logical.plans.QualifiedName import org.neo4j.cypher.internal.{InternalExecutionResult, QueryStatistics} import org.neo4j.cypher.result.QueryResult.{QueryResultVisitor, Record} import org.neo4j.graphdb.Notification import org.neo4j.graphdb.spatial.{Geometry, Point} +import org.neo4j.helpers.ValueUtils +import org.neo4j.helpers.ValueUtils._ import org.neo4j.values.AnyValue import org.neo4j.values.storable.Values import org.neo4j.values.storable.Values.{of => _, _} diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/helpers/ValueConversion.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/helpers/ValueConversion.scala index 3c9da844acf63..4e22e6c6940d7 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/helpers/ValueConversion.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/helpers/ValueConversion.scala @@ -22,9 +22,9 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.helpers import org.neo4j.cypher.internal.frontend.v3_3.helpers.Eagerly import org.neo4j.cypher.internal.frontend.v3_3.symbols import org.neo4j.cypher.internal.frontend.v3_3.symbols.CypherType -import org.neo4j.cypher.internal.javacompat.ValueUtils import org.neo4j.graphdb.spatial.{Geometry, Point} import org.neo4j.graphdb.{Node, Path, Relationship} +import org.neo4j.helpers.ValueUtils import org.neo4j.values.AnyValue import org.neo4j.values.storable.Values import org.neo4j.values.storable.Values.byteArray diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/AllNodesScanPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/AllNodesScanPipe.scala index cefc6d2e9de70..32112fb5b3d26 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/AllNodesScanPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/AllNodesScanPipe.scala @@ -21,7 +21,7 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id -import org.neo4j.cypher.internal.javacompat.ValueUtils +import org.neo4j.helpers.ValueUtils case class AllNodesScanPipe(ident: String)(val id: Id = new Id) extends Pipe { diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/CachingExpandInto.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/CachingExpandInto.scala index 4364d65d9faf7..861f903af3904 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/CachingExpandInto.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/CachingExpandInto.scala @@ -21,8 +21,8 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.frontend.v3_3.{InternalException, SemanticDirection} -import org.neo4j.cypher.internal.javacompat.ValueUtils import org.neo4j.cypher.internal.spi.v3_3.QueryContext +import org.neo4j.helpers.ValueUtils import org.neo4j.helpers.collection.PrefetchingIterator import org.neo4j.values.AnyValue import org.neo4j.values.storable.Values.NO_VALUE diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/CreateNodePipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/CreateNodePipe.scala index 272cb49a738b5..a001815f1c148 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/CreateNodePipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/CreateNodePipe.scala @@ -27,8 +27,8 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.helpers.IsMap import org.neo4j.cypher.internal.compatibility.v3_3.runtime.mutation.{GraphElementPropertyFunctions, makeValueNeoSafe} import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id import org.neo4j.cypher.internal.frontend.v3_3.{CypherTypeException, InvalidSemanticsException} -import org.neo4j.cypher.internal.javacompat.ValueUtils import org.neo4j.cypher.internal.spi.v3_3.QueryContext +import org.neo4j.helpers.ValueUtils import org.neo4j.values.AnyValue import org.neo4j.values.storable.Values import org.neo4j.values.virtual.{EdgeValue, NodeValue} diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/CreateRelationshipPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/CreateRelationshipPipe.scala index bfd5d2b84139b..1696fbc759261 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/CreateRelationshipPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/CreateRelationshipPipe.scala @@ -27,8 +27,8 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.helpers.IsMap import org.neo4j.cypher.internal.compatibility.v3_3.runtime.mutation.{GraphElementPropertyFunctions, makeValueNeoSafe} import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id import org.neo4j.cypher.internal.frontend.v3_3.{CypherTypeException, InternalException, InvalidSemanticsException} -import org.neo4j.cypher.internal.javacompat.ValueUtils import org.neo4j.cypher.internal.spi.v3_3.QueryContext +import org.neo4j.helpers.ValueUtils import org.neo4j.values.AnyValue import org.neo4j.values.storable.Values import org.neo4j.values.virtual.{EdgeValue, NodeValue} diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ExpandAllPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ExpandAllPipe.scala index e00409fd9e001..cc39fb054ce1d 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ExpandAllPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ExpandAllPipe.scala @@ -22,8 +22,8 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id import org.neo4j.cypher.internal.frontend.v3_3.{InternalException, SemanticDirection} -import org.neo4j.cypher.internal.javacompat.ValueUtils.{fromNodeProxy, fromRelationshipProxy} import org.neo4j.graphdb.Relationship +import org.neo4j.helpers.ValueUtils.{fromNodeProxy, fromRelationshipProxy} import org.neo4j.values.AnyValue import org.neo4j.values.storable.Values import org.neo4j.values.virtual.NodeValue diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/FullPruningVarLengthExpandPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/FullPruningVarLengthExpandPipe.scala index 02f221b80a0b9..1e0ee4fe162d4 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/FullPruningVarLengthExpandPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/FullPruningVarLengthExpandPipe.scala @@ -23,7 +23,7 @@ import org.neo4j.collection.primitive.{Primitive, PrimitiveLongObjectMap} import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id import org.neo4j.cypher.internal.frontend.v3_3.{InternalException, SemanticDirection} -import org.neo4j.cypher.internal.javacompat.ValueUtils +import org.neo4j.helpers.ValueUtils import org.neo4j.values.virtual.{EdgeValue, NodeValue} case class FullPruningVarLengthExpandPipe(source: Pipe, diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/IdSeekIterator.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/IdSeekIterator.scala index c461d73e4eea7..e91dd5dd6acfe 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/IdSeekIterator.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/IdSeekIterator.scala @@ -21,9 +21,9 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.expressions.NumericHelper -import org.neo4j.cypher.internal.javacompat.ValueUtils import org.neo4j.cypher.internal.spi.v3_3.Operations import org.neo4j.graphdb.{Node, PropertyContainer, Relationship} +import org.neo4j.helpers.ValueUtils import org.neo4j.values.AnyValue abstract class IdSeekIterator[T <: PropertyContainer] diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeByLabelScanPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeByLabelScanPipe.scala index b7436c21721e5..39ad1d426241c 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeByLabelScanPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeByLabelScanPipe.scala @@ -21,7 +21,7 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id -import org.neo4j.cypher.internal.javacompat.ValueUtils +import org.neo4j.helpers.ValueUtils case class NodeByLabelScanPipe(ident: String, label: LazyLabel) (val id: Id = new Id) extends Pipe { diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeIndexContainsScanPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeIndexContainsScanPipe.scala index 1d47787443f26..be2a26c3d4180 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeIndexContainsScanPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeIndexContainsScanPipe.scala @@ -25,8 +25,8 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id import org.neo4j.cypher.internal.compiler.v3_3._ import org.neo4j.cypher.internal.frontend.v3_3.CypherTypeException import org.neo4j.cypher.internal.frontend.v3_3.ast.{LabelToken, PropertyKeyToken} -import org.neo4j.cypher.internal.javacompat.ValueUtils import org.neo4j.graphdb.Node +import org.neo4j.helpers.ValueUtils import org.neo4j.values.storable.{TextValue, Values} abstract class AbstractNodeIndexStringScanPipe(ident: String, diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeIndexScanPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeIndexScanPipe.scala index c954cec906929..81ceb43ec95e8 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeIndexScanPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeIndexScanPipe.scala @@ -23,7 +23,7 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id import org.neo4j.cypher.internal.compiler.v3_3._ import org.neo4j.cypher.internal.frontend.v3_3.ast.{LabelToken, PropertyKeyToken} -import org.neo4j.cypher.internal.javacompat.ValueUtils +import org.neo4j.helpers.ValueUtils case class NodeIndexScanPipe(ident: String, label: LabelToken, diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeIndexSeekPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeIndexSeekPipe.scala index 3da76e552760a..7964f5e301556 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeIndexSeekPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeIndexSeekPipe.scala @@ -25,8 +25,8 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.indexQuery import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id import org.neo4j.cypher.internal.compiler.v3_3._ import org.neo4j.cypher.internal.frontend.v3_3.ast.{LabelToken, PropertyKeyToken} -import org.neo4j.cypher.internal.javacompat.ValueUtils.fromNodeProxy import org.neo4j.cypher.internal.v3_3.logical.plans.QueryExpression +import org.neo4j.helpers.ValueUtils.fromNodeProxy case class NodeIndexSeekPipe(ident: String, label: LabelToken, diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/OptionalExpandAllPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/OptionalExpandAllPipe.scala index 6f03d04adcc1d..fca32bf4f72c7 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/OptionalExpandAllPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/OptionalExpandAllPipe.scala @@ -23,7 +23,7 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.predicates.Predicate import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id import org.neo4j.cypher.internal.frontend.v3_3.{InternalException, SemanticDirection} -import org.neo4j.cypher.internal.javacompat.ValueUtils +import org.neo4j.helpers.ValueUtils import org.neo4j.values.AnyValue import org.neo4j.values.storable.Values import org.neo4j.values.virtual.NodeValue diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/PruningVarLengthExpandPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/PruningVarLengthExpandPipe.scala index 51dc6db3d5081..7441ffaa1f1b1 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/PruningVarLengthExpandPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/PruningVarLengthExpandPipe.scala @@ -23,7 +23,7 @@ import org.neo4j.collection.primitive.{Primitive, PrimitiveLongObjectMap} import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id import org.neo4j.cypher.internal.frontend.v3_3.{InternalException, SemanticDirection} -import org.neo4j.cypher.internal.javacompat.ValueUtils +import org.neo4j.helpers.ValueUtils import org.neo4j.values.virtual.{EdgeValue, NodeValue} case class PruningVarLengthExpandPipe(source: Pipe, diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/StartPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/StartPipe.scala index 053815f89b993..541d60dc035c4 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/StartPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/StartPipe.scala @@ -23,8 +23,8 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.executionplan.{Effects, ReadsAllNodes} import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id import org.neo4j.cypher.internal.frontend.v3_3.symbols._ -import org.neo4j.cypher.internal.javacompat.ValueUtils import org.neo4j.graphdb.{Node, PropertyContainer, Relationship} +import org.neo4j.helpers.ValueUtils import org.neo4j.values.AnyValue sealed abstract class StartPipe[T <: PropertyContainer](source: Pipe, diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/VarLengthExpandPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/VarLengthExpandPipe.scala index 0635b90d32163..dc3dcaae8d066 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/VarLengthExpandPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/VarLengthExpandPipe.scala @@ -22,7 +22,7 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id import org.neo4j.cypher.internal.frontend.v3_3.{InternalException, SemanticDirection} -import org.neo4j.cypher.internal.javacompat.ValueUtils +import org.neo4j.helpers.ValueUtils import org.neo4j.values.storable.Values import org.neo4j.values.virtual.{EdgeValue, NodeValue, VirtualValues} diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/matching/PatternRelationship.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/matching/PatternRelationship.scala index 65b83a2a64ab3..81557a40c84ce 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/matching/PatternRelationship.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/matching/PatternRelationship.scala @@ -26,8 +26,8 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes.{LazyTypes, Qu import org.neo4j.cypher.internal.frontend.v3_3.SemanticDirection import org.neo4j.cypher.internal.frontend.v3_3.SemanticDirection.{BOTH, INCOMING, OUTGOING} import org.neo4j.cypher.internal.frontend.v3_3.symbols._ -import org.neo4j.cypher.internal.javacompat.ValueUtils import org.neo4j.graphdb.Path +import org.neo4j.helpers.ValueUtils import org.neo4j.values.virtual.{EdgeValue, NodeValue} import scala.collection.JavaConverters._ diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/valueHelper.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/valueHelper.scala index 0063bd1e732d0..3e126d7d76046 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/valueHelper.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/valueHelper.scala @@ -21,7 +21,7 @@ package org.neo4j.cypher.internal.compatibility import java.util.function.BiConsumer -import org.neo4j.cypher.internal.javacompat.{NodeProxyWrappingNodeValue, RelationshipProxyWrappingEdgeValue} +import org.neo4j.helpers.{NodeProxyWrappingNodeValue, RelationshipProxyWrappingEdgeValue} import org.neo4j.values.AnyValue import org.neo4j.values.storable._ import org.neo4j.values.virtual.{ListValue, MapValue} diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v3_3/TransactionBoundQueryContext.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v3_3/TransactionBoundQueryContext.scala index cba443033941a..a32e946456d0e 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v3_3/TransactionBoundQueryContext.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v3_3/TransactionBoundQueryContext.scala @@ -34,7 +34,7 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes.matching.Patte import org.neo4j.cypher.internal.compiler.v3_3.MinMaxOrdering._ import org.neo4j.cypher.internal.compiler.v3_3.{IndexDescriptor, _} import org.neo4j.cypher.internal.frontend.v3_3._ -import org.neo4j.cypher.internal.javacompat.{NodeProxyWrappingNodeValue, RelationshipProxyWrappingEdgeValue, ValueToObjectSerializer} +import org.neo4j.cypher.internal.javacompat.ValueToObjectSerializer import org.neo4j.cypher.internal.spi.BeansAPIRelationshipIterator import org.neo4j.cypher.internal.spi.v3_3.TransactionBoundQueryContext.IndexSearchMonitor import org.neo4j.cypher.internal.v3_3.logical.plans.QualifiedName @@ -46,6 +46,7 @@ import org.neo4j.graphdb.RelationshipType._ import org.neo4j.graphdb._ import org.neo4j.graphdb.security.URLAccessValidationError import org.neo4j.graphdb.traversal.{Evaluators, TraversalDescription, Uniqueness} +import org.neo4j.helpers.{NodeProxyWrappingNodeValue, RelationshipProxyWrappingEdgeValue} import org.neo4j.kernel.GraphDatabaseQueryService import org.neo4j.kernel.api._ import org.neo4j.kernel.api.exceptions.ProcedureException diff --git a/community/cypher/cypher/src/test/java/org/neo4j/cypher/internal/javacompat/ExecutionEngineTest.java b/community/cypher/cypher/src/test/java/org/neo4j/cypher/internal/javacompat/ExecutionEngineTest.java index 21e5d0f43d4e6..1174fd0b0dc6b 100644 --- a/community/cypher/cypher/src/test/java/org/neo4j/cypher/internal/javacompat/ExecutionEngineTest.java +++ b/community/cypher/cypher/src/test/java/org/neo4j/cypher/internal/javacompat/ExecutionEngineTest.java @@ -46,6 +46,7 @@ import static org.hamcrest.core.Is.is; import static org.junit.Assert.assertThat; +import static org.neo4j.values.virtual.VirtualValues.EMPTY_MAP; public class ExecutionEngineTest { @@ -95,6 +96,6 @@ private TransactionalContext createTransactionContext( GraphDatabaseQueryService { PropertyContainerLocker locker = new PropertyContainerLocker(); TransactionalContextFactory contextFactory = Neo4jTransactionalContextFactory.create( graph, locker ); - return contextFactory.newContext( ClientConnectionInfo.EMBEDDED_CONNECTION, tx, query, Collections.emptyMap() ); + return contextFactory.newContext( ClientConnectionInfo.EMBEDDED_CONNECTION, tx, query, EMPTY_MAP ); } } diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/KillQueryTest.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/KillQueryTest.scala index 70964df5d0029..271acd8e412a6 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/KillQueryTest.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/KillQueryTest.scala @@ -21,7 +21,7 @@ package org.neo4j.cypher import java.util import java.util.concurrent.ArrayBlockingQueue -import java.util.concurrent.atomic.{AtomicBoolean, AtomicInteger} +import java.util.concurrent.atomic.AtomicBoolean import org.neo4j.cypher.internal.{CommunityCompatibilityFactory, ExecutionEngine} import org.neo4j.graphdb.{TransactionTerminatedException, TransientTransactionFailureException} @@ -31,6 +31,7 @@ import org.neo4j.kernel.impl.coreapi.PropertyContainerLocker import org.neo4j.kernel.impl.query.clientconnection.ClientConnectionInfo import org.neo4j.kernel.impl.query.{Neo4jTransactionalContextFactory, TransactionalContext, TransactionalContextFactory} import org.neo4j.logging.NullLogProvider +import org.neo4j.values.virtual.VirtualValues.EMPTY_MAP class KillQueryTest extends ExecutionEngineFunSuite { /* @@ -107,7 +108,7 @@ class KillQueryTest extends ExecutionEngineFunSuite { while (continue.get()) { val tx = graph.beginTransaction(Type.`implicit`, AUTH_DISABLED) try { - val transactionalContext: TransactionalContext = contextFactory.newContext(connectionInfo, tx, query, emptyMap) + val transactionalContext: TransactionalContext = contextFactory.newContext(connectionInfo, tx, query, EMPTY_MAP) tcs.put(transactionalContext) val result = engine.execute(query, Map.empty[String, AnyRef], transactionalContext) result.resultAsString() diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/MatchingContextTest.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/MatchingContextTest.scala index a0e64743aefc6..31d5530e64a22 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/MatchingContextTest.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/MatchingContextTest.scala @@ -32,7 +32,7 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.symbols.SymbolTable import org.neo4j.cypher.internal.compiler.v3_3.QueryStateTestSupport import org.neo4j.cypher.internal.frontend.v3_3.SemanticDirection import org.neo4j.cypher.internal.frontend.v3_3.symbols._ -import org.neo4j.cypher.internal.javacompat.ValueUtils +import org.neo4j.helpers.ValueUtils import org.neo4j.values.AnyValue import scala.collection.Map diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/ImplicitValueConversion.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/ImplicitValueConversion.scala index db17341dc3215..01d6d5b009391 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/ImplicitValueConversion.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/ImplicitValueConversion.scala @@ -20,8 +20,8 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.expressions.PathImpl -import org.neo4j.cypher.internal.javacompat.ValueUtils import org.neo4j.graphdb.{Node, Path, Relationship} +import org.neo4j.helpers.ValueUtils import org.neo4j.values._ import org.neo4j.values.storable.Values._ import org.neo4j.values.storable._ diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/commands/LengthFunctionTest.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/commands/LengthFunctionTest.scala index f2656983dc207..70dd927711873 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/commands/LengthFunctionTest.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/commands/LengthFunctionTest.scala @@ -24,8 +24,8 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ImplicitValueConvers import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.expressions.{LengthFunction, PathImpl, Variable} import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes.QueryStateHelper import org.neo4j.cypher.internal.frontend.v3_3.test_helpers.CypherFunSuite -import org.neo4j.cypher.internal.javacompat.ValueUtils import org.neo4j.graphdb.{Node, Relationship} +import org.neo4j.helpers.ValueUtils import org.neo4j.values.storable.Values.intValue class LengthFunctionTest extends CypherFunSuite { diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/commands/expressions/PathValueBuilderTest.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/commands/expressions/PathValueBuilderTest.scala index 7a3af67823cee..95b72c5188e52 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/commands/expressions/PathValueBuilderTest.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/commands/expressions/PathValueBuilderTest.scala @@ -22,8 +22,8 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.expression import org.mockito.Mockito import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ImplicitValueConversion._ import org.neo4j.cypher.internal.frontend.v3_3.test_helpers.CypherFunSuite -import org.neo4j.cypher.internal.javacompat.ValueUtils.asPathValue import org.neo4j.graphdb.{Node, Relationship, RelationshipType} +import org.neo4j.helpers.ValueUtils.asPathValue import org.neo4j.values.storable.Values.NO_VALUE class PathValueBuilderTest extends CypherFunSuite { diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/mutation/GraphElementPropertyFunctionsTest.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/mutation/GraphElementPropertyFunctionsTest.scala index 3efa9529fb419..d9e0c47d2fa6b 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/mutation/GraphElementPropertyFunctionsTest.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/mutation/GraphElementPropertyFunctionsTest.scala @@ -20,7 +20,7 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.mutation import org.neo4j.cypher.internal.frontend.v3_3.test_helpers.CypherFunSuite -import org.neo4j.cypher.internal.javacompat.ValueUtils +import org.neo4j.helpers.ValueUtils import org.neo4j.values.storable.ArrayValue import org.neo4j.values.storable.Values._ diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ExpandAllPipeTest.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ExpandAllPipeTest.scala index 089be1bab8fa8..a8093adad5c5f 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ExpandAllPipeTest.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ExpandAllPipeTest.scala @@ -27,10 +27,10 @@ import org.mockito.stubbing.Answer import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.frontend.v3_3.SemanticDirection import org.neo4j.cypher.internal.frontend.v3_3.test_helpers.CypherFunSuite -import org.neo4j.cypher.internal.javacompat.ValueUtils -import org.neo4j.cypher.internal.javacompat.ValueUtils.{fromNodeProxy, fromRelationshipProxy} import org.neo4j.cypher.internal.spi.v3_3.QueryContext import org.neo4j.graphdb.{Node, Relationship} +import org.neo4j.helpers.ValueUtils +import org.neo4j.helpers.ValueUtils.{fromNodeProxy, fromRelationshipProxy} class ExpandAllPipeTest extends CypherFunSuite { diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ExpandIntoPipeTest.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ExpandIntoPipeTest.scala index 7fbbc7b7eba0d..b205a1032321e 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ExpandIntoPipeTest.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ExpandIntoPipeTest.scala @@ -26,8 +26,8 @@ import org.mockito.stubbing.Answer import org.neo4j.cypher.internal.frontend.v3_3.SemanticDirection import org.neo4j.cypher.internal.frontend.v3_3.symbols._ import org.neo4j.cypher.internal.frontend.v3_3.test_helpers.CypherFunSuite -import org.neo4j.cypher.internal.javacompat.ValueUtils.{fromNodeProxy, fromRelationshipProxy} import org.neo4j.graphdb.Relationship +import org.neo4j.helpers.ValueUtils.{fromNodeProxy, fromRelationshipProxy} class ExpandIntoPipeTest extends CypherFunSuite with PipeTestSupport { diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/FakePipe.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/FakePipe.scala index 412c0eac7f5f3..8239d5a886e9d 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/FakePipe.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/FakePipe.scala @@ -22,7 +22,7 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id import org.neo4j.cypher.internal.frontend.v3_3.symbols.CypherType -import org.neo4j.cypher.internal.javacompat.ValueUtils +import org.neo4j.helpers.ValueUtils import org.scalatest.mock.MockitoSugar import scala.collection.Map diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeByIdSeekPipeTest.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeByIdSeekPipeTest.scala index 70ecd39f6a336..203ed4930a82e 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeByIdSeekPipeTest.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeByIdSeekPipeTest.scala @@ -22,9 +22,9 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.mockito.Mockito import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.expressions.{ListLiteral, Literal} import org.neo4j.cypher.internal.frontend.v3_3.test_helpers.CypherFunSuite -import org.neo4j.cypher.internal.javacompat.ValueUtils.fromNodeProxy import org.neo4j.cypher.internal.spi.v3_3.{Operations, QueryContext} import org.neo4j.graphdb.Node +import org.neo4j.helpers.ValueUtils.fromNodeProxy class NodeByIdSeekPipeTest extends CypherFunSuite { diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeByLabelScanPipeTest.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeByLabelScanPipeTest.scala index 0325ed28ac49b..abc3ee26ecd9a 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeByLabelScanPipeTest.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeByLabelScanPipeTest.scala @@ -22,9 +22,9 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.frontend.v3_3.ast.LabelName import org.neo4j.cypher.internal.frontend.v3_3.test_helpers.CypherFunSuite import org.neo4j.cypher.internal.frontend.v3_3.{LabelId, SemanticTable} -import org.neo4j.cypher.internal.javacompat.ValueUtils.fromNodeProxy import org.neo4j.cypher.internal.spi.v3_3.QueryContext import org.neo4j.graphdb.Node +import org.neo4j.helpers.ValueUtils.fromNodeProxy class NodeByLabelScanPipeTest extends CypherFunSuite { diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeHashJoinPipeTest.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeHashJoinPipeTest.scala index fdc1c85046bf3..0192dc91cdda2 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeHashJoinPipeTest.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeHashJoinPipeTest.scala @@ -28,8 +28,8 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.symbols.SymbolTable import org.neo4j.cypher.internal.compiler.v3_3.test_helpers.TestableIterator import org.neo4j.cypher.internal.frontend.v3_3.symbols._ import org.neo4j.cypher.internal.frontend.v3_3.test_helpers.CypherFunSuite -import org.neo4j.cypher.internal.javacompat.ValueUtils.fromNodeProxy import org.neo4j.graphdb.Node +import org.neo4j.helpers.ValueUtils.fromNodeProxy import org.neo4j.values.AnyValue import org.neo4j.values.storable.Values.{NO_VALUE, intValue} diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeIndexScanPipeTest.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeIndexScanPipeTest.scala index f8995239e4369..e42ba9bb89242 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeIndexScanPipeTest.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeIndexScanPipeTest.scala @@ -25,9 +25,9 @@ import org.neo4j.cypher.internal.compiler.v3_3.IndexDescriptor import org.neo4j.cypher.internal.frontend.v3_3.ast.{LabelToken, PropertyKeyToken, _} import org.neo4j.cypher.internal.frontend.v3_3.test_helpers.CypherFunSuite import org.neo4j.cypher.internal.frontend.v3_3.{LabelId, PropertyKeyId} -import org.neo4j.cypher.internal.javacompat.ValueUtils.fromNodeProxy import org.neo4j.cypher.internal.spi.v3_3.QueryContext import org.neo4j.graphdb.Node +import org.neo4j.helpers.ValueUtils.fromNodeProxy class NodeIndexScanPipeTest extends CypherFunSuite with AstConstructionTestSupport { diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeIndexSeekPipeTest.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeIndexSeekPipeTest.scala index 0629688325dfc..cb2edf043b75e 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeIndexSeekPipeTest.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeIndexSeekPipeTest.scala @@ -28,10 +28,10 @@ import org.neo4j.cypher.internal.compiler.v3_3._ import org.neo4j.cypher.internal.frontend.v3_3.ast._ import org.neo4j.cypher.internal.frontend.v3_3.test_helpers.{CypherFunSuite, WindowsStringSafe} import org.neo4j.cypher.internal.frontend.v3_3.{CypherTypeException, LabelId, PropertyKeyId} -import org.neo4j.cypher.internal.javacompat.ValueUtils.fromNodeProxy import org.neo4j.cypher.internal.spi.v3_3.QueryContext import org.neo4j.cypher.internal.v3_3.logical.plans.{CompositeQueryExpression, ManyQueryExpression, SingleQueryExpression} import org.neo4j.graphdb.Node +import org.neo4j.helpers.ValueUtils.fromNodeProxy import org.neo4j.values.storable.Values.stringValue class NodeIndexSeekPipeTest extends CypherFunSuite with AstConstructionTestSupport { diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeOuterHashJoinPipeTest.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeOuterHashJoinPipeTest.scala index 8005d45507865..88fbc07876106 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeOuterHashJoinPipeTest.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeOuterHashJoinPipeTest.scala @@ -25,8 +25,8 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ImplicitValueConversion._ import org.neo4j.cypher.internal.compiler.v3_3.test_helpers.TestableIterator import org.neo4j.cypher.internal.frontend.v3_3.test_helpers.CypherFunSuite -import org.neo4j.cypher.internal.javacompat.ValueUtils.fromNodeProxy import org.neo4j.graphdb.Node +import org.neo4j.helpers.ValueUtils.fromNodeProxy import org.neo4j.values.AnyValue import org.neo4j.values.storable.Values.{NO_VALUE, intValue} diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/OptionalExpandAllPipeTest.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/OptionalExpandAllPipeTest.scala index d5b95a639b0ed..eeb5242d4da19 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/OptionalExpandAllPipeTest.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/OptionalExpandAllPipeTest.scala @@ -28,9 +28,9 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ImplicitValueConvers import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.predicates.{Not, Predicate, True} import org.neo4j.cypher.internal.frontend.v3_3.SemanticDirection import org.neo4j.cypher.internal.frontend.v3_3.test_helpers.CypherFunSuite -import org.neo4j.cypher.internal.javacompat.ValueUtils.{fromNodeProxy, fromRelationshipProxy} import org.neo4j.cypher.internal.spi.v3_3.QueryContext import org.neo4j.graphdb.{Node, Relationship} +import org.neo4j.helpers.ValueUtils.{fromNodeProxy, fromRelationshipProxy} import org.neo4j.values.AnyValue import org.neo4j.values.storable.Values.NO_VALUE diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/OptionalExpandIntoPipeTest.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/OptionalExpandIntoPipeTest.scala index 0861d00996dc2..ba16ec71a23d1 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/OptionalExpandIntoPipeTest.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/OptionalExpandIntoPipeTest.scala @@ -28,9 +28,9 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ImplicitValueConvers import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.predicates.{Not, Predicate, True} import org.neo4j.cypher.internal.frontend.v3_3.SemanticDirection import org.neo4j.cypher.internal.frontend.v3_3.test_helpers.CypherFunSuite -import org.neo4j.cypher.internal.javacompat.ValueUtils.{fromNodeProxy, fromRelationshipProxy} import org.neo4j.cypher.internal.spi.v3_3.QueryContext import org.neo4j.graphdb.{Node, Relationship} +import org.neo4j.helpers.ValueUtils.{fromNodeProxy, fromRelationshipProxy} import org.neo4j.values.AnyValue import org.neo4j.values.storable.Values.NO_VALUE diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/PipeTestSupport.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/PipeTestSupport.scala index 9ce3a1631d585..70c0b7e040143 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/PipeTestSupport.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/PipeTestSupport.scala @@ -28,9 +28,9 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id import org.neo4j.cypher.internal.frontend.v3_3.SemanticDirection import org.neo4j.cypher.internal.frontend.v3_3.symbols.{CypherType, _} import org.neo4j.cypher.internal.frontend.v3_3.test_helpers.CypherTestSupport -import org.neo4j.cypher.internal.javacompat.ValueUtils import org.neo4j.cypher.internal.spi.v3_3.QueryContext import org.neo4j.graphdb.{Node, Relationship} +import org.neo4j.helpers.ValueUtils import org.scalatest.mock.MockitoSugar trait PipeTestSupport extends CypherTestSupport with MockitoSugar { diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ProjectEndpointsPipeTest.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ProjectEndpointsPipeTest.scala index 0b9ec548d260a..8a388f606743a 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ProjectEndpointsPipeTest.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ProjectEndpointsPipeTest.scala @@ -27,9 +27,9 @@ import org.neo4j.cypher.ValueComparisonHelper.beEquivalentTo import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ImplicitValueConversion._ import org.neo4j.cypher.internal.frontend.v3_3.test_helpers.CypherFunSuite -import org.neo4j.cypher.internal.javacompat.ValueUtils.{asListOfEdges, fromNodeProxy} import org.neo4j.cypher.internal.spi.v3_3.QueryContext import org.neo4j.graphdb.{Node, Relationship} +import org.neo4j.helpers.ValueUtils.{asListOfEdges, fromNodeProxy} import org.neo4j.values.AnyValue class ProjectEndpointsPipeTest extends CypherFunSuite { diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/QueryStateHelper.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/QueryStateHelper.scala index 11279ceaa114a..700e098b2f6fe 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/QueryStateHelper.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/QueryStateHelper.scala @@ -23,10 +23,10 @@ import org.mockito.invocation.InvocationOnMock import org.mockito.stubbing.Answer import org.mockito.{Matchers, Mockito} import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext -import org.neo4j.cypher.internal.javacompat.BaseToObjectValueWriter import org.neo4j.cypher.internal.spi.v3_3.QueryContext import org.neo4j.graphdb.spatial.Point import org.neo4j.graphdb.{Node, Relationship} +import org.neo4j.helpers.BaseToObjectValueWriter import org.neo4j.values.AnyValue import org.neo4j.values.virtual.MapValue import org.neo4j.values.virtual.VirtualValues.EMPTY_MAP diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/TopPipeTest.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/TopPipeTest.scala index 0c1e2370add96..bb7772428b3f1 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/TopPipeTest.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/TopPipeTest.scala @@ -22,7 +22,7 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.expressions.Literal import org.neo4j.cypher.internal.frontend.v3_3.symbols._ import org.neo4j.cypher.internal.frontend.v3_3.test_helpers.CypherFunSuite -import org.neo4j.cypher.internal.javacompat.ValueUtils +import org.neo4j.helpers.ValueUtils import scala.util.Random diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/TriadicSelectionPipeTest.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/TriadicSelectionPipeTest.scala index 2ffc7859b316d..f824855c6a73b 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/TriadicSelectionPipeTest.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/TriadicSelectionPipeTest.scala @@ -23,7 +23,7 @@ import org.neo4j.collection.primitive.PrimitiveLongIterable import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.frontend.v3_3.symbols._ import org.neo4j.cypher.internal.frontend.v3_3.test_helpers.CypherFunSuite -import org.neo4j.cypher.internal.javacompat.ValueUtils +import org.neo4j.helpers.ValueUtils import org.neo4j.kernel.impl.core.NodeProxy import org.neo4j.values.AnyValue import org.neo4j.values.virtual.NodeValue diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/UndirectedDirectedRelationshipByIdSeekPipeTest.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/UndirectedDirectedRelationshipByIdSeekPipeTest.scala index 5ef5e2510b45f..e18e0614182dc 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/UndirectedDirectedRelationshipByIdSeekPipeTest.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/UndirectedDirectedRelationshipByIdSeekPipeTest.scala @@ -24,9 +24,9 @@ import org.neo4j.cypher.ValueComparisonHelper.beEquivalentTo import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.expressions.{ListLiteral, Literal} import org.neo4j.cypher.internal.frontend.v3_3.test_helpers.CypherFunSuite -import org.neo4j.cypher.internal.javacompat.ValueUtils.{fromNodeProxy, fromRelationshipProxy} import org.neo4j.cypher.internal.spi.v3_3.{Operations, QueryContext} import org.neo4j.graphdb.{Node, Relationship} +import org.neo4j.helpers.ValueUtils.{fromNodeProxy, fromRelationshipProxy} class UndirectedDirectedRelationshipByIdSeekPipeTest extends CypherFunSuite { diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/aggregation/PercentileFunctionsTest.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/aggregation/PercentileFunctionsTest.scala index 8b7b7bb1284d0..8e41dfc2d782b 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/aggregation/PercentileFunctionsTest.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/aggregation/PercentileFunctionsTest.scala @@ -23,7 +23,7 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.expressions.{Expression, Literal, NumericHelper, Variable} import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes.QueryStateHelper import org.neo4j.cypher.internal.frontend.v3_3.test_helpers.CypherFunSuite -import org.neo4j.cypher.internal.javacompat.ValueUtils +import org.neo4j.helpers.ValueUtils import org.neo4j.values.AnyValue import org.neo4j.values.storable.Values.doubleValue diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/aggregation/StdevFunctionTest.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/aggregation/StdevFunctionTest.scala index 6ed857e81dc9a..a8c342aee6462 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/aggregation/StdevFunctionTest.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/aggregation/StdevFunctionTest.scala @@ -23,7 +23,7 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.expressions.{Expression, NumericHelper, Variable} import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes.QueryStateHelper import org.neo4j.cypher.internal.frontend.v3_3.test_helpers.CypherFunSuite -import org.neo4j.cypher.internal.javacompat.ValueUtils +import org.neo4j.helpers.ValueUtils import org.neo4j.values.storable.DoubleValue trait StdevTest { diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiler/v3_3/AllShortestPathsPipeTest.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiler/v3_3/AllShortestPathsPipeTest.scala index e174cb5b9d446..b07591e16a729 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiler/v3_3/AllShortestPathsPipeTest.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiler/v3_3/AllShortestPathsPipeTest.scala @@ -25,8 +25,8 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes.{FakePipe, Sho import org.neo4j.cypher.internal.compiler.v3_3.QueryStateHelper.withQueryState import org.neo4j.cypher.internal.frontend.v3_3.SemanticDirection import org.neo4j.cypher.internal.frontend.v3_3.symbols._ -import org.neo4j.cypher.internal.javacompat.ValueUtils.fromNodeProxy import org.neo4j.graphdb.Node +import org.neo4j.helpers.ValueUtils.fromNodeProxy import org.neo4j.values.virtual.PathValue import org.neo4j.values.virtual.VirtualValues.EMPTY_MAP diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiler/v3_3/PathExpressionTest.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiler/v3_3/PathExpressionTest.scala index 9b261d0fe8dbf..460a8c7f65635 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiler/v3_3/PathExpressionTest.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiler/v3_3/PathExpressionTest.scala @@ -27,7 +27,7 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.expressions import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.predicates.{NonEmpty, True} import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.values.UnresolvedLabel import org.neo4j.cypher.internal.frontend.v3_3.SemanticDirection -import org.neo4j.cypher.internal.javacompat.ValueUtils.fromNodeProxy +import org.neo4j.helpers.ValueUtils.fromNodeProxy import org.neo4j.values.storable.Values.{FALSE, TRUE} import org.neo4j.values.virtual.PathValue diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiler/v3_3/QueryStateHelper.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiler/v3_3/QueryStateHelper.scala index a0d9069aebb1b..256e109023853 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiler/v3_3/QueryStateHelper.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiler/v3_3/QueryStateHelper.scala @@ -19,8 +19,6 @@ */ package org.neo4j.cypher.internal.compiler.v3_3 -import java.util.Collections - import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes.{ExternalCSVResource, NullPipeDecorator, PipeDecorator, QueryState} import org.neo4j.cypher.internal.spi.v3_3.TransactionBoundQueryContext.IndexSearchMonitor import org.neo4j.cypher.internal.spi.v3_3.{QueryContext, TransactionBoundQueryContext, TransactionalContextWrapper, UpdateCountingQueryContext} @@ -46,7 +44,7 @@ object QueryStateHelper { def queryStateFrom(db: GraphDatabaseQueryService, tx: InternalTransaction, params: MapValue = EMPTY_MAP): QueryState = { val searchMonitor = new KernelMonitors().newMonitor(classOf[IndexSearchMonitor]) val contextFactory = Neo4jTransactionalContextFactory.create(db, locker) - val transactionalContext = TransactionalContextWrapper(contextFactory.newContext(ClientConnectionInfo.EMBEDDED_CONNECTION, tx, "X", Collections.emptyMap())) + val transactionalContext = TransactionalContextWrapper(contextFactory.newContext(ClientConnectionInfo.EMBEDDED_CONNECTION, tx, "X", EMPTY_MAP)) val queryContext = new TransactionBoundQueryContext(transactionalContext)(searchMonitor) newWith(db = db, query = queryContext, params = params) } diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiler/v3_3/SingleShortestPathPipeTest.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiler/v3_3/SingleShortestPathPipeTest.scala index 3bcd928a8b380..7d6637e76fa7f 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiler/v3_3/SingleShortestPathPipeTest.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiler/v3_3/SingleShortestPathPipeTest.scala @@ -25,8 +25,8 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes.{FakePipe, Sho import org.neo4j.cypher.internal.compiler.v3_3.QueryStateHelper.withQueryState import org.neo4j.cypher.internal.frontend.v3_3.SemanticDirection import org.neo4j.cypher.internal.frontend.v3_3.symbols._ -import org.neo4j.cypher.internal.javacompat.ValueUtils.{fromNodeProxy, fromRelationshipProxy} import org.neo4j.graphdb.Node +import org.neo4j.helpers.ValueUtils.{fromNodeProxy, fromRelationshipProxy} import org.neo4j.values.virtual.PathValue import org.neo4j.values.virtual.VirtualValues.EMPTY_MAP diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiler/v3_3/pipes/ActualCostCalculationTest.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiler/v3_3/pipes/ActualCostCalculationTest.scala index 5263057870b0b..72b5fa9be4c6f 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiler/v3_3/pipes/ActualCostCalculationTest.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiler/v3_3/pipes/ActualCostCalculationTest.scala @@ -21,7 +21,6 @@ package org.neo4j.cypher.internal.compiler.v3_3.pipes import java.io.File import java.nio.file.Files -import java.util.Collections import java.util.concurrent.TimeUnit import org.apache.commons.math3.stat.regression.{OLSMultipleLinearRegression, SimpleRegression} @@ -45,6 +44,7 @@ import org.neo4j.kernel.impl.coreapi.{InternalTransaction, PropertyContainerLock import org.neo4j.kernel.impl.query.Neo4jTransactionalContextFactory import org.neo4j.kernel.impl.query.clientconnection.ClientConnectionInfo import org.neo4j.test.TestGraphDatabaseFactory +import org.neo4j.values.virtual.VirtualValues.EMPTY_MAP import scala.collection.mutable import scala.collection.mutable.ListBuffer @@ -231,7 +231,7 @@ class ActualCostCalculationTest extends CypherFunSuite { private def transactionContext(graph: GraphDatabaseQueryService, tx: InternalTransaction) = { val contextFactory = Neo4jTransactionalContextFactory.create(graph, new PropertyContainerLocker) - contextFactory.newContext(ClientConnectionInfo.EMBEDDED_CONNECTION, tx, "X", Collections.emptyMap()) + contextFactory.newContext(ClientConnectionInfo.EMBEDDED_CONNECTION, tx, "X", EMPTY_MAP) } //executes the provided pipes and returns execution times diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiler/v3_3/pipes/FullPruningVarLengthExpandPipeTest.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiler/v3_3/pipes/FullPruningVarLengthExpandPipeTest.scala index 8ed2d9c1d03df..6ebd457bfb166 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiler/v3_3/pipes/FullPruningVarLengthExpandPipeTest.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiler/v3_3/pipes/FullPruningVarLengthExpandPipeTest.scala @@ -28,8 +28,8 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.values.Unre import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes._ import org.neo4j.cypher.internal.compiler.v3_3.QueryStateHelper.withQueryState import org.neo4j.cypher.internal.frontend.v3_3.SemanticDirection -import org.neo4j.cypher.internal.javacompat.ValueUtils.fromNodeProxy import org.neo4j.graphdb.Node +import org.neo4j.helpers.ValueUtils.fromNodeProxy import org.neo4j.kernel.api.KernelTransaction.Type import org.neo4j.kernel.api.security.SecurityContext import org.neo4j.values.virtual.VirtualValues.EMPTY_MAP diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiler/v3_3/pipes/PruningVarLengthExpandPipeTest.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiler/v3_3/pipes/PruningVarLengthExpandPipeTest.scala index df87e343a15a6..3c0310e584ce5 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiler/v3_3/pipes/PruningVarLengthExpandPipeTest.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiler/v3_3/pipes/PruningVarLengthExpandPipeTest.scala @@ -27,8 +27,8 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.values.Unre import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes._ import org.neo4j.cypher.internal.compiler.v3_3.QueryStateHelper.withQueryState import org.neo4j.cypher.internal.frontend.v3_3.SemanticDirection -import org.neo4j.cypher.internal.javacompat.ValueUtils._ import org.neo4j.graphdb.Node +import org.neo4j.helpers.ValueUtils._ import org.neo4j.kernel.api.KernelTransaction.Type import org.neo4j.kernel.api.security.SecurityContext import org.neo4j.values.virtual.VirtualValues.EMPTY_MAP diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/helpers/GraphIcing.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/helpers/GraphIcing.scala index f29ce5c8882d7..d087036270170 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/helpers/GraphIcing.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/helpers/GraphIcing.scala @@ -27,6 +27,7 @@ import org.neo4j.cypher.internal.isGraphKernelResultValue import org.neo4j.cypher.javacompat.internal.GraphDatabaseCypherService import org.neo4j.graphdb.Label._ import org.neo4j.graphdb._ +import org.neo4j.helpers.ValueUtils.asMapValue import org.neo4j.kernel.GraphDatabaseQueryService import org.neo4j.kernel.api.KernelTransaction.Type import org.neo4j.kernel.api.Statement @@ -112,7 +113,7 @@ trait GraphIcing { val javaParams = javaValues.asDeepJavaMap(params).asInstanceOf[util.Map[String, AnyRef]] val contextFactory = Neo4jTransactionalContextFactory.create(graphService, locker) - val transactionalContext = contextFactory.newContext(ClientConnectionInfo.EMBEDDED_CONNECTION, tx, queryText, javaParams) + val transactionalContext = contextFactory.newContext(ClientConnectionInfo.EMBEDDED_CONNECTION, tx, queryText, asMapValue(javaParams)) (tx, transactionalContext) } diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/spi/v3_3/TransactionBoundPlanContextTest.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/spi/v3_3/TransactionBoundPlanContextTest.scala index 9872c2e0fd748..952674168336b 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/spi/v3_3/TransactionBoundPlanContextTest.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/spi/v3_3/TransactionBoundPlanContextTest.scala @@ -19,8 +19,6 @@ */ package org.neo4j.cypher.internal.spi.v3_3 -import java.util.Collections - import org.neo4j.cypher.internal.frontend.v3_3.phases.devNullLogger import org.neo4j.cypher.internal.frontend.v3_3.test_helpers.CypherFunSuite import org.neo4j.cypher.internal.frontend.v3_3.{LabelId, RelTypeId} @@ -33,6 +31,7 @@ import org.neo4j.kernel.impl.coreapi.{InternalTransaction, PropertyContainerLock import org.neo4j.kernel.impl.query.Neo4jTransactionalContextFactory import org.neo4j.kernel.impl.query.clientconnection.ClientConnectionInfo import org.neo4j.test.TestGraphDatabaseFactory +import org.neo4j.values.virtual.VirtualValues.EMPTY_MAP class TransactionBoundPlanContextTest extends CypherFunSuite { @@ -40,7 +39,7 @@ class TransactionBoundPlanContextTest extends CypherFunSuite { private def createTransactionContext(graphDatabaseCypherService: GraphDatabaseCypherService, transaction: InternalTransaction) = { val contextFactory = Neo4jTransactionalContextFactory.create(graphDatabaseCypherService, new PropertyContainerLocker) - contextFactory.newContext(ClientConnectionInfo.EMBEDDED_CONNECTION, transaction, "no query", Collections.emptyMap()) + contextFactory.newContext(ClientConnectionInfo.EMBEDDED_CONNECTION, transaction, "no query", EMPTY_MAP) } override protected def initTest(): Unit = { diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/spi/v3_3/TransactionBoundQueryContextTest.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/spi/v3_3/TransactionBoundQueryContextTest.scala index 6048888d3680f..ddd4399590aeb 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/spi/v3_3/TransactionBoundQueryContextTest.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/spi/v3_3/TransactionBoundQueryContextTest.scala @@ -20,7 +20,6 @@ package org.neo4j.cypher.internal.spi.v3_3 import java.net.URL -import java.util.Collections import org.hamcrest.Matchers.greaterThan import org.junit.Assert.assertThat @@ -46,6 +45,7 @@ import org.neo4j.kernel.impl.query.clientconnection.ClientConnectionInfo import org.neo4j.kernel.impl.query.{Neo4jTransactionalContext, Neo4jTransactionalContextFactory} import org.neo4j.storageengine.api.StorageStatement import org.neo4j.test.TestGraphDatabaseFactory +import org.neo4j.values.virtual.VirtualValues.EMPTY_MAP import scala.collection.JavaConverters._ @@ -197,7 +197,7 @@ class TransactionBoundQueryContextTest extends CypherFunSuite { private def createTransactionContext(graphDatabaseCypherService: GraphDatabaseCypherService, transaction: InternalTransaction) = { val contextFactory = Neo4jTransactionalContextFactory.create(graphDatabaseCypherService, new PropertyContainerLocker) - contextFactory.newContext(ClientConnectionInfo.EMBEDDED_CONNECTION, transaction, "no query", Collections.emptyMap()) + contextFactory.newContext(ClientConnectionInfo.EMBEDDED_CONNECTION, transaction, "no query", EMPTY_MAP) } private def createMiniGraph(relTypeName: String): Node = { diff --git a/community/cypher/cypher/src/main/java/org/neo4j/cypher/internal/javacompat/BaseToObjectValueWriter.java b/community/kernel/src/main/java/org/neo4j/helpers/BaseToObjectValueWriter.java similarity index 99% rename from community/cypher/cypher/src/main/java/org/neo4j/cypher/internal/javacompat/BaseToObjectValueWriter.java rename to community/kernel/src/main/java/org/neo4j/helpers/BaseToObjectValueWriter.java index 0859bc8df8c1c..4fef34ad1a1e4 100644 --- a/community/cypher/cypher/src/main/java/org/neo4j/cypher/internal/javacompat/BaseToObjectValueWriter.java +++ b/community/kernel/src/main/java/org/neo4j/helpers/BaseToObjectValueWriter.java @@ -17,7 +17,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package org.neo4j.cypher.internal.javacompat; +package org.neo4j.helpers; import java.lang.reflect.Array; import java.util.ArrayDeque; diff --git a/community/kernel/src/main/java/org/neo4j/helpers/NodeProxyWrappingNodeValue.java b/community/kernel/src/main/java/org/neo4j/helpers/NodeProxyWrappingNodeValue.java index 93435480ed8a3..3e927d64de152 100644 --- a/community/kernel/src/main/java/org/neo4j/helpers/NodeProxyWrappingNodeValue.java +++ b/community/kernel/src/main/java/org/neo4j/helpers/NodeProxyWrappingNodeValue.java @@ -17,7 +17,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package org.neo4j.cypher.internal.javacompat; +package org.neo4j.helpers; import java.util.ArrayList; diff --git a/community/kernel/src/main/java/org/neo4j/helpers/RelationshipProxyWrappingEdgeValue.java b/community/kernel/src/main/java/org/neo4j/helpers/RelationshipProxyWrappingEdgeValue.java index c7aea4341981e..496ddd49213f3 100644 --- a/community/kernel/src/main/java/org/neo4j/helpers/RelationshipProxyWrappingEdgeValue.java +++ b/community/kernel/src/main/java/org/neo4j/helpers/RelationshipProxyWrappingEdgeValue.java @@ -17,7 +17,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package org.neo4j.cypher.internal.javacompat; +package org.neo4j.helpers; import org.neo4j.graphdb.NotFoundException; import org.neo4j.graphdb.Relationship; diff --git a/community/kernel/src/main/java/org/neo4j/helpers/ValueUtils.java b/community/kernel/src/main/java/org/neo4j/helpers/ValueUtils.java index 6296f337ced1f..2baaa404629fc 100644 --- a/community/kernel/src/main/java/org/neo4j/helpers/ValueUtils.java +++ b/community/kernel/src/main/java/org/neo4j/helpers/ValueUtils.java @@ -17,7 +17,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package org.neo4j.cypher.internal.javacompat; +package org.neo4j.helpers; import java.util.Collection; import java.util.HashMap; diff --git a/community/kernel/src/main/java/org/neo4j/kernel/api/QueryRegistryOperations.java b/community/kernel/src/main/java/org/neo4j/kernel/api/QueryRegistryOperations.java index 66ce0d8a59049..9a1194f21f35a 100644 --- a/community/kernel/src/main/java/org/neo4j/kernel/api/QueryRegistryOperations.java +++ b/community/kernel/src/main/java/org/neo4j/kernel/api/QueryRegistryOperations.java @@ -24,6 +24,7 @@ import org.neo4j.kernel.api.query.ExecutingQuery; import org.neo4j.kernel.impl.query.clientconnection.ClientConnectionInfo; +import org.neo4j.values.virtual.MapValue; /** @@ -58,7 +59,7 @@ public interface QueryRegistryOperations * Registers a query, and creates the ExecutingQuery object for it. */ ExecutingQuery startQueryExecution( - ClientConnectionInfo descriptor, String queryText, Map queryParameters + ClientConnectionInfo descriptor, String queryText, MapValue queryParameters ); /** diff --git a/community/kernel/src/main/java/org/neo4j/kernel/api/query/ExecutingQuery.java b/community/kernel/src/main/java/org/neo4j/kernel/api/query/ExecutingQuery.java index 240c083be6775..4e526d2ef39b8 100644 --- a/community/kernel/src/main/java/org/neo4j/kernel/api/query/ExecutingQuery.java +++ b/community/kernel/src/main/java/org/neo4j/kernel/api/query/ExecutingQuery.java @@ -34,6 +34,7 @@ import org.neo4j.resources.HeapAllocation; import org.neo4j.storageengine.api.lock.ResourceType; import org.neo4j.time.SystemNanoClock; +import org.neo4j.values.virtual.MapValue; import static java.util.concurrent.TimeUnit.NANOSECONDS; import static java.util.concurrent.atomic.AtomicLongFieldUpdater.newUpdater; @@ -51,7 +52,7 @@ public class ExecutingQuery private final String username; private final ClientConnectionInfo clientConnection; private final String queryText; - private final Map queryParameters; + private final MapValue queryParameters; private final long startTimeNanos; private final long startTimestampMillis; /** Uses write barrier of {@link #status}. */ @@ -76,7 +77,7 @@ public ExecutingQuery( ClientConnectionInfo clientConnection, String username, String queryText, - Map queryParameters, + MapValue queryParameters, Map transactionAnnotationData, LongSupplier activeLockCount, PageCursorCounters pageCursorCounters, @@ -232,7 +233,7 @@ public String queryText() return queryText; } - public Map queryParameters() + public MapValue queryParameters() { return queryParameters; } diff --git a/community/kernel/src/main/java/org/neo4j/kernel/api/query/QuerySnapshot.java b/community/kernel/src/main/java/org/neo4j/kernel/api/query/QuerySnapshot.java index b33e6965d6cbc..06468389ba50c 100644 --- a/community/kernel/src/main/java/org/neo4j/kernel/api/query/QuerySnapshot.java +++ b/community/kernel/src/main/java/org/neo4j/kernel/api/query/QuerySnapshot.java @@ -25,6 +25,7 @@ import java.util.stream.Collectors; import org.neo4j.kernel.impl.query.clientconnection.ClientConnectionInfo; +import org.neo4j.values.virtual.MapValue; public class QuerySnapshot { @@ -76,7 +77,7 @@ public String queryText() return query.queryText(); } - public Map queryParameters() + public MapValue queryParameters() { return query.queryParameters(); } diff --git a/community/kernel/src/main/java/org/neo4j/kernel/impl/api/OperationsFacade.java b/community/kernel/src/main/java/org/neo4j/kernel/impl/api/OperationsFacade.java index 4d4758af153e1..9012333b450de 100644 --- a/community/kernel/src/main/java/org/neo4j/kernel/impl/api/OperationsFacade.java +++ b/community/kernel/src/main/java/org/neo4j/kernel/impl/api/OperationsFacade.java @@ -112,6 +112,7 @@ import org.neo4j.storageengine.api.schema.SchemaRule; import org.neo4j.values.storable.Value; import org.neo4j.values.storable.Values; +import org.neo4j.values.virtual.MapValue; import static java.lang.String.format; import static org.neo4j.collection.primitive.PrimitiveIntCollections.deduplicate; @@ -1327,7 +1328,7 @@ public Stream executingQueries() public ExecutingQuery startQueryExecution( ClientConnectionInfo descriptor, String queryText, - Map queryParameters ) + MapValue queryParameters ) { statement.assertOpen(); return queryRegistrationOperations().startQueryExecution( statement, descriptor, queryText, queryParameters ); diff --git a/community/kernel/src/main/java/org/neo4j/kernel/impl/api/StackingQueryRegistrationOperations.java b/community/kernel/src/main/java/org/neo4j/kernel/impl/api/StackingQueryRegistrationOperations.java index 514afeb0000e6..1c6699f91bf78 100644 --- a/community/kernel/src/main/java/org/neo4j/kernel/impl/api/StackingQueryRegistrationOperations.java +++ b/community/kernel/src/main/java/org/neo4j/kernel/impl/api/StackingQueryRegistrationOperations.java @@ -19,7 +19,6 @@ */ package org.neo4j.kernel.impl.api; -import java.util.Map; import java.util.stream.Stream; import org.neo4j.kernel.api.query.ExecutingQuery; @@ -29,6 +28,7 @@ import org.neo4j.resources.CpuClock; import org.neo4j.resources.HeapAllocation; import org.neo4j.time.SystemNanoClock; +import org.neo4j.values.virtual.MapValue; public class StackingQueryRegistrationOperations implements QueryRegistrationOperations { @@ -64,7 +64,7 @@ public ExecutingQuery startQueryExecution( KernelStatement statement, ClientConnectionInfo clientConnection, String queryText, - Map queryParameters + MapValue queryParameters ) { long queryId = lastQueryId.incrementAndGet(); diff --git a/community/kernel/src/main/java/org/neo4j/kernel/impl/api/operations/QueryRegistrationOperations.java b/community/kernel/src/main/java/org/neo4j/kernel/impl/api/operations/QueryRegistrationOperations.java index 13ee2c5d8ff33..94c2790f1f831 100644 --- a/community/kernel/src/main/java/org/neo4j/kernel/impl/api/operations/QueryRegistrationOperations.java +++ b/community/kernel/src/main/java/org/neo4j/kernel/impl/api/operations/QueryRegistrationOperations.java @@ -19,12 +19,12 @@ */ package org.neo4j.kernel.impl.api.operations; -import java.util.Map; import java.util.stream.Stream; import org.neo4j.kernel.api.query.ExecutingQuery; import org.neo4j.kernel.impl.api.KernelStatement; import org.neo4j.kernel.impl.query.clientconnection.ClientConnectionInfo; +import org.neo4j.values.virtual.MapValue; /** * Query execution monitoring operations. @@ -39,7 +39,7 @@ ExecutingQuery startQueryExecution( KernelStatement statement, ClientConnectionInfo descriptor, String queryText, - Map queryParameters + MapValue queryParameters ); void registerExecutingQuery( KernelStatement statement, ExecutingQuery executingQuery ); diff --git a/community/kernel/src/main/java/org/neo4j/kernel/impl/factory/ClassicCoreSPI.java b/community/kernel/src/main/java/org/neo4j/kernel/impl/factory/ClassicCoreSPI.java index 0ad9a34157a89..0042b9e51b426 100644 --- a/community/kernel/src/main/java/org/neo4j/kernel/impl/factory/ClassicCoreSPI.java +++ b/community/kernel/src/main/java/org/neo4j/kernel/impl/factory/ClassicCoreSPI.java @@ -41,6 +41,7 @@ import org.neo4j.kernel.impl.store.StoreId; import org.neo4j.kernel.lifecycle.LifecycleException; import org.neo4j.logging.Logger; +import org.neo4j.values.virtual.MapValue; /** * This implements the backend for the "classic" Core API - meaning the surface-layer-of-the-database, thread bound API. @@ -71,7 +72,21 @@ public boolean databaseIsAvailable( long timeout ) } @Override - public Result executeQuery( String query, Map parameters, TransactionalContext transactionalContext ) + public Result executeQuery( String query, MapValue parameters, TransactionalContext transactionalContext ) + { + try + { + availability.assertDatabaseAvailable(); + return dataSource.queryExecutor.get().executeQuery( query, parameters, transactionalContext ); + } + catch ( QueryExecutionKernelException e ) + { + throw e.asUserException(); + } + } + + @Override + public Result executeQuery( String query, Map parameters, TransactionalContext transactionalContext ) { try { diff --git a/community/kernel/src/main/java/org/neo4j/kernel/impl/factory/GraphDatabaseFacade.java b/community/kernel/src/main/java/org/neo4j/kernel/impl/factory/GraphDatabaseFacade.java index be252326dfe85..a03c9dd1dcb8f 100644 --- a/community/kernel/src/main/java/org/neo4j/kernel/impl/factory/GraphDatabaseFacade.java +++ b/community/kernel/src/main/java/org/neo4j/kernel/impl/factory/GraphDatabaseFacade.java @@ -52,6 +52,7 @@ import org.neo4j.graphdb.security.URLAccessValidationError; import org.neo4j.graphdb.traversal.BidirectionalTraversalDescription; import org.neo4j.graphdb.traversal.TraversalDescription; +import org.neo4j.helpers.ValueUtils; import org.neo4j.helpers.collection.PrefetchingResourceIterator; import org.neo4j.helpers.collection.ResourceClosingIterator; import org.neo4j.kernel.GraphDatabaseQueryService; @@ -103,6 +104,7 @@ import org.neo4j.storageengine.api.EntityType; import org.neo4j.values.storable.Value; import org.neo4j.values.storable.Values; +import org.neo4j.values.virtual.MapValue; import static java.lang.String.format; import static org.neo4j.collection.primitive.PrimitiveLongCollections.map; @@ -164,7 +166,8 @@ public interface SPI * @throws org.neo4j.graphdb.TransactionFailureException if unable to begin, or a transaction already exists. * @see SPI#beginTransaction(KernelTransaction.Type, SecurityContext) */ - KernelTransaction beginTransaction( KernelTransaction.Type type, SecurityContext securityContext, long timeout ); + KernelTransaction beginTransaction( KernelTransaction.Type type, SecurityContext securityContext, + long timeout ); /** * Retrieve the transaction associated with the current context. For the classic implementation of the Core API, @@ -185,6 +188,9 @@ public interface SPI /** Execute a cypher statement */ Result executeQuery( String query, Map parameters, TransactionalContext context ); + /** Execute a cypher statement */ + Result executeQuery( String query, MapValue parameters, TransactionalContext context ); + AutoIndexing autoIndexing(); void registerKernelEventHandler( KernelEventHandler handler ); @@ -206,17 +212,17 @@ public GraphDatabaseFacade() /** * Create a new Core API facade, backed by the given SPI. - * + *

* Any required dependencies are resolved using the resolver obtained from the SPI. */ public final void init( SPI spi ) { DependencyResolver resolver = spi.resolver(); init( - spi, - resolver.resolveDependency( Guard.class ), - resolver.resolveDependency( ThreadToStatementContextBridge.class ), - resolver.resolveDependency( Config.class ) + spi, + resolver.resolveDependency( Guard.class ), + resolver.resolveDependency( ThreadToStatementContextBridge.class ), + resolver.resolveDependency( Config.class ) ); } @@ -236,16 +242,16 @@ public void init( SPI spi, Guard guard, ThreadToStatementContextBridge txBridge, this.relActions = new StandardRelationshipActions( statementSupplier, transactionSupplier, assertTransactionOpen, id -> new NodeProxy( nodeActions, id ), this ); this.nodeActions = new StandardNodeActions( statementSupplier, transactionSupplier, assertTransactionOpen, relActions, this ); - this.indexManager = Suppliers.lazySingleton( () -> { IndexProviderImpl idxProvider = new IndexProviderImpl( this, statementSupplier ); AutoIndexerFacade nodeAutoIndexer = new AutoIndexerFacade<>( - () -> new ReadOnlyIndexFacade<>( idxProvider.getOrCreateNodeIndex( NODE_AUTO_INDEX, null ) ), - spi.autoIndexing().nodes() ); + () -> new ReadOnlyIndexFacade<>( idxProvider.getOrCreateNodeIndex( NODE_AUTO_INDEX, null ) ), + spi.autoIndexing().nodes() ); RelationshipAutoIndexerFacade relAutoIndexer = new RelationshipAutoIndexerFacade( - () -> new ReadOnlyRelationshipIndexFacade( idxProvider.getOrCreateRelationshipIndex( RELATIONSHIP_AUTO_INDEX, null ) ), - spi.autoIndexing().relationships() ); + () -> new ReadOnlyRelationshipIndexFacade( + idxProvider.getOrCreateRelationshipIndex( RELATIONSHIP_AUTO_INDEX, null ) ), + spi.autoIndexing().relationships() ); return new IndexManagerImpl( statementSupplier, idxProvider, nodeAutoIndexer, relAutoIndexer ); } ); @@ -425,7 +431,7 @@ public Result execute( String query, Map parameters ) throws Quer InternalTransaction transaction = beginTransaction( KernelTransaction.Type.implicit, AUTH_DISABLED ); - return execute( transaction, query, parameters ); + return execute( transaction, query, ValueUtils.asMapValue( parameters ) ); } @Override @@ -434,10 +440,10 @@ public Result execute( String query, Map parameters, long timeout { InternalTransaction transaction = beginTransaction( KernelTransaction.Type.implicit, AUTH_DISABLED, timeout, unit ); - return execute( transaction, query, parameters ); + return execute( transaction, query, ValueUtils.asMapValue( parameters ) ); } - public Result execute( InternalTransaction transaction, String query, Map parameters ) + public Result execute( InternalTransaction transaction, String query, MapValue parameters ) throws QueryExecutionException { TransactionalContext context = @@ -601,7 +607,8 @@ private InternalTransaction beginTransactionInternal( KernelTransaction.Type typ // FIXME: perhaps we should check that the new type and access mode are compatible with the current tx return new PlaceboTransaction( spi::currentTransaction, spi::currentStatement ); } - return new TopLevelTransaction( spi.beginTransaction( type, securityContext, timeoutMillis ), spi::currentStatement ); + return new TopLevelTransaction( spi.beginTransaction( type, securityContext, timeoutMillis ), + spi::currentStatement ); } private ResourceIterator nodesByLabelAndProperty( Label myLabel, String key, Value value ) diff --git a/community/kernel/src/main/java/org/neo4j/kernel/impl/proc/ProcedureGDBFacadeSPI.java b/community/kernel/src/main/java/org/neo4j/kernel/impl/proc/ProcedureGDBFacadeSPI.java index 6f70220f705b1..c1fbbf08bed95 100644 --- a/community/kernel/src/main/java/org/neo4j/kernel/impl/proc/ProcedureGDBFacadeSPI.java +++ b/community/kernel/src/main/java/org/neo4j/kernel/impl/proc/ProcedureGDBFacadeSPI.java @@ -43,6 +43,7 @@ import org.neo4j.kernel.impl.query.QueryExecutionKernelException; import org.neo4j.kernel.impl.query.TransactionalContext; import org.neo4j.kernel.impl.store.StoreId; +import org.neo4j.values.virtual.MapValue; class ProcedureGDBFacadeSPI implements GraphDatabaseFacade.SPI { @@ -133,6 +134,20 @@ public Result executeQuery( String query, Map parameters, Transac } } + @Override + public Result executeQuery( String query, MapValue parameters, TransactionalContext tc ) + { + try + { + availability.assertDatabaseAvailable(); + return sourceModule.queryExecutor.get().executeQuery( query, parameters, tc ); + } + catch ( QueryExecutionKernelException e ) + { + throw e.asUserException(); + } + } + @Override public AutoIndexing autoIndexing() { diff --git a/community/kernel/src/main/java/org/neo4j/kernel/impl/query/Neo4jTransactionalContextFactory.java b/community/kernel/src/main/java/org/neo4j/kernel/impl/query/Neo4jTransactionalContextFactory.java index bc292ab0b77b1..c061c30cc4c31 100644 --- a/community/kernel/src/main/java/org/neo4j/kernel/impl/query/Neo4jTransactionalContextFactory.java +++ b/community/kernel/src/main/java/org/neo4j/kernel/impl/query/Neo4jTransactionalContextFactory.java @@ -19,19 +19,19 @@ */ package org.neo4j.kernel.impl.query; -import java.util.Map; import java.util.function.Supplier; import org.neo4j.graphdb.DependencyResolver; import org.neo4j.kernel.GraphDatabaseQueryService; -import org.neo4j.kernel.api.query.ExecutingQuery; import org.neo4j.kernel.api.Statement; +import org.neo4j.kernel.api.query.ExecutingQuery; import org.neo4j.kernel.guard.Guard; import org.neo4j.kernel.impl.core.ThreadToStatementContextBridge; import org.neo4j.kernel.impl.coreapi.InternalTransaction; import org.neo4j.kernel.impl.coreapi.PropertyContainerLocker; import org.neo4j.kernel.impl.factory.GraphDatabaseFacade; import org.neo4j.kernel.impl.query.clientconnection.ClientConnectionInfo; +import org.neo4j.values.virtual.MapValue; import static org.neo4j.function.Suppliers.lazySingleton; @@ -101,7 +101,7 @@ public final Neo4jTransactionalContext newContext( ClientConnectionInfo clientConnection, InternalTransaction tx, String queryText, - Map queryParameters + MapValue queryParameters ) { Statement initialStatement = statementSupplier.get(); diff --git a/community/kernel/src/main/java/org/neo4j/kernel/impl/query/NoQueryEngine.java b/community/kernel/src/main/java/org/neo4j/kernel/impl/query/NoQueryEngine.java index 0c0774b034405..4aab4f342ba8c 100644 --- a/community/kernel/src/main/java/org/neo4j/kernel/impl/query/NoQueryEngine.java +++ b/community/kernel/src/main/java/org/neo4j/kernel/impl/query/NoQueryEngine.java @@ -22,11 +22,18 @@ import java.util.Map; import org.neo4j.graphdb.Result; +import org.neo4j.values.virtual.MapValue; enum NoQueryEngine implements QueryExecutionEngine { INSTANCE; + @Override + public Result executeQuery( String query, MapValue parameters, TransactionalContext context ) + { + throw noQueryEngine(); + } + @Override public Result executeQuery( String query, Map parameters, TransactionalContext context ) { diff --git a/community/kernel/src/main/java/org/neo4j/kernel/impl/query/QueryExecutionEngine.java b/community/kernel/src/main/java/org/neo4j/kernel/impl/query/QueryExecutionEngine.java index 6e5ac0a88fa98..d0b3409aae14e 100644 --- a/community/kernel/src/main/java/org/neo4j/kernel/impl/query/QueryExecutionEngine.java +++ b/community/kernel/src/main/java/org/neo4j/kernel/impl/query/QueryExecutionEngine.java @@ -22,9 +22,13 @@ import java.util.Map; import org.neo4j.graphdb.Result; +import org.neo4j.values.virtual.MapValue; public interface QueryExecutionEngine { + Result executeQuery( String query, MapValue parameters, TransactionalContext context ) + throws QueryExecutionKernelException; + Result executeQuery( String query, Map parameters, TransactionalContext context ) throws QueryExecutionKernelException; diff --git a/community/kernel/src/main/java/org/neo4j/kernel/impl/query/TransactionalContextFactory.java b/community/kernel/src/main/java/org/neo4j/kernel/impl/query/TransactionalContextFactory.java index 219f4317de6a2..87f0c7442da74 100644 --- a/community/kernel/src/main/java/org/neo4j/kernel/impl/query/TransactionalContextFactory.java +++ b/community/kernel/src/main/java/org/neo4j/kernel/impl/query/TransactionalContextFactory.java @@ -19,16 +19,15 @@ */ package org.neo4j.kernel.impl.query; -import java.util.Map; - import org.neo4j.kernel.impl.coreapi.InternalTransaction; import org.neo4j.kernel.impl.query.clientconnection.ClientConnectionInfo; +import org.neo4j.values.virtual.MapValue; public interface TransactionalContextFactory { TransactionalContext newContext( ClientConnectionInfo descriptor, InternalTransaction tx, String queryText, - Map queryParameters + MapValue queryParameters ); } diff --git a/community/kernel/src/test/java/org/neo4j/kernel/api/query/ExecutingQueryTest.java b/community/kernel/src/test/java/org/neo4j/kernel/api/query/ExecutingQueryTest.java index f4d8deeeb9763..3a6733d689b50 100644 --- a/community/kernel/src/test/java/org/neo4j/kernel/api/query/ExecutingQueryTest.java +++ b/community/kernel/src/test/java/org/neo4j/kernel/api/query/ExecutingQueryTest.java @@ -52,6 +52,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertThat; +import static org.neo4j.values.virtual.VirtualValues.EMPTY_MAP; public class ExecutingQueryTest { @@ -67,7 +68,7 @@ public class ExecutingQueryTest ClientConnectionInfo.EMBEDDED_CONNECTION, "neo4j", "hello world", - Collections.emptyMap(), + EMPTY_MAP, Collections.emptyMap(), () -> lockCount, page, Thread.currentThread(), clock, @@ -78,7 +79,7 @@ public class ExecutingQueryTest ClientConnectionInfo.EMBEDDED_CONNECTION, "neo4j", "goodbye world", - Collections.emptyMap(), + EMPTY_MAP, Collections.emptyMap(), () -> lockCount, page, Thread.currentThread(), clock, @@ -253,7 +254,7 @@ public void shouldNotReportCpuTimeIfUnavailable() throws Exception ClientConnectionInfo.EMBEDDED_CONNECTION, "neo4j", "hello world", - Collections.emptyMap(), + EMPTY_MAP, Collections.emptyMap(), () -> lockCount, PageCursorTracer.NULL, Thread.currentThread(), clock, @@ -296,7 +297,7 @@ public void shouldNotReportHeapAllocationIfUnavailable() throws Exception ClientConnectionInfo.EMBEDDED_CONNECTION, "neo4j", "hello world", - Collections.emptyMap(), + EMPTY_MAP, Collections.emptyMap(), () -> lockCount, PageCursorTracer.NULL, Thread.currentThread(), clock, diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/api/ExecutingQueryListTest.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/api/ExecutingQueryListTest.java index 7be89845afe8d..227d9aa83eeca 100644 --- a/community/kernel/src/test/java/org/neo4j/kernel/impl/api/ExecutingQueryListTest.java +++ b/community/kernel/src/test/java/org/neo4j/kernel/impl/api/ExecutingQueryListTest.java @@ -28,13 +28,14 @@ import org.neo4j.io.pagecache.tracing.cursor.PageCursorTracer; import org.neo4j.kernel.api.query.ExecutingQuery; import org.neo4j.kernel.impl.query.clientconnection.ClientConnectionInfo; +import org.neo4j.resources.CpuClock; import org.neo4j.resources.HeapAllocation; import org.neo4j.time.Clocks; -import org.neo4j.resources.CpuClock; import static java.util.Arrays.asList; import static org.hamcrest.Matchers.equalTo; import static org.junit.Assert.assertThat; +import static org.neo4j.values.virtual.VirtualValues.EMPTY_MAP; public class ExecutingQueryListTest { @@ -118,7 +119,7 @@ public void removingQueryInTheMiddleKeepsOrder() private ExecutingQuery createExecutingQuery( int queryId, String query ) { return new ExecutingQuery( queryId, ClientConnectionInfo.EMBEDDED_CONNECTION, "me", query, - Collections.emptyMap(), Collections.emptyMap(), () -> 0, PageCursorTracer.NULL, Thread.currentThread(), + EMPTY_MAP, Collections.emptyMap(), () -> 0, PageCursorTracer.NULL, Thread.currentThread(), Clocks.nanoClock(), CpuClock.CPU_CLOCK, HeapAllocation.HEAP_ALLOCATION ); } } diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/query/Neo4jTransactionalContextTest.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/query/Neo4jTransactionalContextTest.java index bb7654c168120..ade6781cfe546 100644 --- a/community/kernel/src/test/java/org/neo4j/kernel/impl/query/Neo4jTransactionalContextTest.java +++ b/community/kernel/src/test/java/org/neo4j/kernel/impl/query/Neo4jTransactionalContextTest.java @@ -26,7 +26,6 @@ import org.mockito.Mockito; import org.mockito.internal.stubbing.defaultanswers.ReturnsDeepStubs; -import java.util.Collections; import java.util.Optional; import org.neo4j.graphdb.DependencyResolver; @@ -60,6 +59,7 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.when; +import static org.neo4j.values.virtual.VirtualValues.EMPTY_MAP; public class Neo4jTransactionalContextTest { @@ -120,7 +120,7 @@ public void neverStopsExecutingQueryDuringCommitAndRestartTx() QueryRegistryOperations secondQueryRegistry = mock( QueryRegistryOperations.class ); when( executingQuery.queryText() ).thenReturn( "X" ); - when( executingQuery.queryParameters() ).thenReturn( Collections.emptyMap() ); + when( executingQuery.queryParameters() ).thenReturn( EMPTY_MAP ); when( initialStatement.queryRegistration() ).thenReturn( initialQueryRegistry ); when( queryService.beginTransaction( transactionType, securityContext ) ).thenReturn( secondTransaction ); when( txBridge.getKernelTransactionBoundToThisThread( true ) ).thenReturn( initialKTX, secondKTX ); @@ -200,7 +200,7 @@ public void rollsBackNewlyCreatedTransactionIfTerminationDetectedOnCloseDuringPe QueryRegistryOperations secondQueryRegistry = mock( QueryRegistryOperations.class ); when( executingQuery.queryText() ).thenReturn( "X" ); - when( executingQuery.queryParameters() ).thenReturn( Collections.emptyMap() ); + when( executingQuery.queryParameters() ).thenReturn( EMPTY_MAP ); Mockito.doThrow( RuntimeException.class ).when( initialTransaction ).close(); when( initialStatement.queryRegistration() ).thenReturn( initialQueryRegistry ); when( initialStatement.executionStatisticsOperations() ).thenReturn( initialExecutionStatisticOperations ); diff --git a/community/neo4j/src/test/java/org/neo4j/locking/QueryExecutionLocksIT.java b/community/neo4j/src/test/java/org/neo4j/locking/QueryExecutionLocksIT.java index 1c22dd4ab0aee..f633414fc049f 100644 --- a/community/neo4j/src/test/java/org/neo4j/locking/QueryExecutionLocksIT.java +++ b/community/neo4j/src/test/java/org/neo4j/locking/QueryExecutionLocksIT.java @@ -103,6 +103,7 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; +import static org.neo4j.values.virtual.VirtualValues.EMPTY_MAP; public class QueryExecutionLocksIT { @@ -217,7 +218,7 @@ private TransactionalContext createTransactionContext( GraphDatabaseQueryService { PropertyContainerLocker locker = new PropertyContainerLocker(); TransactionalContextFactory contextFactory = Neo4jTransactionalContextFactory.create( graph, locker ); - return contextFactory.newContext( ClientConnectionInfo.EMBEDDED_CONNECTION, tx, query, Collections.emptyMap() ); + return contextFactory.newContext( ClientConnectionInfo.EMBEDDED_CONNECTION, tx, query, EMPTY_MAP ); } private static class TransactionalContextWrapper implements TransactionalContext diff --git a/community/server/src/main/java/org/neo4j/server/database/CypherExecutor.java b/community/server/src/main/java/org/neo4j/server/database/CypherExecutor.java index e86163693d34a..8d9a7f22d9ea7 100644 --- a/community/server/src/main/java/org/neo4j/server/database/CypherExecutor.java +++ b/community/server/src/main/java/org/neo4j/server/database/CypherExecutor.java @@ -35,11 +35,11 @@ import org.neo4j.kernel.impl.query.TransactionalContext; import org.neo4j.kernel.impl.query.TransactionalContextFactory; import org.neo4j.kernel.lifecycle.LifecycleAdapter; +import org.neo4j.logging.Log; import org.neo4j.logging.LogProvider; import org.neo4j.server.rest.web.HttpConnectionInfoFactory; -import org.neo4j.logging.Log; - +import static org.neo4j.helpers.ValueUtils.asMapValue; import static org.neo4j.kernel.api.security.SecurityContext.AUTH_DISABLED; import static org.neo4j.server.web.HttpHeaderUtils.getTransactionTimeout; @@ -84,7 +84,7 @@ public TransactionalContext createTransactionContext( String query, Map> getServerGroups( CoreGraphDatabase db ) List> serverGroups = new ArrayList<>(); try ( InternalTransaction tx = db.beginTransaction( KernelTransaction.Type.explicit, EnterpriseSecurityContext.AUTH_DISABLED ) ) { - try ( Result result = db.execute( tx, "CALL dbms.cluster.overview", emptyMap() ) ) + try ( Result result = db.execute( tx, "CALL dbms.cluster.overview", EMPTY_MAP ) ) { while ( result.hasNext() ) { diff --git a/enterprise/causal-clustering/src/test/java/org/neo4j/causalclustering/scenarios/ServerPoliciesLoadBalancingIT.java b/enterprise/causal-clustering/src/test/java/org/neo4j/causalclustering/scenarios/ServerPoliciesLoadBalancingIT.java index a5cb24b7fc970..c23b2227b4d54 100644 --- a/enterprise/causal-clustering/src/test/java/org/neo4j/causalclustering/scenarios/ServerPoliciesLoadBalancingIT.java +++ b/enterprise/causal-clustering/src/test/java/org/neo4j/causalclustering/scenarios/ServerPoliciesLoadBalancingIT.java @@ -48,6 +48,7 @@ import org.neo4j.function.ThrowingSupplier; import org.neo4j.graphdb.Result; import org.neo4j.helpers.AdvertisedSocketAddress; +import org.neo4j.helpers.ValueUtils; import org.neo4j.helpers.collection.MapUtil; import org.neo4j.kernel.api.KernelTransaction; import org.neo4j.kernel.enterprise.api.security.EnterpriseSecurityContext; @@ -222,7 +223,7 @@ private LoadBalancingResult getServers( CoreGraphDatabase db, Map try ( InternalTransaction tx = db.beginTransaction( KernelTransaction.Type.explicit, EnterpriseSecurityContext.AUTH_DISABLED ) ) { Map parameters = MapUtil.map( ParameterNames.CONTEXT.parameterName(), context ); - try ( Result result = db.execute( tx, "CALL " + GET_SERVERS_V2.callName(), parameters ) ) + try ( Result result = db.execute( tx, "CALL " + GET_SERVERS_V2.callName(), ValueUtils.asMapValue( parameters )) ) { while ( result.hasNext() ) { diff --git a/enterprise/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v3_3/codegen/GeneratedMethodStructure.scala b/enterprise/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v3_3/codegen/GeneratedMethodStructure.scala index 72046a238704a..352f1be065ce5 100644 --- a/enterprise/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v3_3/codegen/GeneratedMethodStructure.scala +++ b/enterprise/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v3_3/codegen/GeneratedMethodStructure.scala @@ -39,11 +39,11 @@ import org.neo4j.cypher.internal.compiler.v3_3.spi.{NodeIdWrapper, RelationshipI import org.neo4j.cypher.internal.frontend.v3_3.helpers._ import org.neo4j.cypher.internal.frontend.v3_3.symbols.{CTInteger, CTNode, CTRelationship, ListType} import org.neo4j.cypher.internal.frontend.v3_3.{ParameterNotFoundException, SemanticDirection, symbols} -import org.neo4j.cypher.internal.javacompat.ValueUtils import org.neo4j.cypher.internal.spi.v3_3.codegen.GeneratedMethodStructure.CompletableFinalizer import org.neo4j.cypher.internal.spi.v3_3.codegen.Methods._ import org.neo4j.cypher.internal.spi.v3_3.codegen.Templates._ import org.neo4j.graphdb.{Direction, Node, Relationship} +import org.neo4j.helpers.ValueUtils import org.neo4j.kernel.api.ReadOperations import org.neo4j.kernel.api.schema.index.{IndexDescriptor, IndexDescriptorFactory} import org.neo4j.kernel.api.schema.{IndexQuery, LabelSchemaDescriptor} diff --git a/enterprise/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiled_runtime/v3_3/codegen/CodeGeneratorTest.scala b/enterprise/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiled_runtime/v3_3/codegen/CodeGeneratorTest.scala index 7f5adec0623a1..0593df6cc7196 100644 --- a/enterprise/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiled_runtime/v3_3/codegen/CodeGeneratorTest.scala +++ b/enterprise/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiled_runtime/v3_3/codegen/CodeGeneratorTest.scala @@ -38,13 +38,13 @@ import org.neo4j.cypher.internal.frontend.v3_3.symbols._ import org.neo4j.cypher.internal.frontend.v3_3.test_helpers.CypherFunSuite import org.neo4j.cypher.internal.frontend.v3_3.{ParameterNotFoundException, SemanticDirection, SemanticTable, _} import org.neo4j.cypher.internal.ir.v3_3.IdName -import org.neo4j.cypher.internal.javacompat.ValueUtils import org.neo4j.cypher.internal.spi.v3_3.codegen.GeneratedQueryStructure import org.neo4j.cypher.internal.spi.v3_3.{QueryContext, TransactionalContextWrapper} import org.neo4j.cypher.internal.v3_3.logical.plans import org.neo4j.cypher.internal.v3_3.logical.plans.{Ascending, Descending, _} import org.neo4j.graphdb.Result.{ResultRow, ResultVisitor} import org.neo4j.graphdb._ +import org.neo4j.helpers.ValueUtils import org.neo4j.kernel.api.ReadOperations import org.neo4j.kernel.impl.api.RelationshipVisitor import org.neo4j.kernel.impl.api.store.RelationshipIterator diff --git a/enterprise/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiled_runtime/v3_3/codegen/CompiledExecutionResultTest.scala b/enterprise/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiled_runtime/v3_3/codegen/CompiledExecutionResultTest.scala index 2b969357af149..37e10247736c9 100644 --- a/enterprise/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiled_runtime/v3_3/codegen/CompiledExecutionResultTest.scala +++ b/enterprise/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiled_runtime/v3_3/codegen/CompiledExecutionResultTest.scala @@ -31,12 +31,13 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.executionplan.Comple import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.InternalPlanDescription import org.neo4j.cypher.internal.compatibility.v3_3.runtime.{ExecutionMode, NormalMode, TaskCloser} import org.neo4j.cypher.internal.frontend.v3_3.test_helpers.CypherFunSuite -import org.neo4j.cypher.internal.javacompat.{ResultRecord, ValueUtils} +import org.neo4j.cypher.internal.javacompat.ResultRecord import org.neo4j.cypher.internal.spi.v3_3.QueryContext import org.neo4j.cypher.internal.v3_3.executionplan.GeneratedQueryExecution import org.neo4j.cypher.result.QueryResult.QueryResultVisitor import org.neo4j.graphdb.NotFoundException import org.neo4j.graphdb.Result.{ResultRow, ResultVisitor} +import org.neo4j.helpers.ValueUtils import org.neo4j.helpers.collection.Iterators import org.neo4j.values.AnyValue import org.neo4j.values.storable._ diff --git a/enterprise/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiled_runtime/v3_3/codegen/ir/CodeGenSugar.scala b/enterprise/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiled_runtime/v3_3/codegen/ir/CodeGenSugar.scala index 9f91f16127e60..b448e4c236dac 100644 --- a/enterprise/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiled_runtime/v3_3/codegen/ir/CodeGenSugar.scala +++ b/enterprise/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiled_runtime/v3_3/codegen/ir/CodeGenSugar.scala @@ -19,7 +19,6 @@ */ package org.neo4j.cypher.internal.compiled_runtime.v3_3.codegen.ir -import java.util.Collections import java.util.concurrent.atomic.AtomicInteger import org.mockito.Mockito._ @@ -81,7 +80,7 @@ trait CodeGenSugar extends MockitoSugar { val contextFactory = Neo4jTransactionalContextFactory.create(graphDb, locker) transactionalContext = TransactionalContextWrapper( contextFactory.newContext(ClientConnectionInfo.EMBEDDED_CONNECTION, tx, - "no query text exists for this test", Collections.emptyMap())) + "no query text exists for this test", EMPTY_MAP)) val queryContext = new TransactionBoundQueryContext(transactionalContext)(mock[IndexSearchMonitor]) val result = plan .executionResultBuilder(queryContext, mode, tracer(mode, queryContext), EMPTY_MAP, new TaskCloser) diff --git a/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/PrimitiveExecutionContext.scala b/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/PrimitiveExecutionContext.scala index 61a82842f61a2..f5feda072a9f2 100644 --- a/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/PrimitiveExecutionContext.scala +++ b/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/PrimitiveExecutionContext.scala @@ -21,7 +21,7 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.slotted import org.neo4j.cypher.internal.compatibility.v3_3.runtime.{ExecutionContext, PipelineInformation} import org.neo4j.cypher.internal.frontend.v3_3.InternalException -import org.neo4j.cypher.internal.javacompat.ValueUtils +import org.neo4j.helpers.ValueUtils import org.neo4j.values.AnyValue object PrimitiveExecutionContext { diff --git a/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/expressions/NodeFromSlot.scala b/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/expressions/NodeFromSlot.scala index 036a72c372d13..ff0654df22004 100644 --- a/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/expressions/NodeFromSlot.scala +++ b/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/expressions/NodeFromSlot.scala @@ -22,7 +22,7 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.slotted.expressions import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.expressions.Expression import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes.QueryState -import org.neo4j.cypher.internal.javacompat.ValueUtils.fromNodeProxy +import org.neo4j.helpers.ValueUtils.fromNodeProxy import org.neo4j.values.virtual.NodeValue case class NodeFromSlot(offset: Int) extends Expression with SlottedExpression { diff --git a/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/expressions/RelationshipFromSlot.scala b/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/expressions/RelationshipFromSlot.scala index cdcbcffdb052b..af2f766f6c534 100644 --- a/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/expressions/RelationshipFromSlot.scala +++ b/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/expressions/RelationshipFromSlot.scala @@ -22,7 +22,7 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.slotted.expressions import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.expressions.Expression import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes.QueryState -import org.neo4j.cypher.internal.javacompat.ValueUtils +import org.neo4j.helpers.ValueUtils import org.neo4j.values.virtual.EdgeValue case class RelationshipFromSlot(offset: Int) extends Expression with SlottedExpression { diff --git a/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/VarLengthExpandSlottedPipe.scala b/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/VarLengthExpandSlottedPipe.scala index d63f4c724b51e..f2ba5fd07f613 100644 --- a/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/VarLengthExpandSlottedPipe.scala +++ b/enterprise/cypher/slotted-runtime/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/slotted/pipes/VarLengthExpandSlottedPipe.scala @@ -25,8 +25,8 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id import org.neo4j.cypher.internal.compatibility.v3_3.runtime.slotted.PrimitiveExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.{ExecutionContext, PipelineInformation} import org.neo4j.cypher.internal.frontend.v3_3.{InternalException, SemanticDirection} -import org.neo4j.cypher.internal.javacompat.ValueUtils import org.neo4j.graphdb.Relationship +import org.neo4j.helpers.ValueUtils import org.neo4j.kernel.impl.api.RelationshipVisitor import org.neo4j.kernel.impl.api.store.RelationshipIterator diff --git a/enterprise/kernel/src/main/java/org/neo4j/kernel/enterprise/builtinprocs/EnterpriseBuiltInDbmsProcedures.java b/enterprise/kernel/src/main/java/org/neo4j/kernel/enterprise/builtinprocs/EnterpriseBuiltInDbmsProcedures.java index cda645062b4b4..82d1b3edda6d5 100644 --- a/enterprise/kernel/src/main/java/org/neo4j/kernel/enterprise/builtinprocs/EnterpriseBuiltInDbmsProcedures.java +++ b/enterprise/kernel/src/main/java/org/neo4j/kernel/enterprise/builtinprocs/EnterpriseBuiltInDbmsProcedures.java @@ -48,6 +48,7 @@ import org.neo4j.kernel.api.security.SecurityContext; import org.neo4j.kernel.configuration.Config; import org.neo4j.kernel.impl.api.KernelTransactions; +import org.neo4j.kernel.impl.core.NodeManager; import org.neo4j.kernel.impl.core.ThreadToStatementContextBridge; import org.neo4j.kernel.impl.proc.Procedures; import org.neo4j.kernel.internal.GraphDatabaseAPI; @@ -293,12 +294,14 @@ public void setConfigValue( @Name( "setting" ) String setting, @Name( "value" ) public Stream listQueries() throws InvalidArgumentsException, IOException { securityContext.assertCredentialsNotExpired(); + NodeManager nodeManager = resolver.resolveDependency( NodeManager.class ); try { return getKernelTransactions().activeTransactions().stream() .flatMap( KernelTransactionHandle::executingQueries ) - .filter( query -> isAdminOrSelf( query.username() ) ) - .map( catchThrown( InvalidArgumentsException.class, QueryStatusResult::new ) ); + .filter( query -> isAdminOrSelf( query.username() ) ) + .map( catchThrown( InvalidArgumentsException.class, + query -> new QueryStatusResult( query, nodeManager ) ) ); } catch ( UncaughtCheckedException uncaught ) { diff --git a/enterprise/kernel/src/main/java/org/neo4j/kernel/enterprise/builtinprocs/QueryStatusResult.java b/enterprise/kernel/src/main/java/org/neo4j/kernel/enterprise/builtinprocs/QueryStatusResult.java index cf0175befd5b6..ef759a60da5c5 100644 --- a/enterprise/kernel/src/main/java/org/neo4j/kernel/enterprise/builtinprocs/QueryStatusResult.java +++ b/enterprise/kernel/src/main/java/org/neo4j/kernel/enterprise/builtinprocs/QueryStatusResult.java @@ -22,15 +22,29 @@ import java.time.Instant; import java.time.OffsetDateTime; import java.time.ZoneId; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.function.BiConsumer; +import org.neo4j.graphdb.Node; +import org.neo4j.graphdb.Relationship; +import org.neo4j.graphdb.spatial.CRS; +import org.neo4j.graphdb.spatial.Coordinate; +import org.neo4j.graphdb.spatial.Point; +import org.neo4j.helpers.BaseToObjectValueWriter; import org.neo4j.kernel.api.exceptions.InvalidArgumentsException; import org.neo4j.kernel.api.query.ExecutingQuery; import org.neo4j.kernel.api.query.QuerySnapshot; +import org.neo4j.kernel.impl.core.NodeManager; import org.neo4j.kernel.impl.query.clientconnection.ClientConnectionInfo; +import org.neo4j.values.AnyValue; +import org.neo4j.values.virtual.MapValue; import static java.time.format.DateTimeFormatter.ISO_OFFSET_DATE_TIME; +import static java.util.Collections.singletonList; import static java.util.concurrent.TimeUnit.HOURS; import static java.util.concurrent.TimeUnit.MILLISECONDS; import static java.util.concurrent.TimeUnit.MINUTES; @@ -39,7 +53,7 @@ public class QueryStatusResult { - public static final ZoneId UTC_ZONE_ID = ZoneId.of("UTC"); + public static final ZoneId UTC_ZONE_ID = ZoneId.of( "UTC" ); public final String queryId; public final String username; public final Map metaData; @@ -83,17 +97,17 @@ public class QueryStatusResult /** @since Neo4j 3.2 */ public final long pageFaults; - QueryStatusResult( ExecutingQuery query ) throws InvalidArgumentsException + QueryStatusResult( ExecutingQuery query, NodeManager manager ) throws InvalidArgumentsException { - this( query.snapshot() ); + this( query.snapshot(), manager ); } - private QueryStatusResult( QuerySnapshot query ) throws InvalidArgumentsException + private QueryStatusResult( QuerySnapshot query, NodeManager manager ) throws InvalidArgumentsException { this.queryId = ofInternalId( query.internalQueryId() ).toString(); this.username = query.username(); this.query = query.queryText(); - this.parameters = query.queryParameters(); + this.parameters = asRawMap( query.queryParameters(), new ParameterWriter( manager ) ); this.startTime = formatTime( query.startTimestampMillis() ); this.elapsedTimeMillis = query.elapsedTimeMillis(); this.elapsedTime = formatInterval( elapsedTimeMillis ); @@ -117,10 +131,21 @@ private QueryStatusResult( QuerySnapshot query ) throws InvalidArgumentsExceptio this.pageFaults = query.pageFaults(); } + private Map asRawMap( MapValue mapValue, ParameterWriter writer ) + { + HashMap map = new HashMap<>(); + mapValue.foreach( ( s, value ) -> + { + value.writeTo( writer ); + map.put( s, writer.value() ); + } ); + return map; + } + private static String formatTime( final long startTime ) { return OffsetDateTime - .ofInstant( Instant.ofEpochMilli( startTime ), UTC_ZONE_ID) + .ofInstant( Instant.ofEpochMilli( startTime ), UTC_ZONE_ID ) .format( ISO_OFFSET_DATE_TIME ); } @@ -132,4 +157,81 @@ private static String formatInterval( final long l ) final long ms = l - HOURS.toMillis( hr ) - MINUTES.toMillis( min ) - SECONDS.toMillis( sec ); return String.format( "%02d:%02d:%02d.%03d", hr, min, sec, ms ); } + + private static class ParameterWriter extends BaseToObjectValueWriter + { + private final NodeManager nodeManager; + + private ParameterWriter( NodeManager nodeManager ) + { + this.nodeManager = nodeManager; + } + + @Override + protected Node newNodeProxyById( long id ) + { + return nodeManager.newNodeProxyById( id ); + } + + @Override + protected Relationship newRelationshipProxyById( long id ) + { + return nodeManager.newRelationshipProxyById( id ); + } + + @Override + protected Point newGeographicPoint( double longitude, double latitude, String name, int code, String href ) + { + return point( longitude, latitude, name, code, href ); + } + + @Override + protected Point newCartesianPoint( double x, double y, String name, int code, String href ) + { + return point( x, y, name, code, href ); + } + + private Point point( double x, double y, String name, int code, String href ) + { + return new Point() + { + @Override + public String getGeometryType() + { + return "Point"; + } + + @Override + public List getCoordinates() + { + return singletonList( new Coordinate( x, y ) ); + } + + @Override + public CRS getCRS() + { + return new CRS() + { + @Override + public int getCode() + { + return code; + } + + @Override + public String getType() + { + return name; + } + + @Override + public String getHref() + { + return href; + } + }; + } + }; + } + } } diff --git a/enterprise/query-logging/src/main/java/org/neo4j/kernel/impl/query/QueryLogFormatter.java b/enterprise/query-logging/src/main/java/org/neo4j/kernel/impl/query/QueryLogFormatter.java index f91146bf7b6f8..b2c8a868d62f1 100644 --- a/enterprise/query-logging/src/main/java/org/neo4j/kernel/impl/query/QueryLogFormatter.java +++ b/enterprise/query-logging/src/main/java/org/neo4j/kernel/impl/query/QueryLogFormatter.java @@ -25,6 +25,8 @@ import org.neo4j.helpers.Strings; import org.neo4j.kernel.api.query.QuerySnapshot; +import org.neo4j.values.AnyValue; +import org.neo4j.values.virtual.MapValue; class QueryLogFormatter { @@ -59,12 +61,44 @@ static void formatDetailedTime( StringBuilder result, QuerySnapshot query ) result.append( ") - " ); } + static void formatMapValue( StringBuilder result, MapValue params ) + { + formatMapValue( result, params, Collections.emptySet() ); + } + + static void formatMapValue( StringBuilder result, MapValue params, Collection obfuscate ) + { + result.append( '{' ); + if ( params != null ) + { + String sep = ""; + for ( Map.Entry entry : params.entrySet() ) + { + result + .append( sep ) + .append( entry.getKey() ) + .append( ": " ); + + if ( obfuscate.contains( entry.getKey() ) ) + { + result.append( "******" ); + } + else + { + formatValue( result, entry.getValue() ); + } + sep = ", "; + } + } + result.append( "}" ); + } + static void formatMap( StringBuilder result, Map params ) { formatMap( result, params, Collections.emptySet() ); } - static void formatMap( StringBuilder result, Map params, Collection obfuscate ) + static void formatMap( StringBuilder result, Map params, Collection obfuscate ) { result.append( '{' ); if ( params != null ) @@ -95,7 +129,7 @@ private static void formatValue( StringBuilder result, Object value ) { if ( value instanceof Map ) { - formatMap( result, (Map) value ); + formatMapValue( result, (MapValue) value ); } else if ( value instanceof String ) { diff --git a/enterprise/query-logging/src/main/java/org/neo4j/kernel/impl/query/QueryLogger.java b/enterprise/query-logging/src/main/java/org/neo4j/kernel/impl/query/QueryLogger.java index c994cc1ecc152..45885cfcd7138 100644 --- a/enterprise/query-logging/src/main/java/org/neo4j/kernel/impl/query/QueryLogger.java +++ b/enterprise/query-logging/src/main/java/org/neo4j/kernel/impl/query/QueryLogger.java @@ -131,7 +131,7 @@ else if ( password.charAt( 0 ) == '{' ) result.append( sourceString ).append( " - " ).append( queryText ); if ( logQueryParameters ) { - QueryLogFormatter.formatMap( result.append(" - "), query.queryParameters(), passwordParams ); + QueryLogFormatter.formatMapValue( result.append(" - "), query.queryParameters(), passwordParams ); } QueryLogFormatter.formatMap( result.append(" - "), query.transactionAnnotationData() ); return result.toString(); diff --git a/enterprise/query-logging/src/test/java/org/neo4j/kernel/impl/query/QueryLoggerIT.java b/enterprise/query-logging/src/test/java/org/neo4j/kernel/impl/query/QueryLoggerIT.java index 16f102c12f70b..b21c9585fbba6 100644 --- a/enterprise/query-logging/src/test/java/org/neo4j/kernel/impl/query/QueryLoggerIT.java +++ b/enterprise/query-logging/src/test/java/org/neo4j/kernel/impl/query/QueryLoggerIT.java @@ -60,6 +60,7 @@ import org.neo4j.test.TestEnterpriseGraphDatabaseFactory; import org.neo4j.test.rule.TestDirectory; import org.neo4j.test.rule.fs.DefaultFileSystemRule; +import org.neo4j.values.virtual.VirtualValues; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.endsWith; @@ -344,7 +345,7 @@ public void shouldNotLogPassword() throws Exception try ( InternalTransaction tx = database .beginTransaction( KernelTransaction.Type.explicit, neo ) ) { - Result res = database.execute( tx, query, Collections.emptyMap() ); + Result res = database.execute( tx, query, VirtualValues.EMPTY_MAP ); res.close(); tx.success(); } diff --git a/enterprise/query-logging/src/test/java/org/neo4j/kernel/impl/query/QueryLoggerTest.java b/enterprise/query-logging/src/test/java/org/neo4j/kernel/impl/query/QueryLoggerTest.java index 62ed5b2f0959e..c264f81a35621 100644 --- a/enterprise/query-logging/src/test/java/org/neo4j/kernel/impl/query/QueryLoggerTest.java +++ b/enterprise/query-logging/src/test/java/org/neo4j/kernel/impl/query/QueryLoggerTest.java @@ -29,6 +29,7 @@ import java.util.Map; import java.util.concurrent.TimeUnit; +import org.neo4j.helpers.ValueUtils; import org.neo4j.io.pagecache.tracing.cursor.PageCursorCounters; import org.neo4j.kernel.api.query.ExecutingQuery; import org.neo4j.kernel.impl.query.clientconnection.ClientConnectionInfo; @@ -515,7 +516,7 @@ private ExecutingQuery query( sessionInfo.withUsername( username ), username, queryText, - params, + ValueUtils.asMapValue( params ), metaData, () -> 0, new PageCursorCounters() diff --git a/enterprise/security/src/test/java/org/neo4j/server/security/enterprise/auth/BoltAuthScenariosInteractionIT.java b/enterprise/security/src/test/java/org/neo4j/server/security/enterprise/auth/BoltAuthScenariosInteractionIT.java index 6fe04136c22ee..00975dbb61e21 100644 --- a/enterprise/security/src/test/java/org/neo4j/server/security/enterprise/auth/BoltAuthScenariosInteractionIT.java +++ b/enterprise/security/src/test/java/org/neo4j/server/security/enterprise/auth/BoltAuthScenariosInteractionIT.java @@ -23,8 +23,8 @@ import java.util.Map; -import org.neo4j.cypher.internal.javacompat.ValueUtils; import org.neo4j.graphdb.mockfs.UncloseableDelegatingFileSystemAbstraction; +import org.neo4j.helpers.ValueUtils; import org.neo4j.test.rule.fs.EphemeralFileSystemRule; public class BoltAuthScenariosInteractionIT extends AuthScenariosInteractionTestBase diff --git a/enterprise/security/src/test/java/org/neo4j/server/security/enterprise/auth/BoltBuiltInProceduresInteractionIT.java b/enterprise/security/src/test/java/org/neo4j/server/security/enterprise/auth/BoltBuiltInProceduresInteractionIT.java index 6ec9214de1690..65c1e9380fdf8 100644 --- a/enterprise/security/src/test/java/org/neo4j/server/security/enterprise/auth/BoltBuiltInProceduresInteractionIT.java +++ b/enterprise/security/src/test/java/org/neo4j/server/security/enterprise/auth/BoltBuiltInProceduresInteractionIT.java @@ -21,7 +21,7 @@ import java.util.Map; -import org.neo4j.cypher.internal.javacompat.ValueUtils; +import org.neo4j.helpers.ValueUtils; public class BoltBuiltInProceduresInteractionIT extends BuiltInProceduresInteractionTestBase { diff --git a/enterprise/security/src/test/java/org/neo4j/server/security/enterprise/auth/BoltConfiguredAuthScenariosInteractionIT.java b/enterprise/security/src/test/java/org/neo4j/server/security/enterprise/auth/BoltConfiguredAuthScenariosInteractionIT.java index 2cb3f4c6857f9..fc0937dc27f2c 100644 --- a/enterprise/security/src/test/java/org/neo4j/server/security/enterprise/auth/BoltConfiguredAuthScenariosInteractionIT.java +++ b/enterprise/security/src/test/java/org/neo4j/server/security/enterprise/auth/BoltConfiguredAuthScenariosInteractionIT.java @@ -21,7 +21,7 @@ import java.util.Map; -import org.neo4j.cypher.internal.javacompat.ValueUtils; +import org.neo4j.helpers.ValueUtils; public class BoltConfiguredAuthScenariosInteractionIT extends ConfiguredAuthScenariosInteractionTestBase { diff --git a/enterprise/security/src/test/java/org/neo4j/server/security/enterprise/auth/BoltConfiguredProceduresIT.java b/enterprise/security/src/test/java/org/neo4j/server/security/enterprise/auth/BoltConfiguredProceduresIT.java index ac54adddddad1..ce8e1d3ed2e14 100644 --- a/enterprise/security/src/test/java/org/neo4j/server/security/enterprise/auth/BoltConfiguredProceduresIT.java +++ b/enterprise/security/src/test/java/org/neo4j/server/security/enterprise/auth/BoltConfiguredProceduresIT.java @@ -21,7 +21,7 @@ import java.util.Map; -import org.neo4j.cypher.internal.javacompat.ValueUtils; +import org.neo4j.helpers.ValueUtils; public class BoltConfiguredProceduresIT extends ConfiguredProceduresTestBase { diff --git a/enterprise/security/src/test/java/org/neo4j/server/security/enterprise/auth/BoltInteraction.java b/enterprise/security/src/test/java/org/neo4j/server/security/enterprise/auth/BoltInteraction.java index 59f69f26c1361..b1f436c1059c5 100644 --- a/enterprise/security/src/test/java/org/neo4j/server/security/enterprise/auth/BoltInteraction.java +++ b/enterprise/security/src/test/java/org/neo4j/server/security/enterprise/auth/BoltInteraction.java @@ -45,6 +45,7 @@ import org.neo4j.graphdb.factory.GraphDatabaseSettings; import org.neo4j.graphdb.mockfs.EphemeralFileSystemAbstraction; import org.neo4j.helpers.HostnamePort; +import org.neo4j.helpers.ValueUtils; import org.neo4j.io.fs.FileSystemAbstraction; import org.neo4j.kernel.api.KernelTransaction; import org.neo4j.kernel.api.exceptions.Status; @@ -145,7 +146,7 @@ public String executeQuery( BoltSubject subject, String call, Map } try { - subject.client.send( TransportTestUtil.chunk( RunMessage.run( call, params ), PullAllMessage.pullAll() ) ); + subject.client.send( TransportTestUtil.chunk( RunMessage.run( call, ValueUtils.asMapValue( params ) ), PullAllMessage.pullAll() ) ); resultConsumer.accept( collectResults( subject.client ) ); return ""; } diff --git a/enterprise/security/src/test/java/org/neo4j/server/security/enterprise/auth/BoltUserManagementProceduresInteractionIT.java b/enterprise/security/src/test/java/org/neo4j/server/security/enterprise/auth/BoltUserManagementProceduresInteractionIT.java index 59a3870ed9129..a4a2cebe37213 100644 --- a/enterprise/security/src/test/java/org/neo4j/server/security/enterprise/auth/BoltUserManagementProceduresInteractionIT.java +++ b/enterprise/security/src/test/java/org/neo4j/server/security/enterprise/auth/BoltUserManagementProceduresInteractionIT.java @@ -21,7 +21,7 @@ import java.util.Map; -import org.neo4j.cypher.internal.javacompat.ValueUtils; +import org.neo4j.helpers.ValueUtils; public class BoltUserManagementProceduresInteractionIT extends AuthProceduresInteractionTestBase { diff --git a/enterprise/security/src/test/java/org/neo4j/server/security/enterprise/auth/ConfiguredAuthScenariosInteractionTestBase.java b/enterprise/security/src/test/java/org/neo4j/server/security/enterprise/auth/ConfiguredAuthScenariosInteractionTestBase.java index a8d593872730a..da8675c6fc4ec 100644 --- a/enterprise/security/src/test/java/org/neo4j/server/security/enterprise/auth/ConfiguredAuthScenariosInteractionTestBase.java +++ b/enterprise/security/src/test/java/org/neo4j/server/security/enterprise/auth/ConfiguredAuthScenariosInteractionTestBase.java @@ -21,8 +21,6 @@ import org.junit.Test; -import java.util.Collections; -import java.util.HashMap; import java.util.Iterator; import java.util.Map; @@ -33,9 +31,6 @@ import org.neo4j.kernel.impl.coreapi.InternalTransaction; import org.neo4j.kernel.impl.factory.GraphDatabaseFacade; import org.neo4j.server.security.enterprise.configuration.SecuritySettings; -import org.neo4j.values.AnyValues; -import org.neo4j.values.virtual.MapValue; - import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.equalTo; @@ -46,6 +41,7 @@ import static org.neo4j.server.security.enterprise.auth.plugin.api.PredefinedRoles.EDITOR; import static org.neo4j.server.security.enterprise.auth.plugin.api.PredefinedRoles.PUBLISHER; import static org.neo4j.server.security.enterprise.auth.plugin.api.PredefinedRoles.READER; +import static org.neo4j.values.virtual.VirtualValues.EMPTY_MAP; public abstract class ConfiguredAuthScenariosInteractionTestBase extends ProcedureInteractionTestBase { @@ -75,7 +71,7 @@ public void shouldWarnWhenUsingNativeAndOtherProvider() throws Throwable InternalTransaction transaction = localGraph .beginTransaction( KernelTransaction.Type.explicit, StandardEnterpriseSecurityContext.AUTH_DISABLED ); Result result = - localGraph.execute( transaction, "EXPLAIN CALL dbms.security.listUsers", Collections.emptyMap() ); + localGraph.execute( transaction, "EXPLAIN CALL dbms.security.listUsers", EMPTY_MAP ); String description = String.format( "%s (%s)", Status.Procedure.ProcedureWarning.code().description(), "dbms.security.listUsers only applies to native users." ); assertThat( containsNotification( result, description ), equalTo( true ) ); @@ -93,7 +89,7 @@ public void shouldNotWarnWhenOnlyUsingNativeProvider() throws Throwable InternalTransaction transaction = localGraph .beginTransaction( KernelTransaction.Type.explicit, StandardEnterpriseSecurityContext.AUTH_DISABLED ); Result result = - localGraph.execute( transaction, "EXPLAIN CALL dbms.security.listUsers", Collections.emptyMap() ); + localGraph.execute( transaction, "EXPLAIN CALL dbms.security.listUsers", EMPTY_MAP ); String description = String.format( "%s (%s)", Status.Procedure.ProcedureWarning.code().description(), "dbms.security.listUsers only applies to native users." ); assertThat( containsNotification( result, description ), equalTo( false ) ); diff --git a/enterprise/security/src/test/java/org/neo4j/server/security/enterprise/auth/EmbeddedBuiltInProceduresInteractionIT.java b/enterprise/security/src/test/java/org/neo4j/server/security/enterprise/auth/EmbeddedBuiltInProceduresInteractionIT.java index 6f7ada685290d..da260e3e61dd1 100644 --- a/enterprise/security/src/test/java/org/neo4j/server/security/enterprise/auth/EmbeddedBuiltInProceduresInteractionIT.java +++ b/enterprise/security/src/test/java/org/neo4j/server/security/enterprise/auth/EmbeddedBuiltInProceduresInteractionIT.java @@ -40,6 +40,7 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertThat; import static org.neo4j.graphdb.security.AuthorizationViolationException.PERMISSION_DENIED; +import static org.neo4j.values.virtual.VirtualValues.EMPTY_MAP; public class EmbeddedBuiltInProceduresInteractionIT extends BuiltInProceduresInteractionTestBase { @@ -71,7 +72,7 @@ public void shouldNotListAnyQueriesIfNotAuthenticated() try ( InternalTransaction tx = graph .beginTransaction( KernelTransaction.Type.explicit, AnonymousContext.none() ) ) { - Result result = graph.execute( tx, "CALL dbms.listQueries", Collections.emptyMap() ); + Result result = graph.execute( tx, "CALL dbms.listQueries", EMPTY_MAP ); assertFalse( result.hasNext() ); tx.success(); } @@ -94,7 +95,7 @@ public void shouldNotKillQueryIfNotAuthenticated() throws Throwable try ( InternalTransaction tx = graph .beginTransaction( KernelTransaction.Type.explicit, AnonymousContext.none() ) ) { - graph.execute( tx, "CALL dbms.killQuery('" + id + "')", Collections.emptyMap() ); + graph.execute( tx, "CALL dbms.killQuery('" + id + "')", EMPTY_MAP ); throw new AssertionError( "Expected exception to be thrown" ); } catch ( QueryExecutionException e ) diff --git a/enterprise/security/src/test/java/org/neo4j/server/security/enterprise/auth/ProcedureInteractionTestBase.java b/enterprise/security/src/test/java/org/neo4j/server/security/enterprise/auth/ProcedureInteractionTestBase.java index ef2ab56eeddef..ce61c1f398351 100644 --- a/enterprise/security/src/test/java/org/neo4j/server/security/enterprise/auth/ProcedureInteractionTestBase.java +++ b/enterprise/security/src/test/java/org/neo4j/server/security/enterprise/auth/ProcedureInteractionTestBase.java @@ -43,7 +43,7 @@ import org.neo4j.bolt.v1.transport.integration.TransportTestUtil; import org.neo4j.bolt.v1.transport.socket.client.SocketConnection; import org.neo4j.bolt.v1.transport.socket.client.TransportConnection; -import org.neo4j.cypher.internal.javacompat.BaseToObjectValueWriter; +import org.neo4j.helpers.BaseToObjectValueWriter; import org.neo4j.graphdb.GraphDatabaseService; import org.neo4j.graphdb.Label; import org.neo4j.graphdb.Node; diff --git a/integrationtests/src/test/java/org/neo4j/ha/HAClusterStartupIT.java b/integrationtests/src/test/java/org/neo4j/ha/HAClusterStartupIT.java index 7abb8a0f7106c..1903ddf8c0dc7 100644 --- a/integrationtests/src/test/java/org/neo4j/ha/HAClusterStartupIT.java +++ b/integrationtests/src/test/java/org/neo4j/ha/HAClusterStartupIT.java @@ -28,7 +28,6 @@ import java.io.File; import java.io.IOException; import java.nio.file.Files; -import java.util.Collections; import org.neo4j.consistency.checking.full.ConsistencyCheckIncompleteException; import org.neo4j.graphdb.GraphDatabaseService; @@ -49,6 +48,7 @@ import static org.neo4j.consistency.store.StoreAssertions.assertConsistentStore; import static org.neo4j.kernel.impl.ha.ClusterManager.allSeesAllAsAvailable; import static org.neo4j.kernel.impl.ha.ClusterManager.clusterOfSize; +import static org.neo4j.values.virtual.VirtualValues.EMPTY_MAP; @RunWith( Enclosed.class ) public class HAClusterStartupIT @@ -106,7 +106,7 @@ public void allClusterNodesShouldSupportTheBuiltInProcedures() throws Throwable EnterpriseSecurityContext.AUTH_DISABLED ) ) { - Result result = gdb.execute( tx, "CALL dbms.listQueries()", Collections.emptyMap() ); + Result result = gdb.execute( tx, "CALL dbms.listQueries()", EMPTY_MAP ); assertTrue( result.hasNext() ); result.close();