@Test public void testTouch() throws Exception { final DriveFileidProvider fileid = new DriveFileidProvider(session).withCache(cache); final Path test = new DriveTouchFeature(session, fileid).touch( new Path(DriveHomeFinderService.MYDRIVE_FOLDER, UUID.randomUUID().toString(), EnumSet.of(Path.Type.file)), new TransferStatus().withMime("x-application/cyberduck")); assertNotNull(test.attributes().getVersionId()); assertEquals(test.attributes().getVersionId(), new DriveAttributesFinderFeature(session, fileid).find(test).getVersionId()); new DriveDeleteFeature(session, fileid).delete(Collections.singletonList(test), new DisabledLoginCallback(), new Delete.DisabledCallback()); }
@Override public Path touch(final Path file, final TransferStatus status) throws BackgroundException { try { final Drive.Files.Create insert = session.getClient().files().create(new File() .setName(file.getName()) .setMimeType(status.getMime()) .setParents(Collections.singletonList(fileid.getFileid(file.getParent(), new DisabledListProgressListener())))); final File execute = insert.setSupportsTeamDrives(PreferencesFactory.get().getBoolean("googledrive.teamdrive.enable")).execute(); return new Path(file.getParent(), file.getName(), file.getType(), new DriveAttributesFinderFeature(session, fileid).toAttributes(execute)); } catch(IOException e) { throw new DriveExceptionMappingService().map("Cannot create file {0}", e, file); } }
DriveTouchFeature implements Touch<VersionId> { @Override public Path touch(final Path file, final TransferStatus status) throws BackgroundException { try { final Drive.Files.Create insert = session.getClient().files().create(new File() .setName(file.getName()) .setMimeType(status.getMime()) .setParents(Collections.singletonList(fileid.getFileid(file.getParent(), new DisabledListProgressListener())))); final File execute = insert.setSupportsTeamDrives(PreferencesFactory.get().getBoolean("googledrive.teamdrive.enable")).execute(); return new Path(file.getParent(), file.getName(), file.getType(), new DriveAttributesFinderFeature(session, fileid).toAttributes(execute)); } catch(IOException e) { throw new DriveExceptionMappingService().map("Cannot create file {0}", e, file); } } }
DriveTouchFeature implements Touch<VersionId> { @Override public Path touch(final Path file, final TransferStatus status) throws BackgroundException { try { final Drive.Files.Create insert = session.getClient().files().create(new File() .setName(file.getName()) .setMimeType(status.getMime()) .setParents(Collections.singletonList(fileid.getFileid(file.getParent(), new DisabledListProgressListener())))); final File execute = insert.setSupportsTeamDrives(PreferencesFactory.get().getBoolean("googledrive.teamdrive.enable")).execute(); return new Path(file.getParent(), file.getName(), file.getType(), new DriveAttributesFinderFeature(session, fileid).toAttributes(execute)); } catch(IOException e) { throw new DriveExceptionMappingService().map("Cannot create file {0}", e, file); } } DriveTouchFeature(final DriveSession session, final DriveFileidProvider fileid); }
DriveTouchFeature implements Touch<VersionId> { @Override public Path touch(final Path file, final TransferStatus status) throws BackgroundException { try { final Drive.Files.Create insert = session.getClient().files().create(new File() .setName(file.getName()) .setMimeType(status.getMime()) .setParents(Collections.singletonList(fileid.getFileid(file.getParent(), new DisabledListProgressListener())))); final File execute = insert.setSupportsTeamDrives(PreferencesFactory.get().getBoolean("googledrive.teamdrive.enable")).execute(); return new Path(file.getParent(), file.getName(), file.getType(), new DriveAttributesFinderFeature(session, fileid).toAttributes(execute)); } catch(IOException e) { throw new DriveExceptionMappingService().map("Cannot create file {0}", e, file); } } DriveTouchFeature(final DriveSession session, final DriveFileidProvider fileid); @Override Path touch(final Path file, final TransferStatus status); @Override DriveTouchFeature withWriter(final Write<VersionId> writer); @Override boolean isSupported(final Path workdir, final String filename); }
DriveTouchFeature implements Touch<VersionId> { @Override public Path touch(final Path file, final TransferStatus status) throws BackgroundException { try { final Drive.Files.Create insert = session.getClient().files().create(new File() .setName(file.getName()) .setMimeType(status.getMime()) .setParents(Collections.singletonList(fileid.getFileid(file.getParent(), new DisabledListProgressListener())))); final File execute = insert.setSupportsTeamDrives(PreferencesFactory.get().getBoolean("googledrive.teamdrive.enable")).execute(); return new Path(file.getParent(), file.getName(), file.getType(), new DriveAttributesFinderFeature(session, fileid).toAttributes(execute)); } catch(IOException e) { throw new DriveExceptionMappingService().map("Cannot create file {0}", e, file); } } DriveTouchFeature(final DriveSession session, final DriveFileidProvider fileid); @Override Path touch(final Path file, final TransferStatus status); @Override DriveTouchFeature withWriter(final Write<VersionId> writer); @Override boolean isSupported(final Path workdir, final String filename);  }