Skip to content

Commit

Permalink
Change the error code back to Request.Invalid after code review
Browse files Browse the repository at this point in the history
  • Loading branch information
Zhen committed Jun 23, 2016
1 parent 76340e3 commit eae5394
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Expand Up @@ -105,7 +105,7 @@ public State interrupt( SessionStateMachine ctx )
@Override @Override
protected State onNoImplementation( SessionStateMachine ctx, String command ) 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." ) ); "INIT message successfully." ) );
return halt( ctx ); return halt( ctx );
} }
Expand Down
Expand Up @@ -81,7 +81,7 @@ public void shouldDisallowRunOnAuthenticationFailureAndAck() throws Throwable
assertThat( recorder, recorded( assertThat( recorder, recorded(
failedWith(Status.Security.Unauthorized), failedWith(Status.Security.Unauthorized),
success(), success(),
failedWith(Status.Security.Forbidden) )); failedWith(Status.Request.Invalid) ));
} }


@Test @Test
Expand All @@ -105,11 +105,11 @@ public void shouldDisallowRunAfterAuthFailureAndReset() throws Throwable
assertThat( recorder, recorded( assertThat( recorder, recorded(
failedWith(Status.Security.Unauthorized), failedWith(Status.Security.Unauthorized),
success(), success(),
failedWith(Status.Security.Forbidden) )); failedWith(Status.Request.Invalid) ));
} }


@Test @Test
public void shouldIgnoreAfterSecurityForbidden() throws Throwable public void shouldIgnoreAfterRequestInvalid() throws Throwable
{ {
// given it is important for client applications to programmatically // given it is important for client applications to programmatically
// identify expired credentials as the cause of not being authenticated // identify expired credentials as the cause of not being authenticated
Expand All @@ -122,7 +122,7 @@ public void shouldIgnoreAfterSecurityForbidden() throws Throwable


// then // then
assertThat( recorder, recorded( assertThat( recorder, recorded(
failedWith(Status.Security.Forbidden), failedWith(Status.Request.Invalid),
ignored() )); ignored() ));
} }


Expand All @@ -140,7 +140,7 @@ public void shouldDisallowRunBeforeSuccessInit() throws Throwable
session.run( "RETURN 1337", map(), null, recorder ); session.run( "RETURN 1337", map(), null, recorder );


// then // then
assertThat( recorder, recorded( failedWith(Status.Security.Forbidden), ignored() )); assertThat( recorder, recorded( failedWith(Status.Request.Invalid), ignored() ));
} }


@Test @Test
Expand All @@ -156,7 +156,7 @@ public void shouldDisallowResetBeforeSuccessInit() throws Throwable
session.run( "RETURN 1337", map(), null, recorder ); session.run( "RETURN 1337", map(), null, recorder );


// then // then
assertThat( recorder, recorded( failedWith( Status.Security.Forbidden ), ignored() )); assertThat( recorder, recorded( failedWith( Status.Request.Invalid ), ignored() ));
} }


@Test @Test
Expand Down
Expand Up @@ -228,7 +228,7 @@ public void actionsDisallowedBeforeInitialized() throws Throwable
machine.run( "RETURN 1", null, null, messages ); machine.run( "RETURN 1", null, null, messages );


// Then // Then
assertThat( messages.next(), failedWith( Status.Security.Forbidden ) ); assertThat( messages.next(), failedWith( Status.Request.Invalid ) );
assertThat( machine.state(), equalTo( SessionStateMachine.State.STOPPED ) ); assertThat( machine.state(), equalTo( SessionStateMachine.State.STOPPED ) );
} }
} }

0 comments on commit eae5394

Please sign in to comment.