mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
RM-4488 (Refactor REST API Automation test code according to the latest changes)
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
package org.alfresco.rest.rm.community.fileplancomponents;
|
||||
|
||||
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.UNFILED_RECORDS_CONTAINER_ALIAS;
|
||||
import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.IMAGE_FILE;
|
||||
import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createElectronicRecordModel;
|
||||
import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createNonElectronicRecordModel;
|
||||
import static org.springframework.http.HttpStatus.CREATED;
|
||||
@@ -65,9 +66,6 @@ public class DeleteRecordTests extends BaseRestTest
|
||||
@Autowired
|
||||
private DataUser dataUser;
|
||||
|
||||
/** image resource file to be used for records body */
|
||||
private static final String IMAGE_FILE = "money.JPG";
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Given a record
|
||||
|
@@ -32,6 +32,7 @@ import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanCo
|
||||
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.CONTENT_TYPE;
|
||||
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.RECORD_FOLDER_TYPE;
|
||||
import static org.alfresco.rest.rm.community.util.PojoUtility.toJson;
|
||||
import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.IMAGE_FILE;
|
||||
import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createElectronicRecordModel;
|
||||
import static org.springframework.http.HttpStatus.BAD_REQUEST;
|
||||
import static org.springframework.http.HttpStatus.CREATED;
|
||||
@@ -55,9 +56,6 @@ import org.testng.annotations.Test;
|
||||
*/
|
||||
public class ElectronicRecordTests extends BaseRestTest
|
||||
{
|
||||
/** image resource file to be used for records body */
|
||||
private static final String IMAGE_FILE = "money.JPG";
|
||||
|
||||
/** Valid root containers where electronic records can be created */
|
||||
@DataProvider(name = "invalidParentContainers")
|
||||
public Object[][] invalidContainers() throws Exception
|
||||
@@ -199,7 +197,7 @@ public class ElectronicRecordTests extends BaseRestTest
|
||||
public void canCreateElectronicRecordsInValidContainers(FilePlanComponentModel container) throws Exception
|
||||
{
|
||||
FilePlanComponentModel record = createElectronicRecordModel();
|
||||
String newRecordId = getFilePlanComponentsAPI().createElectronicRecord(createElectronicRecordModel(), IMAGE_FILE, container.getId()).getId();
|
||||
String newRecordId = getFilePlanComponentsAPI().createElectronicRecord(record, IMAGE_FILE, container.getId()).getId();
|
||||
|
||||
// verify the create request status code
|
||||
assertStatusCode(CREATED);
|
||||
|
@@ -34,6 +34,7 @@ import static org.alfresco.rest.rm.community.utils.RMSiteUtil.RM_DESCRIPTION;
|
||||
import static org.alfresco.rest.rm.community.utils.RMSiteUtil.RM_ID;
|
||||
import static org.alfresco.rest.rm.community.utils.RMSiteUtil.RM_TITLE;
|
||||
import static org.alfresco.rest.rm.community.utils.RMSiteUtil.createDOD5015RMSiteModel;
|
||||
import static org.alfresco.rest.rm.community.utils.RMSiteUtil.createRMSiteModel;
|
||||
import static org.alfresco.rest.rm.community.utils.RMSiteUtil.createStandardRMSiteModel;
|
||||
import static org.alfresco.utility.constants.UserRole.SiteManager;
|
||||
import static org.springframework.http.HttpStatus.BAD_REQUEST;
|
||||
@@ -124,10 +125,7 @@ public class RMSiteTests extends BaseRestTest
|
||||
String newDescription = RM_DESCRIPTION + "createRMSiteWhenSiteExists";
|
||||
|
||||
// Create the RM site
|
||||
RMSiteModel rmSiteModel = RMSiteModel.builder().compliance(STANDARD).build();
|
||||
rmSiteModel.setTitle(newTitle);
|
||||
rmSiteModel.setDescription(newDescription);
|
||||
|
||||
RMSiteModel rmSiteModel = createRMSiteModel(STANDARD, newTitle, newDescription);
|
||||
getRMSiteAPI().createRMSite(rmSiteModel);
|
||||
|
||||
// Verify the status code
|
||||
@@ -145,6 +143,9 @@ public class RMSiteTests extends BaseRestTest
|
||||
)
|
||||
public void deleteRMSite() throws Exception
|
||||
{
|
||||
// Create the RM site if it does not exist
|
||||
createRMSiteIfNotExists();
|
||||
|
||||
// Delete the RM site
|
||||
getRMSiteAPI().deleteRMSite();
|
||||
|
||||
|
@@ -46,6 +46,9 @@ public class FilePlanComponentsUtil
|
||||
// Intentionally blank
|
||||
}
|
||||
|
||||
/** image resource file to be used for records body */
|
||||
public static final String IMAGE_FILE = "money.JPG";
|
||||
|
||||
/**
|
||||
* FIXME!!!
|
||||
*
|
||||
|
@@ -50,6 +50,22 @@ public class RMSiteUtil
|
||||
public static final String RM_TITLE = "Records Management";
|
||||
public static final String RM_DESCRIPTION = "Records Management Site";
|
||||
|
||||
/**
|
||||
* FIXME!!!
|
||||
*
|
||||
* @param compliance FIXME!!!
|
||||
* @param title FIXME!!!
|
||||
* @param description FIXME!!!
|
||||
* @return FIXME!!!
|
||||
*/
|
||||
public static RMSiteModel createRMSiteModel(RMSiteCompliance compliance, String title, String description)
|
||||
{
|
||||
RMSiteModel rmSiteModel = RMSiteModel.builder().compliance(compliance).build();
|
||||
rmSiteModel.setTitle(title);
|
||||
rmSiteModel.setDescription(description);
|
||||
return rmSiteModel;
|
||||
}
|
||||
|
||||
/**
|
||||
* FIXME!!!
|
||||
*
|
||||
@@ -58,10 +74,7 @@ public class RMSiteUtil
|
||||
*/
|
||||
private static RMSiteModel createRMSiteModel(RMSiteCompliance compliance)
|
||||
{
|
||||
RMSiteModel rmSiteModel = RMSiteModel.builder().compliance(compliance).build();
|
||||
rmSiteModel.setTitle(RM_TITLE);
|
||||
rmSiteModel.setDescription(RM_DESCRIPTION);
|
||||
return rmSiteModel;
|
||||
return createRMSiteModel(compliance, RM_TITLE, RM_DESCRIPTION);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -83,5 +96,4 @@ public class RMSiteUtil
|
||||
{
|
||||
return createRMSiteModel(DOD5015);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user