RM-4488 (Refactor REST API Automation test code according to the latest changes)

This commit is contained in:
Tuna Aksoy
2016-12-28 00:04:11 +00:00
parent 5c28bf41da
commit 25ddd883df
9 changed files with 91 additions and 52 deletions

View File

@@ -43,6 +43,7 @@ import org.alfresco.rest.RestTest;
import org.alfresco.rest.core.RestAPIFactory;
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent;
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentProperties;
import org.alfresco.rest.rm.community.requests.igCoreAPI.RMSiteAPI;
import org.alfresco.utility.data.DataUser;
import org.alfresco.utility.model.UserModel;
import org.springframework.beans.factory.annotation.Autowired;
@@ -137,11 +138,13 @@ public class BaseRMRestTest extends RestTest
*/
public void createRMSiteIfNotExists() throws Exception
{
RMSiteAPI rmSiteAPI = getRestAPIFactory().getRMSiteAPI();
// Check RM site doesn't exist
if (!getRestAPIFactory().getRMSiteAPI().existsRMSite())
if (!rmSiteAPI.existsRMSite())
{
// Create the RM site
getRestAPIFactory().getRMSiteAPI().createRMSite(createStandardRMSiteModel());
rmSiteAPI.createRMSite(createStandardRMSiteModel());
// Verify the status code
assertStatusCode(CREATED);

View File

@@ -40,6 +40,7 @@ import org.alfresco.rest.rm.community.base.BaseRMRestTest;
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent;
import org.alfresco.rest.rm.community.model.user.UserPermissions;
import org.alfresco.rest.rm.community.model.user.UserRoles;
import org.alfresco.rest.rm.community.requests.igCoreAPI.FilePlanComponentAPI;
import org.alfresco.rest.rm.community.requests.igCoreAPI.RMUserAPI;
import org.alfresco.test.AlfrescoTest;
import org.alfresco.utility.constants.UserRole;
@@ -191,20 +192,22 @@ public class DeleteRecordTests extends BaseRMRestTest
// grant deleteUser Filing privileges on randomFolder category, this will be
// inherited to randomFolder
rmUserAPI.addUserPermission(getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(randomFolder.getParentId()),
FilePlanComponentAPI filePlanComponentsAPIAsAdmin = getRestAPIFactory().getFilePlanComponentsAPI();
rmUserAPI.addUserPermission(filePlanComponentsAPIAsAdmin.getFilePlanComponent(randomFolder.getParentId()),
deleteUser, UserPermissions.PERMISSION_FILING);
rmUserAPI.usingRestWrapper().assertStatusCodeIs(OK);
// create a non-electronic record in randomFolder
FilePlanComponent newRecord = getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(createNonElectronicRecordModel(), randomFolder.getId());
FilePlanComponent newRecord = filePlanComponentsAPIAsAdmin.createFilePlanComponent(createNonElectronicRecordModel(), randomFolder.getId());
assertStatusCode(CREATED);
// verify the user can see the newRecord
getRestAPIFactory().getFilePlanComponentsAPI(deleteUser).getFilePlanComponent(newRecord.getId());
FilePlanComponentAPI filePlanComponentsAPIAsUser = getRestAPIFactory().getFilePlanComponentsAPI(deleteUser);
filePlanComponentsAPIAsUser.getFilePlanComponent(newRecord.getId());
assertStatusCode(OK);
// try to delete newRecord
getRestAPIFactory().getFilePlanComponentsAPI(deleteUser).deleteFilePlanComponent(newRecord.getId());
filePlanComponentsAPIAsUser.deleteFilePlanComponent(newRecord.getId());
assertStatusCode(FORBIDDEN);
}
@@ -215,12 +218,14 @@ public class DeleteRecordTests extends BaseRMRestTest
*/
private void deleteAndVerify(FilePlanComponent record) throws Exception
{
FilePlanComponentAPI filePlanComponentsAPI = getRestAPIFactory().getFilePlanComponentsAPI();
// delete it and verify status
getRestAPIFactory().getFilePlanComponentsAPI().deleteFilePlanComponent(record.getId());
filePlanComponentsAPI.deleteFilePlanComponent(record.getId());
assertStatusCode(NO_CONTENT);
// try to get deleted file plan component
getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(record.getId());
filePlanComponentsAPI.getFilePlanComponent(record.getId());
assertStatusCode(NOT_FOUND);
}
}

View File

@@ -42,6 +42,7 @@ import static org.testng.Assert.assertTrue;
import org.alfresco.rest.rm.community.base.BaseRMRestTest;
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent;
import org.alfresco.rest.rm.community.requests.igCoreAPI.FilePlanComponentAPI;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@@ -197,13 +198,14 @@ public class ElectronicRecordTests extends BaseRMRestTest
public void canCreateElectronicRecordsInValidContainers(FilePlanComponent container) throws Exception
{
FilePlanComponent record = createElectronicRecordModel();
String newRecordId = getRestAPIFactory().getFilePlanComponentsAPI().createElectronicRecord(record, IMAGE_FILE, container.getId()).getId();
FilePlanComponentAPI filePlanComponentsAPI = getRestAPIFactory().getFilePlanComponentsAPI();
String newRecordId = filePlanComponentsAPI.createElectronicRecord(record, IMAGE_FILE, container.getId()).getId();
// verify the create request status code
assertStatusCode(CREATED);
// get newly created electronic record and verify its properties
FilePlanComponent electronicRecord = getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(newRecordId);
FilePlanComponent electronicRecord = filePlanComponentsAPI.getFilePlanComponent(newRecordId);
// created record will have record identifier inserted in its name but will be prefixed with
// the name it was created as
assertTrue(electronicRecord.getName().startsWith(record.getName()));
@@ -227,13 +229,14 @@ public class ElectronicRecordTests extends BaseRMRestTest
.nodeType(CONTENT_TYPE)
.build();
String newRecordId = getRestAPIFactory().getFilePlanComponentsAPI().createElectronicRecord(record, IMAGE_FILE, container.getId()).getId();
FilePlanComponentAPI filePlanComponentsAPI = getRestAPIFactory().getFilePlanComponentsAPI();
String newRecordId = filePlanComponentsAPI.createElectronicRecord(record, IMAGE_FILE, container.getId()).getId();
// verify the create request status code
assertStatusCode(CREATED);
// get newly created electonic record and verify its properties
FilePlanComponent electronicRecord = getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(newRecordId);
FilePlanComponent electronicRecord = filePlanComponentsAPI.getFilePlanComponent(newRecordId);
// record will have record identifier inserted in its name but will for sure start with file name
// and end with its extension
assertTrue(electronicRecord.getName().startsWith(IMAGE_FILE.substring(0, IMAGE_FILE.indexOf("."))));

View File

@@ -47,6 +47,8 @@ import org.alfresco.rest.rm.community.base.BaseRMRestTest;
import org.alfresco.rest.rm.community.base.TestData;
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent;
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentProperties;
import org.alfresco.rest.rm.community.requests.igCoreAPI.FilePlanComponentAPI;
import org.alfresco.rest.rm.community.requests.igCoreAPI.RMSiteAPI;
import org.alfresco.utility.model.UserModel;
import org.alfresco.utility.report.Bug;
import org.testng.annotations.Test;
@@ -73,11 +75,13 @@ public class FilePlanTests extends BaseRMRestTest
)
public void getFilePlanComponentWhenRMIsNotCreated(String filePlanComponentAlias) throws Exception
{
RMSiteAPI rmSiteAPI = getRestAPIFactory().getRMSiteAPI();
// Check RM Site Exist
if (getRestAPIFactory().getRMSiteAPI().existsRMSite())
if (rmSiteAPI.existsRMSite())
{
// Delete RM Site
getRestAPIFactory().getRMSiteAPI().deleteRMSite();
rmSiteAPI.deleteRMSite();
}
// Get the file plan component
@@ -264,16 +268,18 @@ public class FilePlanTests extends BaseRMRestTest
.build())
.build();
FilePlanComponentAPI filePlanComponentsAPI = getRestAPIFactory().getFilePlanComponentsAPI();
// Create the special containers into RM site - parent folder
getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(filePlanComponent, rmSiteId);
filePlanComponentsAPI.createFilePlanComponent(filePlanComponent, rmSiteId);
assertStatusCode(UNPROCESSABLE_ENTITY);
// Create the special containers into RM site - parent folder
getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(filePlanComponent, FILE_PLAN_ALIAS);
filePlanComponentsAPI.createFilePlanComponent(filePlanComponent, FILE_PLAN_ALIAS);
assertStatusCode(UNPROCESSABLE_ENTITY);
// Create the special containers into the root of special containers containers
getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(filePlanComponent, filePlanComponentAlias);
filePlanComponentsAPI.createFilePlanComponent(filePlanComponent, filePlanComponentAlias);
assertStatusCode(UNPROCESSABLE_ENTITY);
}

