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


Java Owner类代码示例

本文整理汇总了Java中com.amazonaws.services.s3.model.Owner的典型用法代码示例。如果您正苦于以下问题:Java Owner类的具体用法?Java Owner怎么用?Java Owner使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Owner类属于com.amazonaws.services.s3.model包,在下文中一共展示了Owner类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: shouldCreateBucketAndListAllBuckets

import com.amazonaws.services.s3.model.Owner; //导入依赖的package包/类
/**
 * Verify that buckets can be created and listed
 */
@Test
public void shouldCreateBucketAndListAllBuckets() {
  // the returned creation date might strip off the millisecond-part, resulting in rounding down
  // and account for a clock-skew in the Docker container of up to a minute.
  final Date creationDate = new Date((System.currentTimeMillis() / 1000) * 1000 - 60000);

  final Bucket bucket = s3Client.createBucket(BUCKET_NAME);
  assertThat(
      String.format("Bucket name should match '%s'!", BUCKET_NAME), bucket.getName(),
      equalTo(BUCKET_NAME));

  final List<Bucket> buckets =
      s3Client.listBuckets().stream().filter(b -> BUCKET_NAME.equals(b.getName()))
          .collect(Collectors.toList());

  assertThat("Expecting one bucket", buckets, hasSize(1));
  final Bucket createdBucket = buckets.get(0);

  assertThat(createdBucket.getCreationDate(), greaterThanOrEqualTo(creationDate));
  final Owner bucketOwner = createdBucket.getOwner();
  assertThat(bucketOwner.getDisplayName(), equalTo("s3-mock-file-store"));
  assertThat(bucketOwner.getId(), equalTo("123"));
}
 
开发者ID:adobe,项目名称:S3Mock,代码行数:27,代码来源:AmazonClientUploadIT.java

示例2: checkNewlyAddedBuckets

import com.amazonaws.services.s3.model.Owner; //导入依赖的package包/类
@Test
public void checkNewlyAddedBuckets() {
    Instant addedTime1 = LocalDateTime.of(2015, 10, 15, 12, 25).toInstant(ZoneOffset.UTC);
    Instant addedTime2 = LocalDateTime.of(2015, 10, 15, 13, 30).toInstant(ZoneOffset.UTC);
    when(clock.instant()).thenReturn(addedTime1, addedTime2);

    s3.createBucket("new_bucket_1");
    s3.createBucket("new_bucket_2");
    List<Bucket> buckets = s3.listBuckets();

    assertThat(buckets).hasSize(2);
    assertThat(getBucketWithName("new_bucket_1", buckets).getCreationDate()).isEqualTo(Date.from(addedTime1));
    assertThat(getBucketWithName("new_bucket_2", buckets).getCreationDate()).isEqualTo(Date.from(addedTime2));

    buckets.forEach(bucket -> {
        Owner owner = bucket.getOwner();
        assertThat(owner.getDisplayName()).isEqualTo("test");
        assertThat(owner.getId()).isNotEmpty();
    });
}
 
开发者ID:OpenG,项目名称:aws-java-sdk,代码行数:21,代码来源:AmazonS3FakeServiceTest.java

示例3: readFields

import com.amazonaws.services.s3.model.Owner; //导入依赖的package包/类
@Override
public void readFields(DataInput in) throws IOException {
	this.setBucketName(Text.readString(in));
	this.setKey(Text.readString(in));
	this.setETag(Text.readString(in));
	this.setStorageClass(Text.readString(in));
	
	// Set owner
	Owner owner = new Owner();
	owner.setId(Text.readString(in));
	owner.setDisplayName(Text.readString(in));
	
	this.setOwner(owner);
	this.setSize(in.readLong());
	this.setLastModified(new Date(in.readLong()));
}
 
开发者ID:disheng,项目名称:alfred-mpi,代码行数:17,代码来源:S3ObjectSummaryWritable.java

示例4: listBuckets

import com.amazonaws.services.s3.model.Owner; //导入依赖的package包/类
@Override
public List<Bucket> listBuckets() throws AmazonClientException, AmazonServiceException {
    ArrayList<Bucket> list = new ArrayList<Bucket>();
    Bucket bucket = new Bucket("camel-bucket");
    bucket.setOwner(new Owner("Camel", "camel"));
    bucket.setCreationDate(new Date());
    list.add(bucket);
    return list;
}
 
开发者ID:syndesisio,项目名称:syndesis,代码行数:10,代码来源:AmazonS3ClientMock.java

示例5: createBucket

import com.amazonaws.services.s3.model.Owner; //导入依赖的package包/类
@Override
public Bucket createBucket(CreateBucketRequest createBucketRequest) throws AmazonClientException, AmazonServiceException {
    if ("nonExistingBucket".equals(createBucketRequest.getBucketName())) {
        nonExistingBucketCreated = true; 
    }
    
    Bucket bucket = new Bucket();
    bucket.setName(createBucketRequest.getBucketName());
    bucket.setCreationDate(new Date());
    bucket.setOwner(new Owner("c2efc7302b9011ba9a78a92ac5fd1cd47b61790499ab5ddf5a37c31f0638a8fc ", "Christian Mueller"));
    return bucket;
}
 
开发者ID:syndesisio,项目名称:syndesis,代码行数:13,代码来源:AmazonS3ClientMock.java

示例6: getS3AccountOwner

