json.put("clusterPort", obj.getClusterPort()); if (obj.getClusterPublicHost() != null) { json.put("clusterPublicHost", obj.getClusterPublicHost());
clusterHost = options.getClusterHost(); if (options.getClusterPort() != VertxOptions.DEFAULT_CLUSTER_PORT) { clusterPort = options.getClusterPort();
@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()); }
VertxOptions options = new VertxOptions(new JsonObject()); assertEquals(0, options.getClusterPort()); assertEquals(-1, options.getClusterPublicPort()); assertEquals(20000, options.getClusterPingInterval()); put("blockedThreadCheckIntervalUnit", blockedThreadCheckIntervalUnit) ); assertEquals(clusterPort, options.getClusterPort()); assertEquals(clusterPublicPort, options.getClusterPublicPort()); assertEquals(clusterPublicHost, options.getClusterPublicHost());
assertEquals(clusterPort, options.getClusterPort()); assertEquals(clusterPublicPort, options.getClusterPublicPort()); assertEquals(clusterPingInterval, options.getClusterPingInterval());
json.put("clusterPort", obj.getClusterPort()); if (obj.getClusterPublicHost() != null) { json.put("clusterPublicHost", obj.getClusterPublicHost());
clusterHost = options.getClusterHost(); if (options.getClusterPort() != VertxOptions.DEFAULT_CLUSTER_PORT) { clusterPort = options.getClusterPort();
@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(options, options.setClustered(true)); assertTrue(options.isClustered()); assertEquals(0, options.getClusterPort()); assertEquals(options, options.setClusterPort(1234)); assertEquals(1234, options.getClusterPort()); try { options.setClusterPort(-1);
VertxOptions options = new VertxOptions(new JsonObject()); assertEquals(0, options.getClusterPort()); assertEquals(-1, options.getClusterPublicPort()); assertEquals(20000, options.getClusterPingInterval()); put("blockedThreadCheckIntervalUnit", blockedThreadCheckIntervalUnit) ); assertEquals(clusterPort, options.getClusterPort()); assertEquals(clusterPublicPort, options.getClusterPublicPort()); assertEquals(clusterPublicHost, options.getClusterPublicHost());
assertEquals(clusterPort, options.getClusterPort()); assertEquals(clusterPublicPort, options.getClusterPublicPort()); assertEquals(clusterPingInterval, options.getClusterPingInterval());
assertEquals(options, options.setClustered(true)); assertTrue(options.isClustered()); assertEquals(0, options.getClusterPort()); assertEquals(options, options.setClusterPort(1234)); assertEquals(1234, options.getClusterPort()); try { options.setClusterPort(-1);