

package com.groupon.seleniumgridextras.downloader;

import com.groupon.seleniumgridextras.config.RuntimeConfig;

public class WdDownloader extends Downloader {

  public WdDownloader(String version) {
    setDestinationDir(RuntimeConfig.getConfig().getWebdriver().getDirectory());
    setDestinationFile(version + ".jar");

    String versionMajor = version.substring(0, version.lastIndexOf('.'));

    setSourceURL("http://selenium-release.storage.googleapis.com/" + versionMajor
                 + "/selenium-server-standalone-" + destinationFile);
  }

  @Override
  public void setSourceURL(String source) {
    sourceURL = source;
  }

  @Override
  public void setDestinationFile(String destination) {
    destinationFile = destination;
  }

  @Override
  public void setDestinationDir(String dir) {
    destinationDir = dir;
  }

}
