Search in sources :

Example 21 with DefaultX509KeyManager

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

the class OfflineGraphCopyMoveFeatureTest method testOneDrive.

@Test
public void testOneDrive() {
    final OneDriveSession session = new OneDriveSession(new Host(new TestProtocol()), new DisabledX509TrustManager(), new DefaultX509KeyManager());
    final Object feature = session.getFeature(this.feature);
    final List<TestCase> cases = new ArrayList<>();
    // Rename Tests
    // Assumption: Cyberduck always uses same source and target path to indicate rename.
    cases.add(new TestCase("/Test", directory, false));
    cases.add(new TestCase("/My Files", directory, false));
    cases.add(new TestCase("/Shared", directory, false));
    cases.add(new TestCase("/Shared/Element", file, false));
    cases.add(new TestCase("/My Files/Element", file, true));
    cases.add(new TestCase("/My Files/Folder/Element", file, true));
    cases.add(new TestCase("/Shared/Folder/Element", file, true));
    // Move/Copy-Tests
    // Assumption: Cyberduck always uses target directory without name to indicate drag.
    // Target always is folder.
    cases.add(new TestCase("/My Files", directory, "/Shared", false));
    cases.add(new TestCase("/Shared", directory, "/My Files", false));
    cases.add(new TestCase("/Shared/Element", file, "/My Files", false));
    cases.add(new TestCase("/Shared/Element", file, "/My Files/Folder", false));
    cases.add(new TestCase("/Shared/Element", file, "/Shared/Folder", false));
    cases.add(new TestCase("/Shared/Element", file, "/Shared/Folder/Folder", false));
    cases.add(new TestCase("/Shared/Folder/Element", file, "/Shared", false));
    // CAUTION! This is moving a file from /Shared/Folder to /Shared/Test
    cases.add(new TestCase("/Shared/Folder/Element", file, "/Shared/Test", true));
    cases.add(new TestCase("/Shared/Folder/Element", file, "/My Files", false));
    cases.add(new TestCase("/Shared/Folder/Element", file, "/My Files/Element", false));
    cases.add(new TestCase("/My Files/Element", file, "/My Files/Folder", true));
    cases.add(new TestCase("/My Files/Folder/Element", file, "/My Files", true));
    cases.add(new TestCase("/Shared/Folder/Element", file, "/Shared/Folder", true));
    cases.add(new TestCase("/Shared/Folder/Element", file, "/Shared/Folder/Folder", true));
    test(feature, cases);
}
Also used : DisabledX509TrustManager(ch.cyberduck.core.ssl.DisabledX509TrustManager) TestProtocol(ch.cyberduck.core.TestProtocol) ArrayList(java.util.ArrayList) Host(ch.cyberduck.core.Host) DefaultX509KeyManager(ch.cyberduck.core.ssl.DefaultX509KeyManager) Test(org.junit.Test)

Example 22 with DefaultX509KeyManager

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

the class OneDriveBusinessContextLoginTest method testLogin.

@Test(expected = LoginCanceledException.class)
public void testLogin() throws Exception {
    final ProtocolFactory factory = new ProtocolFactory(new HashSet<>(Collections.singleton(new OneDriveProtocol())));
    final Profile profile = new ProfilePlistReader(factory).read(this.getClass().getResourceAsStream("/Microsoft SharePoint.cyberduckprofile"));
    final Host host = new Host(profile, profile.getDefaultHostname());
    final OneDriveSession session = new OneDriveSession(host, new DefaultX509TrustManager(), new DefaultX509KeyManager());
    new LoginConnectionService(new DisabledLoginCallback() {

        @Override
        public Credentials prompt(final Host bookmark, final String username, final String title, final String reason, final LoginOptions options) throws LoginCanceledException {
            assertEquals("OAuth2 Authentication", title);
            throw new LoginCanceledException();
        }
    }, new DisabledHostKeyCallback(), new DisabledPasswordStore() {

        @Override
        public String getPassword(Scheme scheme, int port, String hostname, String user) {
            if ("Microsoft OneDrive Business OAuth2 Access Token".equals(user)) {
                return System.getProperties().getProperty("onedrive.business.accesstoken");
            }
            if ("Microsoft OneDrive Business OAuth2 Refresh Token".equals(user)) {
                return System.getProperties().getProperty("onedrive.business.refreshtoken");
            }
            return null;
        }

        @Override
        public String getPassword(String hostname, String user) {
            return super.getPassword(hostname, user);
        }
    }, new DisabledProgressListener()).connect(session, new DisabledCancelCallback());
    assertEquals("/b!9prv2DvXt0Cua27a0kKBHlYP69u02QdCtkueQRimv8UsYPDHr-_uQoMvBiuYAjdH", (new OneDriveHomeFinderService().find().getAbsolute()));
}
Also used : DisabledProgressListener(ch.cyberduck.core.DisabledProgressListener) Scheme(ch.cyberduck.core.Scheme) LoginConnectionService(ch.cyberduck.core.LoginConnectionService) LoginCanceledException(ch.cyberduck.core.exception.LoginCanceledException) Host(ch.cyberduck.core.Host) ProfilePlistReader(ch.cyberduck.core.serializer.impl.dd.ProfilePlistReader) Profile(ch.cyberduck.core.Profile) ProtocolFactory(ch.cyberduck.core.ProtocolFactory) LoginOptions(ch.cyberduck.core.LoginOptions) DisabledCancelCallback(ch.cyberduck.core.DisabledCancelCallback) DisabledHostKeyCallback(ch.cyberduck.core.DisabledHostKeyCallback) DisabledLoginCallback(ch.cyberduck.core.DisabledLoginCallback) DefaultX509KeyManager(ch.cyberduck.core.ssl.DefaultX509KeyManager) DisabledPasswordStore(ch.cyberduck.core.DisabledPasswordStore) DefaultX509TrustManager(ch.cyberduck.core.ssl.DefaultX509TrustManager) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest)

