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

This commit is contained in:
Tuna Aksoy
2016-12-27 23:50:48 +00:00
parent cbb4a9845c
commit 5c28bf41da
12 changed files with 254 additions and 273 deletions

View File

@@ -0,0 +1,87 @@
/*
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
* -
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* -
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
* -
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.rest.core;
import org.alfresco.rest.rm.community.requests.igCoreAPI.FilePlanComponentAPI;
import org.alfresco.rest.rm.community.requests.igCoreAPI.RMSiteAPI;
import org.alfresco.rest.rm.community.requests.igCoreAPI.RestIGCoreAPI;
import org.alfresco.utility.data.DataUser;
import org.alfresco.utility.model.UserModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
/**
* REST API Factory Implementation
*
* @author Tuna Aksoy
* @since 2.6
*/
@Service
@Scope(value = "prototype")
public class RestAPIFactory
{
@Autowired
private DataUser dataUser;
@Autowired
private RMRestWrapper rmRestWrapper;
/**
* @return the rmRestWrapper
*/
public RMRestWrapper getRmRestWrapper()
{
return this.rmRestWrapper;
}
private RestIGCoreAPI getRestIGCoreAPI(UserModel userModel)
{
getRmRestWrapper().authenticateUser(userModel != null ? userModel : dataUser.getAdminUser());
return getRmRestWrapper().withIGCoreAPI();
}
public RMSiteAPI getRMSiteAPI()
{
return getRestIGCoreAPI(null).usingRMSite();
}
public RMSiteAPI getRMSiteAPI(UserModel userModel)
{
return getRestIGCoreAPI(userModel).usingRMSite();
}
public FilePlanComponentAPI getFilePlanComponentsAPI()
{
return getRestIGCoreAPI(null).usingFilePlanComponents();
}
public FilePlanComponentAPI getFilePlanComponentsAPI(UserModel userModel)
{
return getRestIGCoreAPI(userModel).usingFilePlanComponents();
}
}

View File

