Пример #1
0
  @Test
  public void test10expire() throws NotFoundException {
    String token = store.newToken("*****@*****.**", "domain.com");

    assertThat(token, is(notNullValue()));
    assertThat(token.length(), is(not(0)));
    assertThat(store.getSessions().size(), is(1));

    Session s = store.getSessions().get(0);

    store.expireSession(s.getId());

    assertThat(store.getSessions().isEmpty(), is(true));
  }
Пример #2
0
  @Test
  public void test1create() throws InterruptedException {
    long now = System.currentTimeMillis();

    Thread.sleep(20);

    String token = store.newToken("*****@*****.**", "domain.com");

    assertThat(token, is(notNullValue()));
    assertThat(token.length(), is(not(0)));
    assertThat(store.getSessions().size(), is(1));

    Session s = store.getSessions().get(0);

    assertThat(s.getId(), is(notNullValue()));
    assertThat(s.getDomain(), is("domain.com"));
    assertThat(s.getToken(), is(token));
    assertThat(s.getUser(), is("*****@*****.**"));
    assertThat(s.getSessionStart(), is(greaterThan(now)));
    assertThat(s.getSessionExpiration(), is(greaterThan(s.getSessionStart())));
  }