本文整理汇总了Java中org.apache.sshd.server.ExitCallback类的典型用法代码示例。如果您正苦于以下问题:Java ExitCallback类的具体用法?Java ExitCallback怎么用?Java ExitCallback使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ExitCallback类属于org.apache.sshd.server包,在下文中一共展示了ExitCallback类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: starts
import org.apache.sshd.server.ExitCallback; //导入依赖的package包/类
/**
* MkCommand can start.
* @throws Exception If something goes wrong.
*/
@Test
public void starts() throws Exception {
final ByteArrayOutputStream output = new ByteArrayOutputStream();
final String text = "test mkcommand";
final MkCommand command = new MkCommand(text);
command.setOutputStream(output);
command.setExitCallback(Mockito.mock(ExitCallback.class));
command.start(Mockito.mock(Environment.class));
MatcherAssert.assertThat(
output.toString(), Matchers.equalTo(text)
);
}
示例2: create
import org.apache.sshd.server.ExitCallback; //导入依赖的package包/类
@Override
public Command create() {
return new Command() {
@Override
public void setInputStream(InputStream in) {
SshEchoCommandFactory.this.in = in;
}
@Override
public void setOutputStream(OutputStream out) {
SshEchoCommandFactory.this.out = out;
}
@Override
public void setErrorStream(OutputStream err) {
}
@Override
public void setExitCallback(ExitCallback callback) {
}
@Override
public void start(Environment env) throws IOException {
executor.scheduleWithFixedDelay(
SshEchoCommandFactory.this,
0,
100,
TimeUnit.MILLISECONDS);
}
@Override
public void destroy() {
executor.shutdownNow();
}
};
}
示例3: getFailureScpCommand
import org.apache.sshd.server.ExitCallback; //导入依赖的package包/类
@SuppressWarnings({"boxing", "resource"})
NewScpCommand getFailureScpCommand(int returnVal, ExitCallback callback) throws IOException {
String filePath = "/mep-testing-gradle/foo/bar/maven-metadata.xml";
FileSystemView viewMock = Mockito.mock(FileSystemView.class);
Mockito.when(viewMock.getFile(Matchers.any(SshFile.class), Matchers.anyString())).thenReturn(null);
OutputStream osMock = Mockito.mock(OutputStream.class);
InputStream isMock = Mockito.mock(InputStream.class);
LoggingHelper loggingHelper = Mockito.mock(LoggingHelper.class);
Mockito.when(isMock.read()).thenReturn(returnVal);
final NewScpHelper helperMocked = new NewScpHelper(isMock, osMock, viewMock, loggingHelper, null, null) {
@Override
public String readLine() throws IOException {
return "filename";
}
};
SshRequestLog requestLog = Mockito.mock(SshRequestLog.class);
NewScpCommand scpCommand = new NewScpCommand("scp -t " + filePath, requestLog, null) {
@Override
protected NewScpHelper createScpHelper() {
return helperMocked;
}
};
scpCommand.setFileSystemView(viewMock);
scpCommand.setOutputStream(osMock);
scpCommand.setInputStream(isMock);
scpCommand.setExitCallback(callback);
return scpCommand;
}
示例4: testFileFailure
import org.apache.sshd.server.ExitCallback; //导入依赖的package包/类
@Test
public void testFileFailure() throws IOException {
ExitCallback callback = Mockito.mock(ExitCallback.class);
NewScpCommand scpCommand = getFailureScpCommand((int) 'C', callback);
scpCommand.run();
Mockito.verify(callback).onExit(Matchers.anyInt(), Matchers.anyString());
}
示例5: testDirFailure
import org.apache.sshd.server.ExitCallback; //导入依赖的package包/类
@Test
public void testDirFailure() throws IOException {
ExitCallback callback = Mockito.mock(ExitCallback.class);
NewScpCommand scpCommand = getFailureScpCommand((int) 'D', callback);
scpCommand.run();
Mockito.verify(callback).onExit(Matchers.anyInt(), Matchers.anyString());
}
示例6: setExitCallback
import org.apache.sshd.server.ExitCallback; //导入依赖的package包/类
@Override
public void setExitCallback(ExitCallback callback) {
this.callback = callback;
}
示例7: setExitCallback
import org.apache.sshd.server.ExitCallback; //导入依赖的package包/类
@Override
public void setExitCallback(ExitCallback callback) {
this.callback = callback;
}
示例8: setExitCallback
import org.apache.sshd.server.ExitCallback; //导入依赖的package包/类
@Override
public void setExitCallback(ExitCallback ec) {
callback = ec;
}
示例9: setExitCallback
import org.apache.sshd.server.ExitCallback; //导入依赖的package包/类
public void setExitCallback(ExitCallback callback) {
this.callback = callback;
}
示例10: setExitCallback
import org.apache.sshd.server.ExitCallback; //导入依赖的package包/类
@Override
public void setExitCallback(ExitCallback callback) {
this.exitCallback = callback;
}
示例11: setExitCallback
import org.apache.sshd.server.ExitCallback; //导入依赖的package包/类
@Override
public void setExitCallback(ExitCallback callback) {
this.callback = callback;
}
示例12: setExitCallback
import org.apache.sshd.server.ExitCallback; //导入依赖的package包/类
@Override
public void setExitCallback(ExitCallback callback) {
this.exit = callback;
}
示例13: setExitCallback
import org.apache.sshd.server.ExitCallback; //导入依赖的package包/类
@Override
public void setExitCallback(ExitCallback exitCallback) {
this.exitCallback = exitCallback;
}
示例14: setExitCallback
import org.apache.sshd.server.ExitCallback; //导入依赖的package包/类
@Override
public void setExitCallback(final ExitCallback cllbck) {
this.callback = cllbck;
}
示例15: setExitCallback
import org.apache.sshd.server.ExitCallback; //导入依赖的package包/类
@Override
public void setExitCallback(ExitCallback callback) {
this.exitCallback = callback;
}