// Path: deploy-runner-common/src/main/java/jetbrains/buildServer/deployer/common/DeployerRunnerConstants.java
// public class DeployerRunnerConstants {
//   public static final String SSH_RUN_TYPE = "ssh-deploy-runner";
//   public static final String SMB_RUN_TYPE = "smb-deploy-runner";
//   public static final String SMB2_RUN_TYPE = "smb2-deploy-runner";
//   public static final String FTP_RUN_TYPE = "ftp-deploy-runner";
//   public static final String TOMCAT_RUN_TYPE = "tomcat-deploy-runner";
//   public static final String CARGO_RUN_TYPE = "cargo-deploy-runner";
// 
// 
//   public static final String PARAM_USERNAME = "jetbrains.buildServer.deployer.username";
//   public static final String PARAM_PASSWORD = "secure:jetbrains.buildServer.deployer.password";
//   @Deprecated
//   public static final String PARAM_PLAIN_PASSWORD = "jetbrains.buildServer.deployer.password";
//   @Deprecated
//   public static final String PARAM_DOMAIN = "jetbrains.buildServer.deployer.domain";
//   public static final String PARAM_TARGET_URL = "jetbrains.buildServer.deployer.targetUrl";
//   public static final String PARAM_SOURCE_PATH = "jetbrains.buildServer.deployer.sourcePath";
//   public static final String PARAM_CONTAINER_CONTEXT_PATH = "jetbrains.buildServer.deployer.container.contextPath";
//   public static final String PARAM_CONTAINER_TYPE = "jetbrains.buildServer.deployer.container.type";
// 
//   public static final String BUILD_PROBLEM_TYPE = "jetbrains.buildServer.deployer";
// }
// 
// Path: deploy-runner-common/src/main/java/jetbrains/buildServer/deployer/common/SSHRunnerConstants.java
// public class SSHRunnerConstants {
// 
//   public static final String SSH_EXEC_RUN_TYPE = "ssh-exec-runner";
// 
//   @Deprecated
//   public static final String PARAM_HOST = "jetbrains.buildServer.sshexec.host";
//   public static final String PARAM_PORT = "jetbrains.buildServer.sshexec.port";
//   @Deprecated
//   public static final String PARAM_USERNAME = "jetbrains.buildServer.sshexec.username";
//   @Deprecated
//   public static final String PARAM_PASSWORD = "jetbrains.buildServer.sshexec.password";
//   public static final String PARAM_KEYFILE = "jetbrains.buildServer.sshexec.keyFile";
//   public static final String PARAM_UPLOADED_KEY_ID = "jetbrains.buildServer.sshexec.key.id";
//   public static final String PARAM_AUTH_METHOD = "jetbrains.buildServer.sshexec.authMethod";
//   public static final String PARAM_COMMAND = "jetbrains.buildServer.sshexec.command";
//   public static final String PARAM_PTY = "jetbrains.buildServer.sshexec.pty";
// 
//   public static final String PARAM_TRANSPORT = "jetbrains.buildServer.deployer.ssh.transport";
// 
//   public static final String TRANSPORT_SCP = "jetbrains.buildServer.deployer.ssh.transport.scp";
//   public static final String TRANSPORT_SFTP = "jetbrains.buildServer.deployer.ssh.transport.sftp";
//   public static final String AUTH_METHOD_DEFAULT_KEY = "DEFAULT_KEY";
//   public static final String AUTH_METHOD_CUSTOM_KEY = "CUSTOM_KEY";
//   public static final String AUTH_METHOD_USERNAME_PWD = "PWD";
//   public static final String AUTH_METHOD_SSH_AGENT = "SSH_AGENT";
//   public static final String AUTH_METHOD_UPLOADED_KEY = "UPLOADED_KEY";
// 
//   public static final String ENABLE_SSH_AGENT_FORWARDING = "teamcity.deployer.ssh.enableAgentForwarding";
// 
//   public String getTransportType() {
//     return PARAM_TRANSPORT;
//   }
// 
//   public Map<String, String> getTransportTypeValues() {
//     final Map<String, String> result = new LinkedHashMap<String, String>();
//     result.put(TRANSPORT_SCP, "SCP");
//     result.put(TRANSPORT_SFTP, "SFTP");
//     return result;
//   }
// 
// 
// }


import jetbrains.buildServer.deployer.common.DeployerRunnerConstants;
import jetbrains.buildServer.deployer.common.SSHRunnerConstants;
import jetbrains.buildServer.serverSide.InvalidProperty;
import jetbrains.buildServer.util.StringUtil;
import java.util.Collection;
import java.util.Map;
/*
 * Copyright 2000-2022 JetBrains s.r.o.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package jetbrains.buildServer.deployer.server;



/**
 * Created by Nikita.Skvortsov
 * date: 13.02.14.
 */
