assertTrue("expected non-null subject", subject != null);
assertEquals("subject should have five principal", 5, subject.getPrincipals().size());
assertEquals("subject should have two realm principals", 2, subject.getPrincipals(RealmPrincipal.class).size());
assertEquals("subject should have one remote principal", 1, subject.getPrincipals(IdentificationPrincipal.class).size());
IdentificationPrincipal principal = (IdentificationPrincipal) subject.getPrincipals(IdentificationPrincipal.class).iterator().next();
assertTrue("id of principal should be non-zero", principal.getId().getSubjectId().longValue() != 0);
context.logout();
context.login();
context.logout();
/**
* Waiting this long should cause the login module w/ an artificially
* low age limit to expire. The next call to login should automatically
* create a new one.
*/
Thread.sleep(4 * 1000);
context.login();
subject = context.getSubject();
assertTrue("expected non-null subject", subject != null);
assertEquals("subject should have five principal", 5, subject.getPrincipals().size());
assertEquals("subject should have two realm principals", 2, subject.getPrincipals(RealmPrincipal.class).size());
assertEquals("subject should have one remote principal", 1, subject.getPrincipals(IdentificationPrincipal.class).size());
principal = (IdentificationPrincipal) subject.getPrincipals(IdentificationPrincipal.class).iterator().next();
assertTrue("id of principal should be non-zero", principal.getId().getSubjectId().longValue() != 0);
context.logout();
}