Search in sources :

Example 41 with Credentials

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

the class SpectraBulkServiceTest method testSPECTRA67.

@Ignore
@Test
public void testSPECTRA67() throws Exception {
    final Host host = new Host(new SpectraProtocol() {

        @Override
        public Scheme getScheme() {
            return Scheme.http;
        }
    }, System.getProperties().getProperty("spectra.hostname"), Integer.valueOf(System.getProperties().getProperty("spectra.port")), new Credentials(System.getProperties().getProperty("spectra.user"), System.getProperties().getProperty("spectra.key")));
    final SpectraSession session = new SpectraSession(host, new DisabledX509TrustManager(), new DefaultX509KeyManager());
    session.open(Proxy.DIRECT, new DisabledHostKeyCallback(), new DisabledLoginCallback(), new DisabledCancelCallback());
    session.login(Proxy.DIRECT, new DisabledLoginCallback(), new DisabledCancelCallback());
    final Path container = new Path(new Path("cyberduck", EnumSet.of(Path.Type.directory, Path.Type.volume)), "SPECTRA-67", EnumSet.of(Path.Type.directory));
    final HashMap<TransferItem, TransferStatus> files = new HashMap<>();
    for (int i = 1; i < 100; i++) {
        files.put(new TransferItem(new Path(container, String.format("test-%d.f", i), EnumSet.of(Path.Type.file))), new TransferStatus());
    }
    final SpectraBulkService bulk = new SpectraBulkService(session);
    // Clear cache
    bulk.clear();
    final Set<UUID> uuid = bulk.pre(Transfer.Type.download, files, new DisabledConnectionCallback());
    assertNotNull(uuid);
    assertFalse(uuid.isEmpty());
    assertEquals(1, uuid.size());
    session.close();
}
Also used : Path(ch.cyberduck.core.Path) DisabledX509TrustManager(ch.cyberduck.core.ssl.DisabledX509TrustManager) Scheme(ch.cyberduck.core.Scheme) HashMap(java.util.HashMap) Host(ch.cyberduck.core.Host) DisabledCancelCallback(ch.cyberduck.core.DisabledCancelCallback) DisabledHostKeyCallback(ch.cyberduck.core.DisabledHostKeyCallback) DisabledLoginCallback(ch.cyberduck.core.DisabledLoginCallback) TransferStatus(ch.cyberduck.core.transfer.TransferStatus) UUID(java.util.UUID) DefaultX509KeyManager(ch.cyberduck.core.ssl.DefaultX509KeyManager) TransferItem(ch.cyberduck.core.transfer.TransferItem) Credentials(ch.cyberduck.core.Credentials) DisabledConnectionCallback(ch.cyberduck.core.DisabledConnectionCallback) Ignore(org.junit.Ignore) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest)

Example 42 with Credentials

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

the class SpectraReadFeatureTest method testSPECTRA66.

