Search in sources :

Example 41 with DefaultX509KeyManager

use of ch.cyberduck.core.ssl.DefaultX509KeyManager in project cyberduck by iterate-ch.

the class SpectraTouchFeatureTest method testTouch.

@Test
public void testTouch() 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("cyberduck", EnumSet.of(Path.Type.directory, Path.Type.volume));
    final Path test = new Path(container, UUID.randomUUID().toString() + ".txt", EnumSet.of(Path.Type.file));
    new SpectraTouchFeature(session).touch(test, new TransferStatus());
    assertTrue(new SpectraFindFeature(session).find(test));
    final Map<String, String> metadata = new S3MetadataFeature(session, null).getMetadata(test);
    assertFalse(metadata.isEmpty());
    new SpectraDeleteFeature(session).delete(Collections.<Path>singletonList(test), new DisabledLoginCallback(), new Delete.DisabledCallback());
    assertFalse(new SpectraFindFeature(session).find(test));
    session.close();
}
Also used : Path(ch.cyberduck.core.Path) Delete(ch.cyberduck.core.features.Delete) DisabledX509TrustManager(ch.cyberduck.core.ssl.DisabledX509TrustManager) Scheme(ch.cyberduck.core.Scheme) Host(ch.cyberduck.core.Host) S3MetadataFeature(ch.cyberduck.core.s3.S3MetadataFeature) 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) Credentials(ch.cyberduck.core.Credentials) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest)

Example 42 with DefaultX509KeyManager

use of ch.cyberduck.core.ssl.DefaultX509KeyManager in project cyberduck by iterate-ch.

the class SpectraUploadFeatureTest method testUpload.

@Test
public void testUpload() 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 Local local = new Local(System.getProperty("java.io.tmpdir"), UUID.randomUUID().toString());
    final int length = 32770;
    final byte[] content = RandomUtils.nextBytes(length);
    final OutputStream out = local.getOutputStream(false);
    IOUtils.write(content, out);
    out.close();
    final Path container = new Path("cyberduck", EnumSet.of(Path.Type.directory, Path.Type.volume));
    final Path test = new Path(container, UUID.randomUUID().toString(), EnumSet.of(Path.Type.file));
    final TransferStatus writeStatus = new TransferStatus().withLength(content.length);
    final SpectraBulkService bulk = new SpectraBulkService(session);
    bulk.pre(Transfer.Type.upload, Collections.singletonMap(new TransferItem(test), writeStatus), new DisabledConnectionCallback());
    final SpectraUploadFeature upload = new SpectraUploadFeature(session, new SpectraWriteFeature(session), new SpectraBulkService(session));
    upload.upload(test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledStreamListener(), writeStatus, new DisabledConnectionCallback());
    final byte[] buffer = new byte[content.length];
    final TransferStatus readStatus = new TransferStatus().withLength(content.length);
    bulk.pre(Transfer.Type.download, Collections.singletonMap(new TransferItem(test), readStatus), new DisabledConnectionCallback());
    final InputStream in = new SpectraReadFeature(session).read(test, readStatus, new DisabledConnectionCallback());
    IOUtils.readFully(in, buffer);
    in.close();
    assertArrayEquals(content, buffer);
    new SpectraDeleteFeature(session).delete(Collections.singletonList(test), new DisabledLoginCallback(), new Delete.DisabledCallback());
    local.delete();
    session.close();
}
Also used : Delete(ch.cyberduck.core.features.Delete) DisabledX509TrustManager(ch.cyberduck.core.ssl.DisabledX509TrustManager) Scheme(ch.cyberduck.core.Scheme) OutputStream(java.io.OutputStream) TransferStatus(ch.cyberduck.core.transfer.TransferStatus) Path(ch.cyberduck.core.Path) DisabledStreamListener(ch.cyberduck.core.io.DisabledStreamListener) InputStream(java.io.InputStream) Local(ch.cyberduck.core.Local) Host(ch.cyberduck.core.Host) DisabledCancelCallback(ch.cyberduck.core.DisabledCancelCallback) BandwidthThrottle(ch.cyberduck.core.io.BandwidthThrottle) DisabledHostKeyCallback(ch.cyberduck.core.DisabledHostKeyCallback) DisabledLoginCallback(ch.cyberduck.core.DisabledLoginCallback) 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 43 with DefaultX509KeyManager

use of ch.cyberduck.core.ssl.DefaultX509KeyManager in project cyberduck by iterate-ch.

the class SpectraDirectoryFeatureTest method testCreatePlaceholder.

