use of nl.uva.cs.lobcder.auth.PrincipalCache in project lobcder by skoulouzis.
the class PrincipalCacheTest method testCache.
@Test
public void testCache() throws InterruptedException {
System.out.println("testCache");
String token = "token";
PrincipalCache instance = new PrincipalCache();
MyPrincipal principal = getPrincipal("user1");
instance.putPrincipal(token, principal, new Date().getTime() + 1000);
Thread.sleep(500);
MyPrincipal result = instance.getPrincipal(token);
assertNotNull(result);
}
use of nl.uva.cs.lobcder.auth.PrincipalCache in project lobcder by skoulouzis.
the class PrincipalCacheTest method testCacheTimeout.
@Test
public void testCacheTimeout() throws InterruptedException {
System.out.println("testCacheTimeout");
String token = "token";
PrincipalCache instance = new PrincipalCache();
MyPrincipal principal = getPrincipal(token);
instance.putPrincipal(token, principal, new Date().getTime() + 1000);
Thread.sleep(1500);
MyPrincipal result = instance.getPrincipal(token);
assertNull(result);
}
Aggregations