/**
   * Tests a call to the two-legged OAuth endpoint: GET /oauth/test_consumer_request using the
   * RSA-SHA1 signature method.
   */
  public void testTwoLeggedOAuthCallWithRsaSha1Signature() throws MalformedURLException {
    OAuthClientHelper och = new OAuthClientHelper();
    och.setHttpMethod(HttpMethod.GET);
    och.setRequestUrl(new URL("https://cheetah.dhcp.pgdev.sap.corp/oauth/test_consumer_request"));
    och.setConsumerKey("1VMzOctCAidMaahS9yJU");
    och.setConsumerPrivateKey(TEST_CONSUMER_PRIVATE_KEY);
    och.setTokenForTwoLeggedOAuth();
    och.setSignatureMethod(SignatureMethod.RSA_SHA1);
    // under normal circumstances, we would not set the timestamp and nonce, and just let the
    // library
    // use the current time and a generated uuid. However, we're comparing with a known good request
    och.setTimestamp(1307748357L);
    och.setNonce("NtX9Gah3Bw");

    String expectedAuthorizationHeader =
        "OAuth oauth_consumer_key=\"1VMzOctCAidMaahS9yJU\", oauth_nonce=\"NtX9Gah3Bw\", oauth_signature_method=\"RSA-SHA1\", oauth_timestamp=\"1307748357\", oauth_version=\"1.0\", oauth_token=\"\", oauth_signature=\"h%2FKJEkVh3GdY%2BLN7G6gQazi625uwKGkxzyN3dcQh4LzyS2z%2FBLCcLiWL5u9Xkk%2FwxvIwvE6FcvWmYlPHxzNUPxjNfXkIo6CgfF2wAqDf09JLPuMlZPAKaj8n%2BFOTiswuOH%2BsxkCatN2ziUKsMqniYWHLxgT3Q9DI1Fve6tdGOuJO0H3Lg%2BzAIC8oWSWw4q6VPPauCbslJaZTA6d6v2yg2oMxBoLCnJ9x1F2C2B9Fqb3w0lkzDm5Vxz%2B%2BWgswLSXpIBQpfoqzZpE5qohBpq%2FT9KGMM8Ewj2hvzf0NSZtMRPvqpE5A4AFBxMnHlIHKnFLTxRqjAn2qgm1MY6wJhDDuoQ%3D%3D\"";
    assertEqualAuthorizationHeaders(expectedAuthorizationHeader, och.generateAuthorizationHeader());
  }
  /** Tests a call to a two-legged OAuth endpoint. */
  public void testTwoLeggedOAuthCall() throws MalformedURLException {

    OAuthClientHelper och = new OAuthClientHelper();
    och.setHttpMethod(HttpMethod.GET);
    och.setRequestUrl(new URL("https://cheetah.dhcp.pgdev.sap.corp/oauth/test_consumer_request"));
    och.setConsumerKey("1VMzOctCAidMaahS9yJU");
    och.setConsumerSecret("JinGkf4bjzFQhOVUbhxpL3eU1esKgO8qTAGfCXy7");
    och.setTokenForTwoLeggedOAuth();
    och.setSignatureMethod(SignatureMethod.HMAC_SHA1);
    // under normal circumstances, we would not set the timestamp and nonce, and just let the
    // library
    // use the current time and a generated uuid. However, we're comparing with a known good request
    och.setTimestamp(1307734348L);
    och.setNonce("thZmo2SoWA");

    String expectedAuthorizationHeader =
        "OAuth oauth_consumer_key=\"1VMzOctCAidMaahS9yJU\", oauth_nonce=\"thZmo2SoWA\", oauth_signature_method=\"HMAC-SHA1\", oauth_timestamp=\"1307734348\", oauth_version=\"1.0\", oauth_token=\"\", oauth_signature=\"suUt%2B%2BCRsEp8WhSPApI83BtsBYk%3D\"";
    assertEqualAuthorizationHeaders(expectedAuthorizationHeader, och.generateAuthorizationHeader());
  }