本文整理汇总了Java中org.zeroturnaround.exec.listener.ProcessListener类的典型用法代码示例。如果您正苦于以下问题:Java ProcessListener类的具体用法?Java ProcessListener怎么用?Java ProcessListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProcessListener类属于org.zeroturnaround.exec.listener包,在下文中一共展示了ProcessListener类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: processEventsAreLogged
import org.zeroturnaround.exec.listener.ProcessListener; //导入依赖的package包/类
@Test
public void processEventsAreLogged() throws Exception {
rabbitMqCommand = new RabbitMqCommand(configBuilder.build(), command);
rabbitMqCommand.call();
ArgumentCaptor<ProcessListener> listenerCaptor = ArgumentCaptor.forClass(ProcessListener.class);
verify(processExecutor, atLeastOnce()).addListener(listenerCaptor.capture());
List<ProcessListener> listeners = listenerCaptor.getAllValues();
boolean found = false;
for (ProcessListener listener : listeners) {
if (listener instanceof LoggingProcessListener){
found = true;
break;
}
}
assertThat("Expected Listener was not found!", found, is(true));
}
开发者ID:AlejandroRivera,项目名称:embedded-rabbitmq,代码行数:19,代码来源:RabbitMqCommandTest.java
示例2: WaitForProcess
import org.zeroturnaround.exec.listener.ProcessListener; //导入依赖的package包/类
public WaitForProcess(Process process, ProcessAttributes attributes, ProcessStopper stopper, ProcessCloser closer, ByteArrayOutputStream out, ProcessListener listener, MessageLogger messageLogger) {
this.process = process;
this.attributes = attributes;
this.stopper = stopper;
this.closer = closer;
this.out = out;
this.listener = listener;
this.messageLogger = messageLogger;
}
开发者ID:zacharee,项目名称:RCTDRemoverforLG,代码行数:10,代码来源:WaitForProcess.java
示例3: processEventsCanBeListenedTo
import org.zeroturnaround.exec.listener.ProcessListener; //导入依赖的package包/类
@Test
public void processEventsCanBeListenedTo() throws Exception {
ProcessListener fakeListener = Mockito.mock(ProcessListener.class);
rabbitMqCommand = new RabbitMqCommand(configBuilder.build(), command);
rabbitMqCommand.listenToEvents(fakeListener);
rabbitMqCommand.call();
ArgumentCaptor<ProcessListener> listenerCaptor = ArgumentCaptor.forClass(ProcessListener.class);
verify(processExecutor, atLeastOnce()).addListener(listenerCaptor.capture());
List<ProcessListener> listeners = listenerCaptor.getAllValues();
assertThat(listeners, hasItem(equalTo(fakeListener)));
}
开发者ID:AlejandroRivera,项目名称:embedded-rabbitmq,代码行数:15,代码来源:RabbitMqCommandTest.java
示例4: buildProcessExecutor
import org.zeroturnaround.exec.listener.ProcessListener; //导入依赖的package包/类
@SuppressWarnings("all")
private ProcessExecutor buildProcessExecutor() {
List<String> commandLine = new ArrayList<>();
String javaHome = System.getProperty("java.home");
String javaBin = javaHome + File.separator + "bin" + File.separator + "java";
commandLine.add(javaBin);
if (jpdaPort > 0) {
LOG.info("Listening for jpda connection at " + jpdaPort);
commandLine.add("-Xdebug");
commandLine.add(String.format("-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=%s", jpdaPort));
}
if (StringUtils.isNotBlank(jvmArgs)){
Arrays.stream(jvmArgs.split(" "))
.filter(arg->arg.length()>0)
.forEach(arg->commandLine.add(arg));
}
commandLine.add("-Dapplication.mode=dev");
commandLine.add("-cp");
commandLine.add(classpath);
commandLine.add(mainClass);
return new ProcessExecutor(commandLine)
.directory(mavenBaseDir)
.destroyOnExit()
.addListener(new ProcessListener() {
@Override
public void afterStop(Process process) {
if (!restarting.get()) {
LOG.error("JVM process terminated (next file change will attempt to restart it)");
}
}
})
.redirectErrorStream(true)
.redirectOutput(this.outputStream);
}
开发者ID:svenkubiak,项目名称:mangooio,代码行数:37,代码来源:Runner.java
示例5: listeningToEventsWith
import org.zeroturnaround.exec.listener.ProcessListener; //导入依赖的package包/类
/**
* Use this method to register a listener to be notified of process events, like start, stop, etc.
*/
public RabbitMqServer listeningToEventsWith(ProcessListener listener) {
this.listener = listener;
return this;
}
开发者ID:AlejandroRivera,项目名称:embedded-rabbitmq,代码行数:8,代码来源:RabbitMqServer.java
示例6: listenToEvents
import org.zeroturnaround.exec.listener.ProcessListener; //导入依赖的package包/类
/**
* Registers a unique listener to be notified of process events, such as start and finish.
*/
public RabbitMqCommand listenToEvents(ProcessListener listener) {
this.eventsListener = listener;
return this;
}
开发者ID:AlejandroRivera,项目名称:embedded-rabbitmq,代码行数:8,代码来源:RabbitMqCommand.java
示例7: addListener
import org.zeroturnaround.exec.listener.ProcessListener; //导入依赖的package包/类
/**
* Register new process event handler.
* @param listener process event handler to be added.
*
* @return This process executor.
*/
public ProcessExecutor addListener(ProcessListener listener) {
listeners.add(listener);
return this;
}
开发者ID:zacharee,项目名称:RCTDRemoverforLG,代码行数:11,代码来源:ProcessExecutor.java
示例8: removeListener
import org.zeroturnaround.exec.listener.ProcessListener; //导入依赖的package包/类
/**
* Unregister existing process event handler.
* @param listener process event handler to be removed.
*
* @return This process executor.
*/
public ProcessExecutor removeListener(ProcessListener listener) {
listeners.remove(listener);
return this;
}
开发者ID:zacharee,项目名称:RCTDRemoverforLG,代码行数:11,代码来源:ProcessExecutor.java
示例9: removeListeners
import org.zeroturnaround.exec.listener.ProcessListener; //导入依赖的package包/类
/**
* Unregister existing process event handlers of given type or its sub-types.
* @param listenerType process event handler type.
*
* @return This process executor.
*/
public ProcessExecutor removeListeners(Class<? extends ProcessListener> listenerType) {
listeners.removeAll(listenerType);
return this;
}
开发者ID:zacharee,项目名称:RCTDRemoverforLG,代码行数:11,代码来源:ProcessExecutor.java
注:本文中的org.zeroturnaround.exec.listener.ProcessListener类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论