本文整理汇总了Java中org.zeroturnaround.exec.ProcessResult类的典型用法代码示例。如果您正苦于以下问题:Java ProcessResult类的具体用法?Java ProcessResult怎么用?Java ProcessResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProcessResult类属于org.zeroturnaround.exec包,在下文中一共展示了ProcessResult类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: shouldRunImageExport
import org.zeroturnaround.exec.ProcessResult; //导入依赖的package包/类
@Test
public void shouldRunImageExport() throws Exception {
final ProcessResult processResult = new ProcessResult(0, new ProcessOutput(new byte[]{}));
when(processExecutor.command(
ImmutableList.of("rkt", "--insecure-options=image", "image", "export", "--overwrite=true",
"sha512-887890e697d9", "output.aci")))
.thenReturn(processExecutor);
when(processExecutor.executeNoTimeout()).thenReturn(processResult);
final io.honnix.rkt.launcher.command.image.Export export =
Export.builder()
.options(io.honnix.rkt.launcher.options.image.ExportOptions.builder()
.overwrite(true)
.build())
.addArg("sha512-887890e697d9")
.addArg("output.aci")
.build();
final Output exportOutput = rktLauncher.run(export);
assertSame(Output.NULL, exportOutput);
}
开发者ID:honnix,项目名称:rkt-launcher,代码行数:20,代码来源:SystemTest.java
示例2: shouldRunImageExtract
import org.zeroturnaround.exec.ProcessResult; //导入依赖的package包/类
@Test
public void shouldRunImageExtract() throws Exception {
final ProcessResult processResult = new ProcessResult(0, new ProcessOutput(new byte[]{}));
when(processExecutor.command(
ImmutableList.of("rkt", "--insecure-options=image", "image", "extract", "--overwrite=true",
"sha512-887890e697d9", "/data")))
.thenReturn(processExecutor);
when(processExecutor.executeNoTimeout()).thenReturn(processResult);
final Extract extract =
Extract.builder()
.options(ExtractOptions.builder()
.overwrite(true)
.build())
.addArg("sha512-887890e697d9")
.addArg("/data")
.build();
final Output extractOutput = rktLauncher.run(extract);
assertSame(Output.NULL, extractOutput);
}
开发者ID:honnix,项目名称:rkt-launcher,代码行数:20,代码来源:SystemTest.java
示例3: shouldRunImageRm
import org.zeroturnaround.exec.ProcessResult; //导入依赖的package包/类
@Test
public void shouldRunImageRm() throws Exception {
final String
output =
"successfully removed aci for image: \"sha512-e39d4089a224718c41e6bef4c1ac692a6c1832c8c69cf28123e1f205a9355444\"\n"
+ "successfully removed aci for image: \"sha512-0648aa44a37a8200147d41d1a9eff0757d0ac113a22411f27e4e03cbd1e84d0d\"\n"
+ "rm: 2 image(s) successfully removed";
final ProcessResult processResult = new ProcessResult(0, new ProcessOutput(output.getBytes()));
when(processExecutor.command(
ImmutableList.of("rkt", "--insecure-options=image", "image", "rm",
"sha512-e39d4089a224", "sha512-0648aa44a37a")))
.thenReturn(processExecutor);
when(processExecutor.executeNoTimeout()).thenReturn(processResult);
final io.honnix.rkt.launcher.command.image.Rm
rm =
io.honnix.rkt.launcher.command.image.Rm.builder()
.options(RmOptions.builder().build())
.args(ImmutableList.of("sha512-e39d4089a224", "sha512-0648aa44a37a"))
.build();
final RmOutput rmOutput = rktLauncher.run(rm);
assertEquals(2, rmOutput.removed().size());
}
开发者ID:honnix,项目名称:rkt-launcher,代码行数:23,代码来源:SystemTest.java
示例4: shouldRunCatMinifest
import org.zeroturnaround.exec.ProcessResult; //导入依赖的package包/类
@Test
public void shouldRunCatMinifest() throws Exception {
//language=JSON
final String json = "{\n"
+ " \"acVersion\": \"1.25.0\",\n"
+ " \"acKind\": \"PodManifest\",\n"
+ " \"apps\": [],\n"
+ " \"volumes\": [],\n"
+ " \"isolators\": [],\n"
+ " \"annotations\": [],\n"
+ " \"ports\": []\n"
+ "}\n";
final ProcessResult processResult = new ProcessResult(0, new ProcessOutput(json.getBytes()));
when(processExecutor.command(
ImmutableList.of("rkt", "--insecure-options=image", "cat-manifest", "1d284607")))
.thenReturn(processExecutor);
when(processExecutor.executeNoTimeout()).thenReturn(processResult);
final io.honnix.rkt.launcher.command.CatManifest
catManifest = io.honnix.rkt.launcher.command.CatManifest.builder()
.args(ImmutableList.of("1d284607"))
.build();
final io.honnix.rkt.launcher.output.CatManifestOutput
catManifestOutput = rktLauncher.run(catManifest);
assertEquals(ACKind.POD_MANIFEST, catManifestOutput.podManifest().acKind());
}
开发者ID:honnix,项目名称:rkt-launcher,代码行数:26,代码来源:SystemTest.java
示例5: shouldRunExport
import org.zeroturnaround.exec.ProcessResult; //导入依赖的package包/类
@Test
public void shouldRunExport() throws Exception {
final ProcessResult processResult = new ProcessResult(0, new ProcessOutput(new byte[]{}));
when(processExecutor.command(
ImmutableList.of("rkt", "--insecure-options=image", "export", "--app=nginx", "1d284607",
"output.aci")))
.thenReturn(processExecutor);
when(processExecutor.executeNoTimeout()).thenReturn(processResult);
final io.honnix.rkt.launcher.command.Export export = io.honnix.rkt.launcher.command.Export.builder()
.options(ExportOptions.builder()
.app("nginx")
.build())
.addArg("1d284607")
.addArg("output.aci")
.build();
final Output exportOutput = rktLauncher.run(export);
assertSame(Output.NULL, exportOutput);
}
开发者ID:honnix,项目名称:rkt-launcher,代码行数:19,代码来源:SystemTest.java
示例6: shouldRunFetch
import org.zeroturnaround.exec.ProcessResult; //导入依赖的package包/类
@Test
public void shouldRunFetch() throws Exception {
final String output =
"image: keys already exist for prefix \"coreos.com/etcd\", not fetching again\n"
+ "Downloading signature: [=======================================] 819 B/819 B\n"
+ "Downloading ACI: [=============================================] 3.7 MB/3.7 MB\n"
+ "image: signature verified:\n"
+ " CoreOS ACI Builder <[email protected]>\n"
+ "sha512-fa1cb92dc276b0f9bedf87981e61ecde93cc16432d2441f23aa006a42bb873df";
final ProcessResult processResult = new ProcessResult(0, new ProcessOutput(output.getBytes()));
when(processExecutor.command(
ImmutableList.of("rkt", "--insecure-options=image", "fetch", "--full=true",
"--pull-policy=new", "coreos.com/etcd:v2.0.0")))
.thenReturn(processExecutor);
when(processExecutor.executeNoTimeout()).thenReturn(processResult);
final Fetch fetch = Fetch.builder()
.options(FetchOptions.builder()
.full(true)
.pullPolicy(PullPolicy.NEW)
.build())
.addArg("coreos.com/etcd:v2.0.0")
.build();
final FetchOutput fetchOutput = rktLauncher.run(fetch);
assertEquals("sha512-fa1cb92dc276b0f9bedf87981e61ecde93cc16432d2441f23aa006a42bb873df",
fetchOutput.hash());
}
开发者ID:honnix,项目名称:rkt-launcher,代码行数:27,代码来源:SystemTest.java
示例7: shouldRunGc
import org.zeroturnaround.exec.ProcessResult; //导入依赖的package包/类
@Test
public void shouldRunGc() throws Exception {
final String output = "gc: moving pod \"6806ba33-0bfa-4389-84ba-3abba3dba97b\" to garbage\n"
+ "gc: moving pod \"7806ba33-0bfa-4389-84ba-3abba3dba97b\" to garbage\n"
+ "gc: pod \"6806ba33-0bfa-4389-84ba-3abba3dba97b\" not removed: still within grace period (5m10s)\n"
+ "gc: pod \"7806ba33-0bfa-4389-84ba-3abba3dba97b\" not removed: still within grace period (5m10s)";
final ProcessResult processResult = new ProcessResult(0, new ProcessOutput(output.getBytes()));
when(processExecutor.command(
ImmutableList.of("rkt", "--insecure-options=image", "gc", "--mark-only=true")))
.thenReturn(processExecutor);
when(processExecutor.executeNoTimeout()).thenReturn(processResult);
final io.honnix.rkt.launcher.command.Gc gc = io.honnix.rkt.launcher.command.Gc.builder()
.options(GcOptions.builder()
.markOnly(true)
.build())
.build();
final io.honnix.rkt.launcher.output.GcOutput gcOutput = rktLauncher.run(gc);
assertEquals(2, gcOutput.marked().size());
}
开发者ID:honnix,项目名称:rkt-launcher,代码行数:20,代码来源:SystemTest.java
示例8: shouldRunPrepare
import org.zeroturnaround.exec.ProcessResult; //导入依赖的package包/类
@Test
public void shouldRunPrepare() throws Exception {
final String output = "6c8158de-e3f0-46af-9100-88591c17d302";
final ProcessResult processResult = new ProcessResult(0, new ProcessOutput(output.getBytes()));
when(processExecutor.command(
ImmutableList.of("rkt", "--insecure-options=image", "prepare",
"--quiet=true",
"docker://nginx",
"---",
"docker://mysql",
"---")))
.thenReturn(processExecutor);
when(processExecutor.executeNoTimeout()).thenReturn(processResult);
final Prepare prepare = Prepare.builder()
.options(PrepareOptions.builder()
.addImagesOption(PerImageOptions.builder().image("docker://nginx").build())
.addImagesOption(PerImageOptions.builder().image("docker://mysql").build())
.build())
.build();
final PrepareOutput prepareOutput = rktLauncher.run(prepare);
assertEquals("6c8158de-e3f0-46af-9100-88591c17d302", prepareOutput.prepared());
}
开发者ID:honnix,项目名称:rkt-launcher,代码行数:23,代码来源:SystemTest.java
示例9: shouldRunRm
import org.zeroturnaround.exec.ProcessResult; //导入依赖的package包/类
@Test
public void shouldRunRm() throws Exception {
final String output = "\"1e4bb8f2\"\n"
+ "\"9c1c7e0b\"";
final ProcessResult processResult = new ProcessResult(0, new ProcessOutput(output.getBytes()));
when(processExecutor.command(
ImmutableList.of("rkt", "--insecure-options=image", "rm", "1e4bb8f2", "9c1c7e0b")))
.thenReturn(processExecutor);
when(processExecutor.executeNoTimeout()).thenReturn(processResult);
final Rm rm = Rm.builder()
.options(io.honnix.rkt.launcher.options.RmOptions.builder().build())
.args(ImmutableList.of("1e4bb8f2", "9c1c7e0b"))
.build();
final io.honnix.rkt.launcher.output.RmOutput rmOutput = rktLauncher.run(rm);
assertEquals(2, rmOutput.removed().size());
}
开发者ID:honnix,项目名称:rkt-launcher,代码行数:17,代码来源:SystemTest.java
示例10: shouldRunRun
import org.zeroturnaround.exec.ProcessResult; //导入依赖的package包/类
@Test
public void shouldRunRun() throws Exception {
final String output = "Running as unit run-r69ece8681fbc4e7787e639a78b141599.service.";
final ProcessResult processResult = new ProcessResult(0, new ProcessOutput(output.getBytes()));
when(processExecutor.command(
ImmutableList.of("rkt", "--insecure-options=image", "run", "docker://nginx", "---")))
.thenReturn(processExecutor);
when(processExecutor.executeNoTimeout()).thenReturn(processResult);
final Run run = Run.builder()
.options(RunOptions.builder()
.addImagesOption(PerImageOptions.builder().image("docker://nginx").build())
.build())
.build();
final RunOutput runOutput = rktLauncher.run(run);
assertEquals("NA", runOutput.service());
}
开发者ID:honnix,项目名称:rkt-launcher,代码行数:17,代码来源:SystemTest.java
示例11: shouldRunRunAsDaemon
import org.zeroturnaround.exec.ProcessResult; //导入依赖的package包/类
@Test
public void shouldRunRunAsDaemon() throws Exception {
final String output = "Running as unit run-r69ece8681fbc4e7787e639a78b141599.service.";
final ProcessResult processResult = new ProcessResult(0, new ProcessOutput(output.getBytes()));
when(processExecutor.command(
ImmutableList.of("systemd-run", "--slice=machine", "rkt", "--insecure-options=image", "run",
"docker://nginx", "---")))
.thenReturn(processExecutor);
when(processExecutor.executeNoTimeout()).thenReturn(processResult);
final Run run = Run.builder()
.options(RunOptions.builder()
.addImagesOption(PerImageOptions.builder().image("docker://nginx").build())
.build())
.daemonize(true)
.build();
final RunOutput runOutput = rktLauncher.run(run);
assertEquals("run-r69ece8681fbc4e7787e639a78b141599.service", runOutput.service());
}
开发者ID:honnix,项目名称:rkt-launcher,代码行数:19,代码来源:SystemTest.java
示例12: shouldRunRunPrepared
import org.zeroturnaround.exec.ProcessResult; //导入依赖的package包/类
@Test
public void shouldRunRunPrepared() throws Exception {
final String output = "Running as unit run-r69ece8681fbc4e7787e639a78b141599.service.";
final ProcessResult processResult = new ProcessResult(0, new ProcessOutput(output.getBytes()));
when(processExecutor.command(
ImmutableList.of("rkt", "--insecure-options=image", "run-prepared", "--net=default",
"2a98c7c0")))
.thenReturn(processExecutor);
when(processExecutor.executeNoTimeout()).thenReturn(processResult);
final RunPrepared runPrepared = RunPrepared.builder()
.options(RunPreparedOptions.builder()
.net(ImmutableList.of(Network.DEFAULT))
.build())
.addArg("2a98c7c0")
.build();
final RunOutput runOutput = rktLauncher.run(runPrepared);
assertEquals("NA", runOutput.service());
}
开发者ID:honnix,项目名称:rkt-launcher,代码行数:19,代码来源:SystemTest.java
示例13: shouldRunRunPreparedAsDaemon
import org.zeroturnaround.exec.ProcessResult; //导入依赖的package包/类
@Test
public void shouldRunRunPreparedAsDaemon() throws Exception {
final String output = "Running as unit run-r69ece8681fbc4e7787e639a78b141599.service.";
final ProcessResult processResult = new ProcessResult(0, new ProcessOutput(output.getBytes()));
when(processExecutor.command(
ImmutableList.of("systemd-run", "--slice=machine", "rkt", "--insecure-options=image",
"run-prepared", "--net=default", "2a98c7c0")))
.thenReturn(processExecutor);
when(processExecutor.executeNoTimeout()).thenReturn(processResult);
final RunPrepared runPrepared = RunPrepared.builder()
.options(RunPreparedOptions.builder()
.net(ImmutableList.of(Network.DEFAULT))
.build())
.addArg("2a98c7c0")
.daemonize(true)
.build();
final RunOutput runOutput = rktLauncher.run(runPrepared);
assertEquals("run-r69ece8681fbc4e7787e639a78b141599.service", runOutput.service());
}
开发者ID:honnix,项目名称:rkt-launcher,代码行数:20,代码来源:SystemTest.java
示例14: shouldRunStop
import org.zeroturnaround.exec.ProcessResult; //导入依赖的package包/类
@Test
public void shouldRunStop() throws Exception {
final String output = "\"1e4bb8f2\"\n"
+ "\"9c1c7e0b\"";
final ProcessResult processResult = new ProcessResult(0, new ProcessOutput(output.getBytes()));
when(processExecutor.command(
ImmutableList.of("rkt", "--insecure-options=image", "stop", "--force=true",
"1e4bb8f2", "9c1c7e0b")))
.thenReturn(processExecutor);
when(processExecutor.executeNoTimeout()).thenReturn(processResult);
final Stop stop = Stop.builder()
.options(StopOptions.builder()
.force(true)
.build())
.args(ImmutableList.of("1e4bb8f2", "9c1c7e0b"))
.build();
final StopOutput stopOutput = rktLauncher.run(stop);
assertEquals(2, stopOutput.stopped().size());
}
开发者ID:honnix,项目名称:rkt-launcher,代码行数:20,代码来源:SystemTest.java
示例15: shouldRunVersion
import org.zeroturnaround.exec.ProcessResult; //导入依赖的package包/类
@Test
public void shouldRunVersion() throws Exception {
final String output = "rkt Version: 1.25.0\n"
+ "appc Version: 0.8.10\n"
+ "Go Version: go1.7.4\n"
+ "Go OS/Arch: linux/amd64\n"
+ "Features: -TPM +SDJOURNAL";
final ProcessResult processResult = new ProcessResult(0, new ProcessOutput(output.getBytes()));
when(processExecutor.command(
ImmutableList.of("rkt", "--insecure-options=image", "version")))
.thenReturn(processExecutor);
when(processExecutor.executeNoTimeout()).thenReturn(processResult);
final Version version = Version.builder().build();
final VersionOutput versionOutput = rktLauncher.run(version);
assertEquals("1.25.0", versionOutput.rktVersion());
assertEquals("0.8.10", versionOutput.appcVersion());
assertEquals("go1.7.4", versionOutput.goVersion());
assertEquals("linux/amd64", versionOutput.goOSArch());
assertEquals(ImmutableList.of("-TPM", "+SDJOURNAL"), versionOutput.features());
}
开发者ID:honnix,项目名称:rkt-launcher,代码行数:21,代码来源:SystemTest.java
示例16: login2
import org.zeroturnaround.exec.ProcessResult; //导入依赖的package包/类
@Ignore
public void login2() throws Exception {
List<String> commands = new ArrayList<>();
commands.add("ssh");
// commands.add("-t");
// commands.add ("-o StrictHostKeyChecking=no");
commands.add("[email protected]");
ByteArrayOutputStream out = new ByteArrayOutputStream();
ProcessResult result1 = new ProcessExecutor(commands).readOutput(true).redirectOutput(out)
.redirectInput(new ReaderInputStream(new StringReader("@n$ible.\\r\\n"))).execute();
System.out.println(result1.outputString());
// out.write("@n$ible.".getBytes());
result1.getOutput().getLines().forEach(i -> System.out.println(i));
// ProcessResult result2=new ProcessExecutor("ls -lrt").readOutput(true).execute();
}
开发者ID:januslabs,项目名称:ansible-http,代码行数:17,代码来源:ProcessBuilderTests.java
示例17: doesNeedOneMoreAttempt
import org.zeroturnaround.exec.ProcessResult; //导入依赖的package包/类
@Override
protected boolean doesNeedOneMoreAttempt(@Nonnull final ProcessResult processResult, @Nonnull final String consoleOut, @Nonnull final String consoleErr) throws IOException, MojoExecutionException {
boolean result = false;
if (processResult.getExitValue() != 0) {
final Matcher matcher = PATTERN_NO_SUBMODULE_MAPPING_FOUND_IN_GIT.matcher(consoleErr);
if (matcher.find()) {
final List<String> packagesWithDetectedGitCacheErrors = extractProblemPackagesFromErrorLog(consoleErr);
if (!packagesWithDetectedGitCacheErrors.isEmpty()) {
if (this.autofixGitCache) {
getLog().warn("Trying to fix the detected git cache errors automatically..");
result = tryToFixGitCacheErrorsForPackages(packagesWithDetectedGitCacheErrors);
} else {
for (final String s : packagesWithDetectedGitCacheErrors) {
getLog().error(String.format("Detected Git cache error for package '%s', can be fixed with 'git rm -r --cached .'", s));
}
}
}
}
}
return result;
}
开发者ID:raydac,项目名称:mvn-golang,代码行数:27,代码来源:GolangGetMojo.java
示例18: confirmShutdown
import org.zeroturnaround.exec.ProcessResult; //导入依赖的package包/类
private void confirmShutdown() throws ShutDownException {
int exitValue;
try {
ProcessResult rabbitMqProcessResult = rabbitMqProcess.get(timeoutDuration, TimeUnit.MILLISECONDS);
exitValue = rabbitMqProcessResult.getExitValue();
} catch (InterruptedException | ExecutionException | TimeoutException e) {
throw new ShutDownException("Error while waiting " + timeoutDuration + " " + timeoutUnit + "for "
+ "RabbitMQ Server to shut down", e);
}
if (exitValue == 0) {
LOGGER.debug("RabbitMQ Server stopped successfully.");
} else {
LOGGER.warn("RabbitMQ Server stopped with exit value: " + exitValue);
}
}
开发者ID:AlejandroRivera,项目名称:embedded-rabbitmq,代码行数:17,代码来源:ShutdownHelper.java
示例19: testUnexpectedExitCode
import org.zeroturnaround.exec.ProcessResult; //导入依赖的package包/类
@Test
public void testUnexpectedExitCode() throws Exception {
futureResult = mock(Future.class);
result = mock(ProcessResult.class);
when(startedProcess.getFuture())
.thenReturn(futureResult);
when(futureResult.get(anyLong(), any(TimeUnit.class)))
.thenReturn(result);
int exitCode = new Random().nextInt(10) + 1;
when(result.getExitValue())
.thenReturn(exitCode);
expectedException.expect(instanceOf(RabbitMqCommandException.class));
expectedException.expectMessage("exit code: " + exitCode);
rabbitMqPlugins.groupedList();
}
开发者ID:AlejandroRivera,项目名称:embedded-rabbitmq,代码行数:18,代码来源:RabbitMqPluginsTest.java
示例20: testExecutionError
import org.zeroturnaround.exec.ProcessResult; //导入依赖的package包/类
@Test
public void testExecutionError() throws Exception {
futureResult = mock(Future.class);
result = mock(ProcessResult.class);
when(startedProcess.getFuture())
.thenReturn(futureResult);
TimeoutException timeoutException = new TimeoutException("Fake timeout");
when(futureResult.get(anyLong(), any(TimeUnit.class)))
.thenThrow(timeoutException);
expectedException.expect(instanceOf(RabbitMqCommandException.class));
expectedException.expectMessage("rabbitmq-plugins list");
expectedException.expectCause(sameInstance(timeoutException));
rabbitMqPlugins.groupedList();
}
开发者ID:AlejandroRivera,项目名称:embedded-rabbitmq,代码行数:17,代码来源:RabbitMqPluginsTest.java
注:本文中的org.zeroturnaround.exec.ProcessResult类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论