Search in sources :

Example 1 with DisabledTranscriptListener

use of ch.cyberduck.core.DisabledTranscriptListener in project cyberduck by iterate-ch.

the class DefaultSessionPoolTest method testConnectRefuse.

@Test(expected = ConnectionRefusedException.class)
public void testConnectRefuse() throws Exception {
    final DefaultSessionPool pool = new DefaultSessionPool(new TestLoginConnectionService() {

        @Override
        public boolean check(final Session<?> session, final CancelCallback callback) throws BackgroundException {
            throw new ConnectionRefusedException("t", new RuntimeException());
        }
    }, new DisabledX509TrustManager(), new DefaultX509KeyManager(), new DefaultVaultRegistry(new DisabledPasswordCallback()), new DisabledTranscriptListener(), new Host(new TestProtocol(), "t"));
    pool.borrow(BackgroundActionState.running);
}
Also used : DisabledX509TrustManager(ch.cyberduck.core.ssl.DisabledX509TrustManager) TestProtocol(ch.cyberduck.core.TestProtocol) Host(ch.cyberduck.core.Host) ConnectionRefusedException(ch.cyberduck.core.exception.ConnectionRefusedException) DisabledTranscriptListener(ch.cyberduck.core.DisabledTranscriptListener) TestLoginConnectionService(ch.cyberduck.core.TestLoginConnectionService) DefaultVaultRegistry(ch.cyberduck.core.vault.DefaultVaultRegistry) CancelCallback(ch.cyberduck.core.threading.CancelCallback) DefaultX509KeyManager(ch.cyberduck.core.ssl.DefaultX509KeyManager) DisabledPasswordCallback(ch.cyberduck.core.DisabledPasswordCallback) BackgroundException(ch.cyberduck.core.exception.BackgroundException) Test(org.junit.Test)

Example 2 with DisabledTranscriptListener

use of ch.cyberduck.core.DisabledTranscriptListener in project cyberduck by iterate-ch.

the class DefaultSessionPoolTest method testCheckReconnectApplicationFailure.

@Test
public void testCheckReconnectApplicationFailure() throws Exception {
    final AtomicBoolean interrupt = new AtomicBoolean();
    final Host bookmark = new Host(new TestProtocol());
    final TestLoginConnectionService connect = new TestLoginConnectionService() {

        @Override
        public boolean check(final Session<?> session, final CancelCallback callback) {
            return true;
        }
    };
    final DefaultSessionPool pool = new DefaultSessionPool(connect, new DefaultVaultRegistry(new DisabledPasswordCallback()), new DisabledTranscriptListener(), bookmark, new GenericObjectPool<Session>(new PooledSessionFactory(connect, new DisabledX509TrustManager(), new DefaultX509KeyManager(), bookmark, new DefaultVaultRegistry(new DisabledPasswordCallback())) {

        @Override
        public Session create() {
            return new NullSession(bookmark) {

                @Override
                public void interrupt() throws BackgroundException {
                    interrupt.set(true);
                    super.interrupt();
                }
            };
        }
    }));
    final Session<?> session = pool.borrow(BackgroundActionState.running);
    pool.release(session, new BackgroundException("m", "d"));
    assertFalse(interrupt.get());
}
Also used : DisabledX509TrustManager(ch.cyberduck.core.ssl.DisabledX509TrustManager) TestProtocol(ch.cyberduck.core.TestProtocol) NullSession(ch.cyberduck.core.NullSession) Host(ch.cyberduck.core.Host) DisabledTranscriptListener(ch.cyberduck.core.DisabledTranscriptListener) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) TestLoginConnectionService(ch.cyberduck.core.TestLoginConnectionService) DefaultVaultRegistry(ch.cyberduck.core.vault.DefaultVaultRegistry) CancelCallback(ch.cyberduck.core.threading.CancelCallback) DisabledPasswordCallback(ch.cyberduck.core.DisabledPasswordCallback) DefaultX509KeyManager(ch.cyberduck.core.ssl.DefaultX509KeyManager) BackgroundException(ch.cyberduck.core.exception.BackgroundException) NullSession(ch.cyberduck.core.NullSession) Session(ch.cyberduck.core.Session) Test(org.junit.Test)

