// Path: runAs-common/src/main/java/jetbrains/buildServer/runAs/common/LoggingLevel.java
// public enum LoggingLevel {
//   Off("off", "Off"),
//   Errors("errors", "Errors"),
//   Normal("normal", "Normal"),
//   Debug("debug", "Debug");
// 
//   private final String myValue;
//   private final String myDescription;
// 
//   private LoggingLevel(String value, final String description) {
//     myValue = value;
//     myDescription = description;
//   }
// 
//   public String getValue() {
//     return myValue;
//   }
// 
//   public String getDescription() {
//     return myDescription;
//   }
// 
//   public static LoggingLevel tryParse(String value) {
//     for (LoggingLevel v : values()) {
//       if (v.getValue().equals(value)) return v;
//     }
// 
//     return Off;
//   }
// }
// 
// Path: runAs-common/src/main/java/jetbrains/buildServer/runAs/common/WindowsIntegrityLevel.java
// public enum WindowsIntegrityLevel {
//   Auto("auto", "Default"),
//   Untrusted("untrusted", "Untrusted"),
//   Low("low", "Low"),
//   Medium("medium", "Medium"),
//   MediumPlus("medium_plus", "Medium Plus"),
//   High("high", "High");
// 
//   private final String myValue;
//   private final String myDescription;
// 
//   private WindowsIntegrityLevel(String value, final String description) {
//     myValue = value;
//     myDescription = description;
//   }
// 
//   public String getValue() {
//     return myValue;
//   }
// 
//   public String getDescription() {
//     return myDescription;
//   }
// 
//   public static WindowsIntegrityLevel tryParse(String value) {
//     for (WindowsIntegrityLevel v : values()) {
//       if (v.getValue().equals(value)) return v;
//     }
// 
//     return Auto;
//   }
// }
// 
// Path: runAs-common/src/main/java/jetbrains/buildServer/runAs/common/Constants.java
// public static final String RUN_AS_LOG_ENABLED = "teamcity.runAs.log.enabled";


import static jetbrains.buildServer.runAs.common.Constants.RUN_AS_LOG_ENABLED;
import static org.assertj.core.api.BDDAssertions.then;
import java.io.File;
import java.util.*;
import jetbrains.buildServer.dotNet.buildRunner.agent.*;
import jetbrains.buildServer.runAs.common.LoggingLevel;
import jetbrains.buildServer.runAs.common.WindowsIntegrityLevel;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jmock.Expectations;
import org.jmock.Mockery;
import org.jmock.api.Invocation;
import org.jmock.lib.action.CustomAction;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
        "true",
        new String[] {
          "Starting: tool cred cmd abc",
          "as user: username",
          "Starting: origTool arg1",
          "in directory: CheckoutDirectory" }
      },

      // when log is disabled
      {
        "false",
        new String[] {
          "Starting: origTool arg1",
          "in directory: CheckoutDirectory" }
      },

      // when log is disabled by default
      {
        null,
        new String[] {
          "Starting: origTool arg1",
          "in directory: CheckoutDirectory" }
      }
    };
  }

  @Test(dataProvider = "getLogRunAsCases")
  public void shouldLogRunAs(@Nullable final String isLogEnabledConfigParamValue, @NotNull final String[] expectedLogLines) {
    // Given
    final String password = "abc";
// Path: runAs-common/src/main/java/jetbrains/buildServer/runAs/common/LoggingLevel.java
// public enum LoggingLevel {
//   Off("off", "Off"),
//   Errors("errors", "Errors"),
//   Normal("normal", "Normal"),
//   Debug("debug", "Debug");
// 
//   private final String myValue;
//   private final String myDescription;
// 
//   private LoggingLevel(String value, final String description) {
//     myValue = value;
//     myDescription = description;
//   }
// 
//   public String getValue() {
//     return myValue;
//   }
// 
//   public String getDescription() {
//     return myDescription;
//   }
// 
//   public static LoggingLevel tryParse(String value) {
//     for (LoggingLevel v : values()) {
//       if (v.getValue().equals(value)) return v;
//     }
// 
//     return Off;
//   }
// }
// 
// Path: runAs-common/src/main/java/jetbrains/buildServer/runAs/common/WindowsIntegrityLevel.java
// public enum WindowsIntegrityLevel {
//   Auto("auto", "Default"),
//   Untrusted("untrusted", "Untrusted"),
//   Low("low", "Low"),
//   Medium("medium", "Medium"),
//   MediumPlus("medium_plus", "Medium Plus"),
//   High("high", "High");
// 
//   private final String myValue;
//   private final String myDescription;
// 
//   private WindowsIntegrityLevel(String value, final String description) {
//     myValue = value;
//     myDescription = description;
//   }
// 
//   public String getValue() {
//     return myValue;
//   }
// 
//   public String getDescription() {
//     return myDescription;
//   }
// 
//   public static WindowsIntegrityLevel tryParse(String value) {
//     for (WindowsIntegrityLevel v : values()) {
//       if (v.getValue().equals(value)) return v;
//     }
// 
//     return Auto;
//   }
// }
// 
// Path: runAs-common/src/main/java/jetbrains/buildServer/runAs/common/Constants.java
// public static final String RUN_AS_LOG_ENABLED = "teamcity.runAs.log.enabled";


// Path: runAs-agent/src/test/java/jetbrains/buildServer/runAs/agent/RunAsLoggerTest.java
import static jetbrains.buildServer.runAs.common.Constants.RUN_AS_LOG_ENABLED;
import static org.assertj.core.api.BDDAssertions.then;
import java.io.File;
import java.util.*;
import jetbrains.buildServer.dotNet.buildRunner.agent.*;
import jetbrains.buildServer.runAs.common.LoggingLevel;
import jetbrains.buildServer.runAs.common.WindowsIntegrityLevel;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jmock.Expectations;
import org.jmock.Mockery;
import org.jmock.api.Invocation;
import org.jmock.lib.action.CustomAction;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

        "true",
        new String[] {
          "Starting: tool cred cmd abc",
          "as user: username",
          "Starting: origTool arg1",
          "in directory: CheckoutDirectory" }
      },

      // when log is disabled
      {
        "false",
        new String[] {
          "Starting: origTool arg1",
          "in directory: CheckoutDirectory" }
      },

      // when log is disabled by default
      {
        null,
        new String[] {
          "Starting: origTool arg1",
          "in directory: CheckoutDirectory" }
      }
    };
  }

  @Test(dataProvider = "getLogRunAsCases")
  public void shouldLogRunAs(@Nullable final String isLogEnabledConfigParamValue, @NotNull final String[] expectedLogLines) {
    // Given
    final String password = "abc";
    final UserCredentials userCredentials = new UserCredentials("", "username", password, WindowsIntegrityLevel.Auto, LoggingLevel.Normal, Collections.<CommandLineArgument>emptyList());