@Ignore
@Test
public void testSPECTRA66() throws Exception {
    final Host host = new Host(new SpectraProtocol() {

        @Override
        public Scheme getScheme() {
            return Scheme.http;
        }
    }, System.getProperties().getProperty("spectra.hostname"), Integer.valueOf(System.getProperties().getProperty("spectra.port")), new Credentials(System.getProperties().getProperty("spectra.user"), System.getProperties().getProperty("spectra.key")));
    final SpectraSession session = new SpectraSession(host, new DisabledX509TrustManager(), new DefaultX509KeyManager());
    session.open(Proxy.DIRECT, new DisabledHostKeyCallback(), new DisabledLoginCallback(), new DisabledCancelCallback());
    session.login(Proxy.DIRECT, new DisabledLoginCallback(), new DisabledCancelCallback());
    final Path container = new Path(new Path("cyberduck", EnumSet.of(Path.Type.directory, Path.Type.volume)), "SPECTRA-67", EnumSet.of(Path.Type.directory));
    final HashMap<TransferItem, TransferStatus> files = new HashMap<>();
    for (int i = 1; i < 100; i++) {
        files.put(new TransferItem(new Path(container, String.format("test-%d.f", i), EnumSet.of(Path.Type.file))), new TransferStatus());
    }
    final SpectraBulkService bulk = new SpectraBulkService(session);
    final Set<UUID> uuid = bulk.pre(Transfer.Type.download, files, new DisabledConnectionCallback());
    assertNotNull(uuid);
    assertFalse(uuid.isEmpty());
    assertEquals(1, uuid.size());
    try {
        for (Map.Entry<TransferItem, TransferStatus> entry : files.entrySet()) {
            final InputStream in = new SpectraReadFeature(session).read(entry.getKey().remote, entry.getValue(), new DisabledConnectionCallback());
            assertNotNull(in);
            IOUtils.closeQuietly(in);
        }
    } catch (RetriableAccessDeniedException e) {
    // ignore as the files are not in the cache - next time they might be there
    }
    session.close();
}
Also used : DisabledX509TrustManager(ch.cyberduck.core.ssl.DisabledX509TrustManager) Scheme(ch.cyberduck.core.Scheme) HashMap(java.util.HashMap) RetriableAccessDeniedException(ch.cyberduck.core.exception.RetriableAccessDeniedException) TransferStatus(ch.cyberduck.core.transfer.TransferStatus) UUID(java.util.UUID) Path(ch.cyberduck.core.Path) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) Host(ch.cyberduck.core.Host) DisabledCancelCallback(ch.cyberduck.core.DisabledCancelCallback) DisabledHostKeyCallback(ch.cyberduck.core.DisabledHostKeyCallback) DisabledLoginCallback(ch.cyberduck.core.DisabledLoginCallback) DefaultX509KeyManager(ch.cyberduck.core.ssl.DefaultX509KeyManager) TransferItem(ch.cyberduck.core.transfer.TransferItem) HashMap(java.util.HashMap) Map(java.util.Map) Credentials(ch.cyberduck.core.Credentials) DisabledConnectionCallback(ch.cyberduck.core.DisabledConnectionCallback) Ignore(org.junit.Ignore) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest)

Example 43 with Credentials

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

the class SpectraReadFeatureTest method testReadNotFound.

@Test(expected = NotfoundException.class)
public void testReadNotFound() throws Exception {
    final Host host = new Host(new SpectraProtocol() {

        @Override
        public Scheme getScheme() {
            return Scheme.http;
        }
    }, System.getProperties().getProperty("spectra.hostname"), Integer.valueOf(System.getProperties().getProperty("spectra.port")), new Credentials(System.getProperties().getProperty("spectra.user"), System.getProperties().getProperty("spectra.key")));
    final SpectraSession session = new SpectraSession(host, new DisabledX509TrustManager(), new DefaultX509KeyManager());
    session.open(Proxy.DIRECT, new DisabledHostKeyCallback(), new DisabledLoginCallback(), new DisabledCancelCallback());
    session.login(Proxy.DIRECT, new DisabledLoginCallback(), new DisabledCancelCallback());
    final TransferStatus status = new TransferStatus();
    final Path container = new Path("cyberduck", EnumSet.of(Path.Type.directory, Path.Type.volume));
    final Path test = new Path(container, "nosuchname", EnumSet.of(Path.Type.file));
    new SpectraBulkService(session).pre(Transfer.Type.download, Collections.singletonMap(new TransferItem(test), status), new DisabledConnectionCallback());
    new SpectraReadFeature(session).read(test, status, new DisabledConnectionCallback());
}
Also used : Path(ch.cyberduck.core.Path) DisabledX509TrustManager(ch.cyberduck.core.ssl.DisabledX509TrustManager) Scheme(ch.cyberduck.core.Scheme) Host(ch.cyberduck.core.Host) DisabledCancelCallback(ch.cyberduck.core.DisabledCancelCallback) DisabledHostKeyCallback(ch.cyberduck.core.DisabledHostKeyCallback) DisabledLoginCallback(ch.cyberduck.core.DisabledLoginCallback) TransferStatus(ch.cyberduck.core.transfer.TransferStatus) DefaultX509KeyManager(ch.cyberduck.core.ssl.DefaultX509KeyManager) TransferItem(ch.cyberduck.core.transfer.TransferItem) Credentials(ch.cyberduck.core.Credentials) DisabledConnectionCallback(ch.cyberduck.core.DisabledConnectionCallback) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest)

Example 44 with Credentials

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

the class SpectraSessionTest method testLoginFailureInvalidSecret.

