~s-friedemann/tomdroid/sshfs

« back to all changes in this revision

Viewing changes to lib/signpost/signpost-core/src/test/java/oauth/signpost/SignpostTestBase.java

  • Committer: Benoit Garret
  • Date: 2010-03-06 20:39:56 UTC
  • mto: (185.4.1 sync-ui)
  • mto: This revision was merged to the branch mainline in revision 186.
  • Revision ID: benoit.garret_launchpad@gadz.org-20100306203956-k6vlss6hk2d91j4n
Put the signpost and commons-codec libraries in lib/

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package oauth.signpost;
 
2
 
 
3
import static org.mockito.Mockito.when;
 
4
 
 
5
import java.util.HashMap;
 
6
 
 
7
import oauth.signpost.http.HttpRequest;
 
8
 
 
9
import org.junit.Before;
 
10
import org.junit.BeforeClass;
 
11
import org.mockito.Mock;
 
12
import org.mockito.MockitoAnnotations;
 
13
 
 
14
public abstract class SignpostTestBase {
 
15
 
 
16
    public static final String OAUTH_VERSION = "1.0";
 
17
 
 
18
    public static final String CONSUMER_KEY = "dpf43f3p2l4k3l03";
 
19
 
 
20
    public static final String CONSUMER_SECRET = "kd94hf93k423kf44";
 
21
 
 
22
    public static final String TOKEN = "nnch734d00sl2jdk";
 
23
 
 
24
    public static final String TOKEN_SECRET = "pfkkdhi9sl3r4s00";
 
25
 
 
26
    public static final String NONCE = "kllo9940pd9333jh";
 
27
 
 
28
    public static final String TIMESTAMP = "1191242096";
 
29
 
 
30
    public static final String SIGNATURE_METHOD = "HMAC-SHA1";
 
31
 
 
32
    public static final String REQUEST_TOKEN_ENDPOINT_URL = "http://api.test.com/request_token";
 
33
 
 
34
    public static final String ACCESS_TOKEN_ENDPOINT_URL = "http://api.test.com/access_token";
 
35
 
 
36
    public static final String AUTHORIZE_WEBSITE_URL = "http://www.test.com/authorize";
 
37
 
 
38
    public static final HashMap<String, String> OAUTH_PARAMS = new HashMap<String, String>();
 
39
 
 
40
    @Mock
 
41
    protected HttpRequest httpGetMock;
 
42
 
 
43
    @Mock
 
44
    protected HttpRequest httpPostMock;
 
45
 
 
46
    @BeforeClass
 
47
    public static void initOAuthParams() {
 
48
        OAUTH_PARAMS.put("oauth_consumer_key", CONSUMER_KEY);
 
49
        OAUTH_PARAMS.put("oauth_signature_method", SIGNATURE_METHOD);
 
50
        OAUTH_PARAMS.put("oauth_timestamp", TIMESTAMP);
 
51
        OAUTH_PARAMS.put("oauth_nonce", NONCE);
 
52
        OAUTH_PARAMS.put("oauth_version", OAUTH_VERSION);
 
53
        OAUTH_PARAMS.put("oauth_token", TOKEN);
 
54
    }
 
55
 
 
56
    @Before
 
57
    public void initRequestMocks() {
 
58
        MockitoAnnotations.initMocks(this);
 
59
 
 
60
        when(httpGetMock.getMethod()).thenReturn("GET");
 
61
        when(httpGetMock.getRequestUrl()).thenReturn("http://www.example.com");
 
62
 
 
63
        when(httpPostMock.getMethod()).thenReturn("POST");
 
64
        when(httpPostMock.getRequestUrl()).thenReturn("http://www.example.com");
 
65
    }
 
66
 
 
67
}