org.apache.sshd.common.subsystem.sftp.SftpConstants Java Examples

The following examples show how to use org.apache.sshd.common.subsystem.sftp.SftpConstants. 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: KeyReExchangeTest.java    From termd with Apache License 2.0 6 votes vote down vote up
@Test
public void testSwitchToNoneCipher() throws Exception {
    setUp(0L, 0L, 0L);

    sshd.getCipherFactories().add(BuiltinCiphers.none);
    try (SshClient client = setupTestClient()) {
        client.getCipherFactories().add(BuiltinCiphers.none);
        client.start();

        try (ClientSession session = client.connect(getCurrentTestName(), TEST_LOCALHOST, port).verify(7L, TimeUnit.SECONDS).getSession()) {
            session.addPasswordIdentity(getCurrentTestName());
            session.auth().verify(5L, TimeUnit.SECONDS);

            outputDebugMessage("Request switch to none cipher for %s", session);
            KeyExchangeFuture switchFuture = session.switchToNoneCipher();
            switchFuture.verify(5L, TimeUnit.SECONDS);
            try (ClientChannel channel = session.createSubsystemChannel(SftpConstants.SFTP_SUBSYSTEM_NAME)) {
                channel.open().verify(5L, TimeUnit.SECONDS);
            }
        } finally {
            client.stop();
        }
    }
}
 
Example #2
Source File: KeyReExchangeTest.java    From termd with Apache License 2.0 6 votes vote down vote up
@Test
public void testSwitchToNoneCipher() throws Exception {
    setUp(0L, 0L, 0L);

    sshd.getCipherFactories().add(BuiltinCiphers.none);
    try (SshClient client = setupTestClient()) {
        client.getCipherFactories().add(BuiltinCiphers.none);
        client.start();

        try (ClientSession session = client.connect(getCurrentTestName(), TEST_LOCALHOST, port).verify(7L, TimeUnit.SECONDS).getSession()) {
            session.addPasswordIdentity(getCurrentTestName());
            session.auth().verify(5L, TimeUnit.SECONDS);

            outputDebugMessage("Request switch to none cipher for %s", session);
            KeyExchangeFuture switchFuture = session.switchToNoneCipher();
            switchFuture.verify(5L, TimeUnit.SECONDS);
            try (ClientChannel channel = session.createSubsystemChannel(SftpConstants.SFTP_SUBSYSTEM_NAME)) {
                channel.open().verify(5L, TimeUnit.SECONDS);
            }
        } finally {
            client.stop();
        }
    }
}
 
Example #3
Source File: SftpFileSystemSimpleTests.java    From xenon with Apache License 2.0 4 votes vote down vote up
@Test
public void test_exception_badMessage() {
    XenonException e = SftpFileSystem.sftpExceptionToXenonException(generateSftpException(SftpConstants.SSH_FX_BAD_MESSAGE), "");
    assertTrue(e instanceof XenonException);
}
 
Example #4
Source File: SftpFileSystemSimpleTests.java    From xenon with Apache License 2.0 4 votes vote down vote up
@Test
public void test_exception_noMatchingByteRangeLock() {
    XenonException e = SftpFileSystem.sftpExceptionToXenonException(generateSftpException(SftpConstants.SSH_FX_NO_MATCHING_BYTE_RANGE_LOCK), "");
    assertTrue(e instanceof XenonException);
}
 
Example #5
Source File: SftpFileSystemSimpleTests.java    From xenon with Apache License 2.0 4 votes vote down vote up
@Test
public void test_exception_noConnection() {
    XenonException e = SftpFileSystem.sftpExceptionToXenonException(generateSftpException(SftpConstants.SSH_FX_NO_CONNECTION), "");
    assertTrue(e instanceof NotConnectedException);
}
 
Example #6
Source File: SftpFileSystemSimpleTests.java    From xenon with Apache License 2.0 4 votes vote down vote up
@Test
public void test_exception_connectionLost() {
    XenonException e = SftpFileSystem.sftpExceptionToXenonException(generateSftpException(SftpConstants.SSH_FX_CONNECTION_LOST), "");
    assertTrue(e instanceof NotConnectedException);
}
 
Example #7
Source File: SftpFileSystemSimpleTests.java    From xenon with Apache License 2.0 4 votes vote down vote up
@Test
public void test_exception_opUnsupported() {
    XenonException e = SftpFileSystem.sftpExceptionToXenonException(generateSftpException(SftpConstants.SSH_FX_OP_UNSUPPORTED), "");
    assertTrue(e instanceof XenonException);
}
 
