@Test public void testMaintenanceMode(){ final GrapesServerConfig config = new GrapesServerConfig(); final MaintenanceModeTask task = new MaintenanceModeTask(config); assertFalse(config.isInMaintenance()); task.execute(null,mock(PrintWriter.class)); assertTrue(config.isInMaintenance()); task.execute(null, mock(PrintWriter.class)); assertFalse(config.isInMaintenance()); }
@Override public void execute(final ImmutableMultimap<String, String> args, final PrintWriter printWriter) { if(config.isInMaintenance()){ config.setMaintenanceMode(false); printWriter.println("Maintenance has been disabled."); } else { config.setMaintenanceMode(true); printWriter.println("Maintenance mode is now active."); } }
MaintenanceModeTask extends Task { @Override public void execute(final ImmutableMultimap<String, String> args, final PrintWriter printWriter) { if(config.isInMaintenance()){ config.setMaintenanceMode(false); printWriter.println("Maintenance has been disabled."); } else { config.setMaintenanceMode(true); printWriter.println("Maintenance mode is now active."); } } }
MaintenanceModeTask extends Task { @Override public void execute(final ImmutableMultimap<String, String> args, final PrintWriter printWriter) { if(config.isInMaintenance()){ config.setMaintenanceMode(false); printWriter.println("Maintenance has been disabled."); } else { config.setMaintenanceMode(true); printWriter.println("Maintenance mode is now active."); } } MaintenanceModeTask(final GrapesServerConfig config); }
MaintenanceModeTask extends Task { @Override public void execute(final ImmutableMultimap<String, String> args, final PrintWriter printWriter) { if(config.isInMaintenance()){ config.setMaintenanceMode(false); printWriter.println("Maintenance has been disabled."); } else { config.setMaintenanceMode(true); printWriter.println("Maintenance mode is now active."); } } MaintenanceModeTask(final GrapesServerConfig config); @Override void execute(final ImmutableMultimap<String, String> args, final PrintWriter printWriter); }
MaintenanceModeTask extends Task { @Override public void execute(final ImmutableMultimap<String, String> args, final PrintWriter printWriter) { if(config.isInMaintenance()){ config.setMaintenanceMode(false); printWriter.println("Maintenance has been disabled."); } else { config.setMaintenanceMode(true); printWriter.println("Maintenance mode is now active."); } } MaintenanceModeTask(final GrapesServerConfig config); @Override void execute(final ImmutableMultimap<String, String> args, final PrintWriter printWriter);  }