@@ -44,9 +44,6 @@ import org.alfresco.rest.rm.community.requests.RMModelRequest;
*/ */
public class RestIGCoreAPI extends RMModelRequest public class RestIGCoreAPI extends RMModelRequest
{ {
@SuppressWarnings("unused")
private RMRestProperties rmRestProperties;
/** /**
* Constructor * Constructor
* *
@@ -56,7 +53,6 @@ public class RestIGCoreAPI extends RMModelRequest
public RestIGCoreAPI(RMRestWrapper rmRestWrapper, RMRestProperties rmRestProperties) public RestIGCoreAPI(RMRestWrapper rmRestWrapper, RMRestProperties rmRestProperties)
{ {
super(rmRestWrapper); super(rmRestWrapper);
this.rmRestProperties = rmRestProperties;
RestAssured.baseURI = format("%s://%s", rmRestProperties.getScheme(), rmRestProperties.getServer()); RestAssured.baseURI = format("%s://%s", rmRestProperties.getScheme(), rmRestProperties.getServer());
RestAssured.port = parseInt(rmRestProperties.getPort()); RestAssured.port = parseInt(rmRestProperties.getPort());
RestAssured.basePath = rmRestProperties.getRestRmPath(); RestAssured.basePath = rmRestProperties.getRestRmPath();

View File

@@ -1,135 +0,0 @@
/*
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* -
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
* -
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* -
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
* -
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.rest.rm.community.base;
import org.alfresco.rest.RestTest;
import org.alfresco.rest.core.RMRestWrapper;
import org.alfresco.rest.rm.community.requests.igCoreAPI.FilePlanComponentAPI;
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;
import org.springframework.http.HttpStatus;
/**
* Abstract class to hold the REST APIs
*
* @author Tuna Aksoy
* @since 2.6
*/
public abstract class BaseRESTAPI extends RestTest
{
@Autowired
private RMRestWrapper rmRestWrapper;
@Autowired
private DataUser dataUser;
/**
* The RM REST Wrapper
*
* @return the rmRestWrapper
*/
protected RMRestWrapper getRmRestWrapper()
{
return this.rmRestWrapper;
}
/**
* The data user service
*
* @return the dataUser
*/
protected DataUser getDataUser()
{
return this.dataUser;
}
/**
* Compares the given {@link HttpStatus} code with the response status code
*
* @param httpStatus The {@link HttpStatus} to assert
*/
protected void assertStatusCode(HttpStatus httpStatus)
{
getRmRestWrapper().assertStatusCodeIs(httpStatus);
}
/**
* Gets the admin user
*
* @return The admin user
*/
protected UserModel getAdminUser()
{
return getDataUser().getAdminUser();
}
/**
* Gets the {@link RMSiteAPI} as the admin user
*
* @return {@link RMSiteAPI} with the admin credentials
*/
protected RMSiteAPI getRMSiteAPI()
{
return getRMSiteAPI(getAdminUser());
}
/**
* Gets the {@link RMSiteAPI} as the given user
*
* @param userModel The user model whose credentials will be used to get the API
* @return {@link RMSiteAPI} with user credentials
*/
protected RMSiteAPI getRMSiteAPI(UserModel userModel)
{
getRmRestWrapper().authenticateUser(userModel);
return getRmRestWrapper().withIGCoreAPI().usingRMSite();
}
/**
* Gets the {@link FilePlanComponentAPI} as the admin user
*
* @return {@link FilePlanComponentAPI} with the admin credentials
*/
protected FilePlanComponentAPI getFilePlanComponentsAPI()
{
return getFilePlanComponentsAPI(getAdminUser());
}
/**
* Get the {@link FilePlanComponentAPI} as the given user
*
* @param userModel The user model whose credentials will be used to get the API
* @return {@link FilePlanComponentAPI} with the user credentials
*/
protected FilePlanComponentAPI getFilePlanComponentsAPI(UserModel userModel)
{
getRmRestWrapper().authenticateUser(userModel);
return getRmRestWrapper().withIGCoreAPI().usingFilePlanComponents();
}
}

View File

@@ -39,9 +39,14 @@ import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric;
import static org.springframework.http.HttpStatus.CREATED; import static org.springframework.http.HttpStatus.CREATED;
import static org.springframework.http.HttpStatus.OK; import static org.springframework.http.HttpStatus.OK;
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.FilePlanComponent;
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentProperties; import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentProperties;
import org.alfresco.utility.data.DataUser;
import org.alfresco.utility.model.UserModel; import org.alfresco.utility.model.UserModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider; import org.testng.annotations.DataProvider;
@@ -52,8 +57,54 @@ import org.testng.annotations.DataProvider;
* @author Tuna Aksoy * @author Tuna Aksoy
* @since 2.6 * @since 2.6
*/ */
public class BaseRESTTest extends BaseRESTAPI public class BaseRMRestTest extends RestTest
{ {
@Autowired
private RestAPIFactory restAPIFactory;
@Autowired
private DataUser dataUser;
/**
* FIXME!!!
*
* @return the restAPIFactory FIXME!!!
*/
protected RestAPIFactory getRestAPIFactory()
{
return this.restAPIFactory;
}
/**
* FIXME!!!
*
* @return the dataUser FIXME!!!
*/
protected DataUser getDataUser()
{
return this.dataUser;
}
/**
* FIXME!!!
*
* @param created FIXME!!!
*/
protected void assertStatusCode(HttpStatus statusCode)
{
getRestAPIFactory().getRmRestWrapper().assertStatusCodeIs(statusCode);
}
/**
* FIXME!!!
*
* @return FIXME!!!
*/
protected UserModel getAdminUser()
{
return getDataUser().getAdminUser();
}
/** Valid root containers where electronic and non-electronic records can be created */ /** Valid root containers where electronic and non-electronic records can be created */
@DataProvider(name = "validRootContainers") @DataProvider(name = "validRootContainers")
public Object[][] getValidRootContainers() throws Exception public Object[][] getValidRootContainers() throws Exception
@@ -87,10 +138,10 @@ public class BaseRESTTest extends BaseRESTAPI
public void createRMSiteIfNotExists() throws Exception public void createRMSiteIfNotExists() throws Exception
{ {
// Check RM site doesn't exist // Check RM site doesn't exist
if (!getRMSiteAPI().existsRMSite()) if (!getRestAPIFactory().getRMSiteAPI().existsRMSite())
{ {
// Create the RM site // Create the RM site
getRMSiteAPI().createRMSite(createStandardRMSiteModel()); getRestAPIFactory().getRMSiteAPI().createRMSite(createStandardRMSiteModel());
// Verify the status code // Verify the status code
assertStatusCode(CREATED); assertStatusCode(CREATED);
@@ -192,7 +243,7 @@ public class BaseRESTTest extends BaseRESTAPI
private FilePlanComponent createComponent(UserModel user, String parentComponentId, String componentName, String componentType, String componentTitle) throws Exception private FilePlanComponent createComponent(UserModel user, String parentComponentId, String componentName, String componentType, String componentTitle) throws Exception
{ {
FilePlanComponent filePlanComponentModel = createFilePlanComponentModel(componentName, componentType, componentTitle); FilePlanComponent filePlanComponentModel = createFilePlanComponentModel(componentName, componentType, componentTitle);
FilePlanComponent filePlanComponent = getFilePlanComponentsAPI(user).createFilePlanComponent(filePlanComponentModel, parentComponentId); FilePlanComponent filePlanComponent = getRestAPIFactory().getFilePlanComponentsAPI(user).createFilePlanComponent(filePlanComponentModel, parentComponentId);
assertStatusCode(CREATED); assertStatusCode(CREATED);
return filePlanComponent; return filePlanComponent;
@@ -213,7 +264,7 @@ public class BaseRESTTest extends BaseRESTAPI
FilePlanComponent filePlanComponent = new FilePlanComponent(); FilePlanComponent filePlanComponent = new FilePlanComponent();
filePlanComponent.setProperties(properties); filePlanComponent.setProperties(properties);
FilePlanComponent updatedComponent = getFilePlanComponentsAPI().updateFilePlanComponent(filePlanComponent, folderId); FilePlanComponent updatedComponent = getRestAPIFactory().getFilePlanComponentsAPI().updateFilePlanComponent(filePlanComponent, folderId);
assertStatusCode(OK); assertStatusCode(OK);
return updatedComponent; return updatedComponent;
} }
@@ -257,7 +308,7 @@ public class BaseRESTTest extends BaseRESTAPI
*/ */
public FilePlanComponent getFilePlanComponentAsUser(UserModel user, String componentId) throws Exception public FilePlanComponent getFilePlanComponentAsUser(UserModel user, String componentId) throws Exception
{ {
return getFilePlanComponentsAPI(user).getFilePlanComponent(componentId); return getRestAPIFactory().getFilePlanComponentsAPI(user).getFilePlanComponent(componentId);
} }
/** /**

View File

@@ -36,14 +36,13 @@ import static org.springframework.http.HttpStatus.NOT_FOUND;
import static org.springframework.http.HttpStatus.NO_CONTENT; import static org.springframework.http.HttpStatus.NO_CONTENT;
import static org.springframework.http.HttpStatus.OK; import static org.springframework.http.HttpStatus.OK;
import org.alfresco.rest.rm.community.base.BaseRESTTest; 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.FilePlanComponent;
import org.alfresco.rest.rm.community.model.user.UserPermissions; import org.alfresco.rest.rm.community.model.user.UserPermissions;
import org.alfresco.rest.rm.community.model.user.UserRoles; import org.alfresco.rest.rm.community.model.user.UserRoles;
import org.alfresco.rest.rm.community.requests.igCoreAPI.RMUserAPI; import org.alfresco.rest.rm.community.requests.igCoreAPI.RMUserAPI;
import org.alfresco.test.AlfrescoTest; import org.alfresco.test.AlfrescoTest;
import org.alfresco.utility.constants.UserRole; import org.alfresco.utility.constants.UserRole;
import org.alfresco.utility.data.DataUser;
import org.alfresco.utility.model.SiteModel; import org.alfresco.utility.model.SiteModel;
import org.alfresco.utility.model.UserModel; import org.alfresco.utility.model.UserModel;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -58,14 +57,11 @@ import org.testng.annotations.Test;
* @author Kristijan Conkas * @author Kristijan Conkas
* @since 2.6 * @since 2.6
*/ */
public class DeleteRecordTests extends BaseRESTTest public class DeleteRecordTests extends BaseRMRestTest
{ {
@Autowired @Autowired
private RMUserAPI rmUserAPI; private RMUserAPI rmUserAPI;
@Autowired
private DataUser dataUser;
/** /**
* <pre> * <pre>
* Given a record * Given a record
@@ -86,7 +82,7 @@ public class DeleteRecordTests extends BaseRESTTest
@AlfrescoTest(jira="RM-4363") @AlfrescoTest(jira="RM-4363")
public void adminCanDeleteElectronicRecord(FilePlanComponent container) throws Exception public void adminCanDeleteElectronicRecord(FilePlanComponent container) throws Exception
{ {
FilePlanComponent newRecord = getFilePlanComponentsAPI().createElectronicRecord(createElectronicRecordModel(), IMAGE_FILE, container.getId()); FilePlanComponent newRecord = getRestAPIFactory().getFilePlanComponentsAPI().createElectronicRecord(createElectronicRecordModel(), IMAGE_FILE, container.getId());
assertStatusCode(CREATED); assertStatusCode(CREATED);
@@ -114,7 +110,7 @@ public class DeleteRecordTests extends BaseRESTTest
public void adminCanDeleteNonElectronicRecord(FilePlanComponent container) throws Exception public void adminCanDeleteNonElectronicRecord(FilePlanComponent container) throws Exception
{ {
// create a non-electronic record // create a non-electronic record
FilePlanComponent newRecord = getFilePlanComponentsAPI().createFilePlanComponent(createNonElectronicRecordModel(), container.getId()); FilePlanComponent newRecord = getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(createNonElectronicRecordModel(), container.getId());
assertStatusCode(CREATED); assertStatusCode(CREATED);
@@ -141,22 +137,22 @@ public class DeleteRecordTests extends BaseRESTTest
public void userWithoutWritePermissionsCantDeleteRecord() throws Exception public void userWithoutWritePermissionsCantDeleteRecord() throws Exception
{ {
// create a non-electronic record in unfiled records // create a non-electronic record in unfiled records
FilePlanComponent newRecord = getFilePlanComponentsAPI().createFilePlanComponent(createNonElectronicRecordModel(), UNFILED_RECORDS_CONTAINER_ALIAS); FilePlanComponent newRecord = getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(createNonElectronicRecordModel(), UNFILED_RECORDS_CONTAINER_ALIAS);
assertStatusCode(CREATED); assertStatusCode(CREATED);
// create test user and add it with collab. privileges // create test user and add it with collab. privileges
UserModel deleteUser = dataUser.createRandomTestUser("delnoperm"); UserModel deleteUser = getDataUser().createRandomTestUser("delnoperm");
deleteUser.setUserRole(UserRole.SiteCollaborator); deleteUser.setUserRole(UserRole.SiteCollaborator);
logger.info("test user: " + deleteUser.getUsername()); logger.info("test user: " + deleteUser.getUsername());
dataUser.addUserToSite(deleteUser, new SiteModel(getRMSiteAPI().getSite().getId()), UserRole.SiteCollaborator); getDataUser().addUserToSite(deleteUser, new SiteModel(getRestAPIFactory().getRMSiteAPI().getSite().getId()), UserRole.SiteCollaborator);
// add RM role to user // add RM role to user
rmUserAPI.assignRoleToUser(deleteUser.getUsername(), UserRoles.ROLE_RM_POWER_USER); rmUserAPI.assignRoleToUser(deleteUser.getUsername(), UserRoles.ROLE_RM_POWER_USER);
rmUserAPI.usingRestWrapper().assertStatusCodeIs(OK); rmUserAPI.usingRestWrapper().assertStatusCodeIs(OK);
// try to delete newRecord // try to delete newRecord
getFilePlanComponentsAPI(deleteUser).deleteFilePlanComponent(newRecord.getId()); getRestAPIFactory().getFilePlanComponentsAPI(deleteUser).deleteFilePlanComponent(newRecord.getId());
assertStatusCode(FORBIDDEN); assertStatusCode(FORBIDDEN);
} }
@@ -180,9 +176,9 @@ public class DeleteRecordTests extends BaseRESTTest
public void userWithoutDeleteRecordsCapabilityCantDeleteRecord() throws Exception public void userWithoutDeleteRecordsCapabilityCantDeleteRecord() throws Exception
{ {
// create test user and add it with collab. privileges // create test user and add it with collab. privileges
UserModel deleteUser = dataUser.createRandomTestUser("delnoperm"); UserModel deleteUser = getDataUser().createRandomTestUser("delnoperm");
deleteUser.setUserRole(UserRole.SiteCollaborator); deleteUser.setUserRole(UserRole.SiteCollaborator);
dataUser.addUserToSite(deleteUser, new SiteModel(getRMSiteAPI().getSite().getId()), UserRole.SiteCollaborator); getDataUser().addUserToSite(deleteUser, new SiteModel(getRestAPIFactory().getRMSiteAPI().getSite().getId()), UserRole.SiteCollaborator);
logger.info("test user: " + deleteUser.getUsername()); logger.info("test user: " + deleteUser.getUsername());
// add RM role to user, RM Power User doesn't have the Delete Record capabilities // add RM role to user, RM Power User doesn't have the Delete Record capabilities
@@ -195,20 +191,20 @@ public class DeleteRecordTests extends BaseRESTTest
// grant deleteUser Filing privileges on randomFolder category, this will be // grant deleteUser Filing privileges on randomFolder category, this will be
// inherited to randomFolder // inherited to randomFolder
rmUserAPI.addUserPermission(getFilePlanComponentsAPI().getFilePlanComponent(randomFolder.getParentId()), rmUserAPI.addUserPermission(getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(randomFolder.getParentId()),
deleteUser, UserPermissions.PERMISSION_FILING); deleteUser, UserPermissions.PERMISSION_FILING);
rmUserAPI.usingRestWrapper().assertStatusCodeIs(OK); rmUserAPI.usingRestWrapper().assertStatusCodeIs(OK);
// create a non-electronic record in randomFolder // create a non-electronic record in randomFolder
FilePlanComponent newRecord = getFilePlanComponentsAPI().createFilePlanComponent(createNonElectronicRecordModel(), randomFolder.getId()); FilePlanComponent newRecord = getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(createNonElectronicRecordModel(), randomFolder.getId());
assertStatusCode(CREATED); assertStatusCode(CREATED);
// verify the user can see the newRecord // verify the user can see the newRecord
getFilePlanComponentsAPI(deleteUser).getFilePlanComponent(newRecord.getId()); getRestAPIFactory().getFilePlanComponentsAPI(deleteUser).getFilePlanComponent(newRecord.getId());
assertStatusCode(OK); assertStatusCode(OK);
// try to delete newRecord // try to delete newRecord
getFilePlanComponentsAPI(deleteUser).deleteFilePlanComponent(newRecord.getId()); getRestAPIFactory().getFilePlanComponentsAPI(deleteUser).deleteFilePlanComponent(newRecord.getId());
assertStatusCode(FORBIDDEN); assertStatusCode(FORBIDDEN);
} }
@@ -220,11 +216,11 @@ public class DeleteRecordTests extends BaseRESTTest
private void deleteAndVerify(FilePlanComponent record) throws Exception private void deleteAndVerify(FilePlanComponent record) throws Exception
{ {
// delete it and verify status // delete it and verify status
getFilePlanComponentsAPI().deleteFilePlanComponent(record.getId()); getRestAPIFactory().getFilePlanComponentsAPI().deleteFilePlanComponent(record.getId());
assertStatusCode(NO_CONTENT); assertStatusCode(NO_CONTENT);
// try to get deleted file plan component // try to get deleted file plan component
getFilePlanComponentsAPI().getFilePlanComponent(record.getId()); getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(record.getId());
assertStatusCode(NOT_FOUND); assertStatusCode(NOT_FOUND);
} }
} }

View File

@@ -40,7 +40,7 @@ import static org.springframework.http.HttpStatus.UNPROCESSABLE_ENTITY;
import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue; import static org.testng.Assert.assertTrue;
import org.alfresco.rest.rm.community.base.BaseRESTTest; 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.FilePlanComponent;
import org.testng.annotations.DataProvider; import org.testng.annotations.DataProvider;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@@ -54,7 +54,7 @@ import org.testng.annotations.Test;
* @author Kristijan Conkas * @author Kristijan Conkas
* @since 2.6 * @since 2.6
*/ */
public class ElectronicRecordTests extends BaseRESTTest public class ElectronicRecordTests extends BaseRMRestTest
{ {
/** Valid root containers where electronic records can be created */ /** Valid root containers where electronic records can be created */
@DataProvider(name = "invalidParentContainers") @DataProvider(name = "invalidParentContainers")
@@ -91,7 +91,7 @@ public class ElectronicRecordTests extends BaseRESTTest
public void cantCreateElectronicRecordsInInvalidContainers(FilePlanComponent container) throws Exception public void cantCreateElectronicRecordsInInvalidContainers(FilePlanComponent container) throws Exception
{ {
// Build object the filePlan // Build object the filePlan
getFilePlanComponentsAPI().createElectronicRecord(createElectronicRecordModel(), IMAGE_FILE, container.getId()); getRestAPIFactory().getFilePlanComponentsAPI().createElectronicRecord(createElectronicRecordModel(), IMAGE_FILE, container.getId());
// verify the create request status code // verify the create request status code
assertStatusCode(UNPROCESSABLE_ENTITY); assertStatusCode(UNPROCESSABLE_ENTITY);
@@ -119,7 +119,7 @@ public class ElectronicRecordTests extends BaseRESTTest
closeFolder(recordFolder.getId()); closeFolder(recordFolder.getId());
// try to create it, this should fail // try to create it, this should fail
getFilePlanComponentsAPI().createElectronicRecord(createElectronicRecordModel(), IMAGE_FILE, recordFolder.getId()); getRestAPIFactory().getFilePlanComponentsAPI().createElectronicRecord(createElectronicRecordModel(), IMAGE_FILE, recordFolder.getId());
// verify the status code // verify the status code
assertStatusCode(UNPROCESSABLE_ENTITY); assertStatusCode(UNPROCESSABLE_ENTITY);
@@ -166,7 +166,7 @@ public class ElectronicRecordTests extends BaseRESTTest
.build(); .build();
// try to create it // try to create it
getFilePlanComponentsAPI().createFilePlanComponent(record, container.getId()); getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(record, container.getId());
// verify the status code is BAD_REQUEST // verify the status code is BAD_REQUEST
assertStatusCode(BAD_REQUEST); assertStatusCode(BAD_REQUEST);
@@ -197,13 +197,13 @@ public class ElectronicRecordTests extends BaseRESTTest
public void canCreateElectronicRecordsInValidContainers(FilePlanComponent container) throws Exception public void canCreateElectronicRecordsInValidContainers(FilePlanComponent container) throws Exception
{ {
FilePlanComponent record = createElectronicRecordModel(); FilePlanComponent record = createElectronicRecordModel();
String newRecordId = getFilePlanComponentsAPI().createElectronicRecord(record, IMAGE_FILE, container.getId()).getId(); String newRecordId = getRestAPIFactory().getFilePlanComponentsAPI().createElectronicRecord(record, IMAGE_FILE, container.getId()).getId();
// verify the create request status code // verify the create request status code
assertStatusCode(CREATED); assertStatusCode(CREATED);
// get newly created electronic record and verify its properties // get newly created electronic record and verify its properties
FilePlanComponent electronicRecord = getFilePlanComponentsAPI().getFilePlanComponent(newRecordId); FilePlanComponent electronicRecord = getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(newRecordId);
// created record will have record identifier inserted in its name but will be prefixed with // created record will have record identifier inserted in its name but will be prefixed with
// the name it was created as // the name it was created as
assertTrue(electronicRecord.getName().startsWith(record.getName())); assertTrue(electronicRecord.getName().startsWith(record.getName()));
@@ -227,13 +227,13 @@ public class ElectronicRecordTests extends BaseRESTTest
.nodeType(CONTENT_TYPE) .nodeType(CONTENT_TYPE)
.build(); .build();
String newRecordId = getFilePlanComponentsAPI().createElectronicRecord(record, IMAGE_FILE, container.getId()).getId(); String newRecordId = getRestAPIFactory().getFilePlanComponentsAPI().createElectronicRecord(record, IMAGE_FILE, container.getId()).getId();
// verify the create request status code // verify the create request status code
assertStatusCode(CREATED); assertStatusCode(CREATED);
// get newly created electonic record and verify its properties // get newly created electonic record and verify its properties
FilePlanComponent electronicRecord = getFilePlanComponentsAPI().getFilePlanComponent(newRecordId); FilePlanComponent electronicRecord = getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(newRecordId);
// record will have record identifier inserted in its name but will for sure start with file name // record will have record identifier inserted in its name but will for sure start with file name
// and end with its extension // and end with its extension
assertTrue(electronicRecord.getName().startsWith(IMAGE_FILE.substring(0, IMAGE_FILE.indexOf(".")))); assertTrue(electronicRecord.getName().startsWith(IMAGE_FILE.substring(0, IMAGE_FILE.indexOf("."))));

View File

@@ -43,14 +43,12 @@ import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue; import static org.testng.Assert.assertTrue;
import org.alfresco.rest.rm.community.base.BaseRESTTest; import org.alfresco.rest.rm.community.base.BaseRMRestTest;
import org.alfresco.rest.rm.community.base.TestData; 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.FilePlanComponent;
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentProperties; import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentProperties;
import org.alfresco.utility.data.DataUser;
import org.alfresco.utility.model.UserModel; import org.alfresco.utility.model.UserModel;
import org.alfresco.utility.report.Bug; import org.alfresco.utility.report.Bug;
import org.springframework.beans.factory.annotation.Autowired;
import org.testng.annotations.Test; import org.testng.annotations.Test;
/** /**
@@ -60,11 +58,8 @@ import org.testng.annotations.Test;
* @author Rodica Sutu * @author Rodica Sutu
* @since 2.6 * @since 2.6
*/ */
public class FilePlanTests extends BaseRESTTest public class FilePlanTests extends BaseRMRestTest
{ {
@Autowired
private DataUser dataUser;
/** /**
* Given that the RM site doesn't exist * Given that the RM site doesn't exist
* When I use the API to get the File Plan/Holds/Unfiled Records Container/Transfers * When I use the API to get the File Plan/Holds/Unfiled Records Container/Transfers
@@ -79,14 +74,14 @@ public class FilePlanTests extends BaseRESTTest
public void getFilePlanComponentWhenRMIsNotCreated(String filePlanComponentAlias) throws Exception public void getFilePlanComponentWhenRMIsNotCreated(String filePlanComponentAlias) throws Exception
{ {
// Check RM Site Exist // Check RM Site Exist
if (getRMSiteAPI().existsRMSite()) if (getRestAPIFactory().getRMSiteAPI().existsRMSite())
{ {
// Delete RM Site // Delete RM Site
getRMSiteAPI().deleteRMSite(); getRestAPIFactory().getRMSiteAPI().deleteRMSite();
} }
// Get the file plan component // Get the file plan component
getFilePlanComponentsAPI().getFilePlanComponent(filePlanComponentAlias); getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(filePlanComponentAlias);
//check the response code is NOT_FOUND //check the response code is NOT_FOUND
assertStatusCode(NOT_FOUND); assertStatusCode(NOT_FOUND);
@@ -109,7 +104,7 @@ public class FilePlanTests extends BaseRESTTest
createRMSiteIfNotExists(); createRMSiteIfNotExists();
// Get the file plan special container // Get the file plan special container
FilePlanComponent filePlanComponent = getFilePlanComponentsAPI().getFilePlanComponent(filePlanComponentAlias); FilePlanComponent filePlanComponent = getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(filePlanComponentAlias);
// Check the response code // Check the response code
assertStatusCode(OK); assertStatusCode(OK);
@@ -135,7 +130,7 @@ public class FilePlanTests extends BaseRESTTest
createRMSiteIfNotExists(); createRMSiteIfNotExists();
// Get the file plan special containers with the optional parameter allowableOperations // Get the file plan special containers with the optional parameter allowableOperations
FilePlanComponent filePlanComponent = getFilePlanComponentsAPI().getFilePlanComponent(specialContainerAlias, "include=" + ALLOWABLE_OPERATIONS); FilePlanComponent filePlanComponent = getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(specialContainerAlias, "include=" + ALLOWABLE_OPERATIONS);
// Check the list of allowableOperations returned // Check the list of allowableOperations returned
if(specialContainerAlias.equals(TRANSFERS_ALIAS)) if(specialContainerAlias.equals(TRANSFERS_ALIAS))
@@ -179,7 +174,7 @@ public class FilePlanTests extends BaseRESTTest
.build(); .build();
// Update the record category // Update the record category
FilePlanComponent renamedFilePlanComponent = getFilePlanComponentsAPI().updateFilePlanComponent(filePlanComponent, FILE_PLAN_ALIAS); FilePlanComponent renamedFilePlanComponent = getRestAPIFactory().getFilePlanComponentsAPI().updateFilePlanComponent(filePlanComponent, FILE_PLAN_ALIAS);
// Verify the response status code // Verify the response status code
assertStatusCode(OK); assertStatusCode(OK);
@@ -208,7 +203,7 @@ public class FilePlanTests extends BaseRESTTest
createRMSiteIfNotExists(); createRMSiteIfNotExists();
// Delete the file plan component // Delete the file plan component
getFilePlanComponentsAPI().deleteFilePlanComponent(filePlanComponentAlias); getRestAPIFactory().getFilePlanComponentsAPI().deleteFilePlanComponent(filePlanComponentAlias);
// Check the DELETE response status code // Check the DELETE response status code
assertStatusCode(UNPROCESSABLE_ENTITY); assertStatusCode(UNPROCESSABLE_ENTITY);
@@ -231,10 +226,10 @@ public class FilePlanTests extends BaseRESTTest
createRMSiteIfNotExists(); createRMSiteIfNotExists();
// Create a random user // Create a random user
UserModel nonRMuser = dataUser.createRandomTestUser("testUser"); UserModel nonRMuser = getDataUser().createRandomTestUser("testUser");
// Delete the file plan component // Delete the file plan component
getFilePlanComponentsAPI(nonRMuser).deleteFilePlanComponent(filePlanComponentAlias); getRestAPIFactory().getFilePlanComponentsAPI(nonRMuser).deleteFilePlanComponent(filePlanComponentAlias);
// Check the DELETE response status code // Check the DELETE response status code
assertStatusCode(FORBIDDEN); assertStatusCode(FORBIDDEN);
@@ -258,7 +253,7 @@ public class FilePlanTests extends BaseRESTTest
createRMSiteIfNotExists(); createRMSiteIfNotExists();
// Get the RM site ID // Get the RM site ID
String rmSiteId = getRMSiteAPI().getSite().getGuid(); String rmSiteId = getRestAPIFactory().getRMSiteAPI().getSite().getGuid();
String name = filePlanComponentAlias + getRandomAlphanumeric(); String name = filePlanComponentAlias + getRandomAlphanumeric();
// Build the file plan root properties // Build the file plan root properties
@@ -270,15 +265,15 @@ public class FilePlanTests extends BaseRESTTest
.build(); .build();
// Create the special containers into RM site - parent folder // Create the special containers into RM site - parent folder
getFilePlanComponentsAPI().createFilePlanComponent(filePlanComponent, rmSiteId); getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(filePlanComponent, rmSiteId);
assertStatusCode(UNPROCESSABLE_ENTITY); assertStatusCode(UNPROCESSABLE_ENTITY);
// Create the special containers into RM site - parent folder // Create the special containers into RM site - parent folder
getFilePlanComponentsAPI().createFilePlanComponent(filePlanComponent, FILE_PLAN_ALIAS); getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(filePlanComponent, FILE_PLAN_ALIAS);
assertStatusCode(UNPROCESSABLE_ENTITY); assertStatusCode(UNPROCESSABLE_ENTITY);
// Create the special containers into the root of special containers containers // Create the special containers into the root of special containers containers
getFilePlanComponentsAPI().createFilePlanComponent(filePlanComponent, filePlanComponentAlias); getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(filePlanComponent, filePlanComponentAlias);
assertStatusCode(UNPROCESSABLE_ENTITY); assertStatusCode(UNPROCESSABLE_ENTITY);
} }
@@ -299,10 +294,10 @@ public class FilePlanTests extends BaseRESTTest
createRMSiteIfNotExists(); createRMSiteIfNotExists();
// Create a random user // Create a random user
UserModel nonRMuser = dataUser.createRandomTestUser("testUser"); UserModel nonRMuser = getDataUser().createRandomTestUser("testUser");
// Get the special file plan components // Get the special file plan components
getFilePlanComponentsAPI(nonRMuser).getFilePlanComponent(filePlanComponentAlias); getRestAPIFactory().getFilePlanComponentsAPI(nonRMuser).getFilePlanComponent(filePlanComponentAlias);
// Check the response status code is FORBIDDEN // Check the response status code is FORBIDDEN
assertStatusCode(FORBIDDEN); assertStatusCode(FORBIDDEN);

View File

@@ -47,14 +47,12 @@ import static org.testng.Assert.assertFalse;
import java.util.Random; import java.util.Random;
import org.alfresco.rest.rm.community.base.BaseRESTTest; 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.FilePlanComponent;
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentProperties; import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentProperties;
import org.alfresco.utility.constants.UserRole; import org.alfresco.utility.constants.UserRole;
import org.alfresco.utility.data.DataUser;
import org.alfresco.utility.model.SiteModel; import org.alfresco.utility.model.SiteModel;
import org.alfresco.utility.model.UserModel; import org.alfresco.utility.model.UserModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.testng.annotations.Test; import org.testng.annotations.Test;
/** /**
@@ -63,11 +61,8 @@ import org.testng.annotations.Test;
* @author Kristijan Conkas * @author Kristijan Conkas
* @since 2.6 * @since 2.6
*/ */
public class NonElectronicRecordTests extends BaseRESTTest public class NonElectronicRecordTests extends BaseRMRestTest
{ {
@Autowired
private DataUser dataUser;
/** /**
* <pre> * <pre>
* Given a parent container that is NOT a record folder or an unfiled record folder * Given a parent container that is NOT a record folder or an unfiled record folder
@@ -86,7 +81,7 @@ public class NonElectronicRecordTests extends BaseRESTTest
.nodeType(RECORD_CATEGORY_TYPE) .nodeType(RECORD_CATEGORY_TYPE)
.build(); .build();
FilePlanComponent recordCategory = getFilePlanComponentsAPI().createFilePlanComponent(recordCategoryModel, FILE_PLAN_ALIAS); FilePlanComponent recordCategory = getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(recordCategoryModel, FILE_PLAN_ALIAS);
// iterate through all invalid parent containers and try to create/file an electronic record // iterate through all invalid parent containers and try to create/file an electronic record
asList(FILE_PLAN_ALIAS, TRANSFERS_ALIAS, HOLDS_ALIAS, recordCategory.getId()) asList(FILE_PLAN_ALIAS, TRANSFERS_ALIAS, HOLDS_ALIAS, recordCategory.getId())
@@ -95,7 +90,7 @@ public class NonElectronicRecordTests extends BaseRESTTest
{ {
try try
{ {
getFilePlanComponentsAPI().createFilePlanComponent(createNonElectronicRecordModel(), id); getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(createNonElectronicRecordModel(), id);
} }
catch (Exception error) catch (Exception error)
{ {
@@ -167,7 +162,7 @@ public class NonElectronicRecordTests extends BaseRESTTest
.build(); .build();
// create non-electronic record // create non-electronic record
String nonElectronicId = getFilePlanComponentsAPI().createFilePlanComponent( String nonElectronicId = getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(
filePlanComponent, filePlanComponent,
container.getId()).getId(); container.getId()).getId();
@@ -175,7 +170,7 @@ public class NonElectronicRecordTests extends BaseRESTTest
assertStatusCode(CREATED); assertStatusCode(CREATED);
// get newly created non-electonic record and verify its properties // get newly created non-electonic record and verify its properties
FilePlanComponent nonElectronicRecord = getFilePlanComponentsAPI().getFilePlanComponent(nonElectronicId); FilePlanComponent nonElectronicRecord = getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(nonElectronicId);
assertEquals(title, nonElectronicRecord.getProperties().getTitle()); assertEquals(title, nonElectronicRecord.getProperties().getTitle());
assertEquals(description, nonElectronicRecord.getProperties().getDescription()); assertEquals(description, nonElectronicRecord.getProperties().getDescription());
@@ -209,7 +204,7 @@ public class NonElectronicRecordTests extends BaseRESTTest
closeFolder(recordFolder.getId()); closeFolder(recordFolder.getId());
// try to create it, this should fail and throw an exception // try to create it, this should fail and throw an exception
getFilePlanComponentsAPI().createFilePlanComponent(createNonElectronicRecordModel(), recordFolder.getId()); getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(createNonElectronicRecordModel(), recordFolder.getId());
// verify the status code // verify the status code
assertStatusCode(UNPROCESSABLE_ENTITY); assertStatusCode(UNPROCESSABLE_ENTITY);
@@ -272,7 +267,7 @@ public class NonElectronicRecordTests extends BaseRESTTest
// this should fail and throw an exception // this should fail and throw an exception
try try
{ {
getFilePlanComponentsAPI().createFilePlanComponent(c, container.getId()); getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(c, container.getId());
} }
catch (Exception e) catch (Exception e)
{ {
@@ -315,7 +310,7 @@ public class NonElectronicRecordTests extends BaseRESTTest
// this should fail and throw an exception // this should fail and throw an exception
try try
{ {
getFilePlanComponentsAPI(user).createFilePlanComponent(record, container.getId()); getRestAPIFactory().getFilePlanComponentsAPI(user).createFilePlanComponent(record, container.getId());
} }
catch (Exception e) catch (Exception e)
{ {
@@ -351,20 +346,20 @@ public class NonElectronicRecordTests extends BaseRESTTest
*/ */
private UserModel createUserWithRole(String userName, UserRole userRole) throws Exception private UserModel createUserWithRole(String userName, UserRole userRole) throws Exception
{ {
String siteId = getRMSiteAPI().getSite().getId(); String siteId = getRestAPIFactory().getRMSiteAPI().getSite().getId();
// check if user exists // check if user exists
UserModel user = new UserModel(); UserModel user = new UserModel();
user.setUsername(userName); user.setUsername(userName);
user.setPassword(userName); user.setPassword(userName);
if (!dataUser.isUserInRepo(userName)) if (!getDataUser().isUserInRepo(userName))
{ {
// user doesn't exist, create it // user doesn't exist, create it
user = dataUser.createUser(userName, userName); user = getDataUser().createUser(userName, userName);
user.setUserRole(userRole); user.setUserRole(userRole);
dataUser.addUserToSite(user, new SiteModel(siteId), userRole); getDataUser().addUserToSite(user, new SiteModel(siteId), userRole);
} }
return user; return user;

View File

@@ -44,7 +44,7 @@ import static org.testng.Assert.fail;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.NoSuchElementException; import java.util.NoSuchElementException;
import org.alfresco.rest.rm.community.base.BaseRESTTest; import org.alfresco.rest.rm.community.base.BaseRMRestTest;
import org.alfresco.rest.rm.community.base.TestData; 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.FilePlanComponent;
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentProperties; import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentProperties;
@@ -59,7 +59,7 @@ import org.testng.annotations.Test;
* @author Tuna Aksoy * @author Tuna Aksoy
* @since 2.6 * @since 2.6
*/ */
public class RecordCategoryTest extends BaseRESTTest public class RecordCategoryTest extends BaseRMRestTest
{ {
// Number of children (for children creation test) // Number of children (for children creation test)
private static final int NUMBER_OF_CHILDREN = 10; private static final int NUMBER_OF_CHILDREN = 10;
@@ -90,7 +90,7 @@ public class RecordCategoryTest extends BaseRESTTest
.build(); .build();
// Create the record category // Create the record category
FilePlanComponent filePlanComponent = getFilePlanComponentsAPI().createFilePlanComponent(recordCategory, FILE_PLAN_ALIAS); FilePlanComponent filePlanComponent = getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(recordCategory, FILE_PLAN_ALIAS);
// Verify the status code // Verify the status code
assertStatusCode(CREATED); assertStatusCode(CREATED);
@@ -139,7 +139,7 @@ public class RecordCategoryTest extends BaseRESTTest
.build(); .build();
// Create the record category // Create the record category
FilePlanComponent filePlanComponent = getFilePlanComponentsAPI().createFilePlanComponent(recordCategory, FILE_PLAN_ALIAS); FilePlanComponent filePlanComponent = getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(recordCategory, FILE_PLAN_ALIAS);
String newCategoryName = "Rename " + categoryName; String newCategoryName = "Rename " + categoryName;
@@ -147,7 +147,7 @@ public class RecordCategoryTest extends BaseRESTTest
FilePlanComponent recordCategoryUpdated = FilePlanComponent.builder().name(newCategoryName).build(); FilePlanComponent recordCategoryUpdated = FilePlanComponent.builder().name(newCategoryName).build();
// Update the record category // Update the record category
FilePlanComponent renamedFilePlanComponent = getFilePlanComponentsAPI().updateFilePlanComponent(recordCategoryUpdated, filePlanComponent.getId()); FilePlanComponent renamedFilePlanComponent = getRestAPIFactory().getFilePlanComponentsAPI().updateFilePlanComponent(recordCategoryUpdated, filePlanComponent.getId());
// Verify the status code // Verify the status code
assertStatusCode(OK); assertStatusCode(OK);
@@ -156,7 +156,7 @@ public class RecordCategoryTest extends BaseRESTTest
assertEquals(renamedFilePlanComponent.getName(), newCategoryName); assertEquals(renamedFilePlanComponent.getName(), newCategoryName);
// Get actual FILE_PLAN_ALIAS id // Get actual FILE_PLAN_ALIAS id
FilePlanComponent parentComponent = getFilePlanComponentsAPI().getFilePlanComponent(FILE_PLAN_ALIAS); FilePlanComponent parentComponent = getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(FILE_PLAN_ALIAS);
// verify renamed component still has this parent // verify renamed component still has this parent
assertEquals(renamedFilePlanComponent.getParentId(), parentComponent.getId()); assertEquals(renamedFilePlanComponent.getParentId(), parentComponent.getId());
@@ -189,16 +189,16 @@ public class RecordCategoryTest extends BaseRESTTest
.build(); .build();
// Create the record category // Create the record category
FilePlanComponent filePlanComponent = getFilePlanComponentsAPI().createFilePlanComponent(recordCategory, FILE_PLAN_ALIAS); FilePlanComponent filePlanComponent = getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(recordCategory, FILE_PLAN_ALIAS);
// Delete the record category // Delete the record category
getFilePlanComponentsAPI().deleteFilePlanComponent(filePlanComponent.getId()); getRestAPIFactory().getFilePlanComponentsAPI().deleteFilePlanComponent(filePlanComponent.getId());
// Verify the status code // Verify the status code
assertStatusCode(NO_CONTENT); assertStatusCode(NO_CONTENT);
// Deleted component should no longer be retrievable // Deleted component should no longer be retrievable
getFilePlanComponentsAPI().getFilePlanComponent(filePlanComponent.getId()); getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(filePlanComponent.getId());
assertStatusCode(NOT_FOUND); assertStatusCode(NOT_FOUND);
} }
@@ -264,7 +264,7 @@ public class RecordCategoryTest extends BaseRESTTest
} }
// List children from API // List children from API
FilePlanComponentsCollection apiChildren = getFilePlanComponentsAPI().listChildComponents(rootCategory.getId()); FilePlanComponentsCollection apiChildren = getRestAPIFactory().getFilePlanComponentsAPI().listChildComponents(rootCategory.getId());
// Check status code // Check status code
assertStatusCode(OK); assertStatusCode(OK);
@@ -352,7 +352,7 @@ public class RecordCategoryTest extends BaseRESTTest
.build(); .build();
//create the invalid node type //create the invalid node type
getFilePlanComponentsAPI().createFilePlanComponent(recordCategory, category.getId()); getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(recordCategory, category.getId());
assertStatusCode(UNPROCESSABLE_ENTITY); assertStatusCode(UNPROCESSABLE_ENTITY);
} }
@@ -390,7 +390,7 @@ public class RecordCategoryTest extends BaseRESTTest
.build()) .build())
.build(); .build();
FilePlanComponent filePlanComponent = getFilePlanComponentsAPI().createFilePlanComponent(component, parentComponentId); FilePlanComponent filePlanComponent = getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(component, parentComponentId);
assertStatusCode(CREATED); assertStatusCode(CREATED);
return filePlanComponent; return filePlanComponent;

View File

@@ -49,7 +49,7 @@ import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.NoSuchElementException; import java.util.NoSuchElementException;
import org.alfresco.rest.rm.community.base.BaseRESTTest; import org.alfresco.rest.rm.community.base.BaseRMRestTest;
import org.alfresco.rest.rm.community.base.TestData; 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.FilePlanComponent;
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentProperties; import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentProperties;
@@ -66,7 +66,7 @@ import org.testng.annotations.Test;
* @author Rodica Sutu * @author Rodica Sutu
* @since 2.6 * @since 2.6
*/ */
public class RecordFolderTests extends BaseRESTTest public class RecordFolderTests extends BaseRMRestTest
{ {
private static final int NUMBER_OF_FOLDERS = 5; private static final int NUMBER_OF_FOLDERS = 5;
/** /**
@@ -94,7 +94,7 @@ public class RecordFolderTests extends BaseRESTTest
.build(); .build();
// Create the record folder // Create the record folder
FilePlanComponent folder = getFilePlanComponentsAPI().createFilePlanComponent(recordFolder, filePlanComponent.getId()); FilePlanComponent folder = getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(recordFolder, filePlanComponent.getId());
assertStatusCode(CREATED); assertStatusCode(CREATED);
@@ -128,7 +128,7 @@ public class RecordFolderTests extends BaseRESTTest
@Bug(id="RM-4327") @Bug(id="RM-4327")
public void createFolderIntoSpecialContainers(String filePlanComponent) throws Exception public void createFolderIntoSpecialContainers(String filePlanComponent) throws Exception
{ {
String componentID = getFilePlanComponentsAPI().getFilePlanComponent(filePlanComponent).getId(); String componentID = getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(filePlanComponent).getId();
// Build the record category properties // Build the record category properties
FilePlanComponent recordFolder = FilePlanComponent.builder() FilePlanComponent recordFolder = FilePlanComponent.builder()
@@ -140,7 +140,7 @@ public class RecordFolderTests extends BaseRESTTest
.build(); .build();
// Create a record folder // Create a record folder
getFilePlanComponentsAPI().createFilePlanComponent(recordFolder, componentID); getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(recordFolder, componentID);
// Check the API Response code // Check the API Response code
assertStatusCode(UNPROCESSABLE_ENTITY); assertStatusCode(UNPROCESSABLE_ENTITY);
@@ -162,7 +162,7 @@ public class RecordFolderTests extends BaseRESTTest
FilePlanComponent category = createCategory(FILE_PLAN_ALIAS, CATEGORY); FilePlanComponent category = createCategory(FILE_PLAN_ALIAS, CATEGORY);
FilePlanComponent folder = createFolder(category.getId(),FOLDER_NAME); FilePlanComponent folder = createFolder(category.getId(),FOLDER_NAME);
FilePlanComponent folderDetails = getFilePlanComponentsAPI().getFilePlanComponent(folder.getId(), "include=" + IS_CLOSED); FilePlanComponent folderDetails = getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(folder.getId(), "include=" + IS_CLOSED);
// Verify the returned properties for the file plan component - record folder // Verify the returned properties for the file plan component - record folder
assertEquals(RECORD_FOLDER_TYPE, folderDetails.getNodeType()); assertEquals(RECORD_FOLDER_TYPE, folderDetails.getNodeType());
@@ -218,7 +218,7 @@ public class RecordFolderTests extends BaseRESTTest
.build(); .build();
// Update the record category // Update the record category
FilePlanComponent folderUpdated = getFilePlanComponentsAPI().updateFilePlanComponent(recordFolder, folder.getId()); FilePlanComponent folderUpdated = getRestAPIFactory().getFilePlanComponentsAPI().updateFilePlanComponent(recordFolder, folder.getId());
// Check the Response Status Code // Check the Response Status Code
assertStatusCode(OK); assertStatusCode(OK);
@@ -254,12 +254,12 @@ public class RecordFolderTests extends BaseRESTTest
FilePlanComponent folder = createFolder(category.getId(), FOLDER_NAME); FilePlanComponent folder = createFolder(category.getId(), FOLDER_NAME);
// Delete the Record folder // Delete the Record folder
getFilePlanComponentsAPI().deleteFilePlanComponent(folder.getId()); getRestAPIFactory().getFilePlanComponentsAPI().deleteFilePlanComponent(folder.getId());
// Check the Response Status Code // Check the Response Status Code
assertStatusCode(NO_CONTENT); assertStatusCode(NO_CONTENT);
// Check the File Plan Component is not found // Check the File Plan Component is not found
getFilePlanComponentsAPI().getFilePlanComponent(folder.getId()); getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(folder.getId());
// Check the Response Status Code // Check the Response Status Code
assertStatusCode(NOT_FOUND); assertStatusCode(NOT_FOUND);
} }
@@ -295,7 +295,7 @@ public class RecordFolderTests extends BaseRESTTest
} }
// List children from API // List children from API
FilePlanComponentsCollection apiChildren = getFilePlanComponentsAPI().listChildComponents(category.getId()); FilePlanComponentsCollection apiChildren = getRestAPIFactory().getFilePlanComponentsAPI().listChildComponents(category.getId());
// Check status code // Check status code
assertStatusCode(OK); assertStatusCode(OK);
@@ -364,7 +364,7 @@ public class RecordFolderTests extends BaseRESTTest
.build(); .build();
// Create the record folder // Create the record folder
FilePlanComponent folder = getFilePlanComponentsAPI().createFilePlanComponent(recordFolder, FILE_PLAN_ALIAS, "include=" + PATH); FilePlanComponent folder = getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(recordFolder, FILE_PLAN_ALIAS, "include=" + PATH);
//Check the API response code //Check the API response code
assertStatusCode(CREATED); assertStatusCode(CREATED);
@@ -376,10 +376,10 @@ public class RecordFolderTests extends BaseRESTTest
//Check the path return contains the RELATIVE_PATH //Check the path return contains the RELATIVE_PATH
assertTrue(folder.getPath().getName().contains(relativePath)); assertTrue(folder.getPath().getName().contains(relativePath));
//check the parent is a category //check the parent is a category
assertTrue(getFilePlanComponentsAPI().getFilePlanComponent(folder.getParentId()).getIsCategory()); assertTrue(getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(folder.getParentId()).getIsCategory());
//check the created folder from the server //check the created folder from the server
folder = getFilePlanComponentsAPI().getFilePlanComponent(folder.getId(), "include=" + PATH); folder = getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(folder.getId(), "include=" + PATH);
//Check the API response code //Check the API response code
assertStatusCode(OK); assertStatusCode(OK);
// Verify the returned properties for the file plan component - record folder // Verify the returned properties for the file plan component - record folder
@@ -400,7 +400,7 @@ public class RecordFolderTests extends BaseRESTTest
.build(); .build();
// Create the record folder // Create the record folder
FilePlanComponent folder2 = getFilePlanComponentsAPI().createFilePlanComponent(recordFolder2, FILE_PLAN_ALIAS, "include=" + PATH); FilePlanComponent folder2 = getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(recordFolder2, FILE_PLAN_ALIAS, "include=" + PATH);
//Check the API response code //Check the API response code
assertStatusCode(CREATED); assertStatusCode(CREATED);
@@ -412,10 +412,10 @@ public class RecordFolderTests extends BaseRESTTest
assertTrue(folder2.getPath().getName().contains(NEW_RELATIVE_PATH)); assertTrue(folder2.getPath().getName().contains(NEW_RELATIVE_PATH));
//check the parent is a category //check the parent is a category
assertTrue(getFilePlanComponentsAPI().getFilePlanComponent(folder.getParentId()).getIsCategory()); assertTrue(getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(folder.getParentId()).getIsCategory());
// Check the folder created on the server // Check the folder created on the server
folder2 = getFilePlanComponentsAPI().getFilePlanComponent(folder2.getId(), "include=" + PATH); folder2 = getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(folder2.getId(), "include=" + PATH);
//Check the API response code //Check the API response code
assertStatusCode(OK); assertStatusCode(OK);
@@ -430,11 +430,11 @@ public class RecordFolderTests extends BaseRESTTest
@AfterClass (alwaysRun = true) @AfterClass (alwaysRun = true)
public void tearDown() throws Exception public void tearDown() throws Exception
{ {
getFilePlanComponentsAPI().listChildComponents(FILE_PLAN_ALIAS).getEntries().forEach(filePlanComponentEntry -> getRestAPIFactory().getFilePlanComponentsAPI().listChildComponents(FILE_PLAN_ALIAS).getEntries().forEach(filePlanComponentEntry ->
{ {
try try
{ {
getFilePlanComponentsAPI().deleteFilePlanComponent(filePlanComponentEntry.getFilePlanComponentModel().getId()); getRestAPIFactory().getFilePlanComponentsAPI().deleteFilePlanComponent(filePlanComponentEntry.getFilePlanComponentModel().getId());
} }
catch (Exception e) catch (Exception e)
{ {

View File

@@ -48,7 +48,7 @@ import static org.testng.Assert.assertTrue;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.alfresco.rest.rm.community.base.BaseRESTTest; 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.FilePlanComponent;
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentProperties; import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentProperties;
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentsCollection; import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentsCollection;
@@ -61,7 +61,7 @@ import org.testng.annotations.Test;
* @author Kristijan Conkas * @author Kristijan Conkas
* @since 2.6 * @since 2.6
*/ */
public class UnfiledRecordsFolderTests extends BaseRESTTest public class UnfiledRecordsFolderTests extends BaseRMRestTest
{ {
/** invalid root level types, at unfiled records root level these shouldn't be possible to create */ /** invalid root level types, at unfiled records root level these shouldn't be possible to create */
@@ -104,7 +104,7 @@ public class UnfiledRecordsFolderTests extends BaseRESTTest
.build()) .build())
.build(); .build();
FilePlanComponent filePlanComponent = getFilePlanComponentsAPI().createFilePlanComponent(unfiledFolder, UNFILED_RECORDS_CONTAINER_ALIAS); FilePlanComponent filePlanComponent = getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(unfiledFolder, UNFILED_RECORDS_CONTAINER_ALIAS);
// Verify the status code // Verify the status code
assertStatusCode(CREATED); assertStatusCode(CREATED);
@@ -153,7 +153,7 @@ public class UnfiledRecordsFolderTests extends BaseRESTTest
try try
{ {
getFilePlanComponentsAPI().createFilePlanComponent(unfiledFolder, UNFILED_RECORDS_CONTAINER_ALIAS); getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(unfiledFolder, UNFILED_RECORDS_CONTAINER_ALIAS);
} }
catch (Exception error) catch (Exception error)
{ {
@@ -193,7 +193,7 @@ public class UnfiledRecordsFolderTests extends BaseRESTTest
.build(); .build();
// Create it as a child of parentFolder // Create it as a child of parentFolder
FilePlanComponent childFolder = getFilePlanComponentsAPI().createFilePlanComponent(unfiledFolder, parentFolder.getId()); FilePlanComponent childFolder = getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(unfiledFolder, parentFolder.getId());
// Verify the status code // Verify the status code
assertStatusCode(CREATED); assertStatusCode(CREATED);
@@ -217,7 +217,7 @@ public class UnfiledRecordsFolderTests extends BaseRESTTest
// Does child's parent point to it? // Does child's parent point to it?
// Perform another call as our parentFolder had been executed before childFolder existed // Perform another call as our parentFolder had been executed before childFolder existed
FilePlanComponentsCollection parentsChildren = getFilePlanComponentsAPI().listChildComponents(parentFolder.getId()); FilePlanComponentsCollection parentsChildren = getRestAPIFactory().getFilePlanComponentsAPI().listChildComponents(parentFolder.getId());
assertStatusCode(OK); assertStatusCode(OK);
List<String> childIds = parentsChildren.getEntries() List<String> childIds = parentsChildren.getEntries()
.stream() .stream()
@@ -258,12 +258,12 @@ public class UnfiledRecordsFolderTests extends BaseRESTTest
.build(); .build();
// Update the unfiled records folder // Update the unfiled records folder
getFilePlanComponentsAPI().updateFilePlanComponent(folderToUpdate, folderToModify.getId()); getRestAPIFactory().getFilePlanComponentsAPI().updateFilePlanComponent(folderToUpdate, folderToModify.getId());
// Verify the status code // Verify the status code
assertStatusCode(OK); assertStatusCode(OK);
// This is to ensure the change was actually applied, rather than simply trusting the object returned by PUT // This is to ensure the change was actually applied, rather than simply trusting the object returned by PUT
FilePlanComponent renamedFolder = getFilePlanComponentsAPI().getFilePlanComponent(folderToModify.getId()); FilePlanComponent renamedFolder = getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(folderToModify.getId());
// Verify the returned file plan component // Verify the returned file plan component
assertEquals(modified + folderToModify.getName(), renamedFolder.getName()); assertEquals(modified + folderToModify.getName(), renamedFolder.getName());
@@ -288,13 +288,13 @@ public class UnfiledRecordsFolderTests extends BaseRESTTest
assertEquals(folderName, folderToDelete.getName()); assertEquals(folderName, folderToDelete.getName());
// Delete folderToDelete // Delete folderToDelete
getFilePlanComponentsAPI().deleteFilePlanComponent(folderToDelete.getId()); getRestAPIFactory().getFilePlanComponentsAPI().deleteFilePlanComponent(folderToDelete.getId());
// Verify the status code // Verify the status code
assertStatusCode(NO_CONTENT); assertStatusCode(NO_CONTENT);
// Deleted component should no longer be retrievable // Deleted component should no longer be retrievable
getFilePlanComponentsAPI().getFilePlanComponent(folderToDelete.getId()); getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(folderToDelete.getId());
assertStatusCode(NOT_FOUND); assertStatusCode(NOT_FOUND);
} }
} }

View File

@@ -48,10 +48,9 @@ import static org.springframework.social.alfresco.api.entities.Site.Visibility.P
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertNotNull;
import org.alfresco.rest.rm.community.base.BaseRESTTest; import org.alfresco.rest.rm.community.base.BaseRMRestTest;
import org.alfresco.rest.rm.community.model.site.RMSite; import org.alfresco.rest.rm.community.model.site.RMSite;
import org.alfresco.rest.rm.community.requests.igCoreAPI.RMUserAPI; import org.alfresco.rest.rm.community.requests.igCoreAPI.RMUserAPI;
import org.alfresco.utility.data.DataUser;
import org.alfresco.utility.data.RandomData; import org.alfresco.utility.data.RandomData;
import org.alfresco.utility.model.UserModel; import org.alfresco.utility.model.UserModel;
import org.alfresco.utility.report.Bug; import org.alfresco.utility.report.Bug;
@@ -65,11 +64,8 @@ import org.testng.annotations.Test;
* @author Rodica Sutu * @author Rodica Sutu
* @since 2.6 * @since 2.6
*/ */
public class RMSiteTests extends BaseRESTTest public class RMSiteTests extends BaseRMRestTest
{ {
@Autowired
private DataUser dataUser;
@Autowired @Autowired
private RMUserAPI rmUserAPI; private RMUserAPI rmUserAPI;
@@ -85,14 +81,14 @@ public class RMSiteTests extends BaseRESTTest
public void createRMSiteAsAdminUser() throws Exception public void createRMSiteAsAdminUser() throws Exception
{ {
// Check if the RM site exists // Check if the RM site exists
if (getRMSiteAPI().existsRMSite()) if (getRestAPIFactory().getRMSiteAPI().existsRMSite())
{ {
// Delete the RM site // Delete the RM site
getRMSiteAPI().deleteRMSite(); getRestAPIFactory().getRMSiteAPI().deleteRMSite();
} }
// Create the RM site // Create the RM site
RMSite rmSiteResponse = getRMSiteAPI().createRMSite(createStandardRMSiteModel()); RMSite rmSiteResponse = getRestAPIFactory().getRMSiteAPI().createRMSite(createStandardRMSiteModel());
// Verify the status code // Verify the status code
assertStatusCode(CREATED); assertStatusCode(CREATED);
@@ -126,7 +122,7 @@ public class RMSiteTests extends BaseRESTTest
// Create the RM site // Create the RM site
RMSite rmSiteModel = createRMSiteModel(STANDARD, newTitle, newDescription); RMSite rmSiteModel = createRMSiteModel(STANDARD, newTitle, newDescription);
getRMSiteAPI().createRMSite(rmSiteModel); getRestAPIFactory().getRMSiteAPI().createRMSite(rmSiteModel);
// Verify the status code // Verify the status code
assertStatusCode(CONFLICT); assertStatusCode(CONFLICT);
@@ -147,7 +143,7 @@ public class RMSiteTests extends BaseRESTTest
createRMSiteIfNotExists(); createRMSiteIfNotExists();
// Delete the RM site // Delete the RM site
getRMSiteAPI().deleteRMSite(); getRestAPIFactory().getRMSiteAPI().deleteRMSite();
// Verify the status code // Verify the status code
assertStatusCode(NO_CONTENT); assertStatusCode(NO_CONTENT);
@@ -165,7 +161,7 @@ public class RMSiteTests extends BaseRESTTest
public void getRMSite() throws Exception public void getRMSite() throws Exception
{ {
// Check if RM site exists // Check if RM site exists
if (!getRMSiteAPI().existsRMSite()) if (!getRestAPIFactory().getRMSiteAPI().existsRMSite())
{ {
// Verify the status code when RM site doesn't exist // Verify the status code when RM site doesn't exist
assertStatusCode(NOT_FOUND); assertStatusCode(NOT_FOUND);
@@ -174,7 +170,7 @@ public class RMSiteTests extends BaseRESTTest
else else
{ {
// Get the RM site // Get the RM site
RMSite rmSiteModel = getRMSiteAPI().getSite(); RMSite rmSiteModel = getRestAPIFactory().getRMSiteAPI().getSite();
// Verify the status code // Verify the status code
assertStatusCode(OK); assertStatusCode(OK);
@@ -198,17 +194,17 @@ public class RMSiteTests extends BaseRESTTest
public void createRMSiteAsAnotherAdminUser() throws Exception public void createRMSiteAsAnotherAdminUser() throws Exception
{ {
// Check if the RM site exists // Check if the RM site exists
if (getRMSiteAPI().existsRMSite()) if (getRestAPIFactory().getRMSiteAPI().existsRMSite())
{ {
// Delete the RM site // Delete the RM site
getRMSiteAPI().deleteRMSite(); getRestAPIFactory().getRMSiteAPI().deleteRMSite();
} }
// Create user // Create user
rmUserAPI.createUser(ANOTHER_ADMIN); rmUserAPI.createUser(ANOTHER_ADMIN);
// Create the RM site // Create the RM site
RMSite rmSiteModel = getRMSiteAPI(new UserModel(ANOTHER_ADMIN, DEFAULT_PASSWORD)).createRMSite(createDOD5015RMSiteModel()); RMSite rmSiteModel = getRestAPIFactory().getRMSiteAPI(new UserModel(ANOTHER_ADMIN, DEFAULT_PASSWORD)).createRMSite(createDOD5015RMSiteModel());
// Verify the status code // Verify the status code
assertStatusCode(CREATED); assertStatusCode(CREATED);
@@ -244,13 +240,13 @@ public class RMSiteTests extends BaseRESTTest
rmSiteToUpdate.setDescription(NEW_DESCRIPTION); rmSiteToUpdate.setDescription(NEW_DESCRIPTION);
// Create the RM site // Create the RM site
getRMSiteAPI(dataUser.createRandomTestUser("testUser")).updateRMSite(rmSiteToUpdate); getRestAPIFactory().getRMSiteAPI(getDataUser().createRandomTestUser("testUser")).updateRMSite(rmSiteToUpdate);
// Verify the status code // Verify the status code
assertStatusCode(FORBIDDEN); assertStatusCode(FORBIDDEN);
// Update the RM Site // Update the RM Site
RMSite rmSiteModel = getRMSiteAPI().updateRMSite(rmSiteToUpdate); RMSite rmSiteModel = getRestAPIFactory().getRMSiteAPI().updateRMSite(rmSiteToUpdate);
// Verify the response status code // Verify the response status code
assertStatusCode(OK); assertStatusCode(OK);
@@ -278,7 +274,7 @@ public class RMSiteTests extends BaseRESTTest
RMSite rmSiteToUpdate = RMSite.builder().compliance(DOD5015).build(); RMSite rmSiteToUpdate = RMSite.builder().compliance(DOD5015).build();
// Update the RM site // Update the RM site
getRMSiteAPI().updateRMSite(rmSiteToUpdate); getRestAPIFactory().getRMSiteAPI().updateRMSite(rmSiteToUpdate);
// Verify the response status code // Verify the response status code
assertStatusCode(BAD_REQUEST); assertStatusCode(BAD_REQUEST);