Example 23 with DefaultX509KeyManager

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

the class WebsiteCloudFrontDistributionConfigurationTest method testGetOrigin.

@Test
public void testGetOrigin() throws Exception {
    final WebsiteCloudFrontDistributionConfiguration configuration = new WebsiteCloudFrontDistributionConfiguration(session, new DisabledX509TrustManager(), new DefaultX509KeyManager());
    final Path container = new Path("test-eu-central-1-cyberduck", EnumSet.of(Path.Type.directory, Path.Type.volume));
    assertEquals("test-eu-central-1-cyberduck.s3.amazonaws.com", configuration.getOrigin(container, Distribution.DOWNLOAD).getHost());
    assertEquals("test-eu-central-1-cyberduck.s3.amazonaws.com", configuration.getOrigin(container, Distribution.WEBSITE).getHost());
    assertEquals("test-eu-central-1-cyberduck.s3-website-eu-central-1.amazonaws.com", configuration.getOrigin(container, Distribution.WEBSITE_CDN).getHost());
}
Also used : Path(ch.cyberduck.core.Path) DisabledX509TrustManager(ch.cyberduck.core.ssl.DisabledX509TrustManager) DefaultX509KeyManager(ch.cyberduck.core.ssl.DefaultX509KeyManager) AbstractS3Test(ch.cyberduck.core.s3.AbstractS3Test) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest)

Example 24 with DefaultX509KeyManager

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

the class CloudFrontDistributionConfigurationTest method testGetOrigin.

@Test
public void testGetOrigin() throws Exception {
    final S3Session session = new S3Session(new Host(new S3Protocol(), new S3Protocol().getDefaultHostname()));
    final CloudFrontDistributionConfiguration configuration = new CloudFrontDistributionConfiguration(session, new DisabledX509TrustManager(), new DefaultX509KeyManager());
    assertEquals("bbb.s3.amazonaws.com", configuration.getOrigin(new Path("/bbb", EnumSet.of(Path.Type.directory, Path.Type.volume)), Distribution.DOWNLOAD).getHost());
}
Also used : Path(ch.cyberduck.core.Path) DisabledX509TrustManager(ch.cyberduck.core.ssl.DisabledX509TrustManager) S3Session(ch.cyberduck.core.s3.S3Session) Host(ch.cyberduck.core.Host) DefaultX509KeyManager(ch.cyberduck.core.ssl.DefaultX509KeyManager) S3Protocol(ch.cyberduck.core.s3.S3Protocol) AbstractS3Test(ch.cyberduck.core.s3.AbstractS3Test) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest)

Example 25 with DefaultX509KeyManager

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

the class CloudFrontDistributionConfigurationTest method testWriteNewStreaming.

@Test
public void testWriteNewStreaming() throws Exception {
    final AtomicBoolean set = new AtomicBoolean();
    final CloudFrontDistributionConfiguration configuration = new CloudFrontDistributionConfiguration(session, new DisabledX509TrustManager(), new DefaultX509KeyManager()) {

        @Override
        protected UpdateStreamingDistributionResult updateStreamingDistribution(final Path container, final Distribution distribution) {
            fail();
            return null;
        }

        @Override
        protected StreamingDistribution createStreamingDistribution(final Path container, final Distribution distribution) {
            set.set(true);
            return new StreamingDistribution().withId("");
        }
    };
    final Path container = new Path(UUID.randomUUID().toString(), EnumSet.of(Path.Type.directory, Path.Type.volume));
    final Distribution distribution = new Distribution(Distribution.STREAMING, true);
    configuration.write(container, distribution, new DisabledLoginCallback());
    assertTrue(set.get());
}
Also used : Path(ch.cyberduck.core.Path) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) DisabledX509TrustManager(ch.cyberduck.core.ssl.DisabledX509TrustManager) Distribution(ch.cyberduck.core.cdn.Distribution) StreamingDistribution(com.amazonaws.services.cloudfront.model.StreamingDistribution) DisabledLoginCallback(ch.cyberduck.core.DisabledLoginCallback) DefaultX509KeyManager(ch.cyberduck.core.ssl.DefaultX509KeyManager) StreamingDistribution(com.amazonaws.services.cloudfront.model.StreamingDistribution) AbstractS3Test(ch.cyberduck.core.s3.AbstractS3Test) 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