com.google.code.linkedinapi.client.oauth
Class LinkedInOAuthServiceTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by com.google.code.linkedinapi.client.oauth.LinkedInOAuthServiceTest
All Implemented Interfaces:
junit.framework.Test

public class LinkedInOAuthServiceTest
extends junit.framework.TestCase

Author:
nmukhtar

Field Summary
protected static java.util.regex.Pattern CSRF_TOKEN_PATTERN
          Field description
protected static java.lang.String LOGIN_URL
          Field description
protected static java.util.regex.Pattern OAUTH_VERIFIER_PATTERN
          Field description
protected static java.lang.String RESOURCE_MISSING_MESSAGE
          Field description
protected  LinkedInOAuthService service
          Field description
 
Constructor Summary
LinkedInOAuthServiceTest()
           
 
Method Summary
protected static void assertNotNullOrEmpty(java.lang.String message, java.lang.String value)
           
protected static java.lang.String convertStreamToString(java.io.InputStream is)
          Stolen liberally from http://www.kodejava.org/examples/266.html
private static java.util.Map<java.lang.String,java.lang.String> getParametersMap(LinkedInRequestToken requestToken, java.lang.String userName, java.lang.String password)
           
private static java.lang.String getParametersString(java.util.Map<java.lang.String,java.lang.String> parametersMap)
           
private  void makeTestApiRequest(LinkedInAccessToken accessToken)
           
 void setUp()
           
static void setUpBeforeClass()
           
private static java.lang.String simulateWebLoginAndGetOauthVerifier(LinkedInRequestToken requestToken)
           
 void tearDown()
           
static void tearDownAfterClass()
           
 void testGetOAuthAccessToken()
          Test method for LinkedInOAuthServiceImpl.getOAuthAccessToken(com.google.code.linkedinapi.client.oauth.LinkedInRequestToken, java.lang.String).
 void testGetOAuthRequestToken()
          Test method for LinkedInOAuthServiceImpl.getOAuthRequestToken().
 void testGetOAuthRequestTokenString()
          Test method for LinkedInOAuthServiceImpl.getOAuthRequestToken(java.lang.String).
 void testSignRequestWithToken()
          Test method for LinkedInOAuthServiceImpl.signRequestWithToken(java.net.HttpURLConnection, com.google.code.linkedinapi.client.oauth.LinkedInAccessToken).
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame, format
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

service

protected LinkedInOAuthService service
Field description


RESOURCE_MISSING_MESSAGE

protected static final java.lang.String RESOURCE_MISSING_MESSAGE
Field description

See Also:
Constant Field Values

OAUTH_VERIFIER_PATTERN

protected static final java.util.regex.Pattern OAUTH_VERIFIER_PATTERN
Field description


CSRF_TOKEN_PATTERN

protected static final java.util.regex.Pattern CSRF_TOKEN_PATTERN
Field description


LOGIN_URL

protected static final java.lang.String LOGIN_URL
Field description

See Also:
Constant Field Values
Constructor Detail

LinkedInOAuthServiceTest

public LinkedInOAuthServiceTest()
Method Detail

setUpBeforeClass

public static void setUpBeforeClass()
                             throws java.lang.Exception
Throws:
java.lang.Exception

tearDownAfterClass

public static void tearDownAfterClass()
                               throws java.lang.Exception
Throws:
java.lang.Exception

setUp

public void setUp()
           throws java.lang.Exception
Overrides:
setUp in class junit.framework.TestCase
Throws:
java.lang.Exception

tearDown

public void tearDown()
              throws java.lang.Exception
Overrides:
tearDown in class junit.framework.TestCase
Throws:
java.lang.Exception

testGetOAuthAccessToken

public void testGetOAuthAccessToken()
Test method for LinkedInOAuthServiceImpl.getOAuthAccessToken(com.google.code.linkedinapi.client.oauth.LinkedInRequestToken, java.lang.String).


testGetOAuthRequestToken

public void testGetOAuthRequestToken()
Test method for LinkedInOAuthServiceImpl.getOAuthRequestToken().


testGetOAuthRequestTokenString

public void testGetOAuthRequestTokenString()
Test method for LinkedInOAuthServiceImpl.getOAuthRequestToken(java.lang.String).


testSignRequestWithToken

public void testSignRequestWithToken()
Test method for LinkedInOAuthServiceImpl.signRequestWithToken(java.net.HttpURLConnection, com.google.code.linkedinapi.client.oauth.LinkedInAccessToken).


assertNotNullOrEmpty

protected static void assertNotNullOrEmpty(java.lang.String message,
                                           java.lang.String value)

convertStreamToString

protected static java.lang.String convertStreamToString(java.io.InputStream is)
Stolen liberally from http://www.kodejava.org/examples/266.html


simulateWebLoginAndGetOauthVerifier

private static java.lang.String simulateWebLoginAndGetOauthVerifier(LinkedInRequestToken requestToken)

getParametersString

private static java.lang.String getParametersString(java.util.Map<java.lang.String,java.lang.String> parametersMap)

getParametersMap

private static java.util.Map<java.lang.String,java.lang.String> getParametersMap(LinkedInRequestToken requestToken,
                                                                                 java.lang.String userName,
                                                                                 java.lang.String password)

makeTestApiRequest

private void makeTestApiRequest(LinkedInAccessToken accessToken)
Parameters:
accessToken -