Example 3 with DisabledTranscriptListener

use of ch.cyberduck.core.DisabledTranscriptListener in project cyberduck by iterate-ch.

the class DefaultSessionPoolTest method testCheckReconnectSocketFailure.

@Test
public void testCheckReconnectSocketFailure() throws Exception {
    final AtomicBoolean interrupt = new AtomicBoolean();
    final Host bookmark = new Host(new TestProtocol());
    final TestLoginConnectionService connect = new TestLoginConnectionService() {

        @Override
        public boolean check(final Session<?> session, final CancelCallback callback) {
            return true;
        }
    };
    final DefaultSessionPool pool = new DefaultSessionPool(connect, new DefaultVaultRegistry(new DisabledPasswordCallback()), new DisabledTranscriptListener(), bookmark, new GenericObjectPool<Session>(new PooledSessionFactory(connect, new DisabledX509TrustManager(), new DefaultX509KeyManager(), bookmark, new DefaultVaultRegistry(new DisabledPasswordCallback())) {

        @Override
        public Session create() {
            return new NullSession(bookmark) {

                @Override
                public void interrupt() throws BackgroundException {
                    interrupt.set(true);
                    super.interrupt();
                }
            };
        }
    }));
    final Session<?> session = pool.borrow(BackgroundActionState.running);
    pool.release(session, new BackgroundException("m", new SocketException("m")));
    assertTrue(interrupt.get());
}
Also used : SocketException(java.net.SocketException) DisabledX509TrustManager(ch.cyberduck.core.ssl.DisabledX509TrustManager) TestProtocol(ch.cyberduck.core.TestProtocol) NullSession(ch.cyberduck.core.NullSession) Host(ch.cyberduck.core.Host) DisabledTranscriptListener(ch.cyberduck.core.DisabledTranscriptListener) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) TestLoginConnectionService(ch.cyberduck.core.TestLoginConnectionService) DefaultVaultRegistry(ch.cyberduck.core.vault.DefaultVaultRegistry) CancelCallback(ch.cyberduck.core.threading.CancelCallback) DisabledPasswordCallback(ch.cyberduck.core.DisabledPasswordCallback) DefaultX509KeyManager(ch.cyberduck.core.ssl.DefaultX509KeyManager) BackgroundException(ch.cyberduck.core.exception.BackgroundException) NullSession(ch.cyberduck.core.NullSession) Session(ch.cyberduck.core.Session) Test(org.junit.Test)

Example 4 with DisabledTranscriptListener

use of ch.cyberduck.core.DisabledTranscriptListener in project cyberduck by iterate-ch.

the class StatelessSessionPoolTest method testCheckReconnectSocketFailure.

@Test
public void testCheckReconnectSocketFailure() throws Exception {
    final AtomicBoolean interrupt = new AtomicBoolean();
    final StatelessSessionPool pool = new StatelessSessionPool(new TestLoginConnectionService() {

        @Override
        public boolean check(final Session<?> session, final CancelCallback callback) {
            return true;
        }
    }, new NullSession(new Host(new TestProtocol())) {

        @Override
        public void interrupt() throws BackgroundException {
            interrupt.set(true);
            super.interrupt();
        }
    }, new DisabledTranscriptListener(), new DefaultVaultRegistry(new DisabledPasswordCallback()));
    final Session<?> session = pool.borrow(BackgroundActionState.running);
    pool.release(session, new BackgroundException("m", new SocketException("m")));
    assertFalse(interrupt.get());
}
Also used : SocketException(java.net.SocketException) TestProtocol(ch.cyberduck.core.TestProtocol) NullSession(ch.cyberduck.core.NullSession) Host(ch.cyberduck.core.Host) DisabledTranscriptListener(ch.cyberduck.core.DisabledTranscriptListener) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) TestLoginConnectionService(ch.cyberduck.core.TestLoginConnectionService) DefaultVaultRegistry(ch.cyberduck.core.vault.DefaultVaultRegistry) CancelCallback(ch.cyberduck.core.threading.CancelCallback) DisabledPasswordCallback(ch.cyberduck.core.DisabledPasswordCallback) BackgroundException(ch.cyberduck.core.exception.BackgroundException) Test(org.junit.Test)

