json.put("clusterPublicHost", obj.getClusterPublicHost()); json.put("clusterPublicPort", obj.getClusterPublicPort()); json.put("clustered", obj.isClustered()); if (obj.getEventBusOptions() != null) {
@Test public void testConfigureClusterPublicHostPortFromCommandLine() throws Exception { int clusterPublicPort = TestUtils.randomHighPortInt(); MyLauncher launcher = new MyLauncher(); String[] args = {"run", "java:" + TestVerticle.class.getCanonicalName(), "-cluster", "--cluster-public-host", "127.0.0.1", "--cluster-public-port", Integer.toString(clusterPublicPort)}; launcher.dispatch(args); assertWaitUntil(() -> TestVerticle.instanceCount.get() == 1); assertEquals("127.0.0.1", launcher.options.getClusterPublicHost()); assertEquals(clusterPublicPort, launcher.options.getClusterPublicPort()); }
clusterPublicHost = options.getClusterPublicHost(); if (options.getClusterPublicPort() != VertxOptions.DEFAULT_CLUSTER_PUBLIC_PORT) { clusterPublicPort = options.getClusterPublicPort();
@Test public void testConfigureClusterHostPortFromProperties() throws Exception { int clusterPort = TestUtils.randomHighPortInt(); System.setProperty(RunCommand.VERTX_OPTIONS_PROP_PREFIX + "clusterHost", "127.0.0.1"); System.setProperty(RunCommand.VERTX_OPTIONS_PROP_PREFIX + "clusterPort", Integer.toString(clusterPort)); MyLauncher launcher = new MyLauncher(); String[] args = {"run", "java:" + TestVerticle.class.getCanonicalName(), "-cluster"}; launcher.dispatch(args); assertWaitUntil(() -> TestVerticle.instanceCount.get() == 1); assertEquals("127.0.0.1", launcher.options.getClusterHost()); assertEquals(clusterPort, launcher.options.getClusterPort()); assertNull(launcher.options.getClusterPublicHost()); assertEquals(-1, launcher.options.getClusterPublicPort()); }
@Test public void testConfigureClusterHostPortFromCommandLine() throws Exception { int clusterPort = TestUtils.randomHighPortInt(); MyLauncher launcher = new MyLauncher(); String[] args = {"run", "java:" + TestVerticle.class.getCanonicalName(), "-cluster", "--cluster-host", "127.0.0.1", "--cluster-port", Integer.toString(clusterPort)}; launcher.dispatch(args); assertWaitUntil(() -> TestVerticle.instanceCount.get() == 1); assertEquals("127.0.0.1", launcher.options.getClusterHost()); assertEquals(clusterPort, launcher.options.getClusterPort()); assertNull(launcher.options.getClusterPublicHost()); assertEquals(-1, launcher.options.getClusterPublicPort()); }
@Test public void testOverrideClusterHostPortFromProperties() throws Exception { int clusterPort = TestUtils.randomHighPortInt(); int newClusterPort = TestUtils.randomHighPortInt(); int newClusterPublicPort = TestUtils.randomHighPortInt(); System.setProperty(RunCommand.VERTX_OPTIONS_PROP_PREFIX + "clusterHost", "127.0.0.2"); System.setProperty(RunCommand.VERTX_OPTIONS_PROP_PREFIX + "clusterPort", Integer.toString(clusterPort)); MyLauncher launcher = new MyLauncher(); launcher.clusterHost = "127.0.0.1"; launcher.clusterPort = newClusterPort; launcher.clusterPublicHost = "127.0.0.3"; launcher.clusterPublicPort = newClusterPublicPort; String[] args = {"run", "java:" + TestVerticle.class.getCanonicalName(), "-cluster"}; launcher.dispatch(args); assertWaitUntil(() -> TestVerticle.instanceCount.get() == 1); assertEquals("127.0.0.1", launcher.options.getClusterHost()); assertEquals(newClusterPort, launcher.options.getClusterPort()); assertEquals("127.0.0.3", launcher.options.getClusterPublicHost()); assertEquals(newClusterPublicPort, launcher.options.getClusterPublicPort()); }
@Test public void testOverrideClusterHostPortFromCommandLine() throws Exception { int clusterPort = TestUtils.randomHighPortInt(); int clusterPublicPort = TestUtils.randomHighPortInt(); int newClusterPort = TestUtils.randomHighPortInt(); int newClusterPublicPort = TestUtils.randomHighPortInt(); MyLauncher launcher = new MyLauncher(); launcher.clusterHost = "127.0.0.1"; launcher.clusterPort = newClusterPort; launcher.clusterPublicHost = "127.0.0.3"; launcher.clusterPublicPort = newClusterPublicPort; String[] args = { "run", "java:" + TestVerticle.class.getCanonicalName(), "-cluster", "--cluster-host", "127.0.0.2", "--cluster-port", Integer.toString(clusterPort), "--cluster-public-host", "127.0.0.4", "--cluster-public-port", Integer.toString(clusterPublicPort) }; launcher.dispatch(args); assertWaitUntil(() -> TestVerticle.instanceCount.get() == 1); assertEquals("127.0.0.1", launcher.options.getClusterHost()); assertEquals(newClusterPort, launcher.options.getClusterPort()); assertEquals("127.0.0.3", launcher.options.getClusterPublicHost()); assertEquals(newClusterPublicPort, launcher.options.getClusterPublicPort()); }
assertEquals(-1, options.getClusterPublicPort()); assertEquals(20000, options.getClusterPingInterval()); assertEquals(20000, options.getClusterPingReplyInterval()); ); assertEquals(clusterPort, options.getClusterPort()); assertEquals(clusterPublicPort, options.getClusterPublicPort()); assertEquals(clusterPublicHost, options.getClusterPublicHost()); assertEquals(clusterPingInterval, options.getClusterPingInterval());
@Test public void testDefaultJsonOptions() { VertxOptions def = new VertxOptions(); VertxOptions json = new VertxOptions(new JsonObject()); assertEquals(def.getEventLoopPoolSize(), json.getEventLoopPoolSize()); assertEquals(def.getWorkerPoolSize(), json.getWorkerPoolSize()); assertEquals(def.isClustered(), json.isClustered()); assertEquals(def.getClusterHost(), json.getClusterHost()); assertEquals(def.getClusterPublicHost(), json.getClusterPublicHost()); assertEquals(def.getClusterPublicPort(), json.getClusterPublicPort()); assertEquals(def.getClusterPingInterval(), json.getClusterPingInterval()); assertEquals(def.getClusterPingReplyInterval(), json.getClusterPingReplyInterval()); assertEquals(def.getBlockedThreadCheckInterval(), json.getBlockedThreadCheckInterval()); assertEquals(def.getMaxEventLoopExecuteTime(), json.getMaxEventLoopExecuteTime()); assertEquals(def.getMaxWorkerExecuteTime(), json.getMaxWorkerExecuteTime()); assertEquals(def.getInternalBlockingPoolSize(), json.getInternalBlockingPoolSize()); assertEquals(def.isHAEnabled(), json.isHAEnabled()); assertEquals(def.getQuorumSize(), json.getQuorumSize()); assertEquals(def.getHAGroup(), json.getHAGroup()); assertEquals(def.getWarningExceptionTime(), json.getWarningExceptionTime()); assertEquals(def.isFileResolverCachingEnabled(), json.isFileResolverCachingEnabled()); assertEquals(def.getMaxEventLoopExecuteTimeUnit(), json.getMaxEventLoopExecuteTimeUnit()); assertEquals(def.getMaxWorkerExecuteTimeUnit(), json.getMaxWorkerExecuteTimeUnit()); assertEquals(def.getWarningExceptionTimeUnit(), json.getWarningExceptionTimeUnit()); assertEquals(def.getBlockedThreadCheckIntervalUnit(), json.getBlockedThreadCheckIntervalUnit()); }
assertEquals(clusterPublicPort, options.getClusterPublicPort()); assertEquals(clusterPingInterval, options.getClusterPingInterval()); assertEquals(clusterPingReplyInterval, options.getClusterPingReplyInterval());
json.put("clusterPublicHost", obj.getClusterPublicHost()); json.put("clusterPublicPort", obj.getClusterPublicPort()); json.put("clustered", obj.isClustered()); if (obj.getEventBusOptions() != null) {
@Test public void testConfigureClusterPublicHostPortFromCommandLine() throws Exception { int clusterPublicPort = TestUtils.randomHighPortInt(); MyLauncher launcher = new MyLauncher(); String[] args = {"run", "java:" + TestVerticle.class.getCanonicalName(), "-cluster", "--cluster-public-host", "127.0.0.1", "--cluster-public-port", Integer.toString(clusterPublicPort)}; launcher.dispatch(args); assertWaitUntil(() -> TestVerticle.instanceCount.get() == 1); assertEquals("127.0.0.1", launcher.options.getClusterPublicHost()); assertEquals(clusterPublicPort, launcher.options.getClusterPublicPort()); }
clusterPublicHost = options.getClusterPublicHost(); if (options.getClusterPublicPort() != VertxOptions.DEFAULT_CLUSTER_PUBLIC_PORT) { clusterPublicPort = options.getClusterPublicPort();
@Test public void testConfigureClusterHostPortFromProperties() throws Exception { int clusterPort = TestUtils.randomHighPortInt(); System.setProperty(RunCommand.VERTX_OPTIONS_PROP_PREFIX + "clusterHost", "127.0.0.1"); System.setProperty(RunCommand.VERTX_OPTIONS_PROP_PREFIX + "clusterPort", Integer.toString(clusterPort)); MyLauncher launcher = new MyLauncher(); String[] args = {"run", "java:" + TestVerticle.class.getCanonicalName(), "-cluster"}; launcher.dispatch(args); assertWaitUntil(() -> TestVerticle.instanceCount.get() == 1); assertEquals("127.0.0.1", launcher.options.getClusterHost()); assertEquals(clusterPort, launcher.options.getClusterPort()); assertNull(launcher.options.getClusterPublicHost()); assertEquals(-1, launcher.options.getClusterPublicPort()); }
@Test public void testConfigureClusterHostPortFromCommandLine() throws Exception { int clusterPort = TestUtils.randomHighPortInt(); MyLauncher launcher = new MyLauncher(); String[] args = {"run", "java:" + TestVerticle.class.getCanonicalName(), "-cluster", "--cluster-host", "127.0.0.1", "--cluster-port", Integer.toString(clusterPort)}; launcher.dispatch(args); assertWaitUntil(() -> TestVerticle.instanceCount.get() == 1); assertEquals("127.0.0.1", launcher.options.getClusterHost()); assertEquals(clusterPort, launcher.options.getClusterPort()); assertNull(launcher.options.getClusterPublicHost()); assertEquals(-1, launcher.options.getClusterPublicPort()); }
@Test public void testOverrideClusterHostPortFromProperties() throws Exception { int clusterPort = TestUtils.randomHighPortInt(); int newClusterPort = TestUtils.randomHighPortInt(); int newClusterPublicPort = TestUtils.randomHighPortInt(); System.setProperty(RunCommand.VERTX_OPTIONS_PROP_PREFIX + "clusterHost", "127.0.0.2"); System.setProperty(RunCommand.VERTX_OPTIONS_PROP_PREFIX + "clusterPort", Integer.toString(clusterPort)); MyLauncher launcher = new MyLauncher(); launcher.clusterHost = "127.0.0.1"; launcher.clusterPort = newClusterPort; launcher.clusterPublicHost = "127.0.0.3"; launcher.clusterPublicPort = newClusterPublicPort; String[] args = {"run", "java:" + TestVerticle.class.getCanonicalName(), "-cluster"}; launcher.dispatch(args); assertWaitUntil(() -> TestVerticle.instanceCount.get() == 1); assertEquals("127.0.0.1", launcher.options.getClusterHost()); assertEquals(newClusterPort, launcher.options.getClusterPort()); assertEquals("127.0.0.3", launcher.options.getClusterPublicHost()); assertEquals(newClusterPublicPort, launcher.options.getClusterPublicPort()); }
@Test public void testOverrideClusterHostPortFromCommandLine() throws Exception { int clusterPort = TestUtils.randomHighPortInt(); int clusterPublicPort = TestUtils.randomHighPortInt(); int newClusterPort = TestUtils.randomHighPortInt(); int newClusterPublicPort = TestUtils.randomHighPortInt(); MyLauncher launcher = new MyLauncher(); launcher.clusterHost = "127.0.0.1"; launcher.clusterPort = newClusterPort; launcher.clusterPublicHost = "127.0.0.3"; launcher.clusterPublicPort = newClusterPublicPort; String[] args = { "run", "java:" + TestVerticle.class.getCanonicalName(), "-cluster", "--cluster-host", "127.0.0.2", "--cluster-port", Integer.toString(clusterPort), "--cluster-public-host", "127.0.0.4", "--cluster-public-port", Integer.toString(clusterPublicPort) }; launcher.dispatch(args); assertWaitUntil(() -> TestVerticle.instanceCount.get() == 1); assertEquals("127.0.0.1", launcher.options.getClusterHost()); assertEquals(newClusterPort, launcher.options.getClusterPort()); assertEquals("127.0.0.3", launcher.options.getClusterPublicHost()); assertEquals(newClusterPublicPort, launcher.options.getClusterPublicPort()); }
assertEquals(-1, options.getClusterPublicPort()); assertEquals(options, options.setClusterPublicPort(1234)); assertEquals(1234, options.getClusterPublicPort()); try { options.setClusterPublicPort(-1);
@Test public void testDefaultJsonOptions() { VertxOptions def = new VertxOptions(); VertxOptions json = new VertxOptions(new JsonObject()); assertEquals(def.getEventLoopPoolSize(), json.getEventLoopPoolSize()); assertEquals(def.getWorkerPoolSize(), json.getWorkerPoolSize()); assertEquals(def.isClustered(), json.isClustered()); assertEquals(def.getClusterHost(), json.getClusterHost()); assertEquals(def.getClusterPublicHost(), json.getClusterPublicHost()); assertEquals(def.getClusterPublicPort(), json.getClusterPublicPort()); assertEquals(def.getClusterPingInterval(), json.getClusterPingInterval()); assertEquals(def.getClusterPingReplyInterval(), json.getClusterPingReplyInterval()); assertEquals(def.getBlockedThreadCheckInterval(), json.getBlockedThreadCheckInterval()); assertEquals(def.getMaxEventLoopExecuteTime(), json.getMaxEventLoopExecuteTime()); assertEquals(def.getMaxWorkerExecuteTime(), json.getMaxWorkerExecuteTime()); assertEquals(def.getInternalBlockingPoolSize(), json.getInternalBlockingPoolSize()); assertEquals(def.isHAEnabled(), json.isHAEnabled()); assertEquals(def.getQuorumSize(), json.getQuorumSize()); assertEquals(def.getHAGroup(), json.getHAGroup()); assertEquals(def.getWarningExceptionTime(), json.getWarningExceptionTime()); assertEquals(def.isFileResolverCachingEnabled(), json.isFileResolverCachingEnabled()); assertEquals(def.getMaxEventLoopExecuteTimeUnit(), json.getMaxEventLoopExecuteTimeUnit()); assertEquals(def.getMaxWorkerExecuteTimeUnit(), json.getMaxWorkerExecuteTimeUnit()); assertEquals(def.getWarningExceptionTimeUnit(), json.getWarningExceptionTimeUnit()); assertEquals(def.getBlockedThreadCheckIntervalUnit(), json.getBlockedThreadCheckIntervalUnit()); }
assertEquals(clusterPublicPort, options.getClusterPublicPort()); assertEquals(clusterPingInterval, options.getClusterPingInterval()); assertEquals(clusterPingReplyInterval, options.getClusterPingReplyInterval());