当前位置: 首页>>代码示例>>Java>>正文


Java Bucket.setDefaultObjectAcl方法代码示例

本文整理汇总了Java中com.google.api.services.storage.model.Bucket.setDefaultObjectAcl方法的典型用法代码示例。如果您正苦于以下问题:Java Bucket.setDefaultObjectAcl方法的具体用法?Java Bucket.setDefaultObjectAcl怎么用?Java Bucket.setDefaultObjectAcl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.api.services.storage.model.Bucket的用法示例。


在下文中一共展示了Bucket.setDefaultObjectAcl方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testRetryOn401

import com.google.api.services.storage.model.Bucket; //导入方法依赖的package包/类
@Test
public void testRetryOn401() throws Exception {
  final boolean sharedPublicly = false;
  final boolean forFailedJobs = true;
  final boolean showInline = false;
  final String pathPrefix = null;

  Bucket bucket = new Bucket();
  bucket.setName(BUCKET_NAME);
  bucket.setDefaultObjectAcl(Lists.newArrayList(new ObjectAccessControl()));

  final AbstractUpload.UploadSpec uploads =
      new AbstractUpload.UploadSpec(workspace,
          ImmutableList.of(workspaceFile, workspaceFile2));

  FakeUpload underTest = new FakeUpload(BUCKET_URI,
      sharedPublicly, forFailedJobs, showInline, pathPrefix,
      new MockUploadModule(executor), /* no retries */
      FAKE_DETAILS,
      uploads);

  executor.throwWhen(Storage.Buckets.Get.class, notFoundException);
  executor.passThruWhen(Storage.Buckets.Insert.class,
      MockUploadModule.checkBucketName(BUCKET_NAME));
  executor.passThruWhen(Storage.Objects.Insert.class,
      MockUploadModule.checkObjectName(FILENAME));
  executor.throwWhen(Storage.Objects.Insert.class,
      httpResponseException,
      MockUploadModule.checkObjectName(FILENAME2));
  executor.when(Storage.Buckets.Get.class, bucket);
  executor.passThruWhen(Storage.Objects.Insert.class,
      MockUploadModule.checkObjectName(FILENAME2));

  underTest.perform(CREDENTIALS_ID, build, TaskListener.NULL);
}
 
开发者ID:jenkinsci,项目名称:google-storage-plugin,代码行数:36,代码来源:AbstractUploadTest.java

示例2: testRetryOn401StillFails

import com.google.api.services.storage.model.Bucket; //导入方法依赖的package包/类
@Test(expected = UploadException.class)
public void testRetryOn401StillFails() throws Exception {
  final boolean sharedPublicly = false;
  final boolean forFailedJobs = true;
  final boolean showInline = false;
  final String pathPrefix = null;

  Bucket bucket = new Bucket();
  bucket.setName(BUCKET_NAME);
  bucket.setDefaultObjectAcl(Lists.newArrayList(new ObjectAccessControl()));

  final AbstractUpload.UploadSpec uploads =
      new AbstractUpload.UploadSpec(workspace,
          ImmutableList.of(workspaceFile));

  FakeUpload underTest = new FakeUpload(BUCKET_URI,
      sharedPublicly, forFailedJobs, showInline, pathPrefix,
      new MockUploadModule(executor), /* no retries */
      FAKE_DETAILS,
      uploads);

  int maxRetriesPlus1 =
      RetryStorageOperation.MAX_REMOTE_CREDENTIAL_EXPIRED_RETRIES + 1;

  for (int i = 0; i < maxRetriesPlus1; i++) {
    executor.when(Storage.Buckets.Get.class, bucket);
    executor.throwWhen(Storage.Objects.Insert.class,
        httpResponseException,
        MockUploadModule.checkObjectName(FILENAME));
  }

  underTest.perform(CREDENTIALS_ID, build, TaskListener.NULL);
}
 
开发者ID:jenkinsci,项目名称:google-storage-plugin,代码行数:34,代码来源:AbstractUploadTest.java

示例3: testBucketConflict

