From 03b8e4d4e7c3268d372ac0e1371c1c0925ad5062 Mon Sep 17 00:00:00 2001 From: Tom Page Date: Mon, 13 Mar 2017 08:14:48 +0000 Subject: [PATCH] RM-4159 Ensure there's exactly one RMRestWrapper. Use @PostConstruct to fix the hierarchy after initialisation. --- .../java/org/alfresco/rest/core/RestAPIFactory.java | 5 +++++ .../rest/rm/community/base/BaseRMRestTest.java | 12 ++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/RestAPIFactory.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/RestAPIFactory.java index cec4bf63f1..41370c7a55 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/RestAPIFactory.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/RestAPIFactory.java @@ -67,6 +67,11 @@ public class RestAPIFactory return this.rmRestWrapper; } + public void setRmRestWrapper(RMRestWrapper rmRestWrapper) + { + this.rmRestWrapper = rmRestWrapper; + } + private RestIGCoreAPI getRestIGCoreAPI(UserModel userModel) { getRmRestWrapper().authenticateUser(userModel != null ? userModel : dataUser.getAdminUser()); 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 ebef9ce32c..cb25fcd074 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 @@ -100,7 +100,7 @@ public class BaseRMRestTest extends RestTest */ protected void assertStatusCode(HttpStatus statusCode) { - getRestAPIFactory().getRmRestWrapper().assertStatusCodeIs(statusCode); + restAPIFactory.getRmRestWrapper().assertStatusCodeIs(statusCode); } /** @@ -145,7 +145,7 @@ public class BaseRMRestTest extends RestTest */ public void createRMSiteIfNotExists() throws Exception { - RMSiteAPI rmSiteAPI = getRestAPIFactory().getRMSiteAPI(); + RMSiteAPI rmSiteAPI = restAPIFactory.getRMSiteAPI(); // Check RM site doesn't exist if (!rmSiteAPI.existsRMSite()) @@ -294,16 +294,16 @@ public class BaseRMRestTest extends RestTest assertTrue(aspects.contains(RECORD_TYPE)); // a record mustn't be closed assertFalse(aspects.contains(ASPECTS_CLOSED_RECORD)); - + // add closed record aspect aspects.add(ASPECTS_CLOSED_RECORD); - - FilePlanComponent updatedComponent = filePlanComponentsAPI.updateFilePlanComponent(FilePlanComponent.builder().aspectNames(aspects).build(), + + FilePlanComponent updatedComponent = filePlanComponentsAPI.updateFilePlanComponent(FilePlanComponent.builder().aspectNames(aspects).build(), recordToClose.getId()); assertStatusCode(OK); return updatedComponent; } - + /** * Helper method to create a randomly-named / structure in file plan *