本文整理汇总了Java中com.amazonaws.services.s3.model.InitiateMultipartUploadResult类的典型用法代码示例。如果您正苦于以下问题:Java InitiateMultipartUploadResult类的具体用法?Java InitiateMultipartUploadResult怎么用?Java InitiateMultipartUploadResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
InitiateMultipartUploadResult类属于com.amazonaws.services.s3.model包,在下文中一共展示了InitiateMultipartUploadResult类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testGetters
import com.amazonaws.services.s3.model.InitiateMultipartUploadResult; //导入依赖的package包/类
@Test
void testGetters() {
assertEquals(S3WritableObjectChannel.MIN_PART_SIZE, builder.getPartSize());
assertEquals(123, builder.partSize(123).getPartSize());
assertEquals(amazonS3, builder.amazonS3());
assertEquals(executorService, builder.executorService());
assertEquals("upldId", builder.uploadId());
assertEquals("bucket", builder.bucket());
assertEquals("key", builder.key());
assertEquals(2, builder.failedPartUploadRetries());
assertFalse(builder.hasDelayedHeader());
assertFalse(builder.closeExecutorOnChannelClose());
assertTrue(builder.defaultCachedThreadPoolExecutor().closeExecutorOnChannelClose());
InitiateMultipartUploadResult r = new InitiateMultipartUploadResult();
r.setBucketName("bucket1");
r.setKey("key1");
r.setUploadId("upldId1");
builder.initiateMultipartUploadResult(r);
assertEquals("upldId1", builder.uploadId());
assertEquals("bucket1", builder.bucket());
assertEquals("key1", builder.key());
builder.executorService().shutdown();
}
开发者ID:mentegy,项目名称:s3-channels,代码行数:26,代码来源:S3WritableObjectChannelBuilderTest.java
示例2: shouldListMultipartUploads
import com.amazonaws.services.s3.model.InitiateMultipartUploadResult; //导入依赖的package包/类
/**
* Tests if not yet completed / aborted multipart uploads are listed.
*
* @throws Exception not expected
*/
@Test
public void shouldListMultipartUploads() throws Exception {
s3Client.createBucket(BUCKET_NAME);
assertThat(s3Client.listMultipartUploads(new ListMultipartUploadsRequest(BUCKET_NAME))
.getMultipartUploads(), is(empty()));
final InitiateMultipartUploadResult initiateMultipartUploadResult = s3Client
.initiateMultipartUpload(new InitiateMultipartUploadRequest(BUCKET_NAME, UPLOAD_FILE_NAME));
final String uploadId = initiateMultipartUploadResult.getUploadId();
final MultipartUploadListing listing =
s3Client.listMultipartUploads(new ListMultipartUploadsRequest(BUCKET_NAME));
assertThat(listing.getMultipartUploads(), is(not(empty())));
assertThat(listing.getBucketName(), equalTo(BUCKET_NAME));
assertThat(listing.getMultipartUploads(), hasSize(1));
final MultipartUpload upload = listing.getMultipartUploads().get(0);
assertThat(upload.getUploadId(), equalTo(uploadId));
assertThat(upload.getKey(), equalTo(UPLOAD_FILE_NAME));
}
开发者ID:adobe,项目名称:S3Mock,代码行数:26,代码来源:AmazonClientUploadIT.java
示例3: shouldAbortMultipartUpload
import com.amazonaws.services.s3.model.InitiateMultipartUploadResult; //导入依赖的package包/类
/**
* Tests if a multipart upload can be aborted.
*
* @throws Exception not expected
*/
@Test
public void shouldAbortMultipartUpload() throws Exception {
s3Client.createBucket(BUCKET_NAME);
assertThat(s3Client.listMultipartUploads(new ListMultipartUploadsRequest(BUCKET_NAME))
.getMultipartUploads(), is(empty()));
final InitiateMultipartUploadResult initiateMultipartUploadResult = s3Client
.initiateMultipartUpload(new InitiateMultipartUploadRequest(BUCKET_NAME, UPLOAD_FILE_NAME));
final String uploadId = initiateMultipartUploadResult.getUploadId();
assertThat(s3Client.listMultipartUploads(new ListMultipartUploadsRequest(BUCKET_NAME))
.getMultipartUploads(), is(not(empty())));
s3Client.abortMultipartUpload(
new AbortMultipartUploadRequest(BUCKET_NAME, UPLOAD_FILE_NAME, uploadId));
assertThat(s3Client.listMultipartUploads(new ListMultipartUploadsRequest(BUCKET_NAME))
.getMultipartUploads(), is(empty()));
}
开发者ID:adobe,项目名称:S3Mock,代码行数:26,代码来源:AmazonClientUploadIT.java
示例4: processTuple
import com.amazonaws.services.s3.model.InitiateMultipartUploadResult; //导入依赖的package包/类
/**
* For the input file, initiate the upload and emit the UploadFileMetadata through the fileMetadataOutput,
* uploadMetadataOutput ports.
* @param tuple given tuple
*/
protected void processTuple(AbstractFileSplitter.FileMetadata tuple)
{
if (currentWindowId <= windowDataManager.getLargestCompletedWindow()) {
return;
}
String keyName = getKeyName(tuple.getFilePath());
String uploadId = "";
if (tuple.getNumberOfBlocks() > 1) {
InitiateMultipartUploadRequest initRequest = new InitiateMultipartUploadRequest(bucketName, keyName);
initRequest.setObjectMetadata(createObjectMetadata());
InitiateMultipartUploadResult initResponse = s3Client.initiateMultipartUpload(initRequest);
uploadId = initResponse.getUploadId();
}
UploadFileMetadata uploadFileMetadata = new UploadFileMetadata(tuple, uploadId, keyName);
fileMetadataOutput.emit(uploadFileMetadata);
uploadMetadataOutput.emit(uploadFileMetadata);
currentWindowRecoveryState.add(uploadFileMetadata);
}
开发者ID:apache,项目名称:apex-malhar,代码行数:24,代码来源:S3InitiateFileUploadOperator.java
示例5: testInitiateUpload
import com.amazonaws.services.s3.model.InitiateMultipartUploadResult; //导入依赖的package包/类
@Test
public void testInitiateUpload()
{
InitiateMultipartUploadResult result = new InitiateMultipartUploadResult();
result.setUploadId(uploadId);
MockitoAnnotations.initMocks(this);
when(client.initiateMultipartUpload(any(InitiateMultipartUploadRequest.class))).thenReturn(result);
when(fileMetadata.getFilePath()).thenReturn("/tmp/file1.txt");
when(fileMetadata.getNumberOfBlocks()).thenReturn(4);
S3InitiateFileUploadTest operator = new S3InitiateFileUploadTest();
operator.setBucketName("testbucket");
operator.setup(context);
CollectorTestSink<S3InitiateFileUploadOperator.UploadFileMetadata> fileSink = new CollectorTestSink<>();
CollectorTestSink<Object> tmp = (CollectorTestSink)fileSink;
operator.fileMetadataOutput.setSink(tmp);
operator.beginWindow(0);
operator.processTuple(fileMetadata);
operator.endWindow();
S3InitiateFileUploadOperator.UploadFileMetadata emitted = (S3InitiateFileUploadOperator.UploadFileMetadata)tmp.collectedTuples.get(0);
Assert.assertEquals("Upload ID :", uploadId, emitted.getUploadId());
}
开发者ID:apache,项目名称:apex-malhar,代码行数:26,代码来源:S3InitiateFileUploadOperatorTest.java
示例6: testAtomicMpuAbort
import com.amazonaws.services.s3.model.InitiateMultipartUploadResult; //导入依赖的package包/类
@Test
public void testAtomicMpuAbort() throws Exception {
String key = "testAtomicMpuAbort";
ObjectMetadata metadata = new ObjectMetadata();
metadata.setContentLength(BYTE_SOURCE.size());
client.putObject(containerName, key, BYTE_SOURCE.openStream(),
metadata);
InitiateMultipartUploadRequest initRequest =
new InitiateMultipartUploadRequest(containerName, key);
InitiateMultipartUploadResult initResponse =
client.initiateMultipartUpload(initRequest);
String uploadId = initResponse.getUploadId();
client.abortMultipartUpload(new AbortMultipartUploadRequest(
containerName, key, uploadId));
S3Object object = client.getObject(containerName, key);
assertThat(object.getObjectMetadata().getContentLength()).isEqualTo(
BYTE_SOURCE.size());
try (InputStream actual = object.getObjectContent();
InputStream expected = BYTE_SOURCE.openStream()) {
assertThat(actual).hasContentEqualTo(expected);
}
}
开发者ID:gaul,项目名称:s3proxy,代码行数:26,代码来源:AwsSdkTest.java
示例7: testPartNumberMarker
import com.amazonaws.services.s3.model.InitiateMultipartUploadResult; //导入依赖的package包/类
@Test
public void testPartNumberMarker() throws Exception {
String blobName = "foo";
InitiateMultipartUploadResult result = client.initiateMultipartUpload(
new InitiateMultipartUploadRequest(containerName, blobName));
ListPartsRequest request = new ListPartsRequest(containerName,
blobName, result.getUploadId());
client.listParts(request.withPartNumberMarker(0));
try {
client.listParts(request.withPartNumberMarker(1));
Fail.failBecauseExceptionWasNotThrown(AmazonS3Exception.class);
} catch (AmazonS3Exception e) {
assertThat(e.getErrorCode()).isEqualTo("NotImplemented");
}
}
开发者ID:gaul,项目名称:s3proxy,代码行数:18,代码来源:AwsSdkTest.java
示例8: initiateMultipartUpload
import com.amazonaws.services.s3.model.InitiateMultipartUploadResult; //导入依赖的package包/类
private String initiateMultipartUpload() throws IOException {
boolean operationSuccessful = false;
final InitiateMultipartUploadRequest request = new InitiateMultipartUploadRequest(this.bucket, this.object);
if (this.useRRS) {
request.setStorageClass(StorageClass.ReducedRedundancy);
} else {
request.setStorageClass(StorageClass.Standard);
}
try {
final InitiateMultipartUploadResult result = this.s3Client.initiateMultipartUpload(request);
operationSuccessful = true;
return result.getUploadId();
} catch (AmazonServiceException e) {
throw new IOException(StringUtils.stringifyException(e));
} finally {
if (!operationSuccessful) {
abortUpload();
}
}
}
开发者ID:citlab,项目名称:vs.msc.ws14,代码行数:25,代码来源:S3DataOutputStream.java
示例9: initiateMultipartUploadResult
import com.amazonaws.services.s3.model.InitiateMultipartUploadResult; //导入依赖的package包/类
/**
* Retrieves bucket, key and uploadId from {@link InitiateMultipartUploadResult}
*/
public S3WritableObjectChannelBuilder initiateMultipartUploadResult(InitiateMultipartUploadResult result) {
bucket(result.getBucketName());
key(result.getKey());
uploadId(result.getUploadId());
return this;
}
开发者ID:mentegy,项目名称:s3-channels,代码行数:10,代码来源:S3WritableObjectChannelBuilder.java
示例10: initiateMultipartUploadSecurely
import com.amazonaws.services.s3.model.InitiateMultipartUploadResult; //导入依赖的package包/类
@Override
public InitiateMultipartUploadResult initiateMultipartUploadSecurely(
InitiateMultipartUploadRequest req)
throws SdkClientException, AmazonServiceException {
return defaultCryptoMode == EncryptionOnly
? eo.initiateMultipartUploadSecurely(req)
: ae.initiateMultipartUploadSecurely(req)
;
}
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:10,代码来源:CryptoModuleDispatcher.java
示例11: initiateMultipartUpload
import com.amazonaws.services.s3.model.InitiateMultipartUploadResult; //导入依赖的package包/类
/**
* {@inheritDoc}
* <p>
* Use {@link EncryptedInitiateMultipartUploadRequest} to specify materialsDescription for the EncryptionMaterials to be used for this request.
* AmazonS3EncryptionClient would use {@link EncryptionMaterialsProvider#getEncryptionMaterials(java.util.Map)} to retrieve encryption materials
* corresponding to the materialsDescription specified in the current request.
* </p>
*/
@Override
public InitiateMultipartUploadResult initiateMultipartUpload(
InitiateMultipartUploadRequest req) {
boolean isCreateEncryptionMaterial = true;
if (req instanceof EncryptedInitiateMultipartUploadRequest) {
EncryptedInitiateMultipartUploadRequest cryptoReq =
(EncryptedInitiateMultipartUploadRequest) req;
isCreateEncryptionMaterial = cryptoReq.isCreateEncryptionMaterial();
}
return isCreateEncryptionMaterial
? crypto.initiateMultipartUploadSecurely(req)
: super.initiateMultipartUpload(req)
;
}
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:23,代码来源:AmazonS3EncryptionClient.java
示例12: getMockClient
import com.amazonaws.services.s3.model.InitiateMultipartUploadResult; //导入依赖的package包/类
private AmazonS3Client getMockClient() {
AmazonS3Client mockClient = spy(AmazonS3Client.class);
UploadPartResult uploadResult = new UploadPartResult();
uploadResult.setETag("foo");
doReturn(uploadResult).when(mockClient).uploadPart(any(UploadPartRequest.class));
InitiateMultipartUploadResult initUploadResult = new InitiateMultipartUploadResult();
initUploadResult.setUploadId("123");
doReturn(initUploadResult).when(mockClient)
.initiateMultipartUpload(any(InitiateMultipartUploadRequest.class));
return mockClient;
}
开发者ID:Nextdoor,项目名称:bender,代码行数:14,代码来源:S3TransporterTest.java
示例13: initiateMultipartUpload
import com.amazonaws.services.s3.model.InitiateMultipartUploadResult; //导入依赖的package包/类
@Override
public CompletableFuture<InitiateMultipartUploadResult> initiateMultipartUpload(String bucketName, String key) {
InitiateMultipartUploadRequest request = new InitiateMultipartUploadRequest(bucketName, key);
ObjectMetadata objectMetadata = new ObjectMetadata();
if (serverSideEncrypted) {
objectMetadata.setSSEAlgorithm(ObjectMetadata.AES_256_SERVER_SIDE_ENCRYPTION);
request.setObjectMetadata(objectMetadata);
}
return CompletableFuture.supplyAsync(() -> s3Client.initiateMultipartUpload(request), executorService);
}
开发者ID:cloudkeeper-project,项目名称:cloudkeeper,代码行数:11,代码来源:S3ConnectionImpl.java
示例14: initiateMultipartUpload
import com.amazonaws.services.s3.model.InitiateMultipartUploadResult; //导入依赖的package包/类
public String initiateMultipartUpload(S3Upload upload, String originalFilename) {
try {
runtimeCredentialsProvider.setAwsCredentials(upload.getAwsCredentials());
amazonS3.setRegion(Region.getRegion(Regions.fromName(upload.getRegion())));
ObjectMetadata objectMetadata = new ObjectMetadata();
objectMetadata.addUserMetadata("original-filename", originalFilename);
InitiateMultipartUploadResult result = amazonS3.initiateMultipartUpload(new InitiateMultipartUploadRequest(upload.getBucket(), upload.getKey(), objectMetadata));
return result.getUploadId();
} catch (AmazonClientException e) {
throw new OmakaseRuntimeException(e);
}
}
开发者ID:projectomakase,项目名称:omakase,代码行数:13,代码来源:S3Client.java
示例15: MultipartUploadState
import com.amazonaws.services.s3.model.InitiateMultipartUploadResult; //导入依赖的package包/类
MultipartUploadState(String bucketName, String prefix, String filename, long fileSizeBytes, InitiateMultipartUploadResult initResult) {
this.initResult = initResult;
this.fileSizeBytes = fileSizeBytes;
this.bucketName = bucketName;
this.prefix = prefix;
this.filename = filename;
}
开发者ID:peerindex,项目名称:s3-stream-uploader,代码行数:8,代码来源:MultipartUploadState.java
示例16: multipartUpload
import com.amazonaws.services.s3.model.InitiateMultipartUploadResult; //导入依赖的package包/类
private void multipartUpload(String key, File file, ObjectMetadata objectMetadata, Optional<StorageClass> maybeStorageClass) throws Exception {
List<PartETag> partETags = new ArrayList<>();
InitiateMultipartUploadRequest initRequest = new InitiateMultipartUploadRequest(bucketName, key, objectMetadata);
if (maybeStorageClass.isPresent()) {
initRequest.setStorageClass(maybeStorageClass.get());
}
InitiateMultipartUploadResult initResponse = s3Client.initiateMultipartUpload(initRequest);
long contentLength = file.length();
long partSize = configuration.getUploadPartSize();
try {
long filePosition = 0;
for (int i = 1; filePosition < contentLength; i++) {
partSize = Math.min(partSize, (contentLength - filePosition));
UploadPartRequest uploadRequest = new UploadPartRequest()
.withBucketName(bucketName)
.withKey(key)
.withUploadId(initResponse.getUploadId())
.withPartNumber(i)
.withFileOffset(filePosition)
.withFile(file)
.withPartSize(partSize);
partETags.add(s3Client.uploadPart(uploadRequest).getPartETag());
filePosition += partSize;
}
CompleteMultipartUploadRequest completeRequest = new CompleteMultipartUploadRequest(bucketName, key, initResponse.getUploadId(), partETags);
s3Client.completeMultipartUpload(completeRequest);
} catch (Exception e) {
s3Client.abortMultipartUpload(new AbortMultipartUploadRequest(bucketName, key, initResponse.getUploadId()));
Throwables.propagate(e);
}
}
开发者ID:HubSpot,项目名称:Singularity,代码行数:35,代码来源:SingularityS3Uploader.java
示例17: MultipartUploadOutputStream
import com.amazonaws.services.s3.model.InitiateMultipartUploadResult; //导入依赖的package包/类
public MultipartUploadOutputStream(AmazonS3 s3, ThreadPoolExecutor threadPool, Progressable progressable, String bucketName, String key, ObjectMetadata metadata, long partSize, File[] tempDirs)
/* */ {
/* 75 */ RetryPolicy basePolicy = RetryPolicies.retryUpToMaximumCountWithFixedSleep(4, 10L, TimeUnit.SECONDS);
/* 76 */ Map exceptionToPolicyMap = new HashMap();
/* */
/* 78 */ exceptionToPolicyMap.put(Exception.class, basePolicy);
/* */
/* 80 */ RetryPolicy methodPolicy = RetryPolicies.retryByException(RetryPolicies.TRY_ONCE_THEN_FAIL, exceptionToPolicyMap);
/* */
/* 82 */ Map methodNameToPolicyMap = new HashMap();
/* */
/* 84 */ methodNameToPolicyMap.put("completeMultipartUpload", methodPolicy);
/* */
/* 86 */ this.s3 = ((AmazonS3)RetryProxy.create(AmazonS3.class, s3, methodNameToPolicyMap));
/* 87 */ InitiateMultipartUploadResult result = this.s3.initiateMultipartUpload(new InitiateMultipartUploadRequest(bucketName, key).withObjectMetadata(metadata));
/* */
/* 89 */ this.threadPool = threadPool;
/* 90 */ this.progressable = progressable;
/* 91 */ this.futures = new ArrayList();
/* */
/* 93 */ this.tempDirs = tempDirs;
/* 94 */ this.bucketName = bucketName;
/* 95 */ this.key = key;
/* 96 */ this.uploadId = result.getUploadId();
/* 97 */ this.partSize = partSize;
/* */
/* 99 */ setTempFileAndOutput();
/* */ }
开发者ID:libin,项目名称:s3distcp,代码行数:29,代码来源:MultipartUploadOutputStream.java
示例18: initiateMultipartUpload
import com.amazonaws.services.s3.model.InitiateMultipartUploadResult; //导入依赖的package包/类
@Override
public InitiateMultipartUploadResult initiateMultipartUpload(InitiateMultipartUploadRequest request) throws AmazonClientException, AmazonServiceException {
return delegate.initiateMultipartUpload(request);
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:5,代码来源:AmazonS3Wrapper.java
示例19: initiateMultipartUpload
import com.amazonaws.services.s3.model.InitiateMultipartUploadResult; //导入依赖的package包/类
@Override
public InitiateMultipartUploadResult initiateMultipartUpload(InitiateMultipartUploadRequest initiateMultipartUploadRequest) throws AmazonClientException, AmazonServiceException {
throw new UnsupportedOperationException();
}
开发者ID:syndesisio,项目名称:syndesis,代码行数:5,代码来源:AmazonS3ClientMock.java
示例20: initMultiPart
import com.amazonaws.services.s3.model.InitiateMultipartUploadResult; //导入依赖的package包/类
protected InitiateMultipartUploadResult initMultiPart() {
defaultAmazonS3().deleteObject(testBucket, this.key);
return defaultAmazonS3().initiateMultipartUpload(new InitiateMultipartUploadRequest(testBucket, key));
}
开发者ID:mentegy,项目名称:s3-channels,代码行数:5,代码来源:AbstractS3WritableObjectChannelSuite.java
注:本文中的com.amazonaws.services.s3.model.InitiateMultipartUploadResult类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论