@Test public void oAuthAuthorizerWithAccessTokenSecret() { String accessToken = "TestAccessToken"; String accessTokenSecret = "TestAccessTokenSecret"; String consumerKey = "TestConsumerKey"; String consumerSecret = "TestConsumerSecret"; Header[] header = null; HttpRequestBase requestBase = new HttpGet(); try { requestBase.setURI(new URI(URL_STRING)); OAuthAuthorizer oauthAuthorizer = new OAuthAuthorizer(consumerKey, consumerSecret, accessToken, accessTokenSecret); oauthAuthorizer.authorize(requestBase); header = requestBase.getAllHeaders(); Assert.assertEquals( accessToken, extractHeaderParams(header, requestBase, "OAuth oauth_token"), "The authorization header is not proper,oauth_token not present"); Assert.assertEquals( consumerKey, extractHeaderParams(header, requestBase, " oauth_consumer_key"), "The authorization header is not proper,oauth_consumer_key not present"); } catch (Exception e) { log.debug(e.getMessage()); } }
@Override public void authorize(HttpRequestBase httpRequest) throws FMSException { try { oAuthConsumer.sign(httpRequest); } catch (OAuthMessageSignerException e) { throw new FMSException(e); } catch (OAuthExpectationFailedException e) { throw new FMSException(e); } catch (OAuthCommunicationException e) { throw new FMSException(e); } }
OAuthAuthorizer implements IAuthorizer { @Override public void authorize(HttpRequestBase httpRequest) throws FMSException { try { oAuthConsumer.sign(httpRequest); } catch (OAuthMessageSignerException e) { throw new FMSException(e); } catch (OAuthExpectationFailedException e) { throw new FMSException(e); } catch (OAuthCommunicationException e) { throw new FMSException(e); } } }
OAuthAuthorizer implements IAuthorizer { @Override public void authorize(HttpRequestBase httpRequest) throws FMSException { try { oAuthConsumer.sign(httpRequest); } catch (OAuthMessageSignerException e) { throw new FMSException(e); } catch (OAuthExpectationFailedException e) { throw new FMSException(e); } catch (OAuthCommunicationException e) { throw new FMSException(e); } } private  OAuthAuthorizer(String consumerKey, String consumerSecret);  OAuthAuthorizer(String consumerKey, String consumerSecret, String accessToken, String accessTokenSecret); }
OAuthAuthorizer implements IAuthorizer { @Override public void authorize(HttpRequestBase httpRequest) throws FMSException { try { oAuthConsumer.sign(httpRequest); } catch (OAuthMessageSignerException e) { throw new FMSException(e); } catch (OAuthExpectationFailedException e) { throw new FMSException(e); } catch (OAuthCommunicationException e) { throw new FMSException(e); } } private  OAuthAuthorizer(String consumerKey, String consumerSecret);  OAuthAuthorizer(String consumerKey, String consumerSecret, String accessToken, String accessTokenSecret); @Override void authorize(HttpRequestBase httpRequest); @Override void authorize(HttpURLConnection httpUrlConnection); }
OAuthAuthorizer implements IAuthorizer { @Override public void authorize(HttpRequestBase httpRequest) throws FMSException { try { oAuthConsumer.sign(httpRequest); } catch (OAuthMessageSignerException e) { throw new FMSException(e); } catch (OAuthExpectationFailedException e) { throw new FMSException(e); } catch (OAuthCommunicationException e) { throw new FMSException(e); } } private  OAuthAuthorizer(String consumerKey, String consumerSecret);  OAuthAuthorizer(String consumerKey, String consumerSecret, String accessToken, String accessTokenSecret); @Override void authorize(HttpRequestBase httpRequest); @Override void authorize(HttpURLConnection httpUrlConnection);  }