TestVerticle.instanceCount.set(0);
}
@Test
public void testOptions() {
DeploymentOptions options = new DeploymentOptions();
assertNull(options.getConfig());
JsonObject config = new JsonObject().put("foo", "bar").put("obj", new JsonObject().put("quux", 123));
assertEquals(options, options.setConfig(config));
assertEquals(config, options.getConfig());
assertFalse(options.isWorker());
assertEquals(options, options.setWorker(true));
assertTrue(options.isWorker());
assertFalse(options.isMultiThreaded());
assertEquals(options, options.setMultiThreaded(true));
assertTrue(options.isMultiThreaded());
assertNull(options.getIsolationGroup());
String rand = TestUtils.randomUnicodeString(1000);
assertEquals(options, options.setIsolationGroup(rand));
assertEquals(rand, options.getIsolationGroup());
assertFalse(options.isHa());
assertEquals(options, options.setHa(true));
assertTrue(options.isHa());
assertNull(options.getExtraClasspath());
List<String> cp = Arrays.asList("foo", "bar");
assertEquals(options, options.setExtraClasspath(cp));
assertSame(cp, options.getExtraClasspath());
assertFalse(options.isRedeploy());
assertSame(options, options.setRedeploy(true));
assertTrue(options.isRedeploy());
assertEquals(DeploymentOptions.DEFAULT_REDEPLOY_GRACE_PERIOD, options.getRedeployGracePeriod());
int randInt = TestUtils.randomPositiveInt();
assertEquals(options, options.setRedeployGracePeriod(randInt));
assertEquals(randInt, options.getRedeployGracePeriod());
randInt = TestUtils.randomPositiveInt();
assertEquals(options, options.setRedeployScanPeriod(randInt));
assertEquals(randInt, options.getRedeployScanPeriod());
try {
options.setRedeployGracePeriod(-1);
fail();
} catch (IllegalArgumentException e) {
// OK
}
try {
options.setRedeployScanPeriod(-1);
fail();
} catch (IllegalArgumentException e) {
// OK
}
try {
options.setRedeployGracePeriod(0);
fail();
} catch (IllegalArgumentException e) {
// OK
}
try {
options.setRedeployScanPeriod(0);
fail();
} catch (IllegalArgumentException e) {
// OK
}
}