@Test public void tells_to_daemon_listener_what_events_the_daemon_sends() { daemonSummoner.connectToDaemon(dummySuiteConfig, dummyDaemonConfig, ActorRef.wrap(daemonListener)); NetworkEndpoint<Event<SuiteListener>, Event<RequestListener>> endpoint = daemonConnector.lastEndpointFactory.createEndpoint(); Event<SuiteListener> anyMessage = new OnSuiteStartedEvent(); endpoint.onMessage(anyMessage); verify((NetworkEndpoint<Event<SuiteListener>, Event<RequestListener>>) daemonListener).onMessage(anyMessage); }
@Override public void connectToDaemon(SuiteConfiguration suite, DaemonConfiguration daemon, ActorRef<DaemonListener> listener) { int port = daemonConnector.listenOnAnyPort( new OneTimeDaemonListenerFactory( withInitialMessageTimeout(listener.tell(), daemon.getStartupTimeout()))); daemon = daemon.melt() .setDaemonDir(steward.createDaemonDir(daemon.getJumiHome())) .setLauncherPort(port) .freeze(); try { JvmArgs jvmArgs = new JvmArgsBuilder() .setExecutableJar(steward.getDaemonJar(daemon.getJumiHome())) .setWorkingDir(Paths.get(suite.getWorkingDirectory())) .setJvmOptions(suite.getJvmOptions()) .setSystemProperties(daemon.toSystemProperties()) .setProgramArgs(daemon.toProgramArgs()) .freeze(); Process process = processStarter.startJavaProcess(jvmArgs); copyInBackground(process.getInputStream(), outputListener); } catch (Exception e) { throw Boilerplate.rethrow(e); } }
ProcessStartingDaemonSummoner implements DaemonSummoner { @Override public void connectToDaemon(SuiteConfiguration suite, DaemonConfiguration daemon, ActorRef<DaemonListener> listener) { int port = daemonConnector.listenOnAnyPort( new OneTimeDaemonListenerFactory( withInitialMessageTimeout(listener.tell(), daemon.getStartupTimeout()))); daemon = daemon.melt() .setDaemonDir(steward.createDaemonDir(daemon.getJumiHome())) .setLauncherPort(port) .freeze(); try { JvmArgs jvmArgs = new JvmArgsBuilder() .setExecutableJar(steward.getDaemonJar(daemon.getJumiHome())) .setWorkingDir(Paths.get(suite.getWorkingDirectory())) .setJvmOptions(suite.getJvmOptions()) .setSystemProperties(daemon.toSystemProperties()) .setProgramArgs(daemon.toProgramArgs()) .freeze(); Process process = processStarter.startJavaProcess(jvmArgs); copyInBackground(process.getInputStream(), outputListener); } catch (Exception e) { throw Boilerplate.rethrow(e); } } }
ProcessStartingDaemonSummoner implements DaemonSummoner { @Override public void connectToDaemon(SuiteConfiguration suite, DaemonConfiguration daemon, ActorRef<DaemonListener> listener) { int port = daemonConnector.listenOnAnyPort( new OneTimeDaemonListenerFactory( withInitialMessageTimeout(listener.tell(), daemon.getStartupTimeout()))); daemon = daemon.melt() .setDaemonDir(steward.createDaemonDir(daemon.getJumiHome())) .setLauncherPort(port) .freeze(); try { JvmArgs jvmArgs = new JvmArgsBuilder() .setExecutableJar(steward.getDaemonJar(daemon.getJumiHome())) .setWorkingDir(Paths.get(suite.getWorkingDirectory())) .setJvmOptions(suite.getJvmOptions()) .setSystemProperties(daemon.toSystemProperties()) .setProgramArgs(daemon.toProgramArgs()) .freeze(); Process process = processStarter.startJavaProcess(jvmArgs); copyInBackground(process.getInputStream(), outputListener); } catch (Exception e) { throw Boilerplate.rethrow(e); } } ProcessStartingDaemonSummoner(Steward steward,
                                         ProcessStarter processStarter,
                                         NetworkServer daemonConnector,
                                         @WillClose OutputStream outputListener); }
ProcessStartingDaemonSummoner implements DaemonSummoner { @Override public void connectToDaemon(SuiteConfiguration suite, DaemonConfiguration daemon, ActorRef<DaemonListener> listener) { int port = daemonConnector.listenOnAnyPort( new OneTimeDaemonListenerFactory( withInitialMessageTimeout(listener.tell(), daemon.getStartupTimeout()))); daemon = daemon.melt() .setDaemonDir(steward.createDaemonDir(daemon.getJumiHome())) .setLauncherPort(port) .freeze(); try { JvmArgs jvmArgs = new JvmArgsBuilder() .setExecutableJar(steward.getDaemonJar(daemon.getJumiHome())) .setWorkingDir(Paths.get(suite.getWorkingDirectory())) .setJvmOptions(suite.getJvmOptions()) .setSystemProperties(daemon.toSystemProperties()) .setProgramArgs(daemon.toProgramArgs()) .freeze(); Process process = processStarter.startJavaProcess(jvmArgs); copyInBackground(process.getInputStream(), outputListener); } catch (Exception e) { throw Boilerplate.rethrow(e); } } ProcessStartingDaemonSummoner(Steward steward,
                                         ProcessStarter processStarter,
                                         NetworkServer daemonConnector,
                                         @WillClose OutputStream outputListener); @Override void connectToDaemon(SuiteConfiguration suite,
                                DaemonConfiguration daemon,
                                ActorRef<DaemonListener> listener); }
ProcessStartingDaemonSummoner implements DaemonSummoner { @Override public void connectToDaemon(SuiteConfiguration suite, DaemonConfiguration daemon, ActorRef<DaemonListener> listener) { int port = daemonConnector.listenOnAnyPort( new OneTimeDaemonListenerFactory( withInitialMessageTimeout(listener.tell(), daemon.getStartupTimeout()))); daemon = daemon.melt() .setDaemonDir(steward.createDaemonDir(daemon.getJumiHome())) .setLauncherPort(port) .freeze(); try { JvmArgs jvmArgs = new JvmArgsBuilder() .setExecutableJar(steward.getDaemonJar(daemon.getJumiHome())) .setWorkingDir(Paths.get(suite.getWorkingDirectory())) .setJvmOptions(suite.getJvmOptions()) .setSystemProperties(daemon.toSystemProperties()) .setProgramArgs(daemon.toProgramArgs()) .freeze(); Process process = processStarter.startJavaProcess(jvmArgs); copyInBackground(process.getInputStream(), outputListener); } catch (Exception e) { throw Boilerplate.rethrow(e); } } ProcessStartingDaemonSummoner(Steward steward,
                                         ProcessStarter processStarter,
                                         NetworkServer daemonConnector,
                                         @WillClose OutputStream outputListener); @Override void connectToDaemon(SuiteConfiguration suite,
                                DaemonConfiguration daemon,
                                ActorRef<DaemonListener> listener);  }