Skip to content

Commit

Permalink
Change request name from 'does-user-exists' to 'is-valid-user'
Browse files Browse the repository at this point in the history
  • Loading branch information
GaneshSPatil committed Feb 14, 2019
1 parent 1ca3dfa commit 91ca767
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ public GoPluginApiResponse handle(GoPluginApiRequest request) throws UnhandledRe
return new UserAuthenticationExecutor(request, new Authenticator()).execute();
case REQUEST_SEARCH_USERS:
return new SearchUserExecutor(request).execute();
case REQUEST_DOES_USER_EXISTS:
return new DoesUserExistsExecutor(request).execute();
case REQUEST_IS_VALID_USER:
return new IsValidUserRequestExecutor(request).execute();
default:
throw new UnhandledRequestTypeException(request.requestName());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@

import static cd.go.authentication.passwordfile.utils.Util.GSON;

public class DoesUserExistsExecutor implements RequestExecutor {
public class IsValidUserRequestExecutor implements RequestExecutor {
private final GoPluginApiRequest request;
private PasswordFileReader passwordFileReader;

public DoesUserExistsExecutor(GoPluginApiRequest request) {
public IsValidUserRequestExecutor(GoPluginApiRequest request) {
this(request, new PasswordFileReader());
}

protected DoesUserExistsExecutor(GoPluginApiRequest request, PasswordFileReader passwordFileReader) {
protected IsValidUserRequestExecutor(GoPluginApiRequest request, PasswordFileReader passwordFileReader) {
this.request = request;
this.passwordFileReader = passwordFileReader;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public enum RequestFromServer {
REQUEST_AUTHENTICATE_USER(Constants.REQUEST_PREFIX + ".authenticate-user"),
REQUEST_SEARCH_USERS(Constants.REQUEST_PREFIX + ".find-users"),

REQUEST_DOES_USER_EXISTS(Constants.REQUEST_PREFIX + ".does-user-exists");
REQUEST_IS_VALID_USER(Constants.REQUEST_PREFIX + ".is-valid-user");

private final String requestName;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

public class DoesUserExistsExecutorTest {
public class IsValidUserRequestExecutorTest {

private PasswordFileReader fileReader;

Expand All @@ -47,7 +47,7 @@ public void shouldReturn200WhenTheCurrentUserExistsInThePasswordFile() throws Ex
when(fileReader.read("/var/etc/password.properties")).thenReturn(properties);
when(request.requestBody()).thenReturn(requestJson("bob"));

final GoPluginApiResponse response = new DoesUserExistsExecutor(request, fileReader).execute();
final GoPluginApiResponse response = new IsValidUserRequestExecutor(request, fileReader).execute();

assertThat(response.responseCode(), is(200));
}
Expand All @@ -61,7 +61,7 @@ public void shouldReturn404WhenTheCurrentUserDoesNotExistsInThePasswordFile() th
when(fileReader.read("/var/etc/password.properties")).thenReturn(properties);
when(request.requestBody()).thenReturn(requestJson("john"));

final GoPluginApiResponse response = new DoesUserExistsExecutor(request, fileReader).execute();
final GoPluginApiResponse response = new IsValidUserRequestExecutor(request, fileReader).execute();

assertThat(response.responseCode(), is(404));
}
Expand All @@ -75,7 +75,7 @@ public void shouldLookForExactUsernameMatchInsteadOfRegExp() throws Exception {
when(fileReader.read("/var/etc/password.properties")).thenReturn(properties);
when(request.requestBody()).thenReturn(requestJson("bob"));

final GoPluginApiResponse response = new DoesUserExistsExecutor(request, fileReader).execute();
final GoPluginApiResponse response = new IsValidUserRequestExecutor(request, fileReader).execute();

assertThat(response.responseCode(), is(404));
}
Expand All @@ -89,7 +89,7 @@ public void shouldLookForCaseInsensitiveUsernameMatch() throws Exception {
when(fileReader.read("/var/etc/password.properties")).thenReturn(properties);
when(request.requestBody()).thenReturn(requestJson("BoB"));

final GoPluginApiResponse response = new DoesUserExistsExecutor(request, fileReader).execute();
final GoPluginApiResponse response = new IsValidUserRequestExecutor(request, fileReader).execute();

assertThat(response.responseCode(), is(200));
}
Expand Down

0 comments on commit 91ca767

Please sign in to comment.