From 2a2bc883e8f69b9bda1758249dfb5f6f5ea456d9 Mon Sep 17 00:00:00 2001 From: Claudia Agache Date: Mon, 31 Aug 2020 17:31:01 +0300 Subject: [PATCH 1/4] added class to interact with Amazon S3 --- .travis.yml | 2 +- .../org/alfresco/rest/core/RMRestProperties.java | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 4714b39982..fd914e96ad 100644 --- a/.travis.yml +++ b/.travis.yml @@ -107,7 +107,7 @@ jobs: - bash scripts/create-worm-bucket.sh - bash scripts/start-compose.sh "${ENTERPRISE_SHARE_PATH}/docker-compose-worm-support-rest.yml" - bash scripts/waitForAlfrescoToStart.sh - script: mvn -B test -pl :alfresco-governance-services-automation-enterprise-rest-api -DsuiteXmlFile=wormTestSuite.xml -Dskip.automationtests=false + script: mvn -B test -pl :alfresco-governance-services-automation-enterprise-rest-api -DsuiteXmlFile=wormTestSuite.xml -Dskip.automationtests=false -Ds3.accessKey=${AWS_ACCESS_KEY_ID} -Ds3.secretKey=${AWS_SECRET_ACCESS_KEY} -Ds3.bucketName=${S3_BUCKET2_NAME} -Ds3.bucketRegion=${S3_BUCKET_REGION} after_script: bash scripts/cleanup.sh after_failure: docker ps -a | grep '_alfresco_1' | awk '{print $1}' | xargs docker logs | tail -5000 diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/RMRestProperties.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/RMRestProperties.java index b5ffec459a..29deb88610 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/RMRestProperties.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/RMRestProperties.java @@ -59,4 +59,16 @@ public class RMRestProperties extends RestProperties @Value ("${docker.host}") private String dockerHost; + + @Value ("${s3.accessKey}") + private String s3AccessKey; + + @Value ("${s3.secretKey}") + private String s3SecretKey; + + @Value ("${s3.bucketName}") + private String s3BucketName; + + @Value ("${s3.bucketRegion}") + private String s3BucketRegion; } From 4b42afa11e7ff8073fe680b2c1d7c5681aa4a23c Mon Sep 17 00:00:00 2001 From: Claudia Agache Date: Tue, 1 Sep 2020 17:10:48 +0300 Subject: [PATCH 2/4] set s3 properties only in automation enterprise module --- .../org/alfresco/rest/core/RMRestProperties.java | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/RMRestProperties.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/RMRestProperties.java index 29deb88610..b5ffec459a 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/RMRestProperties.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/RMRestProperties.java @@ -59,16 +59,4 @@ public class RMRestProperties extends RestProperties @Value ("${docker.host}") private String dockerHost; - - @Value ("${s3.accessKey}") - private String s3AccessKey; - - @Value ("${s3.secretKey}") - private String s3SecretKey; - - @Value ("${s3.bucketName}") - private String s3BucketName; - - @Value ("${s3.bucketRegion}") - private String s3BucketRegion; } From ef4f3a506b692e521ad2e9a75837f21131152d3c Mon Sep 17 00:00:00 2001 From: Claudia Agache Date: Fri, 4 Sep 2020 10:14:44 +0300 Subject: [PATCH 3/4] code review comments --- .../org/alfresco/rest/rm/community/base/BaseRMRestTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java index afd58ae54a..3a39086362 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java @@ -533,7 +533,7 @@ public class BaseRMRestTest extends RestTest * @return the created record * @throws Exception */ - public Record createElectronicRecord(String parentId, String name) throws Exception + public Record createElectronicRecord(String parentId, String name) { return createElectronicRecord(parentId, name ,null); } @@ -547,7 +547,7 @@ public class BaseRMRestTest extends RestTest * @return the created record * @throws Exception */ - public Record createElectronicRecord(String parentId, String name, UserModel user) throws Exception + public Record createElectronicRecord(String parentId, String name, UserModel user) { RecordFolderAPI recordFolderAPI = restAPIFactory.getRecordFolderAPI(user); Record recordModel = Record.builder().name(name).nodeType(CONTENT_TYPE).build(); From 0aa202c3d83fdf9e886f691be5bb3b38d6faed6a Mon Sep 17 00:00:00 2001 From: Claudia Agache Date: Fri, 4 Sep 2020 15:12:05 +0300 Subject: [PATCH 4/4] Use environment variables for S3 credentials and bucket information used by S3Client class --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index fd914e96ad..4714b39982 100644 --- a/.travis.yml +++ b/.travis.yml @@ -107,7 +107,7 @@ jobs: - bash scripts/create-worm-bucket.sh - bash scripts/start-compose.sh "${ENTERPRISE_SHARE_PATH}/docker-compose-worm-support-rest.yml" - bash scripts/waitForAlfrescoToStart.sh - script: mvn -B test -pl :alfresco-governance-services-automation-enterprise-rest-api -DsuiteXmlFile=wormTestSuite.xml -Dskip.automationtests=false -Ds3.accessKey=${AWS_ACCESS_KEY_ID} -Ds3.secretKey=${AWS_SECRET_ACCESS_KEY} -Ds3.bucketName=${S3_BUCKET2_NAME} -Ds3.bucketRegion=${S3_BUCKET_REGION} + script: mvn -B test -pl :alfresco-governance-services-automation-enterprise-rest-api -DsuiteXmlFile=wormTestSuite.xml -Dskip.automationtests=false after_script: bash scripts/cleanup.sh after_failure: docker ps -a | grep '_alfresco_1' | awk '{print $1}' | xargs docker logs | tail -5000