import com.google.api.services.storage.model.Bucket; //导入方法依赖的package包/类
@Test
public void testBucketConflict() throws Exception {
  final boolean sharedPublicly = false;
  final boolean forFailedJobs = true;
  final boolean showInline = false;
  final String pathPrefix = null;

  final AbstractUpload.UploadSpec uploads =
      new AbstractUpload.UploadSpec(workspace, ImmutableList.<FilePath>of());

  FakeUpload underTest = new FakeUpload(BUCKET_URI,
      sharedPublicly, forFailedJobs, showInline, pathPrefix,
      new MockUploadModule(executor),
      FAKE_DETAILS,
      uploads);

  Bucket bucket = new Bucket();
  bucket.setName(BUCKET_NAME);
  bucket.setDefaultObjectAcl(Lists.newArrayList(new ObjectAccessControl()));

  executor.throwWhen(Storage.Buckets.Get.class, notFoundException);
  executor.throwWhen(Storage.Buckets.Insert.class, conflictException,
      MockUploadModule.checkBucketName(BUCKET_NAME));
  executor.when(Storage.Buckets.Get.class, bucket);

  underTest.perform(CREDENTIALS_ID, build, TaskListener.NULL);
}
 
开发者ID:jenkinsci,项目名称:google-storage-plugin,代码行数:28,代码来源:AbstractUploadTest.java

示例4: testNotShared

import com.google.api.services.storage.model.Bucket; //导入方法依赖的package包/类
@Test
public void testNotShared() throws Exception {
  final boolean sharedPublicly = false;
  final boolean forFailedJobs = true;
  final boolean showInline = false;
  final String pathPrefix = null;

  final AbstractUpload.UploadSpec uploads =
      new AbstractUpload.UploadSpec(workspace,
          ImmutableList.of(workspaceFile));

  FakeUpload underTest = new FakeUpload(BUCKET_URI,
      sharedPublicly, forFailedJobs, showInline, pathPrefix,
      new MockUploadModule(executor),
      FAKE_DETAILS,
      uploads);

  Bucket bucket = new Bucket();
  bucket.setName(BUCKET_NAME);
  bucket.setDefaultObjectAcl(Lists.newArrayList(new ObjectAccessControl()));

  executor.when(Storage.Buckets.Get.class, bucket);
  executor.passThruWhen(Storage.Objects.Insert.class,
      new Predicate<Storage.Objects.Insert>() {
        @Override
        public boolean apply(Storage.Objects.Insert operation) {
          StorageObject object = (StorageObject) operation.getJsonContent();

          assertNull(object.getAcl());
          return true;
        }
      });

  underTest.perform(CREDENTIALS_ID, build, TaskListener.NULL);
}
 
开发者ID:jenkinsci,项目名称:google-storage-plugin,代码行数:36,代码来源:AbstractUploadTest.java

示例5: testSharedPublicly

import com.google.api.services.storage.model.Bucket; //导入方法依赖的package包/类
@Test
public void testSharedPublicly() throws Exception {
  final boolean sharedPublicly = true;
  final boolean forFailedJobs = true;
  final boolean showInline = false;
  final String pathPrefix = null;

  final AbstractUpload.UploadSpec uploads =
      new AbstractUpload.UploadSpec(workspace,
          ImmutableList.of(workspaceFile));

  FakeUpload underTest = new FakeUpload(BUCKET_URI,
      sharedPublicly, forFailedJobs, showInline, pathPrefix,
      new MockUploadModule(executor),
      FAKE_DETAILS,
      uploads);

  final Bucket bucket = new Bucket();
  bucket.setName(BUCKET_NAME);
  bucket.setDefaultObjectAcl(Lists.newArrayList(new ObjectAccessControl()));

  executor.when(Storage.Buckets.Get.class, bucket);
  executor.passThruWhen(Storage.Objects.Insert.class,
      new Predicate<Storage.Objects.Insert>() {
        @Override
        public boolean apply(Storage.Objects.Insert operation) {
          StorageObject object = (StorageObject) operation.getJsonContent();

          assertTrue(object.getAcl().containsAll(
              bucket.getDefaultObjectAcl()));

          List<ObjectAccessControl> addedAcl =
              Lists.newArrayList(Iterables.filter(
                  object.getAcl(), not(in(bucket.getDefaultObjectAcl()))));
          Set<String> addedEntities = Sets.newHashSet();
          for (ObjectAccessControl access : addedAcl) {
            assertEquals("READER", access.getRole());
            addedEntities.add(access.getEntity());
          }
          assertTrue(addedEntities.contains("allUsers"));
          return true;
        }
      });

  underTest.perform(CREDENTIALS_ID, build, TaskListener.NULL);
}
 
开发者ID:jenkinsci,项目名称:google-storage-plugin,代码行数:47,代码来源:AbstractUploadTest.java


注:本文中的com.google.api.services.storage.model.Bucket.setDefaultObjectAcl方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。