本文整理汇总了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);
}
示例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);
}
示例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;
}
示例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);
}
}
示例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;
}
示例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;
}
示例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());
}
}
示例8: runProcess
import jetbrains.buildServer.dotNet.buildRunner.agent.CommandLineSetup; //导入依赖的package包/类
@Nullable
ExecResult runProcess(@NotNull final CommandLineSetup commandLineSetup, final int executionTimeoutSeconds) throws ExecutionException;
示例9: LogRunAs
import jetbrains.buildServer.dotNet.buildRunner.agent.CommandLineSetup; //导入依赖的package包/类
void LogRunAs(
@NotNull final UserCredentials userCredentials,
@NotNull final CommandLineSetup baseCommandLineSetup,
@NotNull final CommandLineSetup runAsCommandLineSetup);
示例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);
}
示例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);
}
示例12: getBaseSetup
import jetbrains.buildServer.dotNet.buildRunner.agent.CommandLineSetup; //导入依赖的package包/类
@NotNull
public CommandLineSetup getBaseSetup() {
return myBaseSetup;
}