Search in sources :

Example 1 with CurrentTimeMillisSupplier

use of org.apache.druid.common.utils.CurrentTimeMillisSupplier in project druid by druid-io.

the class OssTaskLogsTest method testPushInternal.

private List<Grant> testPushInternal(boolean disableAcl, String ownerId, String ownerDisplayName) throws Exception {
    EasyMock.expect(ossClient.putObject(EasyMock.anyObject())).andReturn(new PutObjectResult()).once();
    AccessControlList aclExpected = new AccessControlList();
    aclExpected.setOwner(new Owner(ownerId, ownerDisplayName));
    EasyMock.expect(ossClient.getBucketAcl(TEST_BUCKET)).andReturn(aclExpected).once();
    EasyMock.expect(ossClient.putObject(EasyMock.anyObject(PutObjectRequest.class))).andReturn(new PutObjectResult()).once();
    EasyMock.replay(ossClient);
    OssTaskLogsConfig config = new OssTaskLogsConfig();
    config.setDisableAcl(disableAcl);
    config.setBucket(TEST_BUCKET);
    CurrentTimeMillisSupplier timeSupplier = new CurrentTimeMillisSupplier();
    OssInputDataConfig inputDataConfig = new OssInputDataConfig();
    OssTaskLogs taskLogs = new OssTaskLogs(ossClient, config, inputDataConfig, timeSupplier);
    String taskId = "index_test-datasource_2019-06-18T13:30:28.887Z";
    File logFile = tempFolder.newFile("test_log_file");
    taskLogs.pushTaskLog(taskId, logFile);
    return new ArrayList<>(aclExpected.getGrants());
}
Also used : AccessControlList(com.aliyun.oss.model.AccessControlList) Owner(com.aliyun.oss.model.Owner) PutObjectResult(com.aliyun.oss.model.PutObjectResult) CurrentTimeMillisSupplier(org.apache.druid.common.utils.CurrentTimeMillisSupplier) ArrayList(java.util.ArrayList) File(java.io.File)

Example 2 with CurrentTimeMillisSupplier

use of org.apache.druid.common.utils.CurrentTimeMillisSupplier in project druid by druid-io.

the class S3TaskLogsTest method testPushInternal.

private List<Grant> testPushInternal(boolean disableAcl, String ownerId, String ownerDisplayName) throws Exception {
    EasyMock.expect(s3Client.putObject(EasyMock.anyObject())).andReturn(new PutObjectResult()).once();
    AccessControlList aclExpected = new AccessControlList();
    aclExpected.setOwner(new Owner(ownerId, ownerDisplayName));
    EasyMock.expect(s3Client.getBucketAcl(TEST_BUCKET)).andReturn(aclExpected).once();
    EasyMock.expect(s3Client.putObject(EasyMock.anyObject(PutObjectRequest.class))).andReturn(new PutObjectResult()).once();
    EasyMock.replay(s3Client);
    S3TaskLogsConfig config = new S3TaskLogsConfig();
    config.setDisableAcl(disableAcl);
    config.setS3Bucket(TEST_BUCKET);
    CurrentTimeMillisSupplier timeSupplier = new CurrentTimeMillisSupplier();
    S3InputDataConfig inputDataConfig = new S3InputDataConfig();
    S3TaskLogs s3TaskLogs = new S3TaskLogs(s3Client, config, inputDataConfig, timeSupplier);
    String taskId = "index_test-datasource_2019-06-18T13:30:28.887Z";
    File logFile = tempFolder.newFile("test_log_file");
    s3TaskLogs.pushTaskLog(taskId, logFile);
    return aclExpected.getGrantsAsList();
}
Also used : AccessControlList(com.amazonaws.services.s3.model.AccessControlList) Owner(com.amazonaws.services.s3.model.Owner) PutObjectResult(com.amazonaws.services.s3.model.PutObjectResult) CurrentTimeMillisSupplier(org.apache.druid.common.utils.CurrentTimeMillisSupplier) File(java.io.File)

Aggregations

File (java.io.File)2 CurrentTimeMillisSupplier (org.apache.druid.common.utils.CurrentTimeMillisSupplier)2 AccessControlList (com.aliyun.oss.model.AccessControlList)1 Owner (com.aliyun.oss.model.Owner)1 PutObjectResult (com.aliyun.oss.model.PutObjectResult)1 AccessControlList (com.amazonaws.services.s3.model.AccessControlList)1 Owner (com.amazonaws.services.s3.model.Owner)1 PutObjectResult (com.amazonaws.services.s3.model.PutObjectResult)1 ArrayList (java.util.ArrayList)1