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


Java CommandLineSetup类代码示例

本文整理汇总了Java中jetbrains.buildServer.dotNet.buildRunner.agent.CommandLineSetup的典型用法代码示例。如果您正苦于以下问题:Java CommandLineSetup类的具体用法?Java CommandLineSetup怎么用?Java CommandLineSetup使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CommandLineSetup类属于jetbrains.buildServer.dotNet.buildRunner.agent包,在下文中一共展示了CommandLineSetup类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: LogRunAs

import jetbrains.buildServer.dotNet.buildRunner.agent.CommandLineSetup; //导入依赖的package包/类
@Override
public void LogRunAs(
  @NotNull final UserCredentials userCredentials,
  @NotNull final CommandLineSetup baseCommandLineSetup,
  @NotNull final CommandLineSetup runAsCommandLineSetup) {
  mySecuredLoggingService.disableLoggingOfCommandLine();
  final GeneralCommandLine baseCmd = convertToCommandLine(baseCommandLineSetup, false);
  final GeneralCommandLine runAsCmd = convertToCommandLine(runAsCommandLineSetup, true);

  LOG.info("Run as user \"" + userCredentials.getUser() + "\": " + runAsCmd.getCommandLineString());
  if(Boolean.parseBoolean(myRunnerParametersService.tryGetConfigParameter(RUN_AS_LOG_ENABLED))) {
    myLoggerService.onStandardOutput("Starting: " + runAsCmd.getCommandLineString());
    myLoggerService.onStandardOutput("as user: " + userCredentials.getUser());
  }

  myLoggerService.onStandardOutput("Starting: " + baseCmd.getCommandLineString());

  File workingDirectory = runAsCommandLineSetup.getWorkingDirectory();
  if(workingDirectory == null) {
    workingDirectory = myPathsService.getPath(WellKnownPaths.Checkout);
  }

  myLoggerService.onStandardOutput("in directory: " + workingDirectory);
}
 
开发者ID:JetBrains,项目名称:teamcity-runas-plugin,代码行数:25,代码来源:RunAsLoggerImpl.java

示例2: build

import jetbrains.buildServer.dotNet.buildRunner.agent.CommandLineSetup; //导入依赖的package包/类
@NotNull
@Override
public Iterable<CommandLineSetup> build(@NotNull final CommandLineSetup commandLineSetup) {
  CommandLineSetupBuilder setupBuilder = myRunAsUnixSetupBuilder;
  switch (myEnvironment.getOperationSystem()) {
    case Windows:
      setupBuilder = myRunAsWindowsSetupBuilder;
      break;

    case Mac:
      setupBuilder = myRunAsMacSetupBuilder;
      break;
  }

  return setupBuilder.build(commandLineSetup);
}
 
开发者ID:JetBrains,项目名称:teamcity-runas-plugin,代码行数:17,代码来源:RunAsSetupBuilder.java

示例3: convertToCommandLine

import jetbrains.buildServer.dotNet.buildRunner.agent.CommandLineSetup; //导入依赖的package包/类
private GeneralCommandLine convertToCommandLine(@NotNull final CommandLineSetup runAsCommandLineSetup, boolean replacePassword)
{
  final GeneralCommandLine cmd = new GeneralCommandLine();
  cmd.setExePath(runAsCommandLineSetup.getToolPath());
  for(final CommandLineArgument arg: runAsCommandLineSetup.getArgs())
  {
    cmd.addParameter(arg.getValue());
  }

  return cmd;
}
 
开发者ID:JetBrains,项目名称:teamcity-runas-plugin,代码行数:12,代码来源:RunAsLoggerImpl.java

示例4: tryExecChmod

import jetbrains.buildServer.dotNet.buildRunner.agent.CommandLineSetup; //导入依赖的package包/类
@Nullable
private Result<AccessControlEntry, Boolean> tryExecChmod(@NotNull final AccessControlEntry entry, @NotNull final Iterable<String> chmodPermissions)
{
  final String chmodPermissionsStr = StringUtil.join("", chmodPermissions);
  if(StringUtil.isEmptyOrSpaces(chmodPermissionsStr)) {
    return null;
  }

  final ArrayList<CommandLineArgument> args = new ArrayList<CommandLineArgument>();
  if (entry.getPermissions().contains(AccessPermissions.Recursive)) {
    args.add(new CommandLineArgument("-R", CommandLineArgument.Type.PARAMETER));
  }
  args.add(new CommandLineArgument(chmodPermissionsStr, CommandLineArgument.Type.PARAMETER));
  args.add(new CommandLineArgument(entry.getFile().getAbsolutePath(), CommandLineArgument.Type.PARAMETER));
  final CommandLineSetup chmodCommandLineSetup = new CommandLineSetup(CHMOD_TOOL_NAME, args, Collections.<CommandLineResource>emptyList());
  try {
    final ExecResult result = myCommandLineExecutor.runProcess(chmodCommandLineSetup, EXECUTION_TIMEOUT_SECONDS);
    if(result == null) {
      return null;
    }

    return processResult(entry, result);
  }
  catch (ExecutionException e) {
    LOG.error(e);
    return new Result<AccessControlEntry, Boolean>(entry, e);
  }
}
 
