
package git4idea.test;

import com.intellij.externalProcessAuthHelper.AuthenticationGate;
import com.intellij.openapi.project.Project;
import com.intellij.externalProcessAuthHelper.AuthenticationMode;
import git4idea.commands.GitHttpAuthService;
import git4idea.commands.GitHttpAuthenticator;
import org.jetbrains.annotations.NotNull;

import java.io.File;
import java.util.Collection;

public class GitHttpAuthTestService extends GitHttpAuthService {

  @NotNull private GitHttpAuthenticator myAuthenticator = STUB_AUTHENTICATOR;

  @NotNull
  @Override
  public GitHttpAuthenticator createAuthenticator(@NotNull Project project,
                                                  @NotNull Collection<String> urls,
                                                  @NotNull File workingDirectory,
                                                  @NotNull AuthenticationGate authenticationGate,
                                                  @NotNull AuthenticationMode authenticationMode) {
    return myAuthenticator;
  }

  public void register(@NotNull GitHttpAuthenticator authenticator) {
    myAuthenticator = authenticator;
  }

  public void cleanup() {
    myAuthenticator = STUB_AUTHENTICATOR;
  }

}
