@Test public void createSessionWithOptionsWithZeroLockDelay(TestContext tc) { SessionOptions opt = new SessionOptions() .setBehavior(SessionBehavior.DELETE) .setLockDelay(0L) .setName("optName") .setTtl(442); ctx.writeClient().createSessionWithOptions(opt, tc.asyncAssertSuccess(id -> { ctx.writeClient().infoSession(id, tc.asyncAssertSuccess(session -> { List<String> checks = session.getChecks(); tc.assertEquals(1, checks.size()); tc.assertTrue("serfHealth".equals(checks.get(0))); tc.assertEquals(0L, session.getLockDelay()); tc.assertEquals(ctx.nodeName(), session.getNode()); ctx.writeClient().destroySession(id, tc.asyncAssertSuccess()); })); })); }
@Test public void createSessionWithOptions(TestContext tc) { SessionOptions opt = new SessionOptions() .setBehavior(SessionBehavior.DELETE) .setLockDelay(42) .setName("optName") .setTtl(442); ctx.writeClient().createSessionWithOptions(opt, tc.asyncAssertSuccess(id -> { ctx.writeClient().infoSession(id, tc.asyncAssertSuccess(session -> { List<String> checks = session.getChecks(); tc.assertEquals(1, checks.size()); tc.assertTrue("serfHealth".equals(checks.get(0))); tc.assertEquals(opt.getLockDelay(), session.getLockDelay()); tc.assertEquals(ctx.nodeName(), session.getNode()); ctx.writeClient().destroySession(id, tc.asyncAssertSuccess()); })); })); }
public static SessionOptions randomSessionOptions() { return new SessionOptions() .setBehavior(randomElement(SessionBehavior.values())) .setChecks(randomStringList(2)) .setLockDelay(randomPositiveInt()) .setName(randomAlphaString(10)) .setNode(randomAlphaString(10)) .setTtl(10 + (randomPositiveInt() % 100)); }