From 0300ac3317be65e93c1e99c73826b4c9cdf991f2 Mon Sep 17 00:00:00 2001 From: cagache Date: Thu, 11 Apr 2019 17:09:40 +0300 Subject: [PATCH 01/10] Added slf4j-log4j12 dependency to automation community rest api project and log4j.properties file because logs didn't work on rest api tests after moving to OpenJdk 11 --- rm-automation/rm-automation-community-rest-api/pom.xml | 6 ++++++ .../src/test/resources/log4j.properties | 7 +++++++ 2 files changed, 13 insertions(+) create mode 100644 rm-automation/rm-automation-community-rest-api/src/test/resources/log4j.properties diff --git a/rm-automation/rm-automation-community-rest-api/pom.xml b/rm-automation/rm-automation-community-rest-api/pom.xml index 66be754b6e..2d10b64cb6 100644 --- a/rm-automation/rm-automation-community-rest-api/pom.xml +++ b/rm-automation/rm-automation-community-rest-api/pom.xml @@ -45,6 +45,12 @@ + + org.slf4j + slf4j-log4j12 + 1.7.26 + test + org.alfresco.tas restapi-test diff --git a/rm-automation/rm-automation-community-rest-api/src/test/resources/log4j.properties b/rm-automation/rm-automation-community-rest-api/src/test/resources/log4j.properties new file mode 100644 index 0000000000..93c931c03c --- /dev/null +++ b/rm-automation/rm-automation-community-rest-api/src/test/resources/log4j.properties @@ -0,0 +1,7 @@ +log4j.rootLogger=info, console + +log4j.appender.console=org.apache.log4j.ConsoleAppender +log4j.appender.console.layout=org.apache.log4j.PatternLayout +log4j.appender.console.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n + +log4j.logger.com.example=debug \ No newline at end of file From de1dd139007e27205304ccfb1689a75b5643f6a4 Mon Sep 17 00:00:00 2001 From: cagache Date: Thu, 11 Apr 2019 17:10:08 +0300 Subject: [PATCH 02/10] fix javadoc --- .../src/main/java/org/alfresco/rest/v0/SearchAPI.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/SearchAPI.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/SearchAPI.java index 814f13aa6f..c1a42bae6a 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/SearchAPI.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/SearchAPI.java @@ -241,7 +241,6 @@ public class SearchAPI extends BaseAPI * Helper method to extract list of names from search result. * * @param searchResult - * @param getProperties * @return */ private List getItemNames(JSONObject searchResult) @@ -253,7 +252,8 @@ public class SearchAPI extends BaseAPI * Helper method to extract list of property values from search result for the given nodeRef. * * @param searchResult - * @param getProperties + * @param nodeRef + * @param propertyName * @return */ private String getItemProperty(JSONObject searchResult, String nodeRef, String propertyName) From 9249b8cb80ade80285d22b184cec99ab4d044437 Mon Sep 17 00:00:00 2001 From: cagache Date: Thu, 11 Apr 2019 17:33:26 +0300 Subject: [PATCH 03/10] refactoring --- .../rm/community/base/BaseRMRestTest.java | 20 +++++++++---------- .../recordfolders/ElectronicRecordTests.java | 8 ++++---- 2 files changed, 13 insertions(+), 15 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 aa65f8c967..e2b5b8f2a9 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 @@ -141,7 +141,7 @@ public class BaseRMRestTest extends RestTest /** Valid root containers where electronic and non-electronic records can be created */ @DataProvider(name = "validRootContainers") - public String[][] getValidRootContainers() throws Exception + public Object[][] getValidRootContainers() throws Exception { return new String[][] { @@ -655,19 +655,17 @@ public class BaseRMRestTest extends RestTest try { this.wait(waitInMilliSeconds); - } catch (InterruptedException e) + } + catch (InterruptedException e) { } } List searchResults = getRestAPIFactory().getRmRestWrapper().withSearchAPI().search(query) .getEntries(); - if ((searchResults != null && !searchResults.isEmpty())) + if (searchResults != null && !searchResults.isEmpty()) { - searchResults.forEach(childNode -> - { - names.add(childNode.onModel().getName()); - }); + searchResults.forEach(childNode -> names.add(childNode.onModel().getName())); break; } else @@ -675,7 +673,7 @@ public class BaseRMRestTest extends RestTest counter++; } // double wait time to not overdo solr search - waitInMilliSeconds = (waitInMilliSeconds * 2); + waitInMilliSeconds = waitInMilliSeconds * 2; } return names; } @@ -711,8 +709,8 @@ public class BaseRMRestTest extends RestTest } } - results = searchApi.searchForNodeNamesAsUser(user.getUsername(), user.getPassword(), term, sortby, - includeFolders, includeCategories); + results = searchApi.searchForNodeNamesAsUser(user.getUsername(), user.getPassword(), term, sortby, + includeFolders, includeCategories); if (!results.isEmpty() && results.containsAll(expectedResults)) { break; @@ -722,7 +720,7 @@ public class BaseRMRestTest extends RestTest counter++; } // double wait time to not overdo solr search - waitInMilliSeconds = (waitInMilliSeconds * 2); + waitInMilliSeconds = waitInMilliSeconds * 2; } return results; } diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/recordfolders/ElectronicRecordTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/recordfolders/ElectronicRecordTests.java index 38dc9d8cc2..7768ce95b8 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/recordfolders/ElectronicRecordTests.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/recordfolders/ElectronicRecordTests.java @@ -71,7 +71,7 @@ public class ElectronicRecordTests extends BaseRMRestTest /** Invalid parent containers where electronic records can't be created */ @DataProvider(name = "invalidParentContainers") - public Object[][] invalidParentContainers() throws Exception + public Object[][] invalidParentContainers() { return new String[][] { @@ -99,7 +99,7 @@ public class ElectronicRecordTests extends BaseRMRestTest dataProvider = "invalidParentContainers", description = "Electronic records can't be created in invalid parent containers" ) - public void cantCreateElectronicRecordsInInvalidContainers(String container) throws Exception + public void cantCreateElectronicRecordsInInvalidContainers(String container) { // Create an electronic record in the given container, this should throw an IllegalArgumentException getRestAPIFactory().getRecordFolderAPI().createRecord(createElectronicRecordModel(), container, getFile(IMAGE_FILE)); @@ -158,7 +158,7 @@ public class ElectronicRecordTests extends BaseRMRestTest * Then nothing happens * And an error is reported * - * @param folderid The folder, which the record will be created in + * @param folderId The folder, which the record will be created in * @param type The type of the record folder, which the record will be created in * @throws Exception if record can't be created */ @@ -405,7 +405,7 @@ public class ElectronicRecordTests extends BaseRMRestTest */ @Test(description = "Electronic records can be created in record folder with duplicate name") @Bug(id ="RM-5116, RM-5012") - public void canCreateElectronicRecordsWithDuplicateName() throws Exception + public void canCreateElectronicRecordsWithDuplicateName() { RecordCategoryChild recordFolder = createCategoryFolderInFilePlan(); From 456bd759681bb4556d2ed888e1a43524d1851b4d Mon Sep 17 00:00:00 2001 From: cagache Date: Thu, 11 Apr 2019 17:47:08 +0300 Subject: [PATCH 04/10] try to search for content ~1 min --- .../alfresco/rest/rm/community/base/BaseRMRestTest.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 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 e2b5b8f2a9..626fd3ef3c 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 @@ -695,8 +695,8 @@ public class BaseRMRestTest extends RestTest List results = new ArrayList<>(); // wait for solr indexing int counter = 0; - int waitInMilliSeconds = 6000; - while (counter < 3) + int waitInMilliSeconds = 5000; + while (counter < 4) { synchronized (this) { @@ -744,8 +744,8 @@ public class BaseRMRestTest extends RestTest String result = ""; // wait for solr indexing int counter = 0; - int waitInMilliSeconds = 6000; - while (counter < 3) + int waitInMilliSeconds = 5000; + while (counter < 4) { synchronized (this) { From f26612f00b6dad4cb5f3ebb2b419aeb52e74c97c Mon Sep 17 00:00:00 2001 From: cagache Date: Fri, 12 Apr 2019 14:14:59 +0300 Subject: [PATCH 05/10] try to search for content ~1.30 min --- .../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 626fd3ef3c..7ace59e8ec 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 @@ -648,7 +648,7 @@ public class BaseRMRestTest extends RestTest // wait for solr indexing int counter = 0; int waitInMilliSeconds = 6000; - while (counter < 3) + while (counter < 4) { synchronized (this) { @@ -695,7 +695,7 @@ public class BaseRMRestTest extends RestTest List results = new ArrayList<>(); // wait for solr indexing int counter = 0; - int waitInMilliSeconds = 5000; + int waitInMilliSeconds = 6000; while (counter < 4) { synchronized (this) From a1b079913373f2a532df47553ee3938770e78d21 Mon Sep 17 00:00:00 2001 From: cagache Date: Mon, 15 Apr 2019 15:42:01 +0300 Subject: [PATCH 06/10] try to search for content ~1.45 min --- .../org/alfresco/rest/rm/community/base/BaseRMRestTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 7ace59e8ec..c2f16dace8 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 @@ -695,7 +695,7 @@ public class BaseRMRestTest extends RestTest List results = new ArrayList<>(); // wait for solr indexing int counter = 0; - int waitInMilliSeconds = 6000; + int waitInMilliSeconds = 7000; while (counter < 4) { synchronized (this) From 4e83a921b949448d311d7220f12912adaefa349e Mon Sep 17 00:00:00 2001 From: cagache Date: Tue, 16 Apr 2019 09:16:20 +0300 Subject: [PATCH 07/10] removed afterMethod annotation --- .../community/unfiledcontainers/UnfiledContainerTests.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/unfiledcontainers/UnfiledContainerTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/unfiledcontainers/UnfiledContainerTests.java index ad7f621256..c9dbb5ae50 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/unfiledcontainers/UnfiledContainerTests.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/unfiledcontainers/UnfiledContainerTests.java @@ -29,8 +29,7 @@ package org.alfresco.rest.rm.community.unfiledcontainers; import static java.time.LocalDateTime.now; import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.FILE_PLAN_ALIAS; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias - .UNFILED_RECORDS_CONTAINER_ALIAS; +import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.UNFILED_RECORDS_CONTAINER_ALIAS; import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.CONTENT_TYPE; import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.FOLDER_TYPE; import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.NON_ELECTRONIC_RECORD_TYPE; @@ -67,7 +66,6 @@ import org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil; import org.alfresco.utility.report.Bug; import org.springframework.http.HttpStatus; import org.testng.annotations.AfterClass; -import org.testng.annotations.AfterMethod; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; @@ -464,9 +462,8 @@ public class UnfiledContainerTests extends BaseRMRestTest assertEquals(child.getName(), recordName + " (" + customIdentifier + ")"); } - @AfterMethod @AfterClass (alwaysRun = true) - public void tearDown() throws Exception + public void tearDown() { UnfiledContainerChildCollection listedChildren = getRestAPIFactory().getUnfiledContainersAPI() .getUnfiledContainerChildren(UNFILED_RECORDS_CONTAINER_ALIAS); From 08acacf4f51e70fddd98ce4508d7027d90be4660 Mon Sep 17 00:00:00 2001 From: cagache Date: Tue, 16 Apr 2019 10:38:24 +0300 Subject: [PATCH 08/10] try to search for content ~1.45 min --- .../org/alfresco/rest/rm/community/base/BaseRMRestTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 c2f16dace8..15e831dc9a 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 @@ -647,7 +647,7 @@ public class BaseRMRestTest extends RestTest List names = new ArrayList<>(); // wait for solr indexing int counter = 0; - int waitInMilliSeconds = 6000; + int waitInMilliSeconds = 7000; while (counter < 4) { synchronized (this) From 95ee11f82c3d81d957aaf74f89aad3bf2497c3eb Mon Sep 17 00:00:00 2001 From: cagache Date: Tue, 16 Apr 2019 14:17:55 +0300 Subject: [PATCH 09/10] try to search for content ~2 min --- .../alfresco/rest/rm/community/base/BaseRMRestTest.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 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 15e831dc9a..efdd747b8b 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 @@ -647,8 +647,8 @@ public class BaseRMRestTest extends RestTest List names = new ArrayList<>(); // wait for solr indexing int counter = 0; - int waitInMilliSeconds = 7000; - while (counter < 4) + int waitInMilliSeconds = 4000; + while (counter < 5) { synchronized (this) { @@ -695,8 +695,8 @@ public class BaseRMRestTest extends RestTest List results = new ArrayList<>(); // wait for solr indexing int counter = 0; - int waitInMilliSeconds = 7000; - while (counter < 4) + int waitInMilliSeconds = 4000; + while (counter < 5) { synchronized (this) { From b5305aee70265f027b25f53811398d3cd16c81b4 Mon Sep 17 00:00:00 2001 From: cagache Date: Thu, 18 Apr 2019 16:40:31 +0300 Subject: [PATCH 10/10] try to search for content ~1.45 min --- .../alfresco/rest/rm/community/base/BaseRMRestTest.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 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 efdd747b8b..15e831dc9a 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 @@ -647,8 +647,8 @@ public class BaseRMRestTest extends RestTest List names = new ArrayList<>(); // wait for solr indexing int counter = 0; - int waitInMilliSeconds = 4000; - while (counter < 5) + int waitInMilliSeconds = 7000; + while (counter < 4) { synchronized (this) { @@ -695,8 +695,8 @@ public class BaseRMRestTest extends RestTest List results = new ArrayList<>(); // wait for solr indexing int counter = 0; - int waitInMilliSeconds = 4000; - while (counter < 5) + int waitInMilliSeconds = 7000; + while (counter < 4) { synchronized (this) {