Example #8
Source File: SftpFileSystemSimpleTests.java    From xenon with Apache License 2.0 4 votes vote down vote up
@Test
public void test_exception_invalidHandle() {
    XenonException e = SftpFileSystem.sftpExceptionToXenonException(generateSftpException(SftpConstants.SSH_FX_INVALID_HANDLE), "");
    assertTrue(e instanceof XenonException);
}
 
Example #9
Source File: SftpFileSystemSimpleTests.java    From xenon with Apache License 2.0 4 votes vote down vote up
@Test
public void test_exception_noSuchPath() {
    XenonException e = SftpFileSystem.sftpExceptionToXenonException(generateSftpException(SftpConstants.SSH_FX_NO_SUCH_PATH), "");
    assertTrue(e instanceof NoSuchPathException);
}
 
Example #10
Source File: SftpFileSystemSimpleTests.java    From xenon with Apache License 2.0 4 votes vote down vote up
@Test
public void test_exception_fileAreadyExists() {
    XenonException e = SftpFileSystem.sftpExceptionToXenonException(generateSftpException(SftpConstants.SSH_FX_FILE_ALREADY_EXISTS), "");
    assertTrue(e instanceof PathAlreadyExistsException);
}
 
Example #11
Source File: SftpFileSystemSimpleTests.java    From xenon with Apache License 2.0 4 votes vote down vote up
@Test
public void test_exception_writeProtect() {
    XenonException e = SftpFileSystem.sftpExceptionToXenonException(generateSftpException(SftpConstants.SSH_FX_WRITE_PROTECT), "");
    assertTrue(e instanceof PermissionDeniedException);
}
 
Example #12
Source File: SftpFileSystemSimpleTests.java    From xenon with Apache License 2.0 4 votes vote down vote up
@Test
public void test_exception_noMedia() {
    XenonException e = SftpFileSystem.sftpExceptionToXenonException(generateSftpException(SftpConstants.SSH_FX_NO_MEDIA), "");
    assertTrue(e instanceof NoSpaceException);
}
 
Example #13
Source File: SftpFileSystemSimpleTests.java    From xenon with Apache License 2.0 4 votes vote down vote up
@Test
public void test_exception_noSpace() {
    XenonException e = SftpFileSystem.sftpExceptionToXenonException(generateSftpException(SftpConstants.SSH_FX_NO_SPACE_ON_FILESYSTEM), "");
    assertTrue(e instanceof NoSpaceException);
}
 
Example #14
Source File: SftpFileSystemSimpleTests.java    From xenon with Apache License 2.0 4 votes vote down vote up
@Test
public void test_exception_quotaExceeded() {
    XenonException e = SftpFileSystem.sftpExceptionToXenonException(generateSftpException(SftpConstants.SSH_FX_QUOTA_EXCEEDED), "");
    assertTrue(e instanceof NoSpaceException);
}
 
Example #15
Source File: SftpFileSystemSimpleTests.java    From xenon with Apache License 2.0 4 votes vote down vote up
@Test
public void test_exception_unknownPricipal() {
    XenonException e = SftpFileSystem.sftpExceptionToXenonException(generateSftpException(SftpConstants.SSH_FX_UNKNOWN_PRINCIPAL), "");
    assertTrue(e instanceof XenonException);
}
 
Example #16
Source File: SftpFileSystemSimpleTests.java    From xenon with Apache License 2.0 4 votes vote down vote up
@Test
public void test_exception_localConflict() {
    XenonException e = SftpFileSystem.sftpExceptionToXenonException(generateSftpException(SftpConstants.SSH_FX_LOCK_CONFLICT), "");
    assertTrue(e instanceof XenonException);
}
 
Example #17
Source File: SftpFileSystemSimpleTests.java    From xenon with Apache License 2.0 4 votes vote down vote up
@Test
public void test_exception_dirNotEmpty() {
    XenonException e = SftpFileSystem.sftpExceptionToXenonException(generateSftpException(SftpConstants.SSH_FX_DIR_NOT_EMPTY), "");
    assertTrue(e instanceof DirectoryNotEmptyException);
}
 
Example #18
Source File: SftpFileSystemSimpleTests.java    From xenon with Apache License 2.0 4 votes vote down vote up
@Test
public void test_exception_notADirectory() {
    XenonException e = SftpFileSystem.sftpExceptionToXenonException(generateSftpException(SftpConstants.SSH_FX_NOT_A_DIRECTORY), "");
    assertTrue(e instanceof InvalidPathException);
}
 
