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);
}
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()));
}
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());
}
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());
}
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());
}
Aggregations