当前位置: 首页>>代码示例>>Java>>正文


Java StringUtil.isEmptyOrSpaces方法代码示例

本文整理汇总了Java中jetbrains.buildServer.util.StringUtil.isEmptyOrSpaces方法的典型用法代码示例。如果您正苦于以下问题:Java StringUtil.isEmptyOrSpaces方法的具体用法?Java StringUtil.isEmptyOrSpaces怎么用?Java StringUtil.isEmptyOrSpaces使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在jetbrains.buildServer.util.StringUtil的用法示例。


在下文中一共展示了StringUtil.isEmptyOrSpaces方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: provideCommandLine

import jetbrains.buildServer.util.StringUtil; //导入方法依赖的package包/类
@NotNull
public List<String> provideCommandLine(@NotNull final PowerShellInfo info,
                                       @NotNull final Map<String, String> runnerParams,
                                       @NotNull final File scriptFile,
                                       final boolean useExecutionPolicy) throws RunBuildException {
  final List<String> result = new ArrayList<String>();
  final PowerShellExecutionMode mod = PowerShellExecutionMode.fromString(runnerParams.get(RUNNER_EXECUTION_MODE));
  if (mod == null) {
    throw new RunBuildException("'" + RUNNER_EXECUTION_MODE + "' runner parameter is not defined");
  }
  addVersion(result, runnerParams, info); // version must be the 1st arg after executable path
  if (!StringUtil.isEmptyOrSpaces(runnerParams.get(RUNNER_NO_PROFILE))) {
    result.add("-NoProfile");
  }
  result.add("-NonInteractive");

  addCustomArguments(result, runnerParams, RUNNER_CUSTOM_ARGUMENTS);
  if (useExecutionPolicy) {
    addExecutionPolicyPreference(result);
  }

  addScriptBody(result, mod, scriptFile, runnerParams);
  return result;
}
 
开发者ID:JetBrains,项目名称:teamcity-powershell,代码行数:25,代码来源:PowerShellCommandLineProvider.java

示例2: getCMDWrappedCommand

import jetbrains.buildServer.util.StringUtil; //导入方法依赖的package包/类
/**
 * Gets path to {@code cmd.exe} wrapper for powershell process.
 * Wrapper implicitly causes child process to inherit its bitness.
 *
 * @param info powershell info
 * @param env environment variables
 * @return path to {@code cmd.exe}
 */
public String getCMDWrappedCommand(@NotNull final PowerShellInfo info, @NotNull final Map<String, String> env) {
  final String windir = env.get("windir");
  if (StringUtil.isEmptyOrSpaces(windir)) {
    LOG.warn("Failed to find %windir%");
    return "cmd.exe";
  }
  switch (info.getBitness()) {
    case x64:
      if (mySystemBitness.is32bit()) {
        return windir + "\\sysnative\\cmd.exe";
      }
      return windir + "\\System32\\cmd.exe";
    case x86:
      if (mySystemBitness.is64bit()) {
        return windir + "\\SysWOW64\\cmd.exe";
      }
      return windir + "\\System32\\cmd.exe";
  }
  return "cmd.exe";
}
 
开发者ID:JetBrains,项目名称:teamcity-powershell,代码行数:29,代码来源:PowerShellCommands.java

示例3: validate

import jetbrains.buildServer.util.StringUtil; //导入方法依赖的package包/类
private ActionErrors validate(@NotNull TelegramSettingsBean settings) {
  ActionErrors errors = new ActionErrors();
  if (StringUtil.isEmptyOrSpaces(settings.getBotToken())) {
    errors.addError("emptyBotToken", "Bot token must not be empty");
  }
  if (settings.isUseProxy()) {
    if (StringUtils.isEmpty(settings.getProxyServer())) {
      errors.addError("emptyProxyServer", "Proxy server must not be empty");
    }
    if (StringUtils.isEmpty(settings.getProxyPort())) {
      errors.addError("emptyProxyPort", "Proxy port must not be empty");
    }
  }
  String port = settings.getProxyPort();
  if (!StringUtils.isEmpty(port) &&
      (!StringUtil.isNumber(port) || Integer.valueOf(port) < 1 || Integer.valueOf(port) > 65535)) {
    errors.addError("badProxyPort", "Proxy port must be integer between 1 and 65535");
  }
  return errors;
}
 
