GDataAccount account = new GDataAccount();
account.setName("simon");
account.setPassword("testme");
account.setRole(AccountRole.ENTRYAMINISTRATOR);
String token = this.controller.calculateAuthToken("192.168.0",Integer.toString(account.getRolesAsInt()),this.accountName);
assertTrue(this.controller.authenticateToken(token,this.clientIp,AccountRole.ENTRYAMINISTRATOR,this.accountName));
assertTrue(this.controller.authenticateToken(token,this.clientIp,AccountRole.USER,this.accountName));
assertFalse(this.controller.authenticateToken(token,this.clientIp,AccountRole.USERADMINISTRATOR,"someOtherAccount"));
try{
this.controller.authenticateToken(token+"test",this.clientIp,AccountRole.ENTRYAMINISTRATOR,this.accountName);
fail("exception expected");
}catch (Exception e) {
// TODO: handle exception
}
this.controller.setLoginTimeout(0);
assertFalse(this.controller.authenticateToken(token,this.clientIp,AccountRole.ENTRYAMINISTRATOR,this.accountName));