@Test(expected = LoginFailureException.class)
public void testLoginFailureInvalidSecret() throws Exception {
    final Host host = new Host(new SpectraProtocol() {

        @Override
        public Scheme getScheme() {
            return Scheme.http;
        }
    }, System.getProperties().getProperty("spectra.hostname"), Integer.valueOf(System.getProperties().getProperty("spectra.port")), new Credentials(System.getProperties().getProperty("spectra.user"), "s"));
    final SpectraSession session = new SpectraSession(host, new DisabledX509TrustManager(), new DefaultX509KeyManager());
    session.open(Proxy.DIRECT, new DisabledHostKeyCallback(), new DisabledLoginCallback(), new DisabledCancelCallback());
    session.login(Proxy.DIRECT, new DisabledLoginCallback(), new DisabledCancelCallback());
}
Also used : DisabledX509TrustManager(ch.cyberduck.core.ssl.DisabledX509TrustManager) Scheme(ch.cyberduck.core.Scheme) DisabledCancelCallback(ch.cyberduck.core.DisabledCancelCallback) DisabledHostKeyCallback(ch.cyberduck.core.DisabledHostKeyCallback) DisabledLoginCallback(ch.cyberduck.core.DisabledLoginCallback) Host(ch.cyberduck.core.Host) DefaultX509KeyManager(ch.cyberduck.core.ssl.DefaultX509KeyManager) Credentials(ch.cyberduck.core.Credentials) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest)

Example 45 with Credentials

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

the class SpectraSessionTest method testLogin.

@Test
public void testLogin() throws Exception {
    final Host host = new Host(new SpectraProtocol() {

        @Override
        public Scheme getScheme() {
            return Scheme.http;
        }
    }, System.getProperties().getProperty("spectra.hostname"), Integer.valueOf(System.getProperties().getProperty("spectra.port")), new Credentials(System.getProperties().getProperty("spectra.user"), System.getProperties().getProperty("spectra.key")));
    final SpectraSession session = new SpectraSession(host, new DisabledX509TrustManager(), new DefaultX509KeyManager());
    session.open(Proxy.DIRECT, new DisabledHostKeyCallback(), new DisabledLoginCallback(), new DisabledCancelCallback());
    session.login(Proxy.DIRECT, new DisabledLoginCallback(), new DisabledCancelCallback());
    new S3ListService(session).list(new Path("/", EnumSet.of(Path.Type.directory)), new DisabledListProgressListener());
    session.close();
}
Also used : Path(ch.cyberduck.core.Path) DisabledX509TrustManager(ch.cyberduck.core.ssl.DisabledX509TrustManager) Scheme(ch.cyberduck.core.Scheme) DisabledListProgressListener(ch.cyberduck.core.DisabledListProgressListener) Host(ch.cyberduck.core.Host) S3ListService(ch.cyberduck.core.s3.S3ListService) DisabledCancelCallback(ch.cyberduck.core.DisabledCancelCallback) DisabledHostKeyCallback(ch.cyberduck.core.DisabledHostKeyCallback) DisabledLoginCallback(ch.cyberduck.core.DisabledLoginCallback) DefaultX509KeyManager(ch.cyberduck.core.ssl.DefaultX509KeyManager) Credentials(ch.cyberduck.core.Credentials) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest)

Aggregations

Credentials (ch.cyberduck.core.Credentials)252 Host (ch.cyberduck.core.Host)201 Test (org.junit.Test)189 DisabledLoginCallback (ch.cyberduck.core.DisabledLoginCallback)165 IntegrationTest (ch.cyberduck.test.IntegrationTest)156 Path (ch.cyberduck.core.Path)138 DisabledCancelCallback (ch.cyberduck.core.DisabledCancelCallback)137 DisabledHostKeyCallback (ch.cyberduck.core.DisabledHostKeyCallback)134 DefaultX509KeyManager (ch.cyberduck.core.ssl.DefaultX509KeyManager)103 TransferStatus (ch.cyberduck.core.transfer.TransferStatus)95 LoginOptions (ch.cyberduck.core.LoginOptions)92 DisabledX509TrustManager (ch.cyberduck.core.ssl.DisabledX509TrustManager)84 Delete (ch.cyberduck.core.features.Delete)76 Local (ch.cyberduck.core.Local)60 DisabledConnectionCallback (ch.cyberduck.core.DisabledConnectionCallback)56 ProtocolFactory (ch.cyberduck.core.ProtocolFactory)55 ProfilePlistReader (ch.cyberduck.core.serializer.impl.dd.ProfilePlistReader)55 Scheme (ch.cyberduck.core.Scheme)52 AlphanumericRandomStringService (ch.cyberduck.core.AlphanumericRandomStringService)51 Profile (ch.cyberduck.core.Profile)50