Merge branch 'master' into feature/RM-5416_REST_API_Tests_for_Folder_Classification

This commit is contained in:
jcule
2017-09-19 13:45:23 +01:00
6 changed files with 168 additions and 128 deletions

View File

@@ -0,0 +1,149 @@
/*
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2017 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 static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.FILE_PLAN_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.CONTENT_TYPE;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.FILE_PLAN_TYPE;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.FOLDER_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;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.TRANSFER_CONTAINER_TYPE;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.TRANSFER_TYPE;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_CONTAINER_TYPE;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_RECORD_FOLDER_TYPE;
import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric;
import org.testng.annotations.DataProvider;
/**
* Data Provider class used in tests
*
* @author Rodica Sutu
* @since 2.6
*/
public class DataProviderClass
{
/**
* Data Provider with the special file plan components alias
* @return file plan component alias
*/
@DataProvider
public static Object[][] getContainers()
{
return new String[][] {
{ FILE_PLAN_ALIAS },
{ TRANSFERS_ALIAS },
{ UNFILED_RECORDS_CONTAINER_ALIAS },
};
}
/**
* Data Provider with:
* with the object types not allowed as children for a record category
*
* @return file plan component alias
*/
@DataProvider
public static Object[][] childrenNotAllowedForCategory()
{
return new String[][] {
{ FILE_PLAN_TYPE },
{ TRANSFER_CONTAINER_TYPE },
{ UNFILED_CONTAINER_TYPE },
{ UNFILED_RECORD_FOLDER_TYPE },
{ TRANSFER_TYPE },
{ CONTENT_TYPE }
};
}
/**
* Data Provider with:
* with the object types for creating a Record Folder
*
* @return file plan component alias
*/
@DataProvider
public static Object[][] folderTypes()
{
return new String[][] {
{ RECORD_FOLDER_TYPE },
{ FOLDER_TYPE }
};
}
/**
* Data Provider with:
* with the object types for creating a Record Category
*
* @return file plan component alias
*/
@DataProvider
public static String[][] categoryTypes()
{
return new String[][] {
{ FOLDER_TYPE },
{ RECORD_CATEGORY_TYPE }
};
}
/**
* Data Provider with:
* with the object types for creating a Record Category Child
*
* @return record category child type
*/
@DataProvider
public static Object[][] categoryChild()
{
return new String[][] {
{ RECORD_FOLDER_TYPE },
{ FOLDER_TYPE },
{ RECORD_CATEGORY_TYPE }
};
}
/**
* Invalid root level types, at unfiled record folder/unfiled containers container level that shouldn't be possible to create
*/
@DataProvider (name = "invalidRootTypes")
public static Object[][] getInvalidRootTypes()
{
return new String[][]
{
{ FILE_PLAN_TYPE },
{ RECORD_CATEGORY_TYPE },
{ RECORD_FOLDER_TYPE },
{ TRANSFER_CONTAINER_TYPE },
{ TRANSFER_TYPE },
{ UNFILED_CONTAINER_TYPE },
};
}
}

View File