Example 5 with DisabledTranscriptListener

use of ch.cyberduck.core.DisabledTranscriptListener in project cyberduck by iterate-ch.

the class SessionBackgroundActionTest method testGetExceptionConnectionCanceledException.

@Test
public void testGetExceptionConnectionCanceledException() {
    SessionBackgroundAction<Void> a = new SessionBackgroundAction<Void>(new StatelessSessionPool(new TestLoginConnectionService(), new NullSession(new Host(new TestProtocol(), "t")), new DisabledTranscriptListener(), new DefaultVaultRegistry(new DisabledPasswordCallback())), new DisabledAlertCallback(), new DisabledProgressListener()) {

        @Override
        public Void run(final Session<?> session) throws BackgroundException {
            throw new ConnectionCanceledException();
        }
    };
    try {
        a.call();
        fail();
    } catch (BackgroundException e) {
    // Ignore
    }
    assertFalse(a.hasFailed());
}
Also used : DisabledProgressListener(ch.cyberduck.core.DisabledProgressListener) TestProtocol(ch.cyberduck.core.TestProtocol) ConnectionCanceledException(ch.cyberduck.core.exception.ConnectionCanceledException) NullSession(ch.cyberduck.core.NullSession) Host(ch.cyberduck.core.Host) StatelessSessionPool(ch.cyberduck.core.pool.StatelessSessionPool) DisabledTranscriptListener(ch.cyberduck.core.DisabledTranscriptListener) TestLoginConnectionService(ch.cyberduck.core.TestLoginConnectionService) DefaultVaultRegistry(ch.cyberduck.core.vault.DefaultVaultRegistry) DisabledPasswordCallback(ch.cyberduck.core.DisabledPasswordCallback) BackgroundException(ch.cyberduck.core.exception.BackgroundException) NullSession(ch.cyberduck.core.NullSession) Session(ch.cyberduck.core.Session) Test(org.junit.Test)

Aggregations

DisabledTranscriptListener (ch.cyberduck.core.DisabledTranscriptListener)18 Test (org.junit.Test)16 Host (ch.cyberduck.core.Host)15 DisabledPasswordCallback (ch.cyberduck.core.DisabledPasswordCallback)14 TestLoginConnectionService (ch.cyberduck.core.TestLoginConnectionService)14 TestProtocol (ch.cyberduck.core.TestProtocol)14 DefaultVaultRegistry (ch.cyberduck.core.vault.DefaultVaultRegistry)14 NullSession (ch.cyberduck.core.NullSession)12 BackgroundException (ch.cyberduck.core.exception.BackgroundException)11 Session (ch.cyberduck.core.Session)9 StatelessSessionPool (ch.cyberduck.core.pool.StatelessSessionPool)7 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)7 DefaultX509KeyManager (ch.cyberduck.core.ssl.DefaultX509KeyManager)6 DisabledX509TrustManager (ch.cyberduck.core.ssl.DisabledX509TrustManager)6 CancelCallback (ch.cyberduck.core.threading.CancelCallback)5 AbstractController (ch.cyberduck.core.AbstractController)4 DisabledProgressListener (ch.cyberduck.core.DisabledProgressListener)4 Path (ch.cyberduck.core.Path)4 DownloadTransfer (ch.cyberduck.core.transfer.DownloadTransfer)4 TransferOptions (ch.cyberduck.core.transfer.TransferOptions)4