Search in sources :

Example 1 with GoogleDriveFileObject

use of org.pentaho.googledrive.vfs.GoogleDriveFileObject in project pentaho-kettle by pentaho.

the class GoogleDriveFileObjectTest method testFileObject.

@Test
public void testFileObject() throws Exception {
    FileSystemManager manager = mock(FileSystemManager.class);
    GoogleDriveFileObject fileObjectMock = mock(GoogleDriveFileObject.class);
    when(manager.resolveFile(FOLDER)).thenReturn(fileObjectMock);
    when(fileObjectMock.isFolder()).thenReturn(true);
    when(fileObjectMock.exists()).thenReturn(true);
    when(fileObjectMock.delete()).thenReturn(true);
    FileObject fileObject = manager.resolveFile(FOLDER);
    fileObject.createFolder();
    assertTrue(fileObject.isFolder());
    assertTrue(fileObject.exists());
    assertTrue(fileObject.delete());
    assertNull(fileObject.getChildren());
}
Also used : GoogleDriveFileObject(org.pentaho.googledrive.vfs.GoogleDriveFileObject) GoogleDriveFileObject(org.pentaho.googledrive.vfs.GoogleDriveFileObject) FileObject(org.apache.commons.vfs2.FileObject) FileSystemManager(org.apache.commons.vfs2.FileSystemManager) Test(org.junit.Test)

Aggregations

FileObject (org.apache.commons.vfs2.FileObject)1 FileSystemManager (org.apache.commons.vfs2.FileSystemManager)1 Test (org.junit.Test)1 GoogleDriveFileObject (org.pentaho.googledrive.vfs.GoogleDriveFileObject)1