RM-4405: CI remediation.

This commit is contained in:
Kristijan Conkas
2016-12-09 15:23:20 +00:00
parent b2698cf8a2
commit d5ff320f56
5 changed files with 32 additions and 53 deletions

View File

@@ -129,8 +129,14 @@ public class FilePlanComponentAPI extends RestAPI<FilePlanComponentAPI>
public FilePlanComponent createFilePlanComponent(FilePlanComponent filePlanComponentModel, String parentId) throws Exception
{
mandatoryObject("filePlanComponentProperties", filePlanComponentModel);
return doCreateFilePlanComponent(toJson(filePlanComponentModel), parentId);
mandatoryString("parentId", parentId);
return usingRestWrapper().processModel(FilePlanComponent.class, requestWithBody(
POST,
toJson(filePlanComponentModel),
"fileplan-components/{fileplanComponentId}/children?{parameters}",
parentId,
getParameters()));
}
/**
@@ -181,24 +187,6 @@ public class FilePlanComponentAPI extends RestAPI<FilePlanComponentAPI>
/* return a FilePlanComponent object representing Response */
return response.jsonPath().getObject("entry", FilePlanComponent.class);
}
/**
* Helper method for handling low-level fileplan component creation requests
* @param requestBody
* @param parentId
* @return Newly created {@link FilePlanComponent}
* @throws Exception
*/
private FilePlanComponent doCreateFilePlanComponent(String requestBody, String parentId) throws Exception
{
mandatoryString("parentId", parentId);
return usingRestWrapper().processModel(FilePlanComponent.class, requestWithBody(
POST,
requestBody,
"fileplan-components/{fileplanComponentId}/children?{parameters}",
parentId,
getParameters()));
}
/**
* Updates a file plan component

View File

@@ -30,6 +30,8 @@ import static java.lang.Integer.parseInt;
import static org.alfresco.rest.rm.community.base.TestData.CATEGORY_TITLE;
import static org.alfresco.rest.rm.community.base.TestData.FOLDER_TITLE;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.FILE_PLAN_ALIAS;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.UNFILED_RECORDS_CONTAINER_ALIAS;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.RECORD_CATEGORY_TYPE;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.RECORD_FOLDER_TYPE;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_RECORD_FOLDER_TYPE;
@@ -55,6 +57,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
/**
* Base class for all IG REST API Tests
@@ -98,6 +101,19 @@ public class BaseRestTest extends RestTest
public static final String RM_TITLE = "Records Management";
public static final String RM_DESCRIPTION = "Records Management Site";
/** Valid root containers where electronic and non-electronic records can be created */
@DataProvider(name = "validContainers")
public Object[][] rootContainers() throws Exception {
return new Object[][] {
// an arbitrary record folder
{ createCategoryFolderInFilePlan(dataUser.getAdminUser(), FILE_PLAN_ALIAS.toString()) },
// unfiled records root
{ getFilePlanComponentAsUser(dataUser.getAdminUser(), UNFILED_RECORDS_CONTAINER_ALIAS.toString()) },
// an arbitrary unfiled records folder
{ createUnfiledRecordsFolder(UNFILED_RECORDS_CONTAINER_ALIAS.toString(), "Unfiled Folder " + getRandomAlphanumeric()) }
};
}
/**
* @see org.alfresco.rest.RestTest#checkServerHealth()
*/

View File

@@ -50,7 +50,7 @@ import org.testng.annotations.DataProvider;
* @since 2.6
*/
public interface TestData
{
{
/**
* A user with ALFRESCO_ADMINISTRATORS role.
* <p>"GROUP_ANOTHER_ADMIN_EXISTS" The ANOTHER_ADMIN user has been created.
@@ -141,5 +141,4 @@ public interface TestData
{ CONTENT_TYPE.toString()}
};
}
}

View File

@@ -50,9 +50,13 @@ import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
/**
*
* Create/File electronic records tests
* <br>
* These tests only test the creation and filing of electronic records, update at
* present isn't implemented in the API under test.
* <p>
* @author Kristijan Conkas
* @since
* @since 2.6
*/
public class ElectronicRecordTests extends BaseRestTest
{
@@ -81,19 +85,6 @@ public class ElectronicRecordTests extends BaseRestTest
};
}
/** Valid root containers where electronic records can be created */
@DataProvider(name = "validContainers")
public Object[][] rootContainers() throws Exception {
return new Object[][] {
// an arbitrary record folder
{ createCategoryFolderInFilePlan(dataUser.getAdminUser(), FILE_PLAN_ALIAS.toString()) },
// unfiled records root
{ getFilePlanComponentAsUser(dataUser.getAdminUser(), UNFILED_RECORDS_CONTAINER_ALIAS.toString()) },
// an arbitrary unfiled records folder
{ createUnfiledRecordsFolder(UNFILED_RECORDS_CONTAINER_ALIAS.toString(), "Unfiled Folder " + getRandomAlphanumeric()) }
};
}
/**
* <pre>
* Given a parent container that is NOT a record folder or an unfiled record folder

View File

@@ -31,7 +31,6 @@ import static java.util.Arrays.asList;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.FILE_PLAN_ALIAS;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.HOLDS_ALIAS;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.TRANSFERS_ALIAS;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.UNFILED_RECORDS_CONTAINER_ALIAS;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.NON_ELECTRONIC_RECORD_TYPE;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.RECORD_CATEGORY_TYPE;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.RECORD_FOLDER_TYPE;
@@ -56,7 +55,6 @@ import org.alfresco.utility.data.DataUser;
import org.alfresco.utility.model.SiteModel;
import org.alfresco.utility.model.UserModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
/**
@@ -75,20 +73,7 @@ public class NonElectronicRecordTests extends BaseRestTest
@Autowired
private RMSiteAPI rmSiteAPI;
/** Valid root containers where non-electronic records can be created */
@DataProvider(name = "validContainers")
public Object[][] rootContainers() throws Exception {
return new Object[][] {
// an arbitrary record folder
{ createCategoryFolderInFilePlan(dataUser.getAdminUser(), FILE_PLAN_ALIAS.toString()) },
// unfiled records root
{ getFilePlanComponentAsUser(dataUser.getAdminUser(), UNFILED_RECORDS_CONTAINER_ALIAS.toString()) },
// an arbitrary unfiled records folder
{ createUnfiledRecordsFolder(UNFILED_RECORDS_CONTAINER_ALIAS.toString(), "Unfiled Folder " + getRandomAlphanumeric()) }
};
}
/**
* <pre>
* Given a parent container that is NOT a record folder or an unfiled record folder