Search in sources :

Example 6 with GraphTouchFeature

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());
}
Also used : Path(ch.cyberduck.core.Path) Delete(ch.cyberduck.core.features.Delete) DisabledListProgressListener(ch.cyberduck.core.DisabledListProgressListener) GraphAttributesFinderFeature(ch.cyberduck.core.onedrive.features.GraphAttributesFinderFeature) PathAttributes(ch.cyberduck.core.PathAttributes) GraphTouchFeature(ch.cyberduck.core.onedrive.features.GraphTouchFeature) DisabledLoginCallback(ch.cyberduck.core.DisabledLoginCallback) TransferStatus(ch.cyberduck.core.transfer.TransferStatus) GraphDeleteFeature(ch.cyberduck.core.onedrive.features.GraphDeleteFeature) AlphanumericRandomStringService(ch.cyberduck.core.AlphanumericRandomStringService) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest)

Example 7 with GraphTouchFeature

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());
}
Also used : Path(ch.cyberduck.core.Path) Delete(ch.cyberduck.core.features.Delete) DisabledListProgressListener(ch.cyberduck.core.DisabledListProgressListener) GraphTouchFeature(ch.cyberduck.core.onedrive.features.GraphTouchFeature) GraphDirectoryFeature(ch.cyberduck.core.onedrive.features.GraphDirectoryFeature) TransferStatus(ch.cyberduck.core.transfer.TransferStatus) GraphDeleteFeature(ch.cyberduck.core.onedrive.features.GraphDeleteFeature) AlphanumericRandomStringService(ch.cyberduck.core.AlphanumericRandomStringService) SimplePathPredicate(ch.cyberduck.core.SimplePathPredicate) DisabledPasswordCallback(ch.cyberduck.core.DisabledPasswordCallback) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest)

Example 8 with GraphTouchFeature

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());
}
Also used : Delete(ch.cyberduck.core.features.Delete) Path(ch.cyberduck.core.Path) GraphAttributesFinderFeature(ch.cyberduck.core.onedrive.features.GraphAttributesFinderFeature) AttributesFinder(ch.cyberduck.core.features.AttributesFinder) GraphMoveFeature(ch.cyberduck.core.onedrive.features.GraphMoveFeature) Touch(ch.cyberduck.core.features.Touch) GraphTouchFeature(ch.cyberduck.core.onedrive.features.GraphTouchFeature) GraphDirectoryFeature(ch.cyberduck.core.onedrive.features.GraphDirectoryFeature) Move(ch.cyberduck.core.features.Move) DisabledLoginCallback(ch.cyberduck.core.DisabledLoginCallback) GraphDeleteFeature(ch.cyberduck.core.onedrive.features.GraphDeleteFeature) TransferStatus(ch.cyberduck.core.transfer.TransferStatus) AlphanumericRandomStringService(ch.cyberduck.core.AlphanumericRandomStringService) DisabledConnectionCallback(ch.cyberduck.core.DisabledConnectionCallback) Directory(ch.cyberduck.core.features.Directory) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest)

Example 9 with GraphTouchFeature

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());
}
Also used : Delete(ch.cyberduck.core.features.Delete) Path(ch.cyberduck.core.Path) GraphAttributesFinderFeature(ch.cyberduck.core.onedrive.features.GraphAttributesFinderFeature) AttributesFinder(ch.cyberduck.core.features.AttributesFinder) GraphMoveFeature(ch.cyberduck.core.onedrive.features.GraphMoveFeature) Touch(ch.cyberduck.core.features.Touch) GraphTouchFeature(ch.cyberduck.core.onedrive.features.GraphTouchFeature) GraphDirectoryFeature(ch.cyberduck.core.onedrive.features.GraphDirectoryFeature) Move(ch.cyberduck.core.features.Move) DisabledLoginCallback(ch.cyberduck.core.DisabledLoginCallback) GraphDeleteFeature(ch.cyberduck.core.onedrive.features.GraphDeleteFeature) TransferStatus(ch.cyberduck.core.transfer.TransferStatus) AlphanumericRandomStringService(ch.cyberduck.core.AlphanumericRandomStringService) DisabledConnectionCallback(ch.cyberduck.core.DisabledConnectionCallback) Directory(ch.cyberduck.core.features.Directory) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest)

Example 10 with GraphTouchFeature

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);
}
Also used : Path(ch.cyberduck.core.Path) InputStream(java.io.InputStream) TransferStatus(ch.cyberduck.core.transfer.TransferStatus) GraphReadFeature(ch.cyberduck.core.onedrive.features.GraphReadFeature) AlphanumericRandomStringService(ch.cyberduck.core.AlphanumericRandomStringService) GraphTouchFeature(ch.cyberduck.core.onedrive.features.GraphTouchFeature) DisabledConnectionCallback(ch.cyberduck.core.DisabledConnectionCallback) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest)

Aggregations

AlphanumericRandomStringService (ch.cyberduck.core.AlphanumericRandomStringService)22 Path (ch.cyberduck.core.Path)22 GraphTouchFeature (ch.cyberduck.core.onedrive.features.GraphTouchFeature)22 TransferStatus (ch.cyberduck.core.transfer.TransferStatus)22 IntegrationTest (ch.cyberduck.test.IntegrationTest)22 Test (org.junit.Test)22 Delete (ch.cyberduck.core.features.Delete)21 GraphDeleteFeature (ch.cyberduck.core.onedrive.features.GraphDeleteFeature)21 DisabledLoginCallback (ch.cyberduck.core.DisabledLoginCallback)20 GraphAttributesFinderFeature (ch.cyberduck.core.onedrive.features.GraphAttributesFinderFeature)13 DisabledConnectionCallback (ch.cyberduck.core.DisabledConnectionCallback)12 GraphDirectoryFeature (ch.cyberduck.core.onedrive.features.GraphDirectoryFeature)7 GraphMoveFeature (ch.cyberduck.core.onedrive.features.GraphMoveFeature)5 GraphReadFeature (ch.cyberduck.core.onedrive.features.GraphReadFeature)5 InputStream (java.io.InputStream)5 DisabledListProgressListener (ch.cyberduck.core.DisabledListProgressListener)4 AttributesFinder (ch.cyberduck.core.features.AttributesFinder)4 Move (ch.cyberduck.core.features.Move)4 Touch (ch.cyberduck.core.features.Touch)4 DisabledStreamListener (ch.cyberduck.core.io.DisabledStreamListener)4