开发者ID:JetBrains,项目名称:teamcity-runas-plugin,代码行数:29,代码来源:LinuxFileAccessService.java

示例5: Context

import jetbrains.buildServer.dotNet.buildRunner.agent.CommandLineSetup; //导入依赖的package包/类
public Context(
  @NotNull final CommandLineSetup baseSetup,
  @NotNull final File projectFile,
  @NotNull final File snapshotFile,
  @NotNull final File patternsFile,
  @NotNull final File reportFile) {
  myBaseSetup = baseSetup;
  myProjectFile = projectFile;
  mySnapshotFile = snapshotFile;
  myPatternsFile = patternsFile;
  myReportFile = reportFile;
}
 
开发者ID:JetBrains,项目名称:teamcity-dottrace,代码行数:13,代码来源:Context.java

示例6: DotMemoryUnitContext

import jetbrains.buildServer.dotNet.buildRunner.agent.CommandLineSetup; //导入依赖的package包/类
public DotMemoryUnitContext(
  @NotNull final CommandLineSetup baseSetup,
  @NotNull final File snapshotDirectory,
  @NotNull final File outputFile) {
  myBaseSetup = baseSetup;
  mySnapshotDirectory = snapshotDirectory;
  myOutputFile = outputFile;
}
 
开发者ID:JetBrains,项目名称:teamcity-dotmemory,代码行数:9,代码来源:DotMemoryUnitContext.java

示例7: runProcess

import jetbrains.buildServer.dotNet.buildRunner.agent.CommandLineSetup; //导入依赖的package包/类
@Nullable
public ExecResult runProcess(@NotNull final CommandLineSetup commandLineSetup, final int executionTimeoutSeconds) throws ExecutionException {
  final GeneralCommandLine cmd = new GeneralCommandLine();
  cmd.setExePath(commandLineSetup.getToolPath());
  for (CommandLineArgument arg: commandLineSetup.getArgs()) {
    cmd.addParameter(arg.getValue());
  }

  try {
    LOG.info("Exec: " + cmd.getCommandLineString());
    final jetbrains.buildServer.CommandLineExecutor executor = new jetbrains.buildServer.CommandLineExecutor(cmd);
    final ExecResult result = executor.runProcess(executionTimeoutSeconds);
    if(LOG.isDebugEnabled()) {
      StringBuilder resultStr = new StringBuilder();
      if (result != null) {
        resultStr.append("exit code: ");
        resultStr.append(result.getExitCode());
        final String[] outLines = result.getOutLines();
        if (outLines != null) {
          resultStr.append("out: ");
          for (String line : outLines) {
            if (!StringUtil.isEmpty(line)) {
              resultStr.append(line);
            }

            resultStr.append(LINE_SEPARATOR);
          }
        }
      } else {
        resultStr.append("has no result");
      }

      LOG.debug("Result: " + resultStr);
    }

    return result;
  }
  catch (RuntimeException ex) {
    throw new ExecutionException(ex.getMessage());
  }
}
 
开发者ID:JetBrains,项目名称:teamcity-runas-plugin,代码行数:42,代码来源:CommandLineExecutorImpl.java

示例8: runProcess

import jetbrains.buildServer.dotNet.buildRunner.agent.CommandLineSetup; //导入依赖的package包/类
@Nullable
ExecResult runProcess(@NotNull final CommandLineSetup commandLineSetup, final int executionTimeoutSeconds) throws ExecutionException;
 
开发者ID:JetBrains,项目名称:teamcity-runas-plugin,代码行数:3,代码来源:CommandLineExecutor.java

示例9: LogRunAs

import jetbrains.buildServer.dotNet.buildRunner.agent.CommandLineSetup; //导入依赖的package包/类
void LogRunAs(
@NotNull final UserCredentials userCredentials,
@NotNull final CommandLineSetup baseCommandLineSetup,
@NotNull final CommandLineSetup runAsCommandLineSetup);
 
开发者ID:JetBrains,项目名称:teamcity-runas-plugin,代码行数:5,代码来源:RunAsLogger.java