开发者ID:dancing-elf,项目名称:teamcity-telegram-plugin,代码行数:21,代码来源:TelegramSettingsController.java

示例4: perform

import jetbrains.buildServer.util.StringUtil; //导入方法依赖的package包/类
@NotNull
public CheckResult<DeploymentProcessChangedSpec> perform(UUID correlationId) {
    final String octopusUrl = props.get(OCTOPUS_URL);
    if (StringUtil.isEmptyOrSpaces(octopusUrl)) {
        return DeploymentProcessChangedSpecCheckResult.createErrorResult(String.format("%s settings are invalid (empty url) in build configuration %s",
                displayName, this.buildType), correlationId);
    }

    final String octopusApiKey = props.get(OCTOPUS_APIKEY);
    if (StringUtil.isEmptyOrSpaces(octopusApiKey)) {
        return DeploymentProcessChangedSpecCheckResult.createErrorResult(String.format("%s settings are invalid (empty api key) in build configuration %s",
                displayName, this.buildType), correlationId);
    }

    final String octopusProject = props.get(OCTOPUS_PROJECT_ID);
    if (StringUtil.isEmptyOrSpaces(octopusProject)) {
        return DeploymentProcessChangedSpecCheckResult.createErrorResult(String.format("%s settings are invalid (empty project) in build configuration %s",
                displayName, this.buildType), correlationId);
    }

    return getCheckResult(octopusUrl, octopusApiKey, octopusProject, dataStorage, correlationId);
}
 
开发者ID:matt-richardson,项目名称:teamcity-octopus-build-trigger-plugin,代码行数:23,代码来源:DeploymentProcessChangedCheckJob.java

示例5: checkConnectivity

import jetbrains.buildServer.util.StringUtil; //导入方法依赖的package包/类
private void checkConnectivity(Map<String, String> properties, ArrayList<InvalidProperty> invalidProps, String url, String apiKey, UUID correlationId) {
    try {
        final Integer connectionTimeoutInMilliseconds = buildTriggerProperties.getConnectionTimeoutInMilliseconds();
        final OctopusConnectivityChecker connectivityChecker = octopusConnectivityCheckerFactory.create(url, apiKey, connectionTimeoutInMilliseconds, metricRegistry);

        final String err = connectivityChecker.checkOctopusConnectivity(correlationId);
        if (StringUtil.isNotEmpty(err)) {
            invalidProps.add(new InvalidProperty(BuildTriggerConstants.OCTOPUS_URL, err));
        }

        final String project = properties.get(BuildTriggerConstants.OCTOPUS_PROJECT_ID);
        if (StringUtil.isEmptyOrSpaces(project)) {
            invalidProps.add(new InvalidProperty(BuildTriggerConstants.OCTOPUS_PROJECT_ID, "Project must be specified"));
        }
    } catch (Exception e) {
        invalidProps.add(new InvalidProperty(BuildTriggerConstants.OCTOPUS_URL, e.getMessage()));
    }
}
 
开发者ID:matt-richardson,项目名称:teamcity-octopus-build-trigger-plugin,代码行数:19,代码来源:DeploymentProcessChangedTriggerPropertiesProcessor.java

示例6: tryGetParameter

import jetbrains.buildServer.util.StringUtil; //导入方法依赖的package包/类
@Nullable
@Override
public String tryGetParameter(@NotNull final String paramName) {
  final String isRunAsUiEnabledStr = myRunnerParametersService.tryGetConfigParameter(Constants.RUN_AS_UI_ENABLED);
  final boolean isRunAsUiEnabled = StringUtil.isEmpty(isRunAsUiEnabledStr) || !Boolean.toString(false).equalsIgnoreCase(isRunAsUiEnabledStr);
  if(isRunAsUiEnabled) {
    String paramValue = myRunnerParametersService.tryGetRunnerParameter(paramName);
    if (!StringUtil.isEmptyOrSpaces(paramValue)) {
      return paramValue;
    }

    paramValue = myBuildFeatureParametersService.tryGetBuildFeatureParameter(Constants.BUILD_FEATURE_TYPE, paramName);
    if (!StringUtil.isEmptyOrSpaces(paramValue)) {
      return paramValue;
    }
  }

  return tryGetConfigParameter(paramName);
}
 