@@ -26,22 +26,8 @@
*/
package org.alfresco.rest.rm.community.base;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.FILE_PLAN_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.CONTENT_TYPE;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.FILE_PLAN_TYPE;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.FOLDER_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;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.TRANSFER_CONTAINER_TYPE;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.TRANSFER_TYPE;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_CONTAINER_TYPE;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_RECORD_FOLDER_TYPE;
import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric;
import org.testng.annotations.DataProvider;
/**
* Test data used in tests
*
@@ -67,20 +53,6 @@ public interface TestData
public static final String DEFAULT_EMAIL = "default@alfresco.com";
/**
* Data Provider with the special file plan components alias
* @return file plan component alias
*/
@DataProvider
public static String[][] getContainers()
{
return new String[][] {
{ FILE_PLAN_ALIAS },
{ TRANSFERS_ALIAS },
{ UNFILED_RECORDS_CONTAINER_ALIAS },
};
}
/**
* The default record category name used when creating categories
*/
public static String RECORD_CATEGORY_NAME = "CATEGORY NAME" + getRandomAlphanumeric();
@@ -110,89 +82,5 @@ public interface TestData
*/
public static String NONELECTRONIC_RECORD_NAME = "Record nonelectronic" + getRandomAlphanumeric();
/**
* Data Provider with:
* with the object types not allowed as children for a record category
*
* @return file plan component alias
*/
@DataProvider
public static String[][] childrenNotAllowedForCategory()
{
return new String[][] {
{ FILE_PLAN_TYPE },
{ TRANSFER_CONTAINER_TYPE },
{ UNFILED_CONTAINER_TYPE },
{ UNFILED_RECORD_FOLDER_TYPE },
{ TRANSFER_TYPE },
{ CONTENT_TYPE }
};
}
/**
* Data Provider with:
* with the object types for creating a Record Folder
*
* @return file plan component alias
*/
@DataProvider
public static String[][] folderTypes()
{
return new String[][] {
{ RECORD_FOLDER_TYPE },
{ FOLDER_TYPE }
};
}
/**
* Data Provider with:
* with the object types for creating a Record Category
*
* @return file plan component alias
*/
@DataProvider
public static String[][] categoryTypes()
{
return new String[][] {
{ FOLDER_TYPE },
{ RECORD_CATEGORY_TYPE }
};
}
/**
* Data Provider with:
* with the object types for creating a Record Category Child
*
* @return record category child type
*/
@DataProvider
public static Object[][] categoryChild()
{
return new String[][] {
{ RECORD_FOLDER_TYPE },
{ FOLDER_TYPE },
{ RECORD_CATEGORY_TYPE }
};
}
/**
* Invalid root level types, at unfiled record folder/unfiled containers container level that shouldn't be possible to create
*/
@DataProvider (name = "invalidRootTypes")
public static Object[][] getInvalidRootTypes()
{
return new String[][]
{
{ FILE_PLAN_TYPE },
{ RECORD_CATEGORY_TYPE },
{ RECORD_FOLDER_TYPE },
{ TRANSFER_CONTAINER_TYPE },
{ TRANSFER_TYPE },
{ UNFILED_CONTAINER_TYPE },
};
}
public static final String ALFRESCO_ADMINISTRATORS = "ALFRESCO_ADMINISTRATORS";
}

View File

@@ -62,7 +62,7 @@ import java.util.ArrayList;
import java.util.NoSuchElementException;
import org.alfresco.rest.rm.community.base.BaseRMRestTest;
import org.alfresco.rest.rm.community.base.TestData;
import org.alfresco.rest.rm.community.base.DataProviderClass;
import org.alfresco.rest.rm.community.model.fileplan.FilePlan;
import org.alfresco.rest.rm.community.model.fileplan.FilePlanProperties;
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType;
@@ -291,7 +291,7 @@ public class FilePlanTests extends BaseRMRestTest
@Test
(
description = "Create root category",
dataProviderClass = TestData.class,
dataProviderClass = DataProviderClass.class,
dataProvider = "categoryTypes"
)
public void createFilePlanChildren(String nodeType) throws Exception

View File

