@Test
  public void testDirCreations() throws IOException, PluginException {
    FitNesse fitnesse = context.makeFitNesseContext().fitNesse;
    fitnesse.start();

    try {
      assertTrue(new File("testFitnesseRoot").exists());
      assertTrue(new File("testFitnesseRoot/files").exists());
    } finally {
      fitnesse.stop();
    }
  }
  @Test
  public void testIsRunning() throws Exception {
    FitNesseContext context = FitNesseUtil.makeTestContext();
    FitNesse fitnesse = context.fitNesse.dontMakeDirs();

    assertFalse(fitnesse.isRunning());

    fitnesse.start();
    assertTrue(fitnesse.isRunning());

    fitnesse.stop();
    assertFalse(fitnesse.isRunning());
  }
Exemple #3
0
 public static void main(String[] args) throws Exception {
   Arguments arguments = parseCommandLine(args);
   if (arguments != null) {
     FitNesseContext context = loadContext(arguments);
     PageVersionPruner.daysTillVersionsExpire = arguments.getDaysTillVersionsExpire();
     FitNesse fitnesse = new FitNesse(context);
     if (!arguments.isOmittingUpdates()) fitnesse.applyUpdates();
     boolean started = fitnesse.start();
     if (started) printStartMessage(arguments, context);
   } else {
     printUsage();
     System.exit(1);
   }
 }
  @Test
  public void commandArgCallsExecuteSingleCommand() throws Exception {
    context.withParameter(ConfigurationParameter.OMITTING_UPDATES, "true");
    context.withParameter(ConfigurationParameter.COMMAND, "command");

    FitNesse fitNesse = mock(FitNesse.class);
    when(fitNesse.start()).thenReturn(true);

    context = spy(context);
    doAnswer(fitNesseContextWith(fitNesse)).when(context).makeFitNesseContext();

    int exitCode = new FitNesseMain().launchFitNesse(context);
    assertThat(exitCode, is(0));
    verify(fitNesse, never()).start();
    verify(fitNesse, times(1)).executeSingleCommand("command", System.out);
    verify(fitNesse, times(1)).stop();
  }