@Test
  public void testLogin() throws Exception {
    Identity identity = Identity.instance();

    assertFalse(identity.isLoggedIn());

    identity.setUsername("gavin");
    identity.setPassword("foobar");
    identity.login();

    User user = (User) Component.getInstance("user");
    assertEquals("Gavin King", user.getName());
    assertEquals("gavin", user.getUsername());
    assertEquals("foobar", user.getPassword());
    assertFalse(Manager.instance().isLongRunningConversation());
    assertTrue(identity.isLoggedIn());

    identity.logout();
    assertTrue(Session.instance().isInvalid());

    assertFalse(identity.isLoggedIn());
  }
Пример #2
0
 @Override
 public void invalidateNow() {
   // sorry, can't support this with Seam
   org.jboss.seam.web.Session.getInstance().invalidate();
 }
Пример #3
0
 @Override
 public void invalidate() {
   org.jboss.seam.web.Session.getInstance().invalidate();
 }