@@ -32,7 +32,8 @@ import static org.alfresco.rest.rm.community.base.TestData.RECORD_CATEGORY_NAME;
import static org.alfresco.rest.rm.community.base.TestData.RECORD_FOLDER_NAME;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.FILE_PLAN_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.FilePlanComponentAlias
.UNFILED_RECORDS_CONTAINER_ALIAS;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PATH;
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;
@@ -59,8 +60,9 @@ import java.util.HashMap;
import java.util.List;
import java.util.NoSuchElementException;
import org.alfresco.rest.core.v0.BaseAPI.RETENTION_SCHEDULE;
import org.alfresco.rest.rm.community.base.BaseRMRestTest;
import org.alfresco.rest.rm.community.base.TestData;
import org.alfresco.rest.rm.community.base.DataProviderClass;
import org.alfresco.rest.rm.community.model.fileplan.FilePlan;
import org.alfresco.rest.rm.community.model.recordcategory.RecordCategory;
import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChild;
@@ -71,7 +73,6 @@ import org.alfresco.rest.rm.community.requests.gscore.api.FilePlanAPI;
import org.alfresco.rest.rm.community.requests.gscore.api.RecordCategoryAPI;
import org.alfresco.rest.rm.community.requests.gscore.api.RecordFolderAPI;
import org.alfresco.rest.v0.RecordCategoriesAPI;
import org.alfresco.rest.core.v0.BaseAPI.RETENTION_SCHEDULE;
import org.alfresco.utility.report.Bug;
import org.springframework.beans.factory.annotation.Autowired;
import org.testng.annotations.DataProvider;
@@ -267,7 +268,7 @@ public class RecordCategoryTests extends BaseRMRestTest
@Test
(
description = "Create a record folder into a record category.",
dataProviderClass = TestData.class,
dataProviderClass = DataProviderClass.class,
dataProvider = "folderTypes"
)
@Bug (id = "RM-4572")
@@ -299,7 +300,7 @@ public class RecordCategoryTests extends BaseRMRestTest
}
@Test
(
dataProviderClass = TestData.class,
dataProviderClass = DataProviderClass.class,
dataProvider = "categoryChild"
)
@Bug(id = "RM-5116")
@@ -452,7 +453,7 @@ public class RecordCategoryTests extends BaseRMRestTest
@Test
(
description = "Create node types not allowed inside a category",
dataProviderClass = TestData.class,
dataProviderClass = DataProviderClass.class,
dataProvider = "childrenNotAllowedForCategory"
)
@Bug (id="RM-4367, RM-4572")
@@ -757,7 +758,7 @@ public class RecordCategoryTests extends BaseRMRestTest
@Test
(
description = "Create a record folder into transfers/unfiled/file plan container",
dataProviderClass = TestData.class,
dataProviderClass = DataProviderClass.class,
dataProvider = "getContainers"
)
@Bug (id = "RM-4327")

View File

@@ -29,7 +29,8 @@ package org.alfresco.rest.rm.community.unfiledcontainers;
import static java.time.LocalDateTime.now;
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.FilePlanComponentAlias
.UNFILED_RECORDS_CONTAINER_ALIAS;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.CONTENT_TYPE;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.FOLDER_TYPE;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.NON_ELECTRONIC_RECORD_TYPE;
@@ -53,7 +54,7 @@ import java.util.List;
import java.util.NoSuchElementException;
import org.alfresco.rest.rm.community.base.BaseRMRestTest;
import org.alfresco.rest.rm.community.base.TestData;
import org.alfresco.rest.rm.community.base.DataProviderClass;
import org.alfresco.rest.rm.community.model.fileplan.FilePlan;
import org.alfresco.rest.rm.community.model.record.RecordProperties;
import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainer;
@@ -63,8 +64,8 @@ import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChi
import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledRecordFolder;
import org.alfresco.rest.rm.community.requests.gscore.api.UnfiledContainerAPI;
import org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil;
import org.springframework.http.HttpStatus;
import org.alfresco.utility.report.Bug;
import org.springframework.http.HttpStatus;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.DataProvider;
@@ -418,7 +419,7 @@ public class UnfiledContainerTests extends BaseRMRestTest
@Test
(
dataProvider = "invalidRootTypes",
dataProviderClass = TestData.class,
dataProviderClass = DataProviderClass.class,
description = "Only unfiled records folders and records can be created as children for unfiled container root"
)
public void createInvalidUnfiledChildren(String filePlanComponentType)

View File

@@ -31,7 +31,8 @@ import static java.time.LocalDateTime.now;
import static org.alfresco.rest.rm.community.base.TestData.RECORD_CATEGORY_NAME;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.FILE_PLAN_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.FilePlanComponentAlias
.UNFILED_RECORDS_CONTAINER_ALIAS;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PATH;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.CONTENT_TYPE;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.NON_ELECTRONIC_RECORD_TYPE;
@@ -57,7 +58,7 @@ import java.util.NoSuchElementException;
import java.util.stream.Collectors;
import org.alfresco.rest.rm.community.base.BaseRMRestTest;
import org.alfresco.rest.rm.community.base.TestData;
import org.alfresco.rest.rm.community.base.DataProviderClass;
import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChild;
import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChildCollection;
import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChildProperties;
@@ -190,7 +191,7 @@ public class UnfiledRecordsFolderTests extends BaseRMRestTest
@Test
(
dataProvider = "invalidRootTypes",
dataProviderClass = TestData.class,
dataProviderClass = DataProviderClass.class,
description = "Only unfiled records folders and records can be created as children for unfiled container root"
)
public void createInvalidUnfiledChildren(String filePlanComponentType) throws Exception