@Test
public void testCreatePlaceholder() 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());
    final AtomicBoolean b = new AtomicBoolean();
    final Path container = new Path("cyberduck", EnumSet.of(Path.Type.directory, Path.Type.volume));
    final String name = UUID.randomUUID().toString();
    session.withListener(new TranscriptListener() {

        @Override
        public void log(final Type request, final String message) {
            switch(request) {
                case request:
                    if ((String.format("PUT /%s/%s/ HTTP/1.1", container.getName(), name)).equals(message)) {
                        b.set(true);
                    }
            }
        }
    });
    session.open(Proxy.DIRECT, new DisabledHostKeyCallback(), new DisabledLoginCallback(), new DisabledCancelCallback());
    session.login(Proxy.DIRECT, new DisabledLoginCallback(), new DisabledCancelCallback());
    final Path test = new SpectraDirectoryFeature(session, new SpectraWriteFeature(session)).mkdir(new Path(container, name, EnumSet.of(Path.Type.directory)), new TransferStatus());
    assertTrue(b.get());
    assertTrue(new SpectraFindFeature(session).find(test));
    assertTrue(new DefaultFindFeature(session).find(test));
    new SpectraDeleteFeature(session).delete(Collections.<Path>singletonList(test), new DisabledLoginCallback(), new Delete.DisabledCallback());
    session.close();
}
Also used : Path(ch.cyberduck.core.Path) Delete(ch.cyberduck.core.features.Delete) DisabledX509TrustManager(ch.cyberduck.core.ssl.DisabledX509TrustManager) Scheme(ch.cyberduck.core.Scheme) Host(ch.cyberduck.core.Host) TranscriptListener(ch.cyberduck.core.TranscriptListener) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) DisabledCancelCallback(ch.cyberduck.core.DisabledCancelCallback) DefaultFindFeature(ch.cyberduck.core.shared.DefaultFindFeature) DisabledHostKeyCallback(ch.cyberduck.core.DisabledHostKeyCallback) DisabledLoginCallback(ch.cyberduck.core.DisabledLoginCallback) TransferStatus(ch.cyberduck.core.transfer.TransferStatus) DefaultX509KeyManager(ch.cyberduck.core.ssl.DefaultX509KeyManager) Credentials(ch.cyberduck.core.Credentials) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest)

Example 44 with DefaultX509KeyManager

use of ch.cyberduck.core.ssl.DefaultX509KeyManager in project cyberduck by iterate-ch.

the class SpectraFindFeatureTest method testFindBucket.

@Test
public void testFindBucket() 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("cyberduck", EnumSet.of(Path.Type.directory, Path.Type.volume));
    assertTrue(new SpectraFindFeature(session).find(container));
    session.close();
}
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) DefaultX509KeyManager(ch.cyberduck.core.ssl.DefaultX509KeyManager) Credentials(ch.cyberduck.core.Credentials) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest)

Example 45 with DefaultX509KeyManager

use of ch.cyberduck.core.ssl.DefaultX509KeyManager in project cyberduck by iterate-ch.

the class SpectraFindFeatureTest method testFindUnknownBucket.

@Test
public void testFindUnknownBucket() 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 test = new Path(UUID.randomUUID().toString(), EnumSet.of(Path.Type.volume, Path.Type.directory));
    assertFalse(new SpectraFindFeature(session).find(test));
    session.close();
}
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) DefaultX509KeyManager(ch.cyberduck.core.ssl.DefaultX509KeyManager) Credentials(ch.cyberduck.core.Credentials) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest)

Aggregations

DefaultX509KeyManager (ch.cyberduck.core.ssl.DefaultX509KeyManager)176 Test (org.junit.Test)155 DisabledX509TrustManager (ch.cyberduck.core.ssl.DisabledX509TrustManager)145 Host (ch.cyberduck.core.Host)136 IntegrationTest (ch.cyberduck.test.IntegrationTest)124 DisabledLoginCallback (ch.cyberduck.core.DisabledLoginCallback)111 Credentials (ch.cyberduck.core.Credentials)103 DisabledCancelCallback (ch.cyberduck.core.DisabledCancelCallback)99 DisabledHostKeyCallback (ch.cyberduck.core.DisabledHostKeyCallback)97 Path (ch.cyberduck.core.Path)86 Scheme (ch.cyberduck.core.Scheme)51 TransferStatus (ch.cyberduck.core.transfer.TransferStatus)45 Delete (ch.cyberduck.core.features.Delete)40 DisabledProgressListener (ch.cyberduck.core.DisabledProgressListener)36 LoginOptions (ch.cyberduck.core.LoginOptions)31 LoginConnectionService (ch.cyberduck.core.LoginConnectionService)30 ProfilePlistReader (ch.cyberduck.core.serializer.impl.dd.ProfilePlistReader)30 DefaultX509TrustManager (ch.cyberduck.core.ssl.DefaultX509TrustManager)30 TransferItem (ch.cyberduck.core.transfer.TransferItem)27 DisabledPasswordStore (ch.cyberduck.core.DisabledPasswordStore)26