From 23524f89cc1ef00f52d0304a4082b645168dcd1d Mon Sep 17 00:00:00 2001 From: cagache Date: Tue, 13 Apr 2021 15:23:32 +0300 Subject: [PATCH] PR 1412 code review comments [skip tests] --- .../rest/rm/community/fileplans/FilePlanTests.java | 2 ++ .../rest/rm/community/records/ReadRecordTests.java | 7 ++++--- .../org/alfresco/rest/rm/community/site/RMSiteTests.java | 8 ++++++-- .../org/alfresco/rest/rm/community/utils/RMSiteUtil.java | 2 +- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplans/FilePlanTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplans/FilePlanTests.java index ee436c0fd4..b24c59d86f 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplans/FilePlanTests.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplans/FilePlanTests.java @@ -116,6 +116,8 @@ public class FilePlanTests extends BaseRMRestTest * */ @Test (priority = 1) + // Set priority to 1 in order for this test to run last one in this class. The rm site is created only once at the + // beginning of the class and because this test deletes the rm site, the other tests might be affected public void getFilePlanWhenRMIsNotCreated() { RMSiteAPI rmSiteAPI = getRestAPIFactory().getRMSiteAPI(); diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/ReadRecordTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/ReadRecordTests.java index 6da5c37843..0de24378f5 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/ReadRecordTests.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/ReadRecordTests.java @@ -97,13 +97,14 @@ public class ReadRecordTests extends BaseRMRestTest .nodeType(NON_ELECTRONIC_RECORD_TYPE) .build(); - private RecordCategory rootCategory; + private RecordCategory rootCategory, rootCategory2; private RecordCategoryChild recordFolder; @BeforeClass(alwaysRun = true) public void setupReadRecordTests() { rootCategory = createRootCategory(getRandomName("rootCategory")); + rootCategory2 = createRootCategory(getRandomName("rootCategory2")); recordFolder = createRecordFolder(rootCategory.getId(), getRandomName("recFolder")); } /** @@ -244,7 +245,6 @@ public class ReadRecordTests extends BaseRMRestTest String RECORD_ELECTRONIC = "Record " + getRandomAlphanumeric(); String RECORD_ELECTRONIC_BINARY = "Binary Record" + getRandomAlphanumeric(); - String existentRecordCategoryId = createRootCategory(getRandomName("rootCategory2")).getId(); String RELATIVE_PATH = "/" + CATEGORY_NAME + getRandomAlphanumeric() + "/folder"; @@ -255,7 +255,7 @@ public class ReadRecordTests extends BaseRMRestTest .relativePath(RELATIVE_PATH) .build(); RecordCategoryAPI recordCategoryAPI = getRestAPIFactory().getRecordCategoryAPI(); - String folderId = recordCategoryAPI.createRecordCategoryChild(recordFolder, existentRecordCategoryId).getId(); + String folderId = recordCategoryAPI.createRecordCategoryChild(recordFolder, rootCategory2.getId()).getId(); // text file as an electronic record Record recordText = Record.builder() @@ -346,6 +346,7 @@ public class ReadRecordTests extends BaseRMRestTest public void cleanupReadRecordTests() { deleteRecordCategory(rootCategory.getId()); + deleteRecordCategory(rootCategory2.getId()); } } diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/site/RMSiteTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/site/RMSiteTests.java index 73f94130e4..31df16ce36 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/site/RMSiteTests.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/site/RMSiteTests.java @@ -72,6 +72,7 @@ public class RMSiteTests extends BaseRMRestTest * Then the RM site is created */ @Test (description = "Create RM site with Standard Compliance as admin user", priority = 2) + // Run after createRMSiteAsAnotherAdminUser. In this way the Dod site is deleted and standard site is created for the rest of the tests public void createRMSiteAsAdminUser() { RMSiteAPI rmSiteAPI = getRestAPIFactory().getRMSiteAPI(); @@ -104,6 +105,7 @@ public class RMSiteTests extends BaseRMRestTest * Then the response code 409 (Site with the given identifier already exists) is return */ @Test (description = "Create RM site when site already exist with admin user", priority = 3) + // Run test after the other tests with priority 0, 1 or 2 public void createRMSiteWhenSiteExists() { // Create the RM site if it does not exist @@ -145,6 +147,7 @@ public class RMSiteTests extends BaseRMRestTest * Then RM site details are returned */ @Test (description = "GET the RM site as admin user", priority = 3) + // Run test after the tests with priority 0, 1 or 2 public void getRMSite() { RMSiteAPI rmSiteAPI = getRestAPIFactory().getRMSiteAPI(); @@ -175,6 +178,7 @@ public class RMSiteTests extends BaseRMRestTest * When the user wants to create a RM site with DOD compliance * Then RM site is created */ + // Run test after deleteRMSite. In this way rmSiteAPI.deleteRMSite isn't called because site is already deleted @Test (description = "Create RM site with DOD compliance as an another admin user", priority = 1) @Bug (id="RM-4289") public void createRMSiteAsAnotherAdminUser() @@ -213,7 +217,7 @@ public class RMSiteTests extends BaseRMRestTest * When the admin user wants to update the RM site details (title or description) * Then RM site details are updated */ - @Test(priority = 3) + @Test(priority = 3) // Run test after the other tests with priority 0, 1 or 2 public void updateRMSiteDetails() { String NEW_TITLE = RM_TITLE + RandomData.getRandomAlphanumeric(); @@ -250,7 +254,7 @@ public class RMSiteTests extends BaseRMRestTest * When the admin user wants to update the RM site compliance * Then RM site compliance is not updated */ - @Test(priority = 3) + @Test(priority = 3) // Run test after the other tests with priority 0, 1 or 2 public void updateRMSiteComplianceAsAdmin() { // Create the RM site if it does not exist diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/utils/RMSiteUtil.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/utils/RMSiteUtil.java index 9b909c0ce4..8e6823585e 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/utils/RMSiteUtil.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/utils/RMSiteUtil.java @@ -70,7 +70,7 @@ public class RMSiteUtil * @param compliance The RM site compliance * @return The {@link RMSite} with the given details */ - public static RMSite createRMSiteModel(RMSiteCompliance compliance) + private static RMSite createRMSiteModel(RMSiteCompliance compliance) { return createRMSiteModel(compliance, RM_TITLE, RM_DESCRIPTION); }