示例10: shouldSetPermissionsForLinux

import jetbrains.buildServer.dotNet.buildRunner.agent.CommandLineSetup; //导入依赖的package包/类
@Test(dataProvider = "getSetPermissionsForLinuxCases")
public void shouldSetPermissionsForLinux(
  @NotNull final AccessControlList accessControlList,
  final int exitCode,
  @Nullable final Exception error,
  @Nullable final List<CommandLineSetup> expectedCommandLineSetups,
  @Nullable final List<Object> expectedResult) throws ExecutionException {
  // Given
  final FileAccessService instance = createInstance();
  final ArrayList<CommandLineSetup> actualCommandLineSetups = new ArrayList<CommandLineSetup>();

  myCtx.checking(new Expectations() {{
    allowing(myCommandLineExecutor).runProcess(with(any(CommandLineSetup.class)), with(any(int.class)));
    if(error != null) {
      will(throwException(error));
    }
    else {
      will(new CustomAction("runProcess") {
        @Override
        public Object invoke(final Invocation invocation) throws Throwable {
          actualCommandLineSetups.add((CommandLineSetup)invocation.getParameter(0));
          final ExecResult execResult = new ExecResult();
          execResult.setExitCode(exitCode);
          return execResult;
        }
      });
    }
  }});

  // When
  final Iterable<Result<AccessControlEntry, Boolean>> result = instance.setAccess(accessControlList);
  final List<Object> actualResult = CollectionsUtil.convertCollection(
    Lists.newArrayList(result), new Converter<Object, Result<AccessControlEntry, Boolean>>() {
      @Override
      public Object createFrom(@NotNull final Result<AccessControlEntry, Boolean> aceResult) {
        if(aceResult.isSuccessful()) {
          return aceResult.getValue();
        }

        return null;
      }
    });

  // Then
  myCtx.assertIsSatisfied();
  then(actualCommandLineSetups).isEqualTo(expectedCommandLineSetups);
  then(actualResult).isEqualTo(expectedResult);
}
 
开发者ID:JetBrains,项目名称:teamcity-runas-plugin,代码行数:49,代码来源:LinuxFileAccessServiceTest.java

示例11: shouldSetPermissionsForWindows

import jetbrains.buildServer.dotNet.buildRunner.agent.CommandLineSetup; //导入依赖的package包/类
@Test(dataProvider = "getSetPermissionsForWindowsCases")
public void shouldSetPermissionsForWindows(
  @NotNull final AccessControlList accessControlList,
  final int exitCode,
  @Nullable final Exception error,
  @Nullable final List<CommandLineSetup> expectedCommandLineSetups,
  @Nullable final List<Object> expectedResult) throws ExecutionException {
  // Given
  final FileAccessService instance = createInstance();
  final ArrayList<CommandLineSetup> actualCommandLineSetups = new ArrayList<CommandLineSetup>();

  myCtx.checking(new Expectations() {{
    allowing(myCommandLineExecutor).runProcess(with(any(CommandLineSetup.class)), with(any(int.class)));
    if(error != null) {
      will(throwException(error));
    }
    else {
      will(new CustomAction("runProcess") {
        @Override
        public Object invoke(final Invocation invocation) throws Throwable {
          actualCommandLineSetups.add((CommandLineSetup)invocation.getParameter(0));
          final ExecResult execResult = new ExecResult();
          execResult.setExitCode(exitCode);
          return execResult;
        }
      });
    }
  }});

  final Iterable<Result<AccessControlEntry, Boolean>> result = instance.setAccess(accessControlList);
  final List<Object> actualResult = CollectionsUtil.convertCollection(
    Lists.newArrayList(result), new Converter<Object, Result<AccessControlEntry, Boolean>>() {
      @Override
      public Object createFrom(@NotNull final Result<AccessControlEntry, Boolean> aceResult) {
        if(aceResult.isSuccessful()) {
          return aceResult.getValue();
        }

        return null;
      }
    });

  // Then
  myCtx.assertIsSatisfied();
  then(actualCommandLineSetups).isEqualTo(expectedCommandLineSetups);
  then(actualResult).isEqualTo(expectedResult);
}
 
开发者ID:JetBrains,项目名称:teamcity-runas-plugin,代码行数:48,代码来源:WindowsFileAccessServiceTest.java

示例12: getBaseSetup

import jetbrains.buildServer.dotNet.buildRunner.agent.CommandLineSetup; //导入依赖的package包/类
@NotNull
public CommandLineSetup getBaseSetup() {
  return myBaseSetup;
}
 
开发者ID:JetBrains,项目名称:teamcity-dottrace,代码行数:5,代码来源:Context.java


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