org.apache.sshd.common.file.FileSystemView Java Examples

The following examples show how to use org.apache.sshd.common.file.FileSystemView. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: NewScpHelper.java    From artifactory_ssh_proxy with Apache License 2.0 5 votes vote down vote up
public NewScpHelper(@Nonnull final InputStream in, @Nonnull final OutputStream out,
                @Nonnull final FileSystemView root, final LoggingHelper loggingHelper, @Nonnull Environment env,
                @Nonnull Map<String, String> envToAfPropertyMapping) {
    super(in, out, root);
    this.loggingHelper = loggingHelper;
    this.env = env;
    this.envToAfPropertyMapping = envToAfPropertyMapping;
}
 
Example #2
Source File: TestNewScpCommand.java    From artifactory_ssh_proxy with Apache License 2.0 5 votes vote down vote up
@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;
}
 
Example #3
Source File: ArtifactoryFileSystemFactory.java    From artifactory_ssh_proxy with Apache License 2.0 4 votes vote down vote up
/**
 * Create the appropriate user file system view.
 */
@Override
public FileSystemView createFileSystemView(final Session session) {
    final String userName = session.getUsername();
    return new ArtifactoryFileSystemView(afInfo, userName, isCaseInsensitive(), artifactoryAuthorizer);
}