@Test public void oAuthAuthorizerWithAccessTokenSecretHttpUrlConnection() { String accessToken = "TestAccessToken"; String accessTokenSecret = "TestAccessTokenSecret"; String consumerKey = "TestConsumerKey"; String consumerSecret = "TestConsumerSecret"; Config.setProperty(Config.HTTP_TRANSPORT, HTTPURLConnectionInterceptor.HTTP_URL_CONNECTION); try { URL url = new URL(URL_STRING); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); OAuthAuthorizer oauthAuthorizer = new OAuthAuthorizer(consumerKey, consumerSecret, accessToken, accessTokenSecret); oauthAuthorizer.authorize(conn); } catch (Exception e) { log.debug(e.getMessage()); Assert.fail("Exception should not happen"); } }
@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);  }