@Test(enabled = true)
public void testMaxSessionPerUser() throws Exception {
String user = "test", pwd = "test";
List<String> sessionList = new ArrayList<String>();
int maxSession = 3;
try {
HashMap<String, String> map = LensUtil.getHashMap(LensConfConstants.MAX_SESSIONS_PER_USER,
Integer.toString(maxSession));
Util.changeConfig(map, confFilePath);
lens.restart();
for (int i = 1; i <= maxSession; i++) {
sessionList.add(sHelper.openSession(user, pwd, lens.getCurrentDB()));
}
Response response = sHelper.openSessionReturnResponse(user, pwd, lens.getCurrentDB(), null);
Assert.assertEquals(response.getStatus(), LensHttpStatus.TOO_MANY_REQUESTS.getStatusCode());
} finally {
for (String session : sessionList) {
if (session != null) {
sHelper.closeSession(session);
}
}
}
}