當前位置: 首頁>>代碼示例>>Java>>正文


Java File.set方法代碼示例

本文整理匯總了Java中com.google.api.services.drive.model.File.set方法的典型用法代碼示例。如果您正苦於以下問題:Java File.set方法的具體用法?Java File.set怎麽用?Java File.set使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.api.services.drive.model.File的用法示例。


在下文中一共展示了File.set方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testSameFoldername

import com.google.api.services.drive.model.File; //導入方法依賴的package包/類
@Test
public void testSameFoldername() throws Exception {
    final String f1 = new AlphanumericRandomStringService().random();
    final String f2 = new AlphanumericRandomStringService().random();
    final Path parent = new Path(DriveHomeFinderService.MYDRIVE_FOLDER, f1, EnumSet.of(Path.Type.directory));
    final Path folder = new Path(parent, f2, EnumSet.of(Path.Type.directory));
    new DriveDirectoryFeature(session).mkdir(parent, null, new TransferStatus());
    new DriveDirectoryFeature(session).mkdir(folder, null, new TransferStatus());
    assertTrue(new DefaultFindFeature(session).find(folder));
    assertEquals(1, new DriveDefaultListService(session).list(parent, new DisabledListProgressListener()).size());
    final String fileid = new DriveFileidProvider(session).getFileid(folder, new DisabledListProgressListener());
    final File body = new File();
    body.set("trashed", true);
    session.getClient().files().update(fileid, body).execute();
    new DriveDirectoryFeature(session).mkdir(folder, null, new TransferStatus());
    assertEquals(2, new DriveDefaultListService(session).list(parent, new DisabledListProgressListener()).size());
    new DriveDeleteFeature(session).delete(Arrays.asList(parent), new DisabledLoginCallback(), new Delete.DisabledCallback());
    assertFalse(new DefaultFindFeature(session).find(parent));
}
 
開發者ID:iterate-ch,項目名稱:cyberduck,代碼行數:20,代碼來源:DriveDefaultListServiceTest.java

示例2: testGetFileidSameName

import com.google.api.services.drive.model.File; //導入方法依賴的package包/類
@Test
public void testGetFileidSameName() throws Exception {
    final Path test = new Path(DriveHomeFinderService.MYDRIVE_FOLDER, UUID.randomUUID().toString(), EnumSet.of(Path.Type.file));
    final Path p1 = new DriveTouchFeature(session).touch(test, new TransferStatus());
    assertEquals(p1.attributes().getVersionId(), new DriveFileidProvider(session).getFileid(test, new DisabledListProgressListener()));
    final File body = new File();
    body.set("trashed", true);
    session.getClient().files().update(p1.attributes().getVersionId(), body).execute();
    final Path p2 = new DriveTouchFeature(session).touch(test, new TransferStatus());
    assertEquals(p2.attributes().getVersionId(), new DriveFileidProvider(session).getFileid(test, new DisabledListProgressListener()));
    session.getClient().files().delete(p1.attributes().getVersionId());
    session.getClient().files().delete(p2.attributes().getVersionId());
}
 
開發者ID:iterate-ch,項目名稱:cyberduck,代碼行數:14,代碼來源:DriveFileidProviderTest.java


注:本文中的com.google.api.services.drive.model.File.set方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。