mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Fixed compilation issue due to licence header changes in RM Community REST API Automation project
This commit is contained in:
@@ -381,7 +381,7 @@ public class RecordCategoryTest extends BaseRestTest
|
|||||||
.getJson();
|
.getJson();
|
||||||
|
|
||||||
//create the invalid node type
|
//create the invalid node type
|
||||||
FilePlanComponent fpc = filePlanComponentAPI.createFilePlanComponent(componentProperties, category.getId());
|
filePlanComponentAPI.createFilePlanComponent(componentProperties, category.getId());
|
||||||
filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(UNPROCESSABLE_ENTITY);
|
filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(UNPROCESSABLE_ENTITY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -4,9 +4,24 @@
|
|||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* License rights for this program may be obtained from Alfresco Software, Ltd.
|
* This file is part of the Alfresco software.
|
||||||
* pursuant to a written agreement and any use of this program without such an
|
* -
|
||||||
* agreement is prohibited.
|
* 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%
|
* #L%
|
||||||
*/
|
*/
|
||||||
package org.alfresco.rest.rm.fileplancomponents;
|
package org.alfresco.rest.rm.fileplancomponents;
|
||||||
@@ -80,12 +95,12 @@ public class UnfiledRecordsFolderTests extends BaseRestTest
|
|||||||
{ UNFILED_CONTAINER_TYPE }
|
{ UNFILED_CONTAINER_TYPE }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given the unfiled record container root
|
* Given the unfiled record container root
|
||||||
* When I create an unfiled record folder via the ReST API
|
* When I create an unfiled record folder via the ReST API
|
||||||
* Then a root unfiled record folder is created
|
* Then a root unfiled record folder is created
|
||||||
*
|
*
|
||||||
* @throws Exception if folder couldn't be created
|
* @throws Exception if folder couldn't be created
|
||||||
*/
|
*/
|
||||||
@Test(description = "Create root unfiled records folder")
|
@Test(description = "Create root unfiled records folder")
|
||||||
@@ -93,11 +108,11 @@ public class UnfiledRecordsFolderTests extends BaseRestTest
|
|||||||
{
|
{
|
||||||
// Authenticate with admin user
|
// Authenticate with admin user
|
||||||
RestWrapper restWrapper = filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
|
RestWrapper restWrapper = filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
|
||||||
|
|
||||||
String folderName = "Folder " + getRandomAlphanumeric();
|
String folderName = "Folder " + getRandomAlphanumeric();
|
||||||
String folderTitle = folderName + " Title";
|
String folderTitle = folderName + " Title";
|
||||||
String folderDescription = folderName + " Description";
|
String folderDescription = folderName + " Description";
|
||||||
|
|
||||||
// Build unfiled records folder properties
|
// Build unfiled records folder properties
|
||||||
JsonObject unfiledFolderProperties = buildObject()
|
JsonObject unfiledFolderProperties = buildObject()
|
||||||
.add(NAME, folderName)
|
.add(NAME, folderName)
|
||||||
@@ -107,13 +122,13 @@ public class UnfiledRecordsFolderTests extends BaseRestTest
|
|||||||
.add(PROPERTIES_DESCRIPTION, folderDescription)
|
.add(PROPERTIES_DESCRIPTION, folderDescription)
|
||||||
.end()
|
.end()
|
||||||
.getJson();
|
.getJson();
|
||||||
|
|
||||||
FilePlanComponent filePlanComponent = filePlanComponentAPI.createFilePlanComponent(unfiledFolderProperties,
|
FilePlanComponent filePlanComponent = filePlanComponentAPI.createFilePlanComponent(unfiledFolderProperties,
|
||||||
UNFILED_RECORDS_CONTAINER_ALIAS.toString());
|
UNFILED_RECORDS_CONTAINER_ALIAS.toString());
|
||||||
|
|
||||||
// Verify the status code
|
// Verify the status code
|
||||||
restWrapper.assertStatusCodeIs(CREATED);
|
restWrapper.assertStatusCodeIs(CREATED);
|
||||||
|
|
||||||
// Verify the returned file plan component
|
// Verify the returned file plan component
|
||||||
assertFalse(filePlanComponent.isIsCategory());
|
assertFalse(filePlanComponent.isIsCategory());
|
||||||
assertFalse(filePlanComponent.isIsFile());
|
assertFalse(filePlanComponent.isIsFile());
|
||||||
@@ -130,7 +145,7 @@ public class UnfiledRecordsFolderTests extends BaseRestTest
|
|||||||
assertEquals(filePlanComponentProperties.getTitle(), folderTitle);
|
assertEquals(filePlanComponentProperties.getTitle(), folderTitle);
|
||||||
assertEquals(filePlanComponentProperties.getDescription(), folderDescription);
|
assertEquals(filePlanComponentProperties.getDescription(), folderDescription);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Negative test to verify only unfiled record folders can be created at root level
|
* Negative test to verify only unfiled record folders can be created at root level
|
||||||
*/
|
*/
|
||||||
@@ -148,7 +163,7 @@ public class UnfiledRecordsFolderTests extends BaseRestTest
|
|||||||
String folderDescription = folderName + " Description";
|
String folderDescription = folderName + " Description";
|
||||||
|
|
||||||
logger.info("creating " + componentType.toString());
|
logger.info("creating " + componentType.toString());
|
||||||
|
|
||||||
JsonObject unfiledFolderProperties = buildObject()
|
JsonObject unfiledFolderProperties = buildObject()
|
||||||
.add(NAME, folderName)
|
.add(NAME, folderName)
|
||||||
.add(NODE_TYPE, componentType.toString())
|
.add(NODE_TYPE, componentType.toString())
|
||||||
@@ -159,7 +174,7 @@ public class UnfiledRecordsFolderTests extends BaseRestTest
|
|||||||
.getJson();
|
.getJson();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
filePlanComponentAPI.createFilePlanComponent(unfiledFolderProperties,
|
filePlanComponentAPI.createFilePlanComponent(unfiledFolderProperties,
|
||||||
UNFILED_RECORDS_CONTAINER_ALIAS.toString());
|
UNFILED_RECORDS_CONTAINER_ALIAS.toString());
|
||||||
}
|
}
|
||||||
catch (Exception error)
|
catch (Exception error)
|
||||||
@@ -169,12 +184,12 @@ public class UnfiledRecordsFolderTests extends BaseRestTest
|
|||||||
// Verify the status code
|
// Verify the status code
|
||||||
restWrapper.assertStatusCodeIs(UNPROCESSABLE_ENTITY);
|
restWrapper.assertStatusCodeIs(UNPROCESSABLE_ENTITY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given an unfiled record folder
|
* Given an unfiled record folder
|
||||||
* When I create an unfiled record folder via the ReST API
|
* When I create an unfiled record folder via the ReST API
|
||||||
* Then an unfiled record folder is created within the unfiled record folder
|
* Then an unfiled record folder is created within the unfiled record folder
|
||||||
*
|
*
|
||||||
* @throws Exception for failed actions
|
* @throws Exception for failed actions
|
||||||
*/
|
*/
|
||||||
@Test(description = "Child unfiled records folder can be created in a parent unfiled records folder")
|
@Test(description = "Child unfiled records folder can be created in a parent unfiled records folder")
|
||||||
@@ -186,11 +201,11 @@ public class UnfiledRecordsFolderTests extends BaseRestTest
|
|||||||
String childFolderName = "Child Folder " + getRandomAlphanumeric();
|
String childFolderName = "Child Folder " + getRandomAlphanumeric();
|
||||||
String childFolderTitle = childFolderName + " Title";
|
String childFolderTitle = childFolderName + " Title";
|
||||||
String childFolderDescription = childFolderName + " Description";
|
String childFolderDescription = childFolderName + " Description";
|
||||||
|
|
||||||
// No need for fine control, create it using utility function
|
// No need for fine control, create it using utility function
|
||||||
FilePlanComponent parentFolder = createUnfiledRecordsFolder(UNFILED_RECORDS_CONTAINER_ALIAS.toString(), parentFolderName);
|
FilePlanComponent parentFolder = createUnfiledRecordsFolder(UNFILED_RECORDS_CONTAINER_ALIAS.toString(), parentFolderName);
|
||||||
assertEquals(parentFolderName, parentFolder.getName());
|
assertEquals(parentFolderName, parentFolder.getName());
|
||||||
|
|
||||||
// Build the unfiled records folder properties
|
// Build the unfiled records folder properties
|
||||||
JsonObject unfiledFolderProperties = buildObject()
|
JsonObject unfiledFolderProperties = buildObject()
|
||||||
.add(NAME, childFolderName)
|
.add(NAME, childFolderName)
|
||||||
@@ -200,14 +215,14 @@ public class UnfiledRecordsFolderTests extends BaseRestTest
|
|||||||
.add(PROPERTIES_DESCRIPTION, childFolderDescription)
|
.add(PROPERTIES_DESCRIPTION, childFolderDescription)
|
||||||
.end()
|
.end()
|
||||||
.getJson();
|
.getJson();
|
||||||
|
|
||||||
// Create it as a child of parentFolder
|
// Create it as a child of parentFolder
|
||||||
FilePlanComponent childFolder = filePlanComponentAPI.createFilePlanComponent(unfiledFolderProperties,
|
FilePlanComponent childFolder = filePlanComponentAPI.createFilePlanComponent(unfiledFolderProperties,
|
||||||
parentFolder.getId());
|
parentFolder.getId());
|
||||||
|
|
||||||
// Verify the status code
|
// Verify the status code
|
||||||
restWrapper.assertStatusCodeIs(CREATED);
|
restWrapper.assertStatusCodeIs(CREATED);
|
||||||
|
|
||||||
// Verify the returned file plan component
|
// Verify the returned file plan component
|
||||||
assertFalse(childFolder.isIsCategory());
|
assertFalse(childFolder.isIsCategory());
|
||||||
assertFalse(childFolder.isIsFile());
|
assertFalse(childFolder.isIsFile());
|
||||||
@@ -223,11 +238,11 @@ public class UnfiledRecordsFolderTests extends BaseRestTest
|
|||||||
FilePlanComponentProperties childProperties = childFolder.getProperties();
|
FilePlanComponentProperties childProperties = childFolder.getProperties();
|
||||||
assertEquals(childProperties.getTitle(), childFolderTitle);
|
assertEquals(childProperties.getTitle(), childFolderTitle);
|
||||||
assertEquals(childProperties.getDescription(), childFolderDescription);
|
assertEquals(childProperties.getDescription(), childFolderDescription);
|
||||||
|
|
||||||
// Does this child point to its parent?
|
// Does this child point to its parent?
|
||||||
assertEquals(childFolder.getParentId(), parentFolder.getId());
|
assertEquals(childFolder.getParentId(), parentFolder.getId());
|
||||||
|
|
||||||
// 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 = filePlanComponentAPI.listChildComponents(parentFolder.getId());
|
FilePlanComponentsCollection parentsChildren = filePlanComponentAPI.listChildComponents(parentFolder.getId());
|
||||||
restWrapper.assertStatusCodeIs(OK);
|
restWrapper.assertStatusCodeIs(OK);
|
||||||
@@ -235,19 +250,19 @@ public class UnfiledRecordsFolderTests extends BaseRestTest
|
|||||||
.stream()
|
.stream()
|
||||||
.map(c -> c.getFilePlanComponent().getId())
|
.map(c -> c.getFilePlanComponent().getId())
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
// Child folder is listed in parent
|
// Child folder is listed in parent
|
||||||
assertTrue(childIds.contains(childFolder.getId()));
|
assertTrue(childIds.contains(childFolder.getId()));
|
||||||
|
|
||||||
// There should be only one child
|
// There should be only one child
|
||||||
assertEquals(1, childIds.size());
|
assertEquals(1, childIds.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given an unfiled record folder
|
* Given an unfiled record folder
|
||||||
* When I modify the unfiled record folder details via the ReST API
|
* When I modify the unfiled record folder details via the ReST API
|
||||||
* Then the details of the unfiled record folder are modified
|
* Then the details of the unfiled record folder are modified
|
||||||
*
|
*
|
||||||
* @throws Exception for failed actions
|
* @throws Exception for failed actions
|
||||||
*/
|
*/
|
||||||
@Test(description = "Unfiled record folder")
|
@Test(description = "Unfiled record folder")
|
||||||
@@ -256,11 +271,11 @@ public class UnfiledRecordsFolderTests extends BaseRestTest
|
|||||||
RestWrapper restWrapper = filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
|
RestWrapper restWrapper = filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
|
||||||
String modified = "Modified ";
|
String modified = "Modified ";
|
||||||
String folderName = "Folder To Modify" + getRandomAlphanumeric();
|
String folderName = "Folder To Modify" + getRandomAlphanumeric();
|
||||||
|
|
||||||
// No need for fine control, create it using utility function
|
// No need for fine control, create it using utility function
|
||||||
FilePlanComponent folderToModify = createUnfiledRecordsFolder(UNFILED_RECORDS_CONTAINER_ALIAS.toString(), folderName);
|
FilePlanComponent folderToModify = createUnfiledRecordsFolder(UNFILED_RECORDS_CONTAINER_ALIAS.toString(), folderName);
|
||||||
assertEquals(folderName, folderToModify.getName());
|
assertEquals(folderName, folderToModify.getName());
|
||||||
|
|
||||||
// Build the properties which will be updated
|
// Build the properties which will be updated
|
||||||
JsonObject updateFolderProperties = buildObject()
|
JsonObject updateFolderProperties = buildObject()
|
||||||
.add(NAME, modified + folderToModify.getName())
|
.add(NAME, modified + folderToModify.getName())
|
||||||
@@ -274,7 +289,7 @@ public class UnfiledRecordsFolderTests extends BaseRestTest
|
|||||||
filePlanComponentAPI.updateFilePlanComponent(updateFolderProperties, folderToModify.getId());
|
filePlanComponentAPI.updateFilePlanComponent(updateFolderProperties, folderToModify.getId());
|
||||||
// Verify the status code
|
// Verify the status code
|
||||||
restWrapper.assertStatusCodeIs(OK);
|
restWrapper.assertStatusCodeIs(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 = filePlanComponentAPI.getFilePlanComponent(folderToModify.getId());
|
FilePlanComponent renamedFolder = filePlanComponentAPI.getFilePlanComponent(folderToModify.getId());
|
||||||
|
|
||||||
@@ -283,12 +298,12 @@ public class UnfiledRecordsFolderTests extends BaseRestTest
|
|||||||
assertEquals(modified + folderToModify.getProperties().getTitle(), renamedFolder.getProperties().getTitle());
|
assertEquals(modified + folderToModify.getProperties().getTitle(), renamedFolder.getProperties().getTitle());
|
||||||
assertEquals(modified + folderToModify.getProperties().getDescription(), renamedFolder.getProperties().getDescription());
|
assertEquals(modified + folderToModify.getProperties().getDescription(), renamedFolder.getProperties().getDescription());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given an unfiled record folder
|
* Given an unfiled record folder
|
||||||
* When I delete the unfiled record folder via the ReST API
|
* When I delete the unfiled record folder via the ReST API
|
||||||
* Then the unfiled record folder is deleted
|
* Then the unfiled record folder is deleted
|
||||||
*
|
*
|
||||||
* @throws Exception for failed actions
|
* @throws Exception for failed actions
|
||||||
*/
|
*/
|
||||||
@Test(description = "Delete unfiled record folder")
|
@Test(description = "Delete unfiled record folder")
|
||||||
@@ -296,11 +311,11 @@ public class UnfiledRecordsFolderTests extends BaseRestTest
|
|||||||
{
|
{
|
||||||
RestWrapper restWrapper = filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
|
RestWrapper restWrapper = filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
|
||||||
String folderName = "Folder To Delete" + getRandomAlphanumeric();
|
String folderName = "Folder To Delete" + getRandomAlphanumeric();
|
||||||
|
|
||||||
// Create folderToDelete
|
// Create folderToDelete
|
||||||
FilePlanComponent folderToDelete = createUnfiledRecordsFolder(UNFILED_RECORDS_CONTAINER_ALIAS.toString(), folderName);
|
FilePlanComponent folderToDelete = createUnfiledRecordsFolder(UNFILED_RECORDS_CONTAINER_ALIAS.toString(), folderName);
|
||||||
assertEquals(folderName, folderToDelete.getName());
|
assertEquals(folderName, folderToDelete.getName());
|
||||||
|
|
||||||
// Delete folderToDelete
|
// Delete folderToDelete
|
||||||
filePlanComponentAPI.deleteFilePlanComponent(folderToDelete.getId());
|
filePlanComponentAPI.deleteFilePlanComponent(folderToDelete.getId());
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user