import com.amazonaws.services.s3.model.Owner; //导入依赖的package包/类
@Override
public Owner getS3AccountOwner(GetS3AccountOwnerRequest getS3AccountOwnerRequest)
        throws SdkClientException, AmazonServiceException {
    getS3AccountOwnerRequest = beforeClientExecution(getS3AccountOwnerRequest);
    rejectNull(getS3AccountOwnerRequest, "The request object parameter getS3AccountOwnerRequest must be specified.");
    Request<GetS3AccountOwnerRequest> request = createRequest(null, null, getS3AccountOwnerRequest, HttpMethodName.GET);
    return invoke(request, new Unmarshallers.ListBucketsOwnerUnmarshaller(), null, null);
}
 
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:9,代码来源:AmazonS3Client.java

示例7: convertToXmlByteArray

import com.amazonaws.services.s3.model.Owner; //导入依赖的package包/类
/**
 * Converts the specified AccessControlList object to an XML fragment that
 * can be sent to Amazon S3.
 *
 * @param acl
 *            The AccessControlList to convert to XML.
 *
 * @return an XML representation of the Access Control List object, suitable
 *         to send in a request to Amazon S3.
 */
public byte[] convertToXmlByteArray(AccessControlList acl) throws SdkClientException {
    Owner owner = acl.getOwner();
    if (owner == null) {
        throw new SdkClientException("Invalid AccessControlList: missing an S3Owner");
    }

    XmlWriter xml = new XmlWriter();
    xml.start("AccessControlPolicy", "xmlns", Constants.XML_NAMESPACE);
    xml.start("Owner");
    if (owner.getId() != null) {
        xml.start("ID").value(owner.getId()).end();
    }
    if (owner.getDisplayName() != null) {
        xml.start("DisplayName").value(owner.getDisplayName()).end();
    }
    xml.end();
    xml.start("AccessControlList");
    for (Grant grant : acl.getGrantsAsList()) {
        xml.start("Grant");
        convertToXml(grant.getGrantee(), xml);
        xml.start("Permission").value(grant.getPermission().toString()).end();
        xml.end();
    }
    xml.end();
    xml.end();

    return xml.getBytes();
}
 
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:39,代码来源:AclXmlFactory.java

示例8: getObjectsInBucket

import com.amazonaws.services.s3.model.Owner; //导入依赖的package包/类
private List<S3ObjectSummary> getObjectsInBucket(Date... dates) {
    List<S3ObjectSummary> list = new ArrayList<S3ObjectSummary>();
    for (Date date : dates) {
        S3ObjectSummary s3Object = new S3ObjectSummary();
        s3Object.setKey("dummy-key");
        s3Object.setLastModified(date);
        s3Object.setOwner(new Owner("123", "username"));
        list.add(s3Object);
    }
    return list;
}
 
开发者ID:schibsted,项目名称:gocd-s3-poller,代码行数:12,代码来源:PackageRepositoryPollerTest.java

示例9: S3ImageStore

import com.amazonaws.services.s3.model.Owner; //导入依赖的package包/类
public S3ImageStore(String accessKey, String secretKey, String bucketName) {
	this.bucketName = bucketName;
	this.myAccessKeyID = accessKey;
	this.mySecretKey = secretKey;
	AWSCredentials myCredentials = new BasicAWSCredentials( myAccessKeyID, mySecretKey);
	s3Client = new AmazonS3Client(myCredentials);        
	Owner o = s3Client.getS3AccountOwner();
	log.info("using S3 as "+o.getDisplayName());
	List<Bucket> bl =s3Client.listBuckets();
	for(Bucket b : bl) {
		log.info("  bucket:"+b.getName());
	}
	
}
 
开发者ID:windbender,项目名称:wildlife-camera-machine,代码行数:15,代码来源:S3ImageStore.java

示例10: getS3AccountOwner

import com.amazonaws.services.s3.model.Owner; //导入依赖的package包/类
@Override
public Owner getS3AccountOwner() throws AmazonClientException, AmazonServiceException {
    return delegate.getS3AccountOwner();
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:5,代码来源:AmazonS3Wrapper.java

示例11: getOwnerName

import com.amazonaws.services.s3.model.Owner; //导入依赖的package包/类
/**
 * Get the owner's display name
 */
public String getOwnerName() {
    Owner owner = s3Summary.getOwner();
    return owner != null ? owner.getDisplayName() : null;
}
 
开发者ID:Axway,项目名称:ats-framework,代码行数:8,代码来源:S3ObjectInfo.java

示例12: getOwnerId

import com.amazonaws.services.s3.model.Owner; //导入依赖的package包/类
/**
 * Get the owner's Id.
 */
public String getOwnerId() {
    Owner owner = s3Summary.getOwner();
    return owner != null ? owner.getId() : null;
}
 
开发者ID:Axway,项目名称:ats-framework,代码行数:8,代码来源:S3ObjectInfo.java

示例13: getS3AccountOwner

import com.amazonaws.services.s3.model.Owner; //导入依赖的package包/类
@Override
public Owner getS3AccountOwner() throws AmazonClientException, AmazonServiceException {
    throw new UnsupportedOperationException();
}
 
开发者ID:syndesisio,项目名称:syndesis,代码行数:5,代码来源:AmazonS3ClientMock.java

示例14: getS3AccountOwner

import com.amazonaws.services.s3.model.Owner; //导入依赖的package包/类
@Override
public Owner getS3AccountOwner() throws SdkClientException, AmazonServiceException {
  return call(() -> getDelegate().getS3AccountOwner());
}
 
开发者ID:HubSpot,项目名称:S3Decorators,代码行数:5,代码来源:S3Decorator.java

示例15: OwnerAssert

import com.amazonaws.services.s3.model.Owner; //导入依赖的package包/类
protected OwnerAssert(Owner actual) {
    super(actual, OwnerAssert.class);
}
 
开发者ID:OpenG,项目名称:aws-java-sdk,代码行数:4,代码来源:OwnerAssert.java


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