com.evernote.edam.userstore.BootstrapInfo Java Examples
The following examples show how to use
com.evernote.edam.userstore.BootstrapInfo.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BootstrapManager.java From EverMemo with MIT License | 6 votes |
/** * Makes a web request to get the latest bootstrap information * This is a requirement during the oauth process * * @return {@link BootstrapInfoWrapper} * @throws Exception */ BootstrapInfoWrapper getBootstrapInfo() throws Exception { Log.d(LOGTAG, "getBootstrapInfo()"); BootstrapInfo bsInfo = null; try { if (mUserStoreClient == null) { initializeUserStoreAndCheckVersion(); } bsInfo = mUserStoreClient.getClient().getBootstrapInfo(mLocale.toString()); printBootstrapInfo(bsInfo); } catch (ClientUnsupportedException cue) { throw cue; } catch (TException e) { Log.e(LOGTAG, "error getting bootstrap info", e); } BootstrapInfoWrapper wrapper = new BootstrapInfoWrapper(mBootstrapServerUsed, bsInfo); return wrapper; }
Example #2
Source File: BootstrapManager.java From EverMemo-EverNote with MIT License | 6 votes |
/** * Makes a web request to get the latest bootstrap information * This is a requirement during the oauth process * * @return {@link BootstrapInfoWrapper} * @throws Exception */ BootstrapInfoWrapper getBootstrapInfo() throws Exception { Log.d(LOGTAG, "getBootstrapInfo()"); BootstrapInfo bsInfo = null; try { if (mUserStoreClient == null) { initializeUserStoreAndCheckVersion(); } bsInfo = mUserStoreClient.getClient().getBootstrapInfo(mLocale.toString()); printBootstrapInfo(bsInfo); } catch (ClientUnsupportedException cue) { throw cue; } catch (TException e) { Log.e(LOGTAG, "error getting bootstrap info", e); } BootstrapInfoWrapper wrapper = new BootstrapInfoWrapper(mBootstrapServerUsed, bsInfo); return wrapper; }
Example #3
Source File: BootstrapManager.java From EverMemo with MIT License | 5 votes |
/** * Log the {@link BootstrapProfile} list * @param bsInfo */ void printBootstrapInfo(BootstrapInfo bsInfo) { if (bsInfo == null) return; Log.d(LOGTAG, "printBootstrapInfo"); List<BootstrapProfile> profiles = bsInfo.getProfiles(); if (profiles != null) { for (BootstrapProfile profile : profiles) { Log.d(LOGTAG, profile.toString()); } } else { Log.d(LOGTAG, "Profiles are null"); } }
Example #4
Source File: EvernoteOAuthActivity.java From EverMemo with MIT License | 5 votes |
@Override protected String doInBackground(Void... params) { String url = null; try { EvernoteSession session = EvernoteSession.getOpenSession(); if (session != null) { // Network request BootstrapManager.BootstrapInfoWrapper infoWrapper = session .getBootstrapSession().getBootstrapInfo(); if (infoWrapper != null) { BootstrapInfo info = infoWrapper.getBootstrapInfo(); if (info != null) { mBootstrapProfiles = (ArrayList<BootstrapProfile>) info .getProfiles(); if (mBootstrapProfiles != null && mBootstrapProfiles.size() > 0 && mSelectedBootstrapProfilePos < mBootstrapProfiles .size()) { mSelectedBootstrapProfile = mBootstrapProfiles .get(mSelectedBootstrapProfilePos); } } } } if (mSelectedBootstrapProfile == null || TextUtils.isEmpty(mSelectedBootstrapProfile .getSettings().getServiceHost())) { Log.d(LOGTAG, "Bootstrap did not return a valid host"); return null; } OAuthService service = createService(); Log.i(LOGTAG, "Retrieving OAuth request token..."); Token reqToken = service.getRequestToken(); mRequestToken = reqToken.getToken(); mRequestTokenSecret = reqToken.getSecret(); Log.i(LOGTAG, "Redirecting user for authorization..."); url = service.getAuthorizationUrl(reqToken); } catch (BootstrapManager.ClientUnsupportedException cue) { return null; } catch (Exception ex) { Log.e(LOGTAG, "Failed to obtain OAuth request token", ex); } return url; }
Example #5
Source File: BootstrapManager.java From EverMemo-EverNote with MIT License | 5 votes |
/** * Log the {@link BootstrapProfile} list * @param bsInfo */ void printBootstrapInfo(BootstrapInfo bsInfo) { if (bsInfo == null) return; Log.d(LOGTAG, "printBootstrapInfo"); List<BootstrapProfile> profiles = bsInfo.getProfiles(); if (profiles != null) { for (BootstrapProfile profile : profiles) { Log.d(LOGTAG, profile.toString()); } } else { Log.d(LOGTAG, "Profiles are null"); } }
Example #6
Source File: EvernoteOAuthActivity.java From EverMemo-EverNote with MIT License | 5 votes |
@Override protected String doInBackground(Void... params) { String url = null; try { EvernoteSession session = EvernoteSession.getOpenSession(); if (session != null) { //Network request BootstrapManager.BootstrapInfoWrapper infoWrapper = session.getBootstrapSession().getBootstrapInfo(); if (infoWrapper != null){ BootstrapInfo info = infoWrapper.getBootstrapInfo(); if(info != null) { mBootstrapProfiles = (ArrayList<BootstrapProfile>) info.getProfiles(); if (mBootstrapProfiles != null && mBootstrapProfiles.size() > 0 && mSelectedBootstrapProfilePos < mBootstrapProfiles.size()){ mSelectedBootstrapProfile = mBootstrapProfiles.get(mSelectedBootstrapProfilePos); } } } } if(mSelectedBootstrapProfile == null || TextUtils.isEmpty(mSelectedBootstrapProfile.getSettings().getServiceHost())) { Log.d(LOGTAG, "Bootstrap did not return a valid host"); return null; } OAuthService service = createService(); Log.i(LOGTAG, "Retrieving OAuth request token..."); Token reqToken = service.getRequestToken(); mRequestToken = reqToken.getToken(); mRequestTokenSecret = reqToken.getSecret(); Log.i(LOGTAG, "Redirecting user for authorization..."); url = service.getAuthorizationUrl(reqToken); } catch(BootstrapManager.ClientUnsupportedException cue) { return null; } catch (Exception ex) { Log.e(LOGTAG, "Failed to obtain OAuth request token", ex); } return url; }
Example #7
Source File: StoreOperationControllerUserStoreIntegrationTest.java From evernote-rest-webapp with Apache License 2.0 | 4 votes |
@Test public void testGetBootstrapInfo() throws Exception { BootstrapSettings settings = new BootstrapSettings(); settings.setServiceHost("SERVICE_HOST"); settings.setMarketingUrl("MARKETING_URL"); settings.setSupportUrl("SUPPORT_URL"); settings.setAccountEmailDomain("ACCOUNT_EMAIL_DOMAIN"); settings.setEnableFacebookSharing(true); settings.setEnableGiftSubscriptions(true); settings.setEnableSupportTickets(true); settings.setEnableSharedNotebooks(true); settings.setEnableSingleNoteSharing(true); settings.setEnableSponsoredAccounts(true); settings.setEnableTwitterSharing(true); settings.setEnableLinkedInSharing(true); settings.setEnablePublicNotebooks(true); BootstrapProfile profile = new BootstrapProfile(); profile.setName("PROFILE_NAME"); profile.setSettings(settings); List<BootstrapProfile> profiles = new ArrayList<BootstrapProfile>(); profiles.add(profile); BootstrapInfo bootstrapInfo = new BootstrapInfo(); bootstrapInfo.setProfiles(profiles); when(userStoreOperations.getBootstrapInfo("foo")).thenReturn(bootstrapInfo); performRequest("/userStore/getBootstrapInfo", "{\"locale\": \"foo\"}") .andExpect(jsonPath("$.profiles[0].name").value("PROFILE_NAME")) .andExpect(jsonPath("$.profiles[0].settings.serviceHost").value("SERVICE_HOST")) .andExpect(jsonPath("$.profiles[0].settings.marketingUrl").value("MARKETING_URL")) .andExpect(jsonPath("$.profiles[0].settings.supportUrl").value("SUPPORT_URL")) .andExpect(jsonPath("$.profiles[0].settings.accountEmailDomain").value("ACCOUNT_EMAIL_DOMAIN")) .andExpect(jsonPath("$.profiles[0].settings.enableFacebookSharing").value(true)) .andExpect(jsonPath("$.profiles[0].settings.enableGiftSubscriptions").value(true)) .andExpect(jsonPath("$.profiles[0].settings.enableSupportTickets").value(true)) .andExpect(jsonPath("$.profiles[0].settings.enableSharedNotebooks").value(true)) .andExpect(jsonPath("$.profiles[0].settings.enableSingleNoteSharing").value(true)) .andExpect(jsonPath("$.profiles[0].settings.enableSponsoredAccounts").value(true)) .andExpect(jsonPath("$.profiles[0].settings.enableTwitterSharing").value(true)) .andExpect(jsonPath("$.profiles[0].settings.enableLinkedInSharing").value(true)) .andExpect(jsonPath("$.profiles[0].settings.enablePublicNotebooks").value(true)) ; verify(userStoreOperations).getBootstrapInfo("foo"); }
Example #8
Source File: BootstrapManager.java From EverMemo with MIT License | 4 votes |
BootstrapInfoWrapper(String serverUrl, BootstrapInfo info) { mServerUrl = serverUrl; mBootstrapInfo = info; }
Example #9
Source File: BootstrapManager.java From EverMemo with MIT License | 4 votes |
BootstrapInfo getBootstrapInfo() { return mBootstrapInfo; }
Example #10
Source File: BootstrapManager.java From EverMemo-EverNote with MIT License | 4 votes |
BootstrapInfoWrapper(String serverUrl, BootstrapInfo info) { mServerUrl = serverUrl; mBootstrapInfo = info; }
Example #11
Source File: BootstrapManager.java From EverMemo-EverNote with MIT License | 4 votes |
BootstrapInfo getBootstrapInfo() { return mBootstrapInfo; }
Example #12
Source File: AsyncUserStoreClient.java From EverMemo with MIT License | 2 votes |
/** * Asynchronous wrapper * * @param {@link OnClientCallback} providing an interface to the calling code * @see UserStore.Client#getBootstrapInfo(String) */ public void getBootstrapInfo(final String locale, final OnClientCallback<BootstrapInfo> callback) { AsyncReflector.execute(mClient, callback, "getBootstrapInfo", locale); }
Example #13
Source File: AsyncUserStoreClient.java From EverMemo-EverNote with MIT License | 2 votes |
/** * Asynchronous wrapper * * @param {@link OnClientCallback} providing an interface to the calling code * @see UserStore.Client#getBootstrapInfo(String) */ public void getBootstrapInfo(final String locale, final OnClientCallback<BootstrapInfo> callback) { AsyncReflector.execute(mClient, callback, "getBootstrapInfo", locale); }