package io.groundhog.replay;

import com.google.common.base.Throwables;
import com.google.common.net.HostAndPort;
import com.google.inject.AbstractModule;
import com.google.inject.name.Names;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;

/**
 * @author Michael Olague
 * @since 1.0
 */
public class ReplayModule extends AbstractModule {
  @Override
  protected void configure() {
    // Temporarily comment out the configuration logic - this class is only for development as it stands
//    String propsLocation = "conf/config.properties";
//    Properties props = new Properties();
//    try {
//      props.load(new FileInputStream(propsLocation));
//    } catch (IOException e) {
//      Throwables.propagate(e);
//    }
//    String hostname = props.getProperty("replayHostName");
//    int port = Integer.parseInt(props.getProperty("replayPort"));
//    File recordingFile = new File(props.getProperty("replayRecordingFile"));

    String hostname = "localhost";
    int port = 8080;
    File recordingFile = new File("out/recording.har");

    bind(ReplayResultListener.class).to(LoggingResultListener.class);
    bind(HostAndPort.class).annotatedWith(Names.named("target")).toInstance(HostAndPort.fromParts(hostname, port));
    bind(boolean.class).annotatedWith(Names.named("usessl")).toInstance(false);
    bind(RequestDispatcher.class).to(DefaultRequestDispatcher.class);
    bind(RequestReader.class).to(DefaultRequestReader.class);
    bind(File.class).toInstance(recordingFile);
  }
}

@@ -27,50 +27,8 @@
 y;%0A%0A
-import com.google.common.base.Throwables;%0A
 impo
@@ -168,97 +168,8 @@
 ile;
-%0Aimport java.io.FileInputStream;%0Aimport java.io.IOException;%0Aimport java.util.Properties;
 %0A%0A/*

Remove unused imports