@Test @Deploy("org.nuxeo.ecm.core.storage.binarymanager.s3.tests:OSGI-INF/test-s3directupload-contrib.xml") public void testTokenRenewalNullBatchId() throws InterruptedException { S3DirectBatchHandler handler = (S3DirectBatchHandler) batchManager.getHandler("s3"); try { handler.refreshToken(null); fail("should not allow null batch ID"); } catch (NullPointerException e) { assertTrue(e.getMessage().contains("required batch ID")); } }
@Override public Map<String, Object> refreshToken(String batchId) { Objects.requireNonNull(batchId, "required batch ID"); Credentials credentials = getAwsCredentials(batchId); Map<String, Object> result = new HashMap<String, Object>(); result.put(INFO_AWS_SECRET_KEY_ID, credentials.getAccessKeyId()); result.put(INFO_AWS_SECRET_ACCESS_KEY, credentials.getSecretAccessKey()); result.put(INFO_AWS_SESSION_TOKEN, credentials.getSessionToken()); result.put(INFO_EXPIRATION, credentials.getExpiration().toInstant().toEpochMilli()); return result; }
S3DirectBatchHandler extends AbstractBatchHandler { @Override public Map<String, Object> refreshToken(String batchId) { Objects.requireNonNull(batchId, "required batch ID"); Credentials credentials = getAwsCredentials(batchId); Map<String, Object> result = new HashMap<String, Object>(); result.put(INFO_AWS_SECRET_KEY_ID, credentials.getAccessKeyId()); result.put(INFO_AWS_SECRET_ACCESS_KEY, credentials.getSecretAccessKey()); result.put(INFO_AWS_SESSION_TOKEN, credentials.getSessionToken()); result.put(INFO_EXPIRATION, credentials.getExpiration().toInstant().toEpochMilli()); return result; } }
S3DirectBatchHandler extends AbstractBatchHandler { @Override public Map<String, Object> refreshToken(String batchId) { Objects.requireNonNull(batchId, "required batch ID"); Credentials credentials = getAwsCredentials(batchId); Map<String, Object> result = new HashMap<String, Object>(); result.put(INFO_AWS_SECRET_KEY_ID, credentials.getAccessKeyId()); result.put(INFO_AWS_SECRET_ACCESS_KEY, credentials.getSecretAccessKey()); result.put(INFO_AWS_SESSION_TOKEN, credentials.getSessionToken()); result.put(INFO_EXPIRATION, credentials.getExpiration().toInstant().toEpochMilli()); return result; }  }
S3DirectBatchHandler extends AbstractBatchHandler { @Override public Map<String, Object> refreshToken(String batchId) { Objects.requireNonNull(batchId, "required batch ID"); Credentials credentials = getAwsCredentials(batchId); Map<String, Object> result = new HashMap<String, Object>(); result.put(INFO_AWS_SECRET_KEY_ID, credentials.getAccessKeyId()); result.put(INFO_AWS_SECRET_ACCESS_KEY, credentials.getSecretAccessKey()); result.put(INFO_AWS_SESSION_TOKEN, credentials.getSessionToken()); result.put(INFO_EXPIRATION, credentials.getExpiration().toInstant().toEpochMilli()); return result; }  @Override Batch getBatch(String batchId); @Override boolean completeUpload(String batchId, String fileIndex, BatchFileInfo fileInfo); @Override Map<String, Object> refreshToken(String batchId); }
S3DirectBatchHandler extends AbstractBatchHandler { @Override public Map<String, Object> refreshToken(String batchId) { Objects.requireNonNull(batchId, "required batch ID"); Credentials credentials = getAwsCredentials(batchId); Map<String, Object> result = new HashMap<String, Object>(); result.put(INFO_AWS_SECRET_KEY_ID, credentials.getAccessKeyId()); result.put(INFO_AWS_SECRET_ACCESS_KEY, credentials.getSecretAccessKey()); result.put(INFO_AWS_SESSION_TOKEN, credentials.getSessionToken()); result.put(INFO_EXPIRATION, credentials.getExpiration().toInstant().toEpochMilli()); return result; }  @Override Batch getBatch(String batchId); @Override boolean completeUpload(String batchId, String fileIndex, BatchFileInfo fileInfo); @Override Map<String, Object> refreshToken(String batchId); @Deprecated
    static final String ACCELERATE_MODE_ENABLED_PROPERTY; static final String POLICY_TEMPLATE_PROPERTY; static final String ROLE_ARN_PROPERTY; static final String BLOB_PROVIDER_ID_PROPERTY; static final String INFO_AWS_SECRET_KEY_ID; static final String INFO_AWS_SECRET_ACCESS_KEY; static final String INFO_AWS_SESSION_TOKEN; static final String INFO_BUCKET; static final String INFO_BASE_KEY; static final String INFO_EXPIRATION; static final String INFO_AWS_ENDPOINT; static final String INFO_AWS_PATH_STYLE_ACCESS; static final String INFO_AWS_REGION; static final String INFO_USE_S3_ACCELERATE; }