From 5ad5512c3eb4d715be0e7040a0272a0ff51ccca3 Mon Sep 17 00:00:00 2001 From: Rodica Sutu Date: Mon, 28 Nov 2016 17:35:41 +0200 Subject: [PATCH] review updates (1) --- .../fileplancomponents/FilePlanComponent.java | 9 +++-- .../rest/rm/community/util/PojoUtility.java | 9 +++-- .../rest/rm/community/base/BaseRestTest.java | 4 +- .../fileplancomponents/FilePlanTests.java | 6 +-- .../RecordCategoryTest.java | 26 ++++++------- .../fileplancomponents/RecordFolderTests.java | 37 +++++++++---------- .../UnfiledRecordsFolderTests.java | 14 +++---- .../rest/rm/community/site/RMSiteTests.java | 6 +-- 8 files changed, 57 insertions(+), 54 deletions(-) diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponent.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponent.java index c0fbe62a63..8342ce9661 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponent.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponent.java @@ -84,6 +84,7 @@ public class FilePlanComponent @JsonProperty (value = ALLOWABLE_OPERATIONS) private List allowableOperations; + private FilePlanComponentPath path; @JsonProperty (required = true) @@ -203,7 +204,7 @@ public class FilePlanComponent /** * @return the isCategory */ - public Boolean isIsCategory() + public Boolean isCategory() { return this.isCategory; } @@ -219,7 +220,7 @@ public class FilePlanComponent /** * @return the isRecordFolder */ - public Boolean isIsRecordFolder() + public Boolean isRecordFolder() { return this.isRecordFolder; } @@ -235,7 +236,7 @@ public class FilePlanComponent /** * @return the isFile */ - public Boolean isIsFile() + public Boolean isFile() { return this.isFile; } @@ -251,7 +252,7 @@ public class FilePlanComponent /** * @return the hasRetentionSchedule */ - public Boolean isHasRetentionSchedule() + public Boolean hasRetentionSchedule() { return this.hasRetentionSchedule; } diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/PojoUtility.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/PojoUtility.java index ede5960c17..7ecb945d9c 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/PojoUtility.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/PojoUtility.java @@ -58,13 +58,16 @@ public class PojoUtility //return the json object return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(model); - } catch (JsonGenerationException e) + } + catch (JsonGenerationException e) { return e.toString(); - } catch (JsonMappingException e) + } + catch (JsonMappingException e) { return e.toString(); - } catch (IOException e) + } + catch (IOException e) { return e.toString(); } diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRestTest.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRestTest.java index 1dad063780..7eade80baa 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRestTest.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRestTest.java @@ -122,7 +122,7 @@ public class BaseRestTest extends RestTest rmSiteAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser()); // Create the RM site - RMSite rmSite= new RMSite(RM_TITLE, RM_DESCRIPTION, STANDARD); + RMSite rmSite = new RMSite(RM_TITLE, RM_DESCRIPTION, STANDARD); rmSiteAPI.createRMSite(rmSite); // Verify the status code @@ -183,7 +183,7 @@ public class BaseRestTest extends RestTest { RestWrapper restWrapper = filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser()); - FilePlanComponent filePlanComponent=new FilePlanComponent(componentName, componentType.toString(),new FilePlanComponentProperties(componentTitle)); + FilePlanComponent filePlanComponent = new FilePlanComponent(componentName, componentType.toString(),new FilePlanComponentProperties(componentTitle)); FilePlanComponent fpc = filePlanComponentAPI.createFilePlanComponent(filePlanComponent, parentComponentId); restWrapper.assertStatusCodeIs(CREATED); diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/FilePlanTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/FilePlanTests.java index bd95856a50..d0b6be85b2 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/FilePlanTests.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/FilePlanTests.java @@ -199,7 +199,7 @@ public class FilePlanTests extends BaseRestTest filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser()); // Build object for updating the filePlan - FilePlanComponent filePlanComponent= new FilePlanComponent(); + FilePlanComponent filePlanComponent = new FilePlanComponent(); FilePlanComponentProperties filePlanComponentProperties=new FilePlanComponentProperties(FILE_PLAN_TITLE, FILE_PLAN_DESCRIPTION); filePlanComponent.setProperties(filePlanComponentProperties); @@ -287,7 +287,7 @@ public class FilePlanTests extends BaseRestTest dataProviderClass = TestData.class, dataProvider = "getContainersAndTypes" ) - @Bug(id="RM-4296") + @Bug(id = "RM-4296") public void createFilePlanSpecialContainerWhenExists(FilePlanComponentAlias filePlanAlias, FilePlanComponentType rmType) throws Exception { // Create RM Site if doesn't exist @@ -301,7 +301,7 @@ public class FilePlanTests extends BaseRestTest String name = filePlanAlias + getRandomAlphanumeric(); // Build the file plan root properties - FilePlanComponent filePlanComponent=new FilePlanComponent(name,rmType.toString(),new FilePlanComponentProperties()); + FilePlanComponent filePlanComponent = new FilePlanComponent(name,rmType.toString(),new FilePlanComponentProperties()); // Authenticate with admin user filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser()); diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordCategoryTest.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordCategoryTest.java index 6a5364e3ec..c812282573 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordCategoryTest.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordCategoryTest.java @@ -94,7 +94,7 @@ public class RecordCategoryTest extends BaseRestTest String categoryTitle = "Category title " + getRandomAlphanumeric(); // Build the record category properties - FilePlanComponent recordCategory= new FilePlanComponent(categoryName,RECORD_CATEGORY_TYPE.toString(), + FilePlanComponent recordCategory = new FilePlanComponent(categoryName,RECORD_CATEGORY_TYPE.toString(), new FilePlanComponentProperties(categoryTitle)); // Create the record category FilePlanComponent filePlanComponent = filePlanComponentAPI.createFilePlanComponent(recordCategory, FILE_PLAN_ALIAS.toString()); @@ -103,9 +103,9 @@ public class RecordCategoryTest extends BaseRestTest restWrapper.assertStatusCodeIs(CREATED); // Verify the returned file plan component - assertTrue(filePlanComponent.isIsCategory()); - assertFalse(filePlanComponent.isIsFile()); - assertFalse(filePlanComponent.isIsRecordFolder()); + assertTrue(filePlanComponent.isCategory()); + assertFalse(filePlanComponent.isFile()); + assertFalse(filePlanComponent.isRecordFolder()); assertEquals(filePlanComponent.getName(), categoryName); assertEquals(filePlanComponent.getNodeType(), RECORD_CATEGORY_TYPE.toString()); @@ -226,9 +226,9 @@ public class RecordCategoryTest extends BaseRestTest // Verify child category assertEquals(childCategory.getParentId(), rootCategory.getId()); - assertTrue(childCategory.isIsCategory()); - assertFalse(childCategory.isIsFile()); - assertFalse(childCategory.isIsRecordFolder()); + assertTrue(childCategory.isCategory()); + assertFalse(childCategory.isFile()); + assertFalse(childCategory.isRecordFolder()); assertEquals(childCategory.getNodeType(), RECORD_CATEGORY_TYPE.toString()); } @@ -295,19 +295,19 @@ public class RecordCategoryTest extends BaseRestTest assertEquals(filePlanComponent.getParentId(), rootCategory.getId()); // Only categories or folders have been created - assertFalse(filePlanComponent.isIsFile()); + assertFalse(filePlanComponent.isFile()); // Boolean properties related to node type // Only RECORD_CATEGORY_TYPE and RECORD_FOLDER_TYPE have been created if (filePlanComponent.getNodeType().equals(RECORD_CATEGORY_TYPE.toString())) { - assertTrue(filePlanComponent.isIsCategory()); - assertFalse(filePlanComponent.isIsRecordFolder()); + assertTrue(filePlanComponent.isCategory()); + assertFalse(filePlanComponent.isRecordFolder()); } else { - assertTrue(filePlanComponent.isIsRecordFolder()); - assertFalse(filePlanComponent.isIsCategory()); + assertTrue(filePlanComponent.isRecordFolder()); + assertFalse(filePlanComponent.isCategory()); } // Does returned object have the same contents as the created one? @@ -339,7 +339,7 @@ public class RecordCategoryTest extends BaseRestTest @Bug (id="RM-4367") public void createTypesNotAllowedInCategory(String nodeType) throws Exception { - String COMPONENT_NAME="Component"+getRandomAlphanumeric(); + String COMPONENT_NAME = "Component"+getRandomAlphanumeric(); // Authenticate with admin user filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser()); diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordFolderTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordFolderTests.java index bf38a0283a..705e79258b 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordFolderTests.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordFolderTests.java @@ -91,7 +91,7 @@ public class RecordFolderTests extends BaseRestTest String CATEGORY = CATEGORY_NAME + getRandomAlphanumeric(); // Authenticate with admin user filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser()); - FilePlanComponent filePlanComponent=createCategory(FILE_PLAN_ALIAS.toString(), CATEGORY); + FilePlanComponent filePlanComponent = createCategory(FILE_PLAN_ALIAS.toString(), CATEGORY); FilePlanComponentProperties filePlanComponentProperties = new FilePlanComponentProperties(FOLDER_TITLE); FilePlanComponent recordFolder = new FilePlanComponent(FOLDER_NAME,RECORD_FOLDER_TYPE.toString(), filePlanComponentProperties); @@ -99,15 +99,15 @@ public class RecordFolderTests extends BaseRestTest // Create the record folder FilePlanComponent folder = filePlanComponentAPI.createFilePlanComponent(recordFolder, filePlanComponent.getId()); - //filePlanComponentAPI.createFilePlanComponent(recordFolderProperties, filePlanComponent.getId()); + filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(CREATED); // Check folder has been created within the category created assertEquals(filePlanComponent.getId(),folder.getParentId()); // Verify the returned properties for the file plan component - record folder - assertFalse(folder.isIsCategory()); - assertFalse(folder.isIsFile()); - assertTrue(folder.isIsRecordFolder()); + assertFalse(folder.isCategory()); + assertFalse(folder.isFile()); + assertTrue(folder.isRecordFolder()); assertEquals(folder.getName(), FOLDER_NAME); assertEquals(folder.getNodeType(), RECORD_FOLDER_TYPE.toString()); @@ -138,7 +138,7 @@ public class RecordFolderTests extends BaseRestTest String componentID = filePlanComponentAPI.getFilePlanComponent(filePlanComponent).getId(); // Build the record category properties - FilePlanComponent recordFolder= new FilePlanComponent(FOLDER_NAME,RECORD_FOLDER_TYPE.toString(), + FilePlanComponent recordFolder = new FilePlanComponent(FOLDER_NAME,RECORD_FOLDER_TYPE.toString(), new FilePlanComponentProperties(FOLDER_TITLE)); // Create a record folder filePlanComponentAPI.createFilePlanComponent(recordFolder, componentID); @@ -158,19 +158,19 @@ public class RecordFolderTests extends BaseRestTest ) public void checkTheRecordFolderProperties() throws Exception { - String CATEGORY=CATEGORY_NAME + getRandomAlphanumeric(); + String CATEGORY = CATEGORY_NAME + getRandomAlphanumeric(); // Authenticate with admin user filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser()); FilePlanComponent category = createCategory(FILE_PLAN_ALIAS.toString(), CATEGORY); - FilePlanComponent folder =createFolder(category.getId(),FOLDER_NAME); + FilePlanComponent folder = createFolder(category.getId(),FOLDER_NAME); - FilePlanComponent folderDetails=filePlanComponentAPI.withParams("include="+IS_CLOSED).getFilePlanComponent(folder.getId()); + FilePlanComponent folderDetails = filePlanComponentAPI.withParams("include="+IS_CLOSED).getFilePlanComponent(folder.getId()); // Verify the returned properties for the file plan component - record folder assertEquals(RECORD_FOLDER_TYPE.toString(),folderDetails.getNodeType()); - assertTrue(folderDetails.isIsRecordFolder()); - assertFalse(folderDetails.isIsCategory()); - assertFalse(folderDetails.isIsFile()); + assertTrue(folderDetails.isRecordFolder()); + assertFalse(folderDetails.isCategory()); + assertFalse(folderDetails.isFile()); assertFalse(folderDetails.isClosed()); assertEquals(FOLDER_NAME,folderDetails.getName()); @@ -205,12 +205,12 @@ public class RecordFolderTests extends BaseRestTest // Create record category first String folderDescription = "The folder description is updated" + getRandomAlphanumeric(); - String folderName= "The folder name is updated" + getRandomAlphanumeric(); + String folderName = "The folder name is updated" + getRandomAlphanumeric(); String folderTitle = "Update title " + getRandomAlphanumeric(); - String location="Location"+getRandomAlphanumeric(); + String location = "Location"+getRandomAlphanumeric(); //Create the file plan component properties to update - FilePlanComponentProperties filePlanComponentProperties= new FilePlanComponentProperties(folderTitle, folderDescription); + FilePlanComponentProperties filePlanComponentProperties = new FilePlanComponentProperties(folderTitle, folderDescription); filePlanComponentProperties.setVitalRecord(true); filePlanComponentProperties.setReviewPeriod( new ReviewPeriod("month","1")); filePlanComponentProperties.setLocation(location); @@ -231,7 +231,6 @@ public class RecordFolderTests extends BaseRestTest assertNotNull(folderUpdated.getProperties().getReviewPeriod().getPeriodType()); assertNotNull(folderUpdated.getProperties().getReviewPeriod().getExpression()); - } /** @@ -325,11 +324,11 @@ public class RecordFolderTests extends BaseRestTest // Is parent Id set correctly assertEquals(filePlanComponent.getParentId(), category.getId()); - assertFalse(filePlanComponent.isIsFile()); + assertFalse(filePlanComponent.isFile()); // Boolean properties related to node type - assertTrue(filePlanComponent.isIsRecordFolder()); - assertFalse(filePlanComponent.isIsCategory()); + assertTrue(filePlanComponent.isRecordFolder()); + assertFalse(filePlanComponent.isCategory()); assertEquals(createdComponent.getName(), filePlanComponent.getName()); assertEquals(createdComponent.getNodeType(), filePlanComponent.getNodeType()); diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/UnfiledRecordsFolderTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/UnfiledRecordsFolderTests.java index d1a4f29466..d074f1c8e8 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/UnfiledRecordsFolderTests.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/UnfiledRecordsFolderTests.java @@ -117,9 +117,9 @@ public class UnfiledRecordsFolderTests extends BaseRestTest filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(CREATED); // Verify the returned file plan component - assertFalse(filePlanComponent.isIsCategory()); - assertFalse(filePlanComponent.isIsFile()); - assertFalse(filePlanComponent.isIsRecordFolder()); // it is not a _normal_ record folder! + assertFalse(filePlanComponent.isCategory()); + assertFalse(filePlanComponent.isFile()); + assertFalse(filePlanComponent.isRecordFolder()); // it is not a _normal_ record folder! assertEquals(filePlanComponent.getName(), folderName); assertEquals(filePlanComponent.getNodeType(), UNFILED_RECORD_FOLDER_TYPE.toString()); @@ -200,9 +200,9 @@ public class UnfiledRecordsFolderTests extends BaseRestTest restWrapper.assertStatusCodeIs(CREATED); // Verify the returned file plan component - assertFalse(childFolder.isIsCategory()); - assertFalse(childFolder.isIsFile()); - assertFalse(childFolder.isIsRecordFolder()); // it is not a _normal_ record folder! + assertFalse(childFolder.isCategory()); + assertFalse(childFolder.isFile()); + assertFalse(childFolder.isRecordFolder()); // it is not a _normal_ record folder! assertEquals(childFolder.getName(), childFolderName); assertEquals(childFolder.getNodeType(), UNFILED_RECORD_FOLDER_TYPE.toString()); @@ -251,7 +251,7 @@ public class UnfiledRecordsFolderTests extends BaseRestTest assertEquals(folderName, folderToModify.getName()); // Build the properties which will be updated - FilePlanComponent folderToUpdate=new FilePlanComponent(modified + folderToModify.getName(), + FilePlanComponent folderToUpdate = new FilePlanComponent(modified + folderToModify.getName(), new FilePlanComponentProperties(modified + folderToModify.getProperties().getTitle(), modified + folderToModify.getProperties().getDescription())); // Update the unfiled records folder 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 cec0621cae..417895d64f 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 @@ -96,7 +96,7 @@ public class RMSiteTests extends BaseRestTest // Create the RM site RMSite rmSite = new RMSite(RM_TITLE, RM_DESCRIPTION, STANDARD); - RMSite rmSiteResponse=rmSiteAPI.createRMSite(rmSite); + RMSite rmSiteResponse = rmSiteAPI.createRMSite(rmSite); // Verify the status code rmSiteAPI.usingRestWrapper().assertStatusCodeIs(CREATED); @@ -262,7 +262,7 @@ public class RMSiteTests extends BaseRestTest public void updateRMSiteDetails()throws Exception { String NEW_TITLE = RM_TITLE + RandomData.getRandomAlphanumeric(); - String NEW_DESCRIPTION=RM_DESCRIPTION+ RandomData.getRandomAlphanumeric(); + String NEW_DESCRIPTION = RM_DESCRIPTION+ RandomData.getRandomAlphanumeric(); // Authenticate with admin user rmSiteAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser()); @@ -271,7 +271,7 @@ public class RMSiteTests extends BaseRestTest createRMSiteIfNotExists(); //Create RM site model - RMSite rmSiteToUpdate=new RMSite(); + RMSite rmSiteToUpdate = new RMSite(); rmSiteToUpdate.setTitle(NEW_TITLE); rmSiteToUpdate.setDescription(NEW_DESCRIPTION);