@Test public void testSpinup() throws Exception { final StandaloneServer server = new DiscoveryServerMain() { @Override public Config getConfig() { final File tmpDir = Files.createTempDir(); tmpDir.deleteOnExit(); System.setProperty("galaxy.internal.port.http", Integer.toString(findUnusedPort())); System.setProperty("ness.zookeeper.dataDir", tmpDir.getAbsolutePath()); System.setProperty("ness.zookeeper.clientPort", Integer.toString(findUnusedPort())); System.setProperty("ness.jmx.enabled", "false"); int port1 = findUnusedPort(); int port2 = findUnusedPort(); System.setProperty("ness.zookeeper.server.1", format("127.0.0.1:%d:%d", port1, port2)); return Config.getConfig(URI.create("classpath:/config"), "discovery-server"); } }; Assert.assertFalse(server.isStarted()); Assert.assertFalse(server.isStopped()); server.startServer(); Assert.assertTrue(server.isStarted()); Assert.assertFalse(server.isStopped()); server.stopServer(); Assert.assertTrue(server.isStarted()); Assert.assertTrue(server.isStopped()); }
@Override public void startServer() { super.startServer(); try { LOG.info("Creating discovery root nodes (%s)", discoveryConfig.getRoot()); final Future<ZookeeperJob> jobFuture = jobProcessor.submitJob(new BuildPathJob(discoveryConfig.getRoot()), 5, 1, TimeUnit.MINUTES); if (jobFuture == null) { LOG.error("Could not submit job to create root nodes for discovery!"); } try { jobFuture.get(1, TimeUnit.MINUTES); } catch (final TimeoutException te) { LOG.error(te, "Root node creation did not finish in time!"); } catch (final ExecutionException ee) { LOG.error(ee, "Root node creation failed!"); } } catch (final InterruptedException ie) { Thread.currentThread().interrupt(); } }
DiscoveryServerMain extends StandaloneServer { @Override public void startServer() { super.startServer(); try { LOG.info("Creating discovery root nodes (%s)", discoveryConfig.getRoot()); final Future<ZookeeperJob> jobFuture = jobProcessor.submitJob(new BuildPathJob(discoveryConfig.getRoot()), 5, 1, TimeUnit.MINUTES); if (jobFuture == null) { LOG.error("Could not submit job to create root nodes for discovery!"); } try { jobFuture.get(1, TimeUnit.MINUTES); } catch (final TimeoutException te) { LOG.error(te, "Root node creation did not finish in time!"); } catch (final ExecutionException ee) { LOG.error(ee, "Root node creation failed!"); } } catch (final InterruptedException ie) { Thread.currentThread().interrupt(); } } }
DiscoveryServerMain extends StandaloneServer { @Override public void startServer() { super.startServer(); try { LOG.info("Creating discovery root nodes (%s)", discoveryConfig.getRoot()); final Future<ZookeeperJob> jobFuture = jobProcessor.submitJob(new BuildPathJob(discoveryConfig.getRoot()), 5, 1, TimeUnit.MINUTES); if (jobFuture == null) { LOG.error("Could not submit job to create root nodes for discovery!"); } try { jobFuture.get(1, TimeUnit.MINUTES); } catch (final TimeoutException te) { LOG.error(te, "Root node creation did not finish in time!"); } catch (final ExecutionException ee) { LOG.error(ee, "Root node creation failed!"); } } catch (final InterruptedException ie) { Thread.currentThread().interrupt(); } }  }
DiscoveryServerMain extends StandaloneServer { @Override public void startServer() { super.startServer(); try { LOG.info("Creating discovery root nodes (%s)", discoveryConfig.getRoot()); final Future<ZookeeperJob> jobFuture = jobProcessor.submitJob(new BuildPathJob(discoveryConfig.getRoot()), 5, 1, TimeUnit.MINUTES); if (jobFuture == null) { LOG.error("Could not submit job to create root nodes for discovery!"); } try { jobFuture.get(1, TimeUnit.MINUTES); } catch (final TimeoutException te) { LOG.error(te, "Root node creation did not finish in time!"); } catch (final ExecutionException ee) { LOG.error(ee, "Root node creation failed!"); } } catch (final InterruptedException ie) { Thread.currentThread().interrupt(); } }  static void main(final String [] args); @Override Module getMainModule(final Config config); @Override String getServerType(); @Override void startServer(); }
DiscoveryServerMain extends StandaloneServer { @Override public void startServer() { super.startServer(); try { LOG.info("Creating discovery root nodes (%s)", discoveryConfig.getRoot()); final Future<ZookeeperJob> jobFuture = jobProcessor.submitJob(new BuildPathJob(discoveryConfig.getRoot()), 5, 1, TimeUnit.MINUTES); if (jobFuture == null) { LOG.error("Could not submit job to create root nodes for discovery!"); } try { jobFuture.get(1, TimeUnit.MINUTES); } catch (final TimeoutException te) { LOG.error(te, "Root node creation did not finish in time!"); } catch (final ExecutionException ee) { LOG.error(ee, "Root node creation failed!"); } } catch (final InterruptedException ie) { Thread.currentThread().interrupt(); } }  static void main(final String [] args); @Override Module getMainModule(final Config config); @Override String getServerType(); @Override void startServer();  }