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());
}
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();
}
Aggregations