开发者ID:JetBrains,项目名称:teamcity-runas-plugin,代码行数:20,代码来源:ParametersServiceImpl.java

示例7: perform

import jetbrains.buildServer.util.StringUtil; //导入方法依赖的package包/类
@NotNull
public CheckResult<ReleaseCreatedSpec> perform(UUID correlationId) {
    final String octopusUrl = props.get(OCTOPUS_URL);
    if (StringUtil.isEmptyOrSpaces(octopusUrl)) {
        return ReleaseCreatedSpecCheckResult.createErrorResult(String.format("%s settings are invalid (empty url) in build configuration %s",
                displayName, buildType), correlationId);
    }

    final String octopusApiKey = props.get(OCTOPUS_APIKEY);
    if (StringUtil.isEmptyOrSpaces(octopusApiKey)) {
        return ReleaseCreatedSpecCheckResult.createErrorResult(String.format("%s settings are invalid (empty api key) in build configuration %s",
                displayName, buildType), correlationId);
    }

    final String octopusProject = props.get(OCTOPUS_PROJECT_ID);
    if (StringUtil.isEmptyOrSpaces(octopusProject)) {
        return ReleaseCreatedSpecCheckResult.createErrorResult(String.format("%s settings are invalid (empty project) in build configuration %s",
                displayName, buildType), correlationId);
    }

    return getCheckResult(octopusUrl, octopusApiKey, octopusProject, dataStorage, correlationId);
}
 
开发者ID:matt-richardson,项目名称:teamcity-octopus-build-trigger-plugin,代码行数:23,代码来源:ReleaseCreatedCheckJob.java

示例8: createCredentials

import jetbrains.buildServer.util.StringUtil; //导入方法依赖的package包/类
@NotNull
private UserCredentials createCredentials(@NotNull final String profileName, @NotNull final String userName, @NotNull final String password, boolean isPredefined)
{
  // Get parameters
  final WindowsIntegrityLevel windowsIntegrityLevel = WindowsIntegrityLevel.tryParse(getParam(profileName, Constants.WINDOWS_INTEGRITY_LEVEL, isPredefined));
  final LoggingLevel loggingLevel = LoggingLevel.tryParse(getParam(profileName, Constants.LOGGING_LEVEL, isPredefined));

  String additionalArgs = tryGetFirstNotEmpty(getParam(profileName, Constants.ADDITIONAL_ARGS, isPredefined));
  if(StringUtil.isEmptyOrSpaces(additionalArgs)) {
    additionalArgs = "";
  }

  return new UserCredentials(
    profileName,
    userName,
    password,
    windowsIntegrityLevel,
    loggingLevel,
    myCommandLineArgumentsService.parseCommandLineArguments(additionalArgs));
}
 
开发者ID:JetBrains,项目名称:teamcity-runas-plugin,代码行数:21,代码来源:UserCredentialsServiceImpl.java

示例9: process

import jetbrains.buildServer.util.StringUtil; //导入方法依赖的package包/类
public Collection<InvalidProperty> process(Map<String, String> properties) {
    final ArrayList<InvalidProperty> invalidProps = new ArrayList<>();

    final String url = properties.get(BuildTriggerConstants.OCTOPUS_URL);
    if (StringUtil.isEmptyOrSpaces(url)) {
        invalidProps.add(new InvalidProperty(BuildTriggerConstants.OCTOPUS_URL, "URL must be specified"));
    }

    final String apiKey = properties.get(BuildTriggerConstants.OCTOPUS_APIKEY);
    if (StringUtil.isEmptyOrSpaces(apiKey)) {
        invalidProps.add(new InvalidProperty(BuildTriggerConstants.OCTOPUS_APIKEY, "API Key must be specified"));
    }

    if (invalidProps.size() == 0) {
        UUID correlationId = UUID.randomUUID();
        checkConnectivity(invalidProps, url, apiKey, correlationId);
    }
    return invalidProps;
}
 
开发者ID:matt-richardson,项目名称:teamcity-octopus-build-trigger-plugin,代码行数:20,代码来源:MachineAddedTriggerPropertiesProcessor.java

示例10: perform