View File

@@ -50,6 +50,7 @@ import java.util.Random;
import org.alfresco.rest.rm.community.base.BaseRMRestTest;
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent;
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentProperties;
import org.alfresco.rest.rm.community.requests.igCoreAPI.FilePlanComponentAPI;
import org.alfresco.utility.constants.UserRole;
import org.alfresco.utility.model.SiteModel;
import org.alfresco.utility.model.UserModel;
@@ -81,7 +82,8 @@ public class NonElectronicRecordTests extends BaseRMRestTest
.nodeType(RECORD_CATEGORY_TYPE)
.build();
FilePlanComponent recordCategory = getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(recordCategoryModel, FILE_PLAN_ALIAS);
FilePlanComponentAPI filePlanComponentsAPI = getRestAPIFactory().getFilePlanComponentsAPI();
FilePlanComponent recordCategory = filePlanComponentsAPI.createFilePlanComponent(recordCategoryModel, FILE_PLAN_ALIAS);
// iterate through all invalid parent containers and try to create/file an electronic record
asList(FILE_PLAN_ALIAS, TRANSFERS_ALIAS, HOLDS_ALIAS, recordCategory.getId())
@@ -90,7 +92,7 @@ public class NonElectronicRecordTests extends BaseRMRestTest
{
try
{
getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(createNonElectronicRecordModel(), id);
filePlanComponentsAPI.createFilePlanComponent(createNonElectronicRecordModel(), id);
}
catch (Exception error)
{
@@ -162,7 +164,8 @@ public class NonElectronicRecordTests extends BaseRMRestTest
.build();
// create non-electronic record
String nonElectronicId = getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(
FilePlanComponentAPI filePlanComponentsAPI = getRestAPIFactory().getFilePlanComponentsAPI();
String nonElectronicId = filePlanComponentsAPI.createFilePlanComponent(
filePlanComponent,
container.getId()).getId();
@@ -170,7 +173,7 @@ public class NonElectronicRecordTests extends BaseRMRestTest
assertStatusCode(CREATED);
// get newly created non-electonic record and verify its properties
FilePlanComponent nonElectronicRecord = getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(nonElectronicId);
FilePlanComponent nonElectronicRecord = filePlanComponentsAPI.getFilePlanComponent(nonElectronicId);
assertEquals(title, nonElectronicRecord.getProperties().getTitle());
assertEquals(description, nonElectronicRecord.getProperties().getDescription());

View File

@@ -49,6 +49,7 @@ import org.alfresco.rest.rm.community.base.TestData;
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent;
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentProperties;
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentsCollection;
import org.alfresco.rest.rm.community.requests.igCoreAPI.FilePlanComponentAPI;
import org.alfresco.utility.report.Bug;
import org.testng.annotations.Test;
@@ -139,7 +140,8 @@ public class RecordCategoryTest extends BaseRMRestTest
.build();
// Create the record category
FilePlanComponent filePlanComponent = getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(recordCategory, FILE_PLAN_ALIAS);
FilePlanComponentAPI filePlanComponentsAPI = getRestAPIFactory().getFilePlanComponentsAPI();
FilePlanComponent filePlanComponent = filePlanComponentsAPI.createFilePlanComponent(recordCategory, FILE_PLAN_ALIAS);
String newCategoryName = "Rename " + categoryName;
@@ -147,7 +149,7 @@ public class RecordCategoryTest extends BaseRMRestTest
FilePlanComponent recordCategoryUpdated = FilePlanComponent.builder().name(newCategoryName).build();
// Update the record category
FilePlanComponent renamedFilePlanComponent = getRestAPIFactory().getFilePlanComponentsAPI().updateFilePlanComponent(recordCategoryUpdated, filePlanComponent.getId());
FilePlanComponent renamedFilePlanComponent = filePlanComponentsAPI.updateFilePlanComponent(recordCategoryUpdated, filePlanComponent.getId());
// Verify the status code
assertStatusCode(OK);
@@ -156,7 +158,7 @@ public class RecordCategoryTest extends BaseRMRestTest
assertEquals(renamedFilePlanComponent.getName(), newCategoryName);
// Get actual FILE_PLAN_ALIAS id
FilePlanComponent parentComponent = getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(FILE_PLAN_ALIAS);
FilePlanComponent parentComponent = filePlanComponentsAPI.getFilePlanComponent(FILE_PLAN_ALIAS);
// verify renamed component still has this parent
assertEquals(renamedFilePlanComponent.getParentId(), parentComponent.getId());
@@ -189,16 +191,17 @@ public class RecordCategoryTest extends BaseRMRestTest
.build();
// Create the record category
FilePlanComponent filePlanComponent = getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(recordCategory, FILE_PLAN_ALIAS);
FilePlanComponentAPI filePlanComponentsAPI = getRestAPIFactory().getFilePlanComponentsAPI();
FilePlanComponent filePlanComponent = filePlanComponentsAPI.createFilePlanComponent(recordCategory, FILE_PLAN_ALIAS);
// Delete the record category
getRestAPIFactory().getFilePlanComponentsAPI().deleteFilePlanComponent(filePlanComponent.getId());
filePlanComponentsAPI.deleteFilePlanComponent(filePlanComponent.getId());
// Verify the status code
assertStatusCode(NO_CONTENT);
// Deleted component should no longer be retrievable
getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(filePlanComponent.getId());
filePlanComponentsAPI.getFilePlanComponent(filePlanComponent.getId());
assertStatusCode(NOT_FOUND);
}

View File

@@ -55,6 +55,7 @@ import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentProperties;
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentReviewPeriod;
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentsCollection;
import org.alfresco.rest.rm.community.requests.igCoreAPI.FilePlanComponentAPI;
import org.alfresco.utility.report.Bug;
import org.testng.annotations.AfterClass;
import org.testng.annotations.Test;
@@ -128,7 +129,8 @@ public class RecordFolderTests extends BaseRMRestTest
@Bug(id="RM-4327")
public void createFolderIntoSpecialContainers(String filePlanComponent) throws Exception
{
String componentID = getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(filePlanComponent).getId();
FilePlanComponentAPI filePlanComponentsAPI = getRestAPIFactory().getFilePlanComponentsAPI();
String componentID = filePlanComponentsAPI.getFilePlanComponent(filePlanComponent).getId();
// Build the record category properties
FilePlanComponent recordFolder = FilePlanComponent.builder()
@@ -140,7 +142,7 @@ public class RecordFolderTests extends BaseRMRestTest
.build();
// Create a record folder
getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(recordFolder, componentID);
filePlanComponentsAPI.createFilePlanComponent(recordFolder, componentID);
// Check the API Response code
assertStatusCode(UNPROCESSABLE_ENTITY);
@@ -254,12 +256,13 @@ public class RecordFolderTests extends BaseRMRestTest
FilePlanComponent folder = createFolder(category.getId(), FOLDER_NAME);
// Delete the Record folder
getRestAPIFactory().getFilePlanComponentsAPI().deleteFilePlanComponent(folder.getId());
FilePlanComponentAPI filePlanComponentsAPI = getRestAPIFactory().getFilePlanComponentsAPI();
filePlanComponentsAPI.deleteFilePlanComponent(folder.getId());
// Check the Response Status Code
assertStatusCode(NO_CONTENT);
// Check the File Plan Component is not found
getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(folder.getId());
filePlanComponentsAPI.getFilePlanComponent(folder.getId());
// Check the Response Status Code
assertStatusCode(NOT_FOUND);
}
@@ -364,7 +367,8 @@ public class RecordFolderTests extends BaseRMRestTest
.build();
// Create the record folder
FilePlanComponent folder = getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(recordFolder, FILE_PLAN_ALIAS, "include=" + PATH);
FilePlanComponentAPI filePlanComponentsAPI = getRestAPIFactory().getFilePlanComponentsAPI();
FilePlanComponent folder = filePlanComponentsAPI.createFilePlanComponent(recordFolder, FILE_PLAN_ALIAS, "include=" + PATH);
//Check the API response code
assertStatusCode(CREATED);
@@ -376,10 +380,10 @@ public class RecordFolderTests extends BaseRMRestTest
//Check the path return contains the RELATIVE_PATH
assertTrue(folder.getPath().getName().contains(relativePath));
//check the parent is a category
assertTrue(getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(folder.getParentId()).getIsCategory());
assertTrue(filePlanComponentsAPI.getFilePlanComponent(folder.getParentId()).getIsCategory());
//check the created folder from the server
folder = getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(folder.getId(), "include=" + PATH);
folder = filePlanComponentsAPI.getFilePlanComponent(folder.getId(), "include=" + PATH);
//Check the API response code
assertStatusCode(OK);
// Verify the returned properties for the file plan component - record folder
@@ -400,7 +404,7 @@ public class RecordFolderTests extends BaseRMRestTest
.build();
// Create the record folder
FilePlanComponent folder2 = getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(recordFolder2, FILE_PLAN_ALIAS, "include=" + PATH);
FilePlanComponent folder2 = filePlanComponentsAPI.createFilePlanComponent(recordFolder2, FILE_PLAN_ALIAS, "include=" + PATH);
//Check the API response code
assertStatusCode(CREATED);
@@ -412,10 +416,10 @@ public class RecordFolderTests extends BaseRMRestTest
assertTrue(folder2.getPath().getName().contains(NEW_RELATIVE_PATH));
//check the parent is a category
assertTrue(getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(folder.getParentId()).getIsCategory());
assertTrue(filePlanComponentsAPI.getFilePlanComponent(folder.getParentId()).getIsCategory());
// Check the folder created on the server
folder2 = getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(folder2.getId(), "include=" + PATH);
folder2 = filePlanComponentsAPI.getFilePlanComponent(folder2.getId(), "include=" + PATH);
//Check the API response code
assertStatusCode(OK);
@@ -430,11 +434,12 @@ public class RecordFolderTests extends BaseRMRestTest
@AfterClass (alwaysRun = true)
public void tearDown() throws Exception
{
getRestAPIFactory().getFilePlanComponentsAPI().listChildComponents(FILE_PLAN_ALIAS).getEntries().forEach(filePlanComponentEntry ->
FilePlanComponentAPI filePlanComponentsAPI = getRestAPIFactory().getFilePlanComponentsAPI();
filePlanComponentsAPI.listChildComponents(FILE_PLAN_ALIAS).getEntries().forEach(filePlanComponentEntry ->
{
try
{
getRestAPIFactory().getFilePlanComponentsAPI().deleteFilePlanComponent(filePlanComponentEntry.getFilePlanComponentModel().getId());
filePlanComponentsAPI.deleteFilePlanComponent(filePlanComponentEntry.getFilePlanComponentModel().getId());
}
catch (Exception e)
{

View File

@@ -52,6 +52,7 @@ import org.alfresco.rest.rm.community.base.BaseRMRestTest;
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent;
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentProperties;
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentsCollection;
import org.alfresco.rest.rm.community.requests.igCoreAPI.FilePlanComponentAPI;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@@ -193,7 +194,8 @@ public class UnfiledRecordsFolderTests extends BaseRMRestTest
.build();
// Create it as a child of parentFolder
FilePlanComponent childFolder = getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(unfiledFolder, parentFolder.getId());
FilePlanComponentAPI filePlanComponentsAPI = getRestAPIFactory().getFilePlanComponentsAPI();
FilePlanComponent childFolder = filePlanComponentsAPI.createFilePlanComponent(unfiledFolder, parentFolder.getId());
// Verify the status code
assertStatusCode(CREATED);
@@ -217,7 +219,7 @@ public class UnfiledRecordsFolderTests extends BaseRMRestTest
// Does child's parent point to it?
// Perform another call as our parentFolder had been executed before childFolder existed
FilePlanComponentsCollection parentsChildren = getRestAPIFactory().getFilePlanComponentsAPI().listChildComponents(parentFolder.getId());
FilePlanComponentsCollection parentsChildren = filePlanComponentsAPI.listChildComponents(parentFolder.getId());
assertStatusCode(OK);
List<String> childIds = parentsChildren.getEntries()
.stream()
@@ -258,12 +260,13 @@ public class UnfiledRecordsFolderTests extends BaseRMRestTest
.build();
// Update the unfiled records folder
getRestAPIFactory().getFilePlanComponentsAPI().updateFilePlanComponent(folderToUpdate, folderToModify.getId());
FilePlanComponentAPI filePlanComponentsAPI = getRestAPIFactory().getFilePlanComponentsAPI();
filePlanComponentsAPI.updateFilePlanComponent(folderToUpdate, folderToModify.getId());
// Verify the status code
assertStatusCode(OK);
// This is to ensure the change was actually applied, rather than simply trusting the object returned by PUT
FilePlanComponent renamedFolder = getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(folderToModify.getId());
FilePlanComponent renamedFolder = filePlanComponentsAPI.getFilePlanComponent(folderToModify.getId());
// Verify the returned file plan component
assertEquals(modified + folderToModify.getName(), renamedFolder.getName());
@@ -288,13 +291,14 @@ public class UnfiledRecordsFolderTests extends BaseRMRestTest
assertEquals(folderName, folderToDelete.getName());
// Delete folderToDelete
getRestAPIFactory().getFilePlanComponentsAPI().deleteFilePlanComponent(folderToDelete.getId());
FilePlanComponentAPI filePlanComponentsAPI = getRestAPIFactory().getFilePlanComponentsAPI();
filePlanComponentsAPI.deleteFilePlanComponent(folderToDelete.getId());
// Verify the status code
assertStatusCode(NO_CONTENT);
// Deleted component should no longer be retrievable
getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(folderToDelete.getId());
filePlanComponentsAPI.getFilePlanComponent(folderToDelete.getId());
assertStatusCode(NOT_FOUND);
}
}

View File

@@ -50,6 +50,7 @@ import static org.testng.Assert.assertNotNull;
import org.alfresco.rest.rm.community.base.BaseRMRestTest;
import org.alfresco.rest.rm.community.model.site.RMSite;
import org.alfresco.rest.rm.community.requests.igCoreAPI.RMSiteAPI;
import org.alfresco.rest.rm.community.requests.igCoreAPI.RMUserAPI;
import org.alfresco.utility.data.RandomData;
import org.alfresco.utility.model.UserModel;
@@ -80,15 +81,17 @@ public class RMSiteTests extends BaseRMRestTest
)
public void createRMSiteAsAdminUser() throws Exception
{
RMSiteAPI rmSiteAPI = getRestAPIFactory().getRMSiteAPI();
// Check if the RM site exists
if (getRestAPIFactory().getRMSiteAPI().existsRMSite())
if (rmSiteAPI.existsRMSite())
{
// Delete the RM site
getRestAPIFactory().getRMSiteAPI().deleteRMSite();
rmSiteAPI.deleteRMSite();
}
// Create the RM site
RMSite rmSiteResponse = getRestAPIFactory().getRMSiteAPI().createRMSite(createStandardRMSiteModel());
RMSite rmSiteResponse = rmSiteAPI.createRMSite(createStandardRMSiteModel());
// Verify the status code
assertStatusCode(CREATED);
@@ -160,8 +163,10 @@ public class RMSiteTests extends BaseRMRestTest
)
public void getRMSite() throws Exception
{
RMSiteAPI rmSiteAPI = getRestAPIFactory().getRMSiteAPI();
// Check if RM site exists
if (!getRestAPIFactory().getRMSiteAPI().existsRMSite())
if (!rmSiteAPI.existsRMSite())
{
// Verify the status code when RM site doesn't exist
assertStatusCode(NOT_FOUND);
@@ -170,7 +175,7 @@ public class RMSiteTests extends BaseRMRestTest
else
{
// Get the RM site
RMSite rmSiteModel = getRestAPIFactory().getRMSiteAPI().getSite();
RMSite rmSiteModel = rmSiteAPI.getSite();
// Verify the status code
assertStatusCode(OK);
@@ -193,11 +198,13 @@ public class RMSiteTests extends BaseRMRestTest
@Bug (id="RM-4289")
public void createRMSiteAsAnotherAdminUser() throws Exception
{
RMSiteAPI rmSiteAPI = getRestAPIFactory().getRMSiteAPI();
// Check if the RM site exists
if (getRestAPIFactory().getRMSiteAPI().existsRMSite())
if (rmSiteAPI.existsRMSite())
{
// Delete the RM site
getRestAPIFactory().getRMSiteAPI().deleteRMSite();
rmSiteAPI.deleteRMSite();
}
// Create user