@Test public void testDestroy() throws Exception { StageDestroyer sd = new StageDestroyer(); Process p = Mockito.mock(Process.class); sd.add(p); StageGroup group = new StageGroup("group"); Stage mockedStage = Mockito.mock(Stage.class); group.addStage(mockedStage); Mockito.when(mockedStage.getProperties()).thenReturn(new HashMap<String, Object>()); ShutdownHandler shutdownHandler = Mockito.mock(ShutdownHandler.class); Mockito.when(shutdownHandler.isShuttingDown()).thenReturn(false); StageRunner sr = new StageRunner(group, new File("test"), 0, false, 0, shutdownHandler); sr.setStageDestroyer(sd); sr.destroy(); Mockito.verify(p, Mockito.times(1)).destroy(); }
public void destroy() { logger.debug("Attempting to destroy JVM running stage group " + stageGroup.getName()); boolean success = stageDestroyer.killAll(); if (success) { logger.debug("... destruction successful"); } else { logger.error("JVM running stage group " + stageGroup.getName() + " was not killed"); throw new IllegalStateException("Orphaned process for " + stageGroup.getName()); } removeFiles(); wasKilled = true; }
StageRunner extends Thread { public void destroy() { logger.debug("Attempting to destroy JVM running stage group " + stageGroup.getName()); boolean success = stageDestroyer.killAll(); if (success) { logger.debug("... destruction successful"); } else { logger.error("JVM running stage group " + stageGroup.getName() + " was not killed"); throw new IllegalStateException("Orphaned process for " + stageGroup.getName()); } removeFiles(); wasKilled = true; } }
StageRunner extends Thread { public void destroy() { logger.debug("Attempting to destroy JVM running stage group " + stageGroup.getName()); boolean success = stageDestroyer.killAll(); if (success) { logger.debug("... destruction successful"); } else { logger.error("JVM running stage group " + stageGroup.getName() + " was not killed"); throw new IllegalStateException("Orphaned process for " + stageGroup.getName()); } removeFiles(); wasKilled = true; } StageRunner(StageGroup stageGroup, File baseDirectory, int pipelinePort, boolean performanceLogging, int loggingPort, ShutdownHandler shutdownHandler); }
StageRunner extends Thread { public void destroy() { logger.debug("Attempting to destroy JVM running stage group " + stageGroup.getName()); boolean success = stageDestroyer.killAll(); if (success) { logger.debug("... destruction successful"); } else { logger.error("JVM running stage group " + stageGroup.getName() + " was not killed"); throw new IllegalStateException("Orphaned process for " + stageGroup.getName()); } removeFiles(); wasKilled = true; } StageRunner(StageGroup stageGroup, File baseDirectory, int pipelinePort, boolean performanceLogging, int loggingPort, ShutdownHandler shutdownHandler); synchronized void setHasQueried(); synchronized boolean hasQueried(); void prepare(); final void setParameters(Map<String, Object> conf); void run(); void printJavaVersion(); void destroy(); StageGroup getStageGroup(); boolean isStarted(); void setStageDestroyer(StageDestroyer sd); }
StageRunner extends Thread { public void destroy() { logger.debug("Attempting to destroy JVM running stage group " + stageGroup.getName()); boolean success = stageDestroyer.killAll(); if (success) { logger.debug("... destruction successful"); } else { logger.error("JVM running stage group " + stageGroup.getName() + " was not killed"); throw new IllegalStateException("Orphaned process for " + stageGroup.getName()); } removeFiles(); wasKilled = true; } StageRunner(StageGroup stageGroup, File baseDirectory, int pipelinePort, boolean performanceLogging, int loggingPort, ShutdownHandler shutdownHandler); synchronized void setHasQueried(); synchronized boolean hasQueried(); void prepare(); final void setParameters(Map<String, Object> conf); void run(); void printJavaVersion(); void destroy(); StageGroup getStageGroup(); boolean isStarted(); void setStageDestroyer(StageDestroyer sd);  }