예제 #1
0
  public static LiveConnectClient newLiveConnectClient(HttpClient client) {
    LiveConnectSession session = TestUtils.newMockLiveConnectSession();
    LiveConnectClient liveClient = new LiveConnectClient(session);
    liveClient.setHttpClient(client);

    return liveClient;
  }
  @Override
  protected void setUp() throws Exception {
    super.setUp();

    // Set up the MockClient
    this.mockEntity = new MockHttpEntity();

    StatusLine statusLine = new BasicStatusLine(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK");
    this.mockResponse = new MockHttpResponse(this.mockEntity, statusLine);
    this.mockClient = new MockHttpClient(this.mockResponse);
    this.loadLiveLibraryHeaderChecker();
    this.exceptionQueue = new LinkedBlockingQueue<LiveOperationException>();
    this.liveConnectClient = TestUtils.newLiveConnectClient(this.mockClient);
  }
예제 #3
0
  public static LiveConnectSession newMockLiveConnectSession() {
    LiveAuthClient authClient = TestUtils.newMockLiveAuthClient();
    LiveConnectSession session = new LiveConnectSession(authClient);
    session.setAccessToken("access_token");
    session.setAuthenticationToken("authentication_token");

    Calendar calendar = Calendar.getInstance();
    calendar.add(Calendar.SECOND, 3600);
    session.setExpiresIn(calendar.getTime());

    String[] scopes = {"scope"};
    session.setScopes(Arrays.asList(scopes));
    session.setRefreshToken("refresh_token");
    session.setTokenType("token_type");

    return session;
  }