import jetbrains.buildServer.util.StringUtil; //导入方法依赖的package包/类
@NotNull
public CheckResult<DeploymentCompleteSpec> perform(UUID correlationId) {
    final String octopusUrl = props.get(OCTOPUS_URL);
    if (StringUtil.isEmptyOrSpaces(octopusUrl)) {
        return DeploymentCompleteSpecCheckResult.createErrorResult(String.format("%s settings are invalid (empty url) in build configuration %s",
                displayName, this.buildType), correlationId);
    }

    final String octopusApiKey = props.get(OCTOPUS_APIKEY);
    if (StringUtil.isEmptyOrSpaces(octopusApiKey)) {
        return DeploymentCompleteSpecCheckResult.createErrorResult(String.format("%s settings are invalid (empty api key) in build configuration %s",
                displayName, this.buildType), correlationId);
    }

    final String octopusProject = props.get(OCTOPUS_PROJECT_ID);
    if (StringUtil.isEmptyOrSpaces(octopusProject)) {
        return DeploymentCompleteSpecCheckResult.createErrorResult(String.format("%s settings are invalid (empty project) in build configuration %s",
                displayName, this.buildType), correlationId);
    }

    final Boolean triggerOnlyOnSuccessfulDeployment = Boolean.parseBoolean(props.get(OCTOPUS_TRIGGER_ONLY_ON_SUCCESSFUL_DEPLOYMENT));

    return getCheckResult(octopusUrl, octopusApiKey, octopusProject, triggerOnlyOnSuccessfulDeployment, dataStorage, correlationId);
}
 
开发者ID:matt-richardson,项目名称:teamcity-octopus-build-trigger-plugin,代码行数:25,代码来源:DeploymentCompleteCheckJob.java

示例11: process

import jetbrains.buildServer.util.StringUtil; //导入方法依赖的package包/类
public Collection<InvalidProperty> process(Map<String, String> properties) {
    final ArrayList<InvalidProperty> invalidProps = new ArrayList<>();

    final String url = properties.get(BuildTriggerConstants.OCTOPUS_URL);
    if (StringUtil.isEmptyOrSpaces(url)) {
        invalidProps.add(new InvalidProperty(BuildTriggerConstants.OCTOPUS_URL, "URL must be specified"));
    }

    final String apiKey = properties.get(BuildTriggerConstants.OCTOPUS_APIKEY);
    if (StringUtil.isEmptyOrSpaces(apiKey)) {
        invalidProps.add(new InvalidProperty(BuildTriggerConstants.OCTOPUS_APIKEY, "API Key must be specified"));
    }

    if (invalidProps.size() == 0) {
        UUID correlationId = UUID.randomUUID();
        checkConnectivity(properties, invalidProps, url, apiKey, correlationId);
    }
    return invalidProps;
}
 
开发者ID:matt-richardson,项目名称:teamcity-octopus-build-trigger-plugin,代码行数:20,代码来源:ReleaseCreatedTriggerPropertiesProcessor.java

示例12: splitCommaSeparatedValues

import jetbrains.buildServer.util.StringUtil; //导入方法依赖的package包/类
private List<String> splitCommaSeparatedValues(String values) {
    List<String> result = new ArrayList<String>();
    if (values == null || StringUtil.isEmptyOrSpaces(values)) {
        return result;
    }

    String[] valueList = values.split(",(?=([^\"]*\"[^\"]*\")*[^\"]*$)");
    for (String value : valueList) {
        String valueTrimmed = value.trim();
        if (valueTrimmed.length() > 0) {
            result.add(valueTrimmed);
        }
    }

    return result;
}
 
开发者ID:stevenlauwers22,项目名称:DotNetBuild.TeamCity,代码行数:17,代码来源:DotNetBuildBuildService.java

示例13: getRunnerPropertiesProcessor

