use of ch.cyberduck.core.sds.io.swagger.client.model.ObjectExpiration in project cyberduck by iterate-ch.
the class SDSSharesUrlProviderTest method testShareTopLevelRoom.
@Test
public void testShareTopLevelRoom() throws Exception {
final SDSNodeIdProvider nodeid = new SDSNodeIdProvider(session);
final Path room = new SDSDirectoryFeature(session, nodeid).mkdir(new Path(new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory, Path.Type.volume)), new TransferStatus());
final DescriptiveUrl url = new SDSSharesUrlProvider(session, nodeid).toDownloadUrl(room, new CreateDownloadShareRequest().expiration(new ObjectExpiration().enableExpiration(false)).notifyCreator(false).sendMail(false).sendSms(false).password(null).mailRecipients(null).mailSubject(null).mailBody(null).maxDownloads(null), new DisabledPasswordCallback());
assertNotEquals(DescriptiveUrl.EMPTY, url);
assertEquals(DescriptiveUrl.Type.signed, url.getType());
assertTrue(url.getUrl().startsWith("https://duck.dracoon.com/#/public/shares-downloads/"));
new SDSDeleteFeature(session, nodeid).delete(Collections.singletonList(room), new DisabledLoginCallback(), new Delete.DisabledCallback());
}
use of ch.cyberduck.core.sds.io.swagger.client.model.ObjectExpiration in project cyberduck by iterate-ch.
the class SDSSharesUrlProviderTest method testEncryptedMissingPassword.
@Test(expected = LoginCanceledException.class)
public void testEncryptedMissingPassword() throws Exception {
final SDSNodeIdProvider nodeid = new SDSNodeIdProvider(session);
final Path room = new SDSDirectoryFeature(session, nodeid).createRoom(new Path(new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory, Path.Type.volume)), true);
final Path test = new SDSTouchFeature(session, nodeid).touch(new Path(room, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)), new TransferStatus());
try {
final DescriptiveUrl url = new SDSSharesUrlProvider(session, nodeid).toDownloadUrl(test, new CreateDownloadShareRequest().expiration(new ObjectExpiration().enableExpiration(false)).notifyCreator(false).sendMail(false).sendSms(false).password(null).mailRecipients(null).mailSubject(null).mailBody(null).maxDownloads(null), new DisabledPasswordCallback());
} finally {
new SDSDeleteFeature(session, nodeid).delete(Collections.singletonList(room), new DisabledLoginCallback(), new Delete.DisabledCallback());
}
}
use of ch.cyberduck.core.sds.io.swagger.client.model.ObjectExpiration in project cyberduck by iterate-ch.
the class SDSSharesUrlProviderTest method testToUrlInvalidSMSRecipients.
@Test(expected = InteroperabilityException.class)
public void testToUrlInvalidSMSRecipients() throws Exception {
final SDSNodeIdProvider nodeid = new SDSNodeIdProvider(session);
final Path room = new SDSDirectoryFeature(session, nodeid).mkdir(new Path(new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory, Path.Type.volume)), new TransferStatus());
final Path test = new SDSTouchFeature(session, nodeid).touch(new Path(room, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)), new TransferStatus());
try {
final DescriptiveUrl url = new SDSSharesUrlProvider(session, nodeid).toDownloadUrl(test, new CreateDownloadShareRequest().expiration(new ObjectExpiration().enableExpiration(false)).notifyCreator(false).sendMail(false).mailRecipients(null).sendSms(true).smsRecipients("invalid").password("p").mailSubject(null).mailBody(null).maxDownloads(null), new DisabledPasswordCallback());
} finally {
new SDSDeleteFeature(session, nodeid).delete(Collections.singletonList(room), new DisabledLoginCallback(), new Delete.DisabledCallback());
}
}
use of ch.cyberduck.core.sds.io.swagger.client.model.ObjectExpiration in project cyberduck by iterate-ch.
the class SDSSharesUrlProviderTest method testUploadAccountSubRoom.
@Test
public void testUploadAccountSubRoom() throws Exception {
final SDSNodeIdProvider nodeid = new SDSNodeIdProvider(session);
final Path room = new SDSDirectoryFeature(session, nodeid).mkdir(new Path(new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory, Path.Type.volume)), new TransferStatus());
final Path test = new SDSDirectoryFeature(session, nodeid).mkdir(new Path(room, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory)), new TransferStatus());
final DescriptiveUrl url = new SDSSharesUrlProvider(session, nodeid).toUploadUrl(test, new CreateUploadShareRequest().name(new AlphanumericRandomStringService().random()).expiration(new ObjectExpiration().enableExpiration(false)).notifyCreator(false).sendMail(false).sendSms(false).password(null).mailRecipients(null).mailSubject(null).mailBody(null).maxSize(null).maxSlots(null).notes(null).filesExpiryPeriod(null), new DisabledPasswordCallback());
assertNotEquals(DescriptiveUrl.EMPTY, url);
assertEquals(DescriptiveUrl.Type.signed, url.getType());
assertTrue(url.getUrl().startsWith("https://duck.dracoon.com/#/public/shares-uploads/"));
new SDSDeleteFeature(session, nodeid).delete(Collections.singletonList(room), new DisabledLoginCallback(), new Delete.DisabledCallback());
}
use of ch.cyberduck.core.sds.io.swagger.client.model.ObjectExpiration in project cyberduck by iterate-ch.
the class SDSSharesUrlProviderTest method testToUrlInvalidEmail.
@Test(expected = InteroperabilityException.class)
public void testToUrlInvalidEmail() throws Exception {
final SDSNodeIdProvider nodeid = new SDSNodeIdProvider(session);
final Path room = new SDSDirectoryFeature(session, nodeid).mkdir(new Path(new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory, Path.Type.volume)), new TransferStatus());
final Path test = new SDSTouchFeature(session, nodeid).touch(new Path(room, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)), new TransferStatus());
try {
final DescriptiveUrl url = new SDSSharesUrlProvider(session, nodeid).toDownloadUrl(test, new CreateDownloadShareRequest().expiration(new ObjectExpiration().enableExpiration(false)).notifyCreator(false).sendMail(true).mailRecipients("a@b").sendSms(false).mailSubject(null).mailBody(null).maxDownloads(null), new DisabledPasswordCallback());
} finally {
new SDSDeleteFeature(session, nodeid).delete(Collections.singletonList(room), new DisabledLoginCallback(), new Delete.DisabledCallback());
}
}
Aggregations