use of ch.cyberduck.core.onedrive.features.GraphTouchFeature in project cyberduck by iterate-ch.
the class GraphItemListServiceTest method testListDriveChildren.
@Test
public void testListDriveChildren() throws Exception {
final Path file = new Path(new OneDriveHomeFinderService().find(), new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file));
new GraphTouchFeature(session, fileid).touch(file, new TransferStatus());
assertNotNull(new GraphAttributesFinderFeature(session, fileid).find(file));
final GraphItemListService listService = new GraphItemListService(session, fileid);
final Path drive = new OneDriveHomeFinderService().find();
final AttributedList<Path> list = listService.list(drive, new DisabledListProgressListener());
assertFalse(list.isEmpty());
for (Path f : list) {
assertEquals(drive.getName(), f.getParent().getName());
final PathAttributes attributes = f.attributes();
assertNotEquals(-1L, attributes.getSize());
assertNotEquals(-1L, attributes.getCreationDate());
assertNotEquals(-1L, attributes.getModificationDate());
assertNotNull(attributes.getETag());
assertNotNull(attributes.getFileId());
assertNotNull(attributes.getLink());
}
new GraphDeleteFeature(session, fileid).delete(Collections.singletonList(file), new DisabledLoginCallback(), new Delete.DisabledCallback());
}
use of ch.cyberduck.core.onedrive.features.GraphTouchFeature in project cyberduck by iterate-ch.
the class GraphItemListServiceTest method testListLexicographically.
@Test
public void testListLexicographically() throws Exception {
final Path directory = new GraphDirectoryFeature(session, fileid).mkdir(new Path(new OneDriveHomeFinderService().find(), new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory)), new TransferStatus());
final Path f2 = new GraphTouchFeature(session, fileid).touch(new Path(directory, "aa", EnumSet.of(Path.Type.file)), new TransferStatus());
final Path f1 = new GraphTouchFeature(session, fileid).touch(new Path(directory, "a", EnumSet.of(Path.Type.file)), new TransferStatus());
final AttributedList<Path> list = new GraphItemListService(session, fileid).list(directory, new DisabledListProgressListener());
assertEquals(2, list.size());
assertEquals(new SimplePathPredicate(f1), new SimplePathPredicate(list.get(0)));
assertEquals(new SimplePathPredicate(f2), new SimplePathPredicate(list.get(1)));
new GraphDeleteFeature(session, fileid).delete(Arrays.asList(f1, f2, directory), new DisabledPasswordCallback(), new Delete.DisabledCallback());
}
use of ch.cyberduck.core.onedrive.features.GraphTouchFeature in project cyberduck by iterate-ch.
the class GraphMoveFeatureTest method testMoveToRoot.
@Test
public void testMoveToRoot() throws BackgroundException {
final Directory directory = new GraphDirectoryFeature(session, fileid);
final Touch touch = new GraphTouchFeature(session, fileid);
final Move move = new GraphMoveFeature(session, fileid);
final Delete delete = new GraphDeleteFeature(session, fileid);
final AttributesFinder attributesFinder = new GraphAttributesFinderFeature(session, fileid);
final Path drive = new OneDriveHomeFinderService().find();
Path targetDirectory = new Path(drive, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory));
directory.mkdir(targetDirectory, new TransferStatus());
assertNotNull(attributesFinder.find(targetDirectory));
Path touchedFile = new Path(targetDirectory, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file));
touch.touch(touchedFile, new TransferStatus().withMime("x-application/cyberduck"));
assertNotNull(attributesFinder.find(touchedFile));
Path rename = new Path(drive, touchedFile.getName(), EnumSet.of(Path.Type.file));
assertTrue(move.isSupported(touchedFile, rename));
move.move(touchedFile, rename, new TransferStatus(), new Delete.DisabledCallback(), new DisabledConnectionCallback());
assertNotNull(attributesFinder.find(rename));
delete.delete(Collections.singletonList(targetDirectory), new DisabledLoginCallback(), new Delete.DisabledCallback());
delete.delete(Collections.singletonList(rename), new DisabledLoginCallback(), new Delete.DisabledCallback());
}
use of ch.cyberduck.core.onedrive.features.GraphTouchFeature in project cyberduck by iterate-ch.
the class GraphMoveFeatureTest method testMoveRename.
@Test
public void testMoveRename() throws BackgroundException {
final Directory directory = new GraphDirectoryFeature(session, fileid);
final Touch touch = new GraphTouchFeature(session, fileid);
final Move move = new GraphMoveFeature(session, fileid);
final Delete delete = new GraphDeleteFeature(session, fileid);
final AttributesFinder attributesFinder = new GraphAttributesFinderFeature(session, fileid);
final Path drive = new OneDriveHomeFinderService().find();
Path targetDirectory = new Path(drive, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory));
directory.mkdir(targetDirectory, new TransferStatus());
assertNotNull(attributesFinder.find(targetDirectory));
Path touchedFile = new Path(drive, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file));
touch.touch(touchedFile, new TransferStatus().withMime("x-application/cyberduck"));
assertNotNull(attributesFinder.find(touchedFile));
Path rename = new Path(targetDirectory, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file));
assertTrue(move.isSupported(touchedFile, rename));
move.move(touchedFile, rename, new TransferStatus(), new Delete.DisabledCallback(), new DisabledConnectionCallback());
assertNotNull(attributesFinder.find(rename));
delete.delete(Collections.singletonList(targetDirectory), new DisabledLoginCallback(), new Delete.DisabledCallback());
}
use of ch.cyberduck.core.onedrive.features.GraphTouchFeature in project cyberduck by iterate-ch.
the class GraphReadFeatureTest method testReadInvalidRange.
@Test(expected = NotfoundException.class)
public void testReadInvalidRange() throws Exception {
final Path drive = new OneDriveHomeFinderService().find();
final Path test = new Path(drive, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file));
new GraphTouchFeature(session, fileid).touch(test, new TransferStatus());
final GraphReadFeature read = new GraphReadFeature(session, fileid);
final InputStream in = read.read(test, new TransferStatus().withOffset(1).append(true), new DisabledConnectionCallback());
assertNull(in);
}
Aggregations