Example #19
Source File: SftpFileSystemSimpleTests.java    From xenon with Apache License 2.0 4 votes vote down vote up
@Test
public void test_exception_invalidFileName() {
    XenonException e = SftpFileSystem.sftpExceptionToXenonException(generateSftpException(SftpConstants.SSH_FX_INVALID_FILENAME), "");
    assertTrue(e instanceof InvalidPathException);
}
 
Example #20
Source File: SftpFileSystemSimpleTests.java    From xenon with Apache License 2.0 4 votes vote down vote up
@Test
public void test_exception_linkLoop() {
    XenonException e = SftpFileSystem.sftpExceptionToXenonException(generateSftpException(SftpConstants.SSH_FX_LINK_LOOP), "");
    assertTrue(e instanceof InvalidPathException);
}
 
Example #21
Source File: SftpFileSystemSimpleTests.java    From xenon with Apache License 2.0 4 votes vote down vote up
@Test
public void test_exception_cannotDelete() {
    XenonException e = SftpFileSystem.sftpExceptionToXenonException(generateSftpException(SftpConstants.SSH_FX_CANNOT_DELETE), "");
    assertTrue(e instanceof PermissionDeniedException);
}
 
Example #22
Source File: SftpFileSystemSimpleTests.java    From xenon with Apache License 2.0 4 votes vote down vote up
@Test
public void test_exception_invalidParameter() {
    XenonException e = SftpFileSystem.sftpExceptionToXenonException(generateSftpException(SftpConstants.SSH_FX_INVALID_PARAMETER), "");
    assertTrue(e instanceof XenonException);
}
 
Example #23
Source File: SftpFileSystemSimpleTests.java    From xenon with Apache License 2.0 4 votes vote down vote up
@Test
public void test_exception_fileIsADirectory() {
    XenonException e = SftpFileSystem.sftpExceptionToXenonException(generateSftpException(SftpConstants.SSH_FX_FILE_IS_A_DIRECTORY), "");
    assertTrue(e instanceof InvalidPathException);
}
 
Example #24
Source File: SftpFileSystemSimpleTests.java    From xenon with Apache License 2.0 4 votes vote down vote up
@Test
public void test_exception_byteRangeLockConflict() {
    XenonException e = SftpFileSystem.sftpExceptionToXenonException(generateSftpException(SftpConstants.SSH_FX_BYTE_RANGE_LOCK_CONFLICT), "");
    assertTrue(e instanceof XenonException);
}
 
Example #25
Source File: SftpFileSystemSimpleTests.java    From xenon with Apache License 2.0 4 votes vote down vote up
@Test
public void test_exception_byteRangeLockRefused() {
    XenonException e = SftpFileSystem.sftpExceptionToXenonException(generateSftpException(SftpConstants.SSH_FX_BYTE_RANGE_LOCK_REFUSED), "");
    assertTrue(e instanceof XenonException);
}
 
Example #26
Source File: SftpFileSystemSimpleTests.java    From xenon with Apache License 2.0 4 votes vote down vote up
@Test
public void test_exception_deletePending() {
    XenonException e = SftpFileSystem.sftpExceptionToXenonException(generateSftpException(SftpConstants.SSH_FX_DELETE_PENDING), "");
    assertTrue(e instanceof PermissionDeniedException);
}
 
Example #27
Source File: SftpFileSystemSimpleTests.java    From xenon with Apache License 2.0 4 votes vote down vote up
@Test
public void test_exception_fileCorrupt() {
    XenonException e = SftpFileSystem.sftpExceptionToXenonException(generateSftpException(SftpConstants.SSH_FX_FILE_CORRUPT), "");
    assertTrue(e instanceof InvalidPathException);
}
 
Example #28
Source File: SftpFileSystemSimpleTests.java    From xenon with Apache License 2.0 4 votes vote down vote up
@Test
public void test_exception_ownerInvalid() {
    XenonException e = SftpFileSystem.sftpExceptionToXenonException(generateSftpException(SftpConstants.SSH_FX_OWNER_INVALID), "");
    assertTrue(e instanceof XenonException);
}
 
Example #29
Source File: SftpFileSystemSimpleTests.java    From xenon with Apache License 2.0 4 votes vote down vote up
@Test
public void test_exception_groupInvalid() {
    XenonException e = SftpFileSystem.sftpExceptionToXenonException(generateSftpException(SftpConstants.SSH_FX_GROUP_INVALID), "");
    assertTrue(e instanceof XenonException);
}
 
Example #30
Source File: MockSftpClient.java    From xenon with Apache License 2.0 4 votes vote down vote up
@Override
public Attributes stat(String path) throws IOException {
    throw new SftpException(SftpConstants.SSH_FX_FAILURE, "This is a test");
}