package com.twitter.mesos.scheduler.log.testing;

import java.io.File;

import com.google.inject.PrivateModule;
import com.google.inject.Singleton;

import com.twitter.common.args.Arg;
import com.twitter.common.args.CmdLine;
import com.twitter.common.args.constraints.NotNull;
import com.twitter.mesos.scheduler.log.Log;

/**
 * Binding module that uses a local log file, intended for testing.
 */
public class FileLogStreamModule extends PrivateModule {

  @NotNull
  @CmdLine(name = "testing_log_file_path", help = "Path to a file to store local log file data in.")
  private static final Arg<File> LOG_PATH = Arg.create(null);

  @Override
  protected void configure() {
    bind(File.class).toInstance(LOG_PATH.get());
    bind(Log.class).to(FileLog.class);
    bind(FileLog.class).in(Singleton.class);
    expose(Log.class);
  }
}

@@ -65,16 +65,61 @@
 .File;%0A%0A
+import com.google.common.base.Preconditions;%0A
 import c
@@ -150,16 +150,16 @@
 Module;%0A
-
 import c
@@ -267,60 +267,8 @@
 ne;%0A
-import com.twitter.common.args.constraints.NotNull;%0A
 impo
@@ -444,16 +444,166 @@
 le %7B%0A%0A  
+// TODO(William Farner): Make this a required argument and ensure it is not included in production%0A  //                       builds (MESOS-471).%0A  //
 @NotNull
@@ -779,16 +779,16 @@
 verride%0A
-
   protec
@@ -810,16 +810,64 @@
 ure() %7B%0A
+    Preconditions.checkNotNull(LOG_PATH.get());%0A
     bind

Make testing_log_file_path optional for now.