From c54cfa36be959d13d6060ba0da05a06df7bd28db Mon Sep 17 00:00:00 2001 From: Stefan Plantikow Date: Wed, 7 Sep 2016 10:53:07 +0200 Subject: [PATCH] Rename terminate query to kill query --- .../builtinprocs/BuiltInProcedures.java | 8 ++++---- .../BuiltInProceduresInteractionTestBase.java | 16 ++++++++-------- ...EmbeddedBuiltInProceduresInteractionTest.java | 4 ++-- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/enterprise/kernel/src/main/java/org/neo4j/kernel/enterprise/builtinprocs/BuiltInProcedures.java b/enterprise/kernel/src/main/java/org/neo4j/kernel/enterprise/builtinprocs/BuiltInProcedures.java index b243ee40ccf55..b3dca198b685a 100644 --- a/enterprise/kernel/src/main/java/org/neo4j/kernel/enterprise/builtinprocs/BuiltInProcedures.java +++ b/enterprise/kernel/src/main/java/org/neo4j/kernel/enterprise/builtinprocs/BuiltInProcedures.java @@ -140,8 +140,8 @@ public Stream listQueries() throws InvalidArgumentsException, .map( this::queryStatusResult ); } - @Procedure( name = "dbms.terminateQuery", mode = DBMS ) - public Stream terminateQuery( @Name( "id" ) String idText ) + @Procedure( name = "dbms.killQuery", mode = DBMS ) + public Stream killQuery( @Name( "id" ) String idText ) throws InvalidArgumentsException, IOException { long queryId = parseQueryId( idText ).kernelQueryId(); @@ -149,7 +149,7 @@ public Stream terminateQuery( @Name( "id" ) String idTex getKernelTransactions().activeTransactions( tx -> executingQueriesWithId( queryId, tx ) ); return executingQueries .stream() - .map(this::terminateQueryTransaction); + .map(this::killQueryTransaction); } private Stream executingQueriesWithId( long id, KernelTransactionHandle txHandle ) @@ -157,7 +157,7 @@ private Stream executingQueriesWithId( long id, KernelTransactio return txHandle.executingQueries().filter( q -> q.kernelQueryId() == id ); } - private QueryTerminationResult terminateQueryTransaction( Pair pair ) + private QueryTerminationResult killQueryTransaction( Pair pair ) { ExecutingQuery query = pair.other(); if ( isAdminEnterpriseAuthSubject() || authSubject.hasUsername( query.authSubjectName() ) ) diff --git a/enterprise/security/src/test/java/org/neo4j/server/security/enterprise/auth/BuiltInProceduresInteractionTestBase.java b/enterprise/security/src/test/java/org/neo4j/server/security/enterprise/auth/BuiltInProceduresInteractionTestBase.java index 2a20cb37439e5..4f459c6cfcd89 100644 --- a/enterprise/security/src/test/java/org/neo4j/server/security/enterprise/auth/BuiltInProceduresInteractionTestBase.java +++ b/enterprise/security/src/test/java/org/neo4j/server/security/enterprise/auth/BuiltInProceduresInteractionTestBase.java @@ -251,7 +251,7 @@ public void shouldListQueriesEvenIfUsingPeriodicCommit() throws Throwable //---------- terminate query ----------- @Test - public void shouldTerminateQueryAsAdmin() throws Throwable + public void shouldKillQueryAsAdmin() throws Throwable { DoubleLatch latch = new DoubleLatch( 3 ); ThreadedTransactionCreate read1 = new ThreadedTransactionCreate<>( neo, latch ); @@ -264,7 +264,7 @@ public void shouldTerminateQueryAsAdmin() throws Throwable assertSuccess( adminSubject, - "CALL dbms.terminateQuery('" + id1 + "') YIELD username " + + "CALL dbms.killQuery('" + id1 + "') YIELD username " + "RETURN count(username) AS count, username", r -> { List> actual = r.stream().collect( toList() ); @@ -286,7 +286,7 @@ public void shouldTerminateQueryAsAdmin() throws Throwable } @Test - public void shouldTerminateQueryAsUser() throws Throwable + public void shouldKillQueryAsUser() throws Throwable { DoubleLatch latch = new DoubleLatch( 3 ); ThreadedTransactionCreate read = new ThreadedTransactionCreate<>( neo, latch ); @@ -299,7 +299,7 @@ public void shouldTerminateQueryAsUser() throws Throwable assertSuccess( readSubject, - "CALL dbms.terminateQuery('" + id1 + "') YIELD username " + + "CALL dbms.killQuery('" + id1 + "') YIELD username " + "RETURN count(username) AS count, username", r -> { List> actual = r.stream().collect( toList() ); @@ -321,12 +321,12 @@ public void shouldTerminateQueryAsUser() throws Throwable } @Test - public void shouldSelfTerminateQuery() throws Throwable + public void shouldSelfKillQuery() throws Throwable { String result = neo.executeQuery( readSubject, "WITH 'Hello' AS marker CALL dbms.listQueries() YIELD queryId AS id, query " + - "WITH * WHERE query CONTAINS 'Hello' CALL dbms.terminateQuery(id) YIELD username " + + "WITH * WHERE query CONTAINS 'Hello' CALL dbms.killQuery(id) YIELD username " + "RETURN count(username) AS count, username", Collections.emptyMap(), r -> {} @@ -354,7 +354,7 @@ public void shouldFailToTerminateOtherUsersQuery() throws Throwable String id1 = extractQueryId( q1 ); assertFail( writeSubject, - "CALL dbms.terminateQuery('" + id1 + "') YIELD username RETURN *", + "CALL dbms.killQuery('" + id1 + "') YIELD username RETURN *", PERMISSION_DENIED ); latch.finishAndWaitForAllToFinish(); @@ -405,7 +405,7 @@ public void shouldTerminateQueriesEvenIfUsingPeriodicCommit() throws Throwable assertSuccess( adminSubject, - "CALL dbms.terminateQuery('" + writeQueryId + "') YIELD username " + + "CALL dbms.killQuery('" + writeQueryId + "') YIELD username " + "RETURN count(username) AS count, username", r -> { List> actual = r.stream().collect( toList() ); diff --git a/enterprise/security/src/test/java/org/neo4j/server/security/enterprise/auth/EmbeddedBuiltInProceduresInteractionTest.java b/enterprise/security/src/test/java/org/neo4j/server/security/enterprise/auth/EmbeddedBuiltInProceduresInteractionTest.java index 93941cb08ea36..6028db822e1ae 100644 --- a/enterprise/security/src/test/java/org/neo4j/server/security/enterprise/auth/EmbeddedBuiltInProceduresInteractionTest.java +++ b/enterprise/security/src/test/java/org/neo4j/server/security/enterprise/auth/EmbeddedBuiltInProceduresInteractionTest.java @@ -67,7 +67,7 @@ public void shouldNotListAnyQueriesIfNotAuthenticated() } @Test - public void shouldNotTerminateQueryIfNotAuthenticated() throws Throwable + public void shouldNotKillQueryIfNotAuthenticated() throws Throwable { EnterpriseAuthSubject authy = createFakeAnonymousEnterpriseAuthSubject(); @@ -83,7 +83,7 @@ public void shouldNotTerminateQueryIfNotAuthenticated() throws Throwable try ( InternalTransaction tx = graph .beginTransaction( KernelTransaction.Type.explicit, AuthSubject.ANONYMOUS ) ) { - graph.execute( tx, "CALL dbms.terminateQuery('" + id + "')", Collections.emptyMap() ); + graph.execute( tx, "CALL dbms.killQuery('" + id + "')", Collections.emptyMap() ); throw new AssertionError( "Expected exception to be thrown" ); } catch ( QueryExecutionException e )