Search in sources :

Example 1 with OSSObjectOperation

use of com.aliyun.oss.internal.OSSObjectOperation in project aliyun-oss-java-sdk by aliyun.

the class OSSClient method initOperations.

private void initOperations() {
    this.bucketOperation = new OSSBucketOperation(this.serviceClient, this.credsProvider);
    this.objectOperation = new OSSObjectOperation(this.serviceClient, this.credsProvider);
    this.multipartOperation = new OSSMultipartOperation(this.serviceClient, this.credsProvider);
    this.corsOperation = new CORSOperation(this.serviceClient, this.credsProvider);
    this.uploadOperation = new OSSUploadOperation(this.multipartOperation);
    this.downloadOperation = new OSSDownloadOperation(objectOperation);
    this.liveChannelOperation = new LiveChannelOperation(this.serviceClient, this.credsProvider);
    this.udfOperation = new OSSUdfOperation(this.serviceClient, this.credsProvider);
}
Also used : CORSOperation(com.aliyun.oss.internal.CORSOperation) OSSUploadOperation(com.aliyun.oss.internal.OSSUploadOperation) OSSObjectOperation(com.aliyun.oss.internal.OSSObjectOperation) OSSMultipartOperation(com.aliyun.oss.internal.OSSMultipartOperation) OSSUdfOperation(com.aliyun.oss.internal.OSSUdfOperation) OSSBucketOperation(com.aliyun.oss.internal.OSSBucketOperation) OSSDownloadOperation(com.aliyun.oss.internal.OSSDownloadOperation) LiveChannelOperation(com.aliyun.oss.internal.LiveChannelOperation)

Example 2 with OSSObjectOperation

use of com.aliyun.oss.internal.OSSObjectOperation in project aliyun-oss-java-sdk by aliyun.

the class OSSObjectOperationTest method testPopulateCopyObjectHeaders.

@Test
public void testPopulateCopyObjectHeaders() throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, URISyntaxException {
    CopyObjectRequest request = new CopyObjectRequest("srcbucket", "srckey", "destbucket", "destkey");
    request.setServerSideEncryption(ObjectMetadata.AES_256_SERVER_SIDE_ENCRYPTION);
    Method[] testMethods = OSSObjectOperation.class.getDeclaredMethods();
    Method testMethod = null;
    for (Method m : testMethods) {
        if (m.getName().equals("populateCopyObjectHeaders")) {
            testMethod = m;
        }
    }
    testMethod.setAccessible(true);
    OSSObjectOperation operations = new OSSObjectOperation(new DefaultServiceClient(new ClientConfiguration()), new DefaultCredentialProvider(new DefaultCredentials("id", "key")));
    Map<String, String> headers = new HashMap<String, String>();
    Object[] params = new Object[2];
    params[0] = request;
    params[1] = headers;
    testMethod.invoke(operations, params);
    assertEquals("/srcbucket/srckey", headers.get(OSSHeaders.COPY_OBJECT_SOURCE));
    assertEquals(ObjectMetadata.AES_256_SERVER_SIDE_ENCRYPTION, headers.get(OSSHeaders.OSS_SERVER_SIDE_ENCRYPTION));
    assertEquals(null, headers.get(OSSHeaders.COPY_OBJECT_METADATA_DIRECTIVE));
}
Also used : OSSObjectOperation(com.aliyun.oss.internal.OSSObjectOperation) HashMap(java.util.HashMap) DefaultCredentialProvider(com.aliyun.oss.common.auth.DefaultCredentialProvider) Method(java.lang.reflect.Method) DefaultCredentials(com.aliyun.oss.common.auth.DefaultCredentials) CopyObjectRequest(com.aliyun.oss.model.CopyObjectRequest) DefaultServiceClient(com.aliyun.oss.common.comm.DefaultServiceClient) Test(org.junit.Test)

Aggregations

OSSObjectOperation (com.aliyun.oss.internal.OSSObjectOperation)2 DefaultCredentialProvider (com.aliyun.oss.common.auth.DefaultCredentialProvider)1 DefaultCredentials (com.aliyun.oss.common.auth.DefaultCredentials)1 DefaultServiceClient (com.aliyun.oss.common.comm.DefaultServiceClient)1 CORSOperation (com.aliyun.oss.internal.CORSOperation)1 LiveChannelOperation (com.aliyun.oss.internal.LiveChannelOperation)1 OSSBucketOperation (com.aliyun.oss.internal.OSSBucketOperation)1 OSSDownloadOperation (com.aliyun.oss.internal.OSSDownloadOperation)1 OSSMultipartOperation (com.aliyun.oss.internal.OSSMultipartOperation)1 OSSUdfOperation (com.aliyun.oss.internal.OSSUdfOperation)1 OSSUploadOperation (com.aliyun.oss.internal.OSSUploadOperation)1 CopyObjectRequest (com.aliyun.oss.model.CopyObjectRequest)1 Method (java.lang.reflect.Method)1 HashMap (java.util.HashMap)1 Test (org.junit.Test)1