From 5f9026eebf91ecc1dd28aadf2104d3ae5a10addd Mon Sep 17 00:00:00 2001 From: Max Shaposhnik Date: Tue, 1 Mar 2016 12:15:42 +0200 Subject: [PATCH] CODENVY-170 rename autghorize method to authenticate Signed-off-by: Max Shaposhnik --- .../ide/api/oauth/OAuth2Authenticator.java | 4 +-- .../oauth/DefaultOAuthAuthenticatorImpl.java | 4 +-- .../projectimport/wizard/ProjectImporter.java | 32 +++++++++---------- .../GitHubAuthenticatorImpl.java | 4 +-- .../page/GithubImporterPagePresenter.java | 4 +-- .../GitHubAuthenticatorImplTest.java | 10 +++--- .../page/GithubImporterPagePresenterTest.java | 4 +-- 7 files changed, 31 insertions(+), 31 deletions(-) diff --git a/core/ide/che-core-ide-api/src/main/java/org/eclipse/che/ide/api/oauth/OAuth2Authenticator.java b/core/ide/che-core-ide-api/src/main/java/org/eclipse/che/ide/api/oauth/OAuth2Authenticator.java index bbd14ebc2b..0bcffea5f6 100644 --- a/core/ide/che-core-ide-api/src/main/java/org/eclipse/che/ide/api/oauth/OAuth2Authenticator.java +++ b/core/ide/che-core-ide-api/src/main/java/org/eclipse/che/ide/api/oauth/OAuth2Authenticator.java @@ -20,9 +20,9 @@ import org.eclipse.che.security.oauth.OAuthStatus; */ public interface OAuth2Authenticator { - void authorize(String authenticatorUrl, AsyncCallback callback); + void authenticate(String authenticationUrl, AsyncCallback callback); - Promise authorize(String authenticationUrl); + Promise authenticate(String authenticationUrl); String getProviderName(); } diff --git a/core/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/oauth/DefaultOAuthAuthenticatorImpl.java b/core/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/oauth/DefaultOAuthAuthenticatorImpl.java index f717696567..ca82283427 100644 --- a/core/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/oauth/DefaultOAuthAuthenticatorImpl.java +++ b/core/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/oauth/DefaultOAuthAuthenticatorImpl.java @@ -49,13 +49,13 @@ public class DefaultOAuthAuthenticatorImpl implements OAuth2Authenticator, OAuth } @Override - public void authorize(String authenticationUrl, @NotNull final AsyncCallback callback) { + public void authenticate(String authenticationUrl, @NotNull final AsyncCallback callback) { this.authenticationUrl = authenticationUrl; this.callback = callback; showDialog(); } - public Promise authorize(String authenticationUrl) { + public Promise authenticate(String authenticationUrl) { this.authenticationUrl = authenticationUrl; return AsyncPromiseHelper.createFromAsyncRequest(new AsyncPromiseHelper.RequestCall() { diff --git a/core/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/projectimport/wizard/ProjectImporter.java b/core/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/projectimport/wizard/ProjectImporter.java index 10655aa70f..375178f2d8 100644 --- a/core/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/projectimport/wizard/ProjectImporter.java +++ b/core/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/projectimport/wizard/ProjectImporter.java @@ -175,23 +175,23 @@ public class ProjectImporter extends AbstractImporter { if(authenticator == null) { authenticator = oAuth2AuthenticatorRegistry.getAuthenticator("default"); } - authenticator.authorize(OAuth2AuthenticatorUrlProvider.get(restContext, authenticateUrl), - new AsyncCallback() { - @Override - public void onFailure(Throwable caught) { - callback.onFailure(new Exception(caught.getMessage())); - } + authenticator.authenticate(OAuth2AuthenticatorUrlProvider.get(restContext, authenticateUrl), + new AsyncCallback() { + @Override + public void onFailure(Throwable caught) { + callback.onFailure(new Exception(caught.getMessage())); + } - @Override - public void onSuccess(OAuthStatus result) { - if (!result.equals(OAuthStatus.NOT_PERFORMED)) { - doImport(pathToProject, projectName, sourceStorage); - } else { - subscriber.onFailure("Authentication cancelled"); - callback.onCompleted(); - } - } - }); + @Override + public void onSuccess(OAuthStatus result) { + if (!result.equals(OAuthStatus.NOT_PERFORMED)) { + doImport(pathToProject, projectName, sourceStorage); + } else { + subscriber.onFailure("Authentication cancelled"); + callback.onCompleted(); + } + } + }); } diff --git a/plugins/plugin-github/che-plugin-github-ext-github/src/main/java/org/eclipse/che/ide/ext/github/client/authenticator/GitHubAuthenticatorImpl.java b/plugins/plugin-github/che-plugin-github-ext-github/src/main/java/org/eclipse/che/ide/ext/github/client/authenticator/GitHubAuthenticatorImpl.java index 751f2d4438..eb73f56e83 100644 --- a/plugins/plugin-github/che-plugin-github-ext-github/src/main/java/org/eclipse/che/ide/ext/github/client/authenticator/GitHubAuthenticatorImpl.java +++ b/plugins/plugin-github/che-plugin-github-ext-github/src/main/java/org/eclipse/che/ide/ext/github/client/authenticator/GitHubAuthenticatorImpl.java @@ -82,13 +82,13 @@ public class GitHubAuthenticatorImpl implements OAuth2Authenticator, OAuthCallba } @Override - public void authorize(String authenticationUrl, @NotNull final AsyncCallback callback) { + public void authenticate(String authenticationUrl, @NotNull final AsyncCallback callback) { this.authenticationUrl = authenticationUrl; this.callback = callback; view.showDialog(); } - public Promise authorize(String authenticationUrl) { + public Promise authenticate(String authenticationUrl) { this.authenticationUrl = authenticationUrl; return AsyncPromiseHelper.createFromAsyncRequest(new AsyncPromiseHelper.RequestCall() { diff --git a/plugins/plugin-github/che-plugin-github-ext-github/src/main/java/org/eclipse/che/ide/ext/github/client/importer/page/GithubImporterPagePresenter.java b/plugins/plugin-github/che-plugin-github-ext-github/src/main/java/org/eclipse/che/ide/ext/github/client/importer/page/GithubImporterPagePresenter.java index 5a0ec38c82..888638d4ae 100644 --- a/plugins/plugin-github/che-plugin-github-ext-github/src/main/java/org/eclipse/che/ide/ext/github/client/importer/page/GithubImporterPagePresenter.java +++ b/plugins/plugin-github/che-plugin-github-ext-github/src/main/java/org/eclipse/che/ide/ext/github/client/importer/page/GithubImporterPagePresenter.java @@ -282,9 +282,9 @@ public class GithubImporterPagePresenter extends AbstractWizardPage() { @Override public void onFailure(Throwable caught) { diff --git a/plugins/plugin-github/che-plugin-github-ext-github/src/test/java/org/eclipse/che/ide/ext/github/client/authenticator/GitHubAuthenticatorImplTest.java b/plugins/plugin-github/che-plugin-github-ext-github/src/test/java/org/eclipse/che/ide/ext/github/client/authenticator/GitHubAuthenticatorImplTest.java index 503de8c444..79881714fd 100644 --- a/plugins/plugin-github/che-plugin-github-ext-github/src/test/java/org/eclipse/che/ide/ext/github/client/authenticator/GitHubAuthenticatorImplTest.java +++ b/plugins/plugin-github/che-plugin-github-ext-github/src/test/java/org/eclipse/che/ide/ext/github/client/authenticator/GitHubAuthenticatorImplTest.java @@ -128,7 +128,7 @@ public class GitHubAuthenticatorImplTest { @Test public void dialogShouldBeShow() throws Exception { AsyncCallback callback = getCallBack(); - gitHubAuthenticator.authorize(null, callback); + gitHubAuthenticator.authenticate(null, callback); verify(view).showDialog(); assertThat(gitHubAuthenticator.callback, is(callback)); @@ -171,7 +171,7 @@ public class GitHubAuthenticatorImplTest { when(user.getProfile()).thenReturn(profile); when(profile.getId()).thenReturn(userId); - gitHubAuthenticator.authorize(null, getCallBack()); + gitHubAuthenticator.authenticate(null, getCallBack()); gitHubAuthenticator.onAuthenticated(authStatus); verify(view).isGenerateKeysSelected(); @@ -198,7 +198,7 @@ public class GitHubAuthenticatorImplTest { when(user.getProfile()).thenReturn(profile); when(profile.getId()).thenReturn(userId); - gitHubAuthenticator.authorize(null, getCallBack()); + gitHubAuthenticator.authenticate(null, getCallBack()); gitHubAuthenticator.onAuthenticated(authStatus); verify(keyProvider).uploadKey(eq(userId), generateKeyCallbackCaptor.capture()); @@ -229,7 +229,7 @@ public class GitHubAuthenticatorImplTest { when(profile.getId()).thenReturn(userId); when(dialogFactory.createMessageDialog(anyString(), anyString(), Matchers.anyObject())).thenReturn(messageDialog); - gitHubAuthenticator.authorize(null, getCallBack()); + gitHubAuthenticator.authenticate(null, getCallBack()); gitHubAuthenticator.onAuthenticated(authStatus); verify(keyProvider).uploadKey(eq(userId), generateKeyCallbackCaptor.capture()); @@ -266,7 +266,7 @@ public class GitHubAuthenticatorImplTest { when(pair.getName()).thenReturn(GITHUB_HOST); when(pair.getService()).thenReturn(SshKeyManagerPresenter.GIT_SSH_SERVICE); - gitHubAuthenticator.authorize(null, getCallBack()); + gitHubAuthenticator.authenticate(null, getCallBack()); gitHubAuthenticator.onAuthenticated(authStatus); verify(keyUploader).uploadKey(eq(userId), generateKeyCallbackCaptor.capture()); diff --git a/plugins/plugin-github/che-plugin-github-ext-github/src/test/java/org/eclipse/che/ide/ext/github/client/importer/page/GithubImporterPagePresenterTest.java b/plugins/plugin-github/che-plugin-github-ext-github/src/test/java/org/eclipse/che/ide/ext/github/client/importer/page/GithubImporterPagePresenterTest.java index a3a715cb44..929931100c 100644 --- a/plugins/plugin-github/che-plugin-github-ext-github/src/test/java/org/eclipse/che/ide/ext/github/client/importer/page/GithubImporterPagePresenterTest.java +++ b/plugins/plugin-github/che-plugin-github-ext-github/src/test/java/org/eclipse/che/ide/ext/github/client/importer/page/GithubImporterPagePresenterTest.java @@ -420,7 +420,7 @@ public class GithubImporterPagePresenterTest { verify(gitHubClientService).getUserInfo(); verify(gitHubClientService).getOrganizations(); - verify(gitHubAuthenticator).authorize(anyString(), asyncCallbackCaptor.capture()); + verify(gitHubAuthenticator).authenticate(anyString(), asyncCallbackCaptor.capture()); AsyncCallback asyncCallback = asyncCallbackCaptor.getValue(); asyncCallback.onFailure(exception); @@ -463,7 +463,7 @@ public class GithubImporterPagePresenterTest { verify(gitHubClientService).getUserInfo(); verify(gitHubClientService).getOrganizations(); - verify(gitHubAuthenticator).authorize(anyString(), asyncCallbackCaptor.capture()); + verify(gitHubAuthenticator).authenticate(anyString(), asyncCallbackCaptor.capture()); AsyncCallback asyncCallback = asyncCallbackCaptor.getValue(); asyncCallback.onSuccess(null);