From eae5394d325932762ef77df27df6e0b5e8d186e0 Mon Sep 17 00:00:00 2001 From: Zhen Date: Thu, 23 Jun 2016 14:29:01 +0200 Subject: [PATCH] Change the error code back to Request.Invalid after code review --- .../v1/runtime/internal/SessionStateMachine.java | 2 +- .../bolt/v1/runtime/integration/SessionAuthIT.java | 12 ++++++------ .../v1/runtime/internal/StateMachineErrorTest.java | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/community/bolt/src/main/java/org/neo4j/bolt/v1/runtime/internal/SessionStateMachine.java b/community/bolt/src/main/java/org/neo4j/bolt/v1/runtime/internal/SessionStateMachine.java index eb03cb9a2efa..6e10acab33f5 100644 --- a/community/bolt/src/main/java/org/neo4j/bolt/v1/runtime/internal/SessionStateMachine.java +++ b/community/bolt/src/main/java/org/neo4j/bolt/v1/runtime/internal/SessionStateMachine.java @@ -105,7 +105,7 @@ public State interrupt( SessionStateMachine ctx ) @Override protected State onNoImplementation( SessionStateMachine ctx, String command ) { - ctx.error( new Neo4jError( Status.Security.Forbidden, "No operations allowed until you send an " + + ctx.error( new Neo4jError( Status.Request.Invalid, "No operations allowed until you send an " + "INIT message successfully." ) ); return halt( ctx ); } diff --git a/community/bolt/src/test/java/org/neo4j/bolt/v1/runtime/integration/SessionAuthIT.java b/community/bolt/src/test/java/org/neo4j/bolt/v1/runtime/integration/SessionAuthIT.java index f59b218fc4a1..760d5ce7f38b 100644 --- a/community/bolt/src/test/java/org/neo4j/bolt/v1/runtime/integration/SessionAuthIT.java +++ b/community/bolt/src/test/java/org/neo4j/bolt/v1/runtime/integration/SessionAuthIT.java @@ -81,7 +81,7 @@ public void shouldDisallowRunOnAuthenticationFailureAndAck() throws Throwable assertThat( recorder, recorded( failedWith(Status.Security.Unauthorized), success(), - failedWith(Status.Security.Forbidden) )); + failedWith(Status.Request.Invalid) )); } @Test @@ -105,11 +105,11 @@ public void shouldDisallowRunAfterAuthFailureAndReset() throws Throwable assertThat( recorder, recorded( failedWith(Status.Security.Unauthorized), success(), - failedWith(Status.Security.Forbidden) )); + failedWith(Status.Request.Invalid) )); } @Test - public void shouldIgnoreAfterSecurityForbidden() throws Throwable + public void shouldIgnoreAfterRequestInvalid() throws Throwable { // given it is important for client applications to programmatically // identify expired credentials as the cause of not being authenticated @@ -122,7 +122,7 @@ public void shouldIgnoreAfterSecurityForbidden() throws Throwable // then assertThat( recorder, recorded( - failedWith(Status.Security.Forbidden), + failedWith(Status.Request.Invalid), ignored() )); } @@ -140,7 +140,7 @@ public void shouldDisallowRunBeforeSuccessInit() throws Throwable session.run( "RETURN 1337", map(), null, recorder ); // then - assertThat( recorder, recorded( failedWith(Status.Security.Forbidden), ignored() )); + assertThat( recorder, recorded( failedWith(Status.Request.Invalid), ignored() )); } @Test @@ -156,7 +156,7 @@ public void shouldDisallowResetBeforeSuccessInit() throws Throwable session.run( "RETURN 1337", map(), null, recorder ); // then - assertThat( recorder, recorded( failedWith( Status.Security.Forbidden ), ignored() )); + assertThat( recorder, recorded( failedWith( Status.Request.Invalid ), ignored() )); } @Test diff --git a/community/bolt/src/test/java/org/neo4j/bolt/v1/runtime/internal/StateMachineErrorTest.java b/community/bolt/src/test/java/org/neo4j/bolt/v1/runtime/internal/StateMachineErrorTest.java index 365c3e6a5bad..740b7ec01cf4 100644 --- a/community/bolt/src/test/java/org/neo4j/bolt/v1/runtime/internal/StateMachineErrorTest.java +++ b/community/bolt/src/test/java/org/neo4j/bolt/v1/runtime/internal/StateMachineErrorTest.java @@ -228,7 +228,7 @@ public void actionsDisallowedBeforeInitialized() throws Throwable machine.run( "RETURN 1", null, null, messages ); // Then - assertThat( messages.next(), failedWith( Status.Security.Forbidden ) ); + assertThat( messages.next(), failedWith( Status.Request.Invalid ) ); assertThat( machine.state(), equalTo( SessionStateMachine.State.STOPPED ) ); } }