import jetbrains.buildServer.util.StringUtil; //导入方法依赖的package包/类
@Nullable
@Override
public PropertiesProcessor getRunnerPropertiesProcessor() {
  return new PropertiesProcessor() {
    @Override
    public Collection<InvalidProperty> process(final Map<String, String> properties) {
      final ArrayList<InvalidProperty> result = new ArrayList<InvalidProperty>();

      final boolean useDotTrace = StringUtil.isTrue(properties.get(DotTraceBean.Shared.getUseDotTraceKey()));
      if(useDotTrace && StringUtil.isEmptyOrSpaces(properties.get(DotTraceBean.Shared.getPathKey()))) {
        result.add(new InvalidProperty(DotTraceBean.Shared.getPathKey(), PATH_NOT_SPECIFIED_ERROR_MESSAGE));
      }

      if(useDotTrace && StringUtil.isEmptyOrSpaces(properties.get(DotTraceBean.Shared.getThresholdsKey()))) {
        result.add(new InvalidProperty(DotTraceBean.Shared.getThresholdsKey(), THRESHOLDS_NOT_SPECIFIED_ERROR_MESSAGE));
      }

      return result;
    }
  };
}
 
开发者ID:JetBrains,项目名称:teamcity-dottrace,代码行数:22,代码来源:DotTraceEditExtension.java

示例14: process

import jetbrains.buildServer.util.StringUtil; //导入方法依赖的package包/类
@Override
public Collection<InvalidProperty> process(Map<String, String> properties) {

    Collection<InvalidProperty> result = new HashSet<InvalidProperty>();

    if (StringUtil.isEmptyOrSpaces(properties.get(TodoBuildRunnerConstants.PARAM_INCLUDE_REGEX))) {
        result.add(new InvalidProperty(TodoBuildRunnerConstants.PARAM_INCLUDE_REGEX, "The parameter 'include regex' must be specified."));
    }
    if (StringUtil.isEmptyOrSpaces(properties.get(TodoBuildRunnerConstants.PARAM_PATTERN_MINOR_REGEX))) {
        result.add(new InvalidProperty(TodoBuildRunnerConstants.PARAM_PATTERN_MINOR_REGEX, "The parameter 'minor pattern' must be specified."));
    }
    if (StringUtil.isEmptyOrSpaces(properties.get(TodoBuildRunnerConstants.PARAM_PATTERN_MAJOR_REGEX))) {
        result.add(new InvalidProperty(TodoBuildRunnerConstants.PARAM_PATTERN_MAJOR_REGEX, "The parameter 'major pattern' must be specified."));
    }
    if (StringUtil.isEmptyOrSpaces(properties.get(TodoBuildRunnerConstants.PARAM_PATTERN_CRITICAL_REGEX))) {
        result.add(new InvalidProperty(TodoBuildRunnerConstants.PARAM_PATTERN_CRITICAL_REGEX, "The parameter 'critical pattern' must be specified."));
    }

    return result;
}
 
开发者ID:rvdginste,项目名称:todo-teamcity-plugin,代码行数:21,代码来源:TodoPropertiesProcessor.java

示例15: getRunnerPropertiesProcessor

import jetbrains.buildServer.util.StringUtil; //导入方法依赖的package包/类
@NotNull
@Override
public PropertiesProcessor getRunnerPropertiesProcessor() {
  return new PropertiesProcessor() {
    public Collection<InvalidProperty> process(final Map<String, String> properties) {
        List<InvalidProperty> errors = new ArrayList<InvalidProperty>();
        AnsibleRunConfig config = new AnsibleRunConfig(properties);
        if (AnsibleCommand.EXECUTABLE.equals(config.getCommandType())) {
            if (StringUtil.isEmptyOrSpaces(config.getExecutable())) {
                errors.add(new InvalidProperty(AnsibleRunnerConstants.EXECUTABLE_KEY, "Cannot be empty"));
            }
            if (StringUtil.isEmptyOrSpaces(config.getPlaybook())) {
                errors.add(new InvalidProperty(AnsibleRunnerConstants.PLAYBOOK_FILE_KEY, "Cannot be empty"));
            }
        } else if (AnsibleCommand.CUSTOM_SCRIPT.equals(config.getCommandType())) {
            if (StringUtil.isEmptyOrSpaces(config.getSourceCode())) {
                errors.add(new InvalidProperty(AnsibleRunnerConstants.SOURCE_CODE_KEY, "Cannot be empty"));
            }
        }
      return errors;
    }
  };
}
 
开发者ID:andreizhuk,项目名称:tc-ansible-runner,代码行数:24,代码来源:AnsibleRunType.java


注:本文中的jetbrains.buildServer.util.StringUtil.isEmptyOrSpaces方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。