diff --git a/rm-automation/rm-automation-community-rest-api/pom.xml b/rm-automation/rm-automation-community-rest-api/pom.xml index c643e57053..583d5b15e7 100644 --- a/rm-automation/rm-automation-community-rest-api/pom.xml +++ b/rm-automation/rm-automation-community-rest-api/pom.xml @@ -46,6 +46,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/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) 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..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 @@ -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[][] { @@ -647,27 +647,25 @@ public class BaseRMRestTest extends RestTest List names = new ArrayList<>(); // wait for solr indexing int counter = 0; - int waitInMilliSeconds = 6000; - while (counter < 3) + int waitInMilliSeconds = 7000; + while (counter < 4) { synchronized (this) { 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; } @@ -697,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 = 7000; + while (counter < 4) { synchronized (this) { @@ -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; } @@ -746,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) { 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(); 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); 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