當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。