class SSHDeployerPropertiesProcessor extends DeployerPropertiesProcessor {
  @Override
  public Collection<InvalidProperty> process(Map<String, String> properties) {
    Collection<InvalidProperty> result = super.process(properties);
    if (StringUtil.isEmptyOrSpaces(properties.get(DeployerRunnerConstants.PARAM_USERNAME)) &&
        !SSHRunnerConstants.AUTH_METHOD_DEFAULT_KEY.equals(properties.get(SSHRunnerConstants.PARAM_AUTH_METHOD))) {
// Path: deploy-runner-common/src/main/java/jetbrains/buildServer/deployer/common/DeployerRunnerConstants.java
// public class DeployerRunnerConstants {
//   public static final String SSH_RUN_TYPE = "ssh-deploy-runner";
//   public static final String SMB_RUN_TYPE = "smb-deploy-runner";
//   public static final String SMB2_RUN_TYPE = "smb2-deploy-runner";
//   public static final String FTP_RUN_TYPE = "ftp-deploy-runner";
//   public static final String TOMCAT_RUN_TYPE = "tomcat-deploy-runner";
//   public static final String CARGO_RUN_TYPE = "cargo-deploy-runner";
// 
// 
//   public static final String PARAM_USERNAME = "jetbrains.buildServer.deployer.username";
//   public static final String PARAM_PASSWORD = "secure:jetbrains.buildServer.deployer.password";
//   @Deprecated
//   public static final String PARAM_PLAIN_PASSWORD = "jetbrains.buildServer.deployer.password";
//   @Deprecated
//   public static final String PARAM_DOMAIN = "jetbrains.buildServer.deployer.domain";
//   public static final String PARAM_TARGET_URL = "jetbrains.buildServer.deployer.targetUrl";
//   public static final String PARAM_SOURCE_PATH = "jetbrains.buildServer.deployer.sourcePath";
//   public static final String PARAM_CONTAINER_CONTEXT_PATH = "jetbrains.buildServer.deployer.container.contextPath";
//   public static final String PARAM_CONTAINER_TYPE = "jetbrains.buildServer.deployer.container.type";
// 
//   public static final String BUILD_PROBLEM_TYPE = "jetbrains.buildServer.deployer";
// }
// 
// Path: deploy-runner-common/src/main/java/jetbrains/buildServer/deployer/common/SSHRunnerConstants.java
// public class SSHRunnerConstants {
// 
//   public static final String SSH_EXEC_RUN_TYPE = "ssh-exec-runner";
// 
//   @Deprecated
//   public static final String PARAM_HOST = "jetbrains.buildServer.sshexec.host";
//   public static final String PARAM_PORT = "jetbrains.buildServer.sshexec.port";
//   @Deprecated
//   public static final String PARAM_USERNAME = "jetbrains.buildServer.sshexec.username";
//   @Deprecated
//   public static final String PARAM_PASSWORD = "jetbrains.buildServer.sshexec.password";
//   public static final String PARAM_KEYFILE = "jetbrains.buildServer.sshexec.keyFile";
//   public static final String PARAM_UPLOADED_KEY_ID = "jetbrains.buildServer.sshexec.key.id";
//   public static final String PARAM_AUTH_METHOD = "jetbrains.buildServer.sshexec.authMethod";
//   public static final String PARAM_COMMAND = "jetbrains.buildServer.sshexec.command";
//   public static final String PARAM_PTY = "jetbrains.buildServer.sshexec.pty";
// 
//   public static final String PARAM_TRANSPORT = "jetbrains.buildServer.deployer.ssh.transport";
// 
//   public static final String TRANSPORT_SCP = "jetbrains.buildServer.deployer.ssh.transport.scp";
//   public static final String TRANSPORT_SFTP = "jetbrains.buildServer.deployer.ssh.transport.sftp";
//   public static final String AUTH_METHOD_DEFAULT_KEY = "DEFAULT_KEY";
//   public static final String AUTH_METHOD_CUSTOM_KEY = "CUSTOM_KEY";
//   public static final String AUTH_METHOD_USERNAME_PWD = "PWD";
//   public static final String AUTH_METHOD_SSH_AGENT = "SSH_AGENT";
//   public static final String AUTH_METHOD_UPLOADED_KEY = "UPLOADED_KEY";
// 
//   public static final String ENABLE_SSH_AGENT_FORWARDING = "teamcity.deployer.ssh.enableAgentForwarding";
// 
//   public String getTransportType() {
//     return PARAM_TRANSPORT;
//   }
// 
//   public Map<String, String> getTransportTypeValues() {
//     final Map<String, String> result = new LinkedHashMap<String, String>();
//     result.put(TRANSPORT_SCP, "SCP");
//     result.put(TRANSPORT_SFTP, "SFTP");
//     return result;
//   }
// 
// 
// }


// Path: deploy-runner-server/src/main/java/jetbrains/buildServer/deployer/server/SSHDeployerPropertiesProcessor.java
import jetbrains.buildServer.deployer.common.DeployerRunnerConstants;
import jetbrains.buildServer.deployer.common.SSHRunnerConstants;
import jetbrains.buildServer.serverSide.InvalidProperty;
import jetbrains.buildServer.util.StringUtil;
import java.util.Collection;
import java.util.Map;

/*
 * Copyright 2000-2022 JetBrains s.r.o.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package jetbrains.buildServer.deployer.server;



/**
 * Created by Nikita.Skvortsov
 * date: 13.02.14.
 */
class SSHDeployerPropertiesProcessor extends DeployerPropertiesProcessor {
  @Override
  public Collection<InvalidProperty> process(Map<String, String> properties) {
    Collection<InvalidProperty> result = super.process(properties);
    if (StringUtil.isEmptyOrSpaces(properties.get(DeployerRunnerConstants.PARAM_USERNAME)) &&
        !SSHRunnerConstants.AUTH_METHOD_DEFAULT_KEY.equals(properties.get(SSHRunnerConstants.PARAM_AUTH_METHOD))) {
      result.add(new InvalidProperty(DeployerRunnerConstants.PARAM_USERNAME, "Username must be specified."));