Merge remote-tracking branch 'remotes/origin/feature/RM-6792_AddLocnParamToDeclareAsRec' into feature/RM-6796_DeclareAndFileTests

This commit is contained in:
cagache
2019-05-16 13:56:45 +03:00
3 changed files with 17 additions and 14 deletions

View File

@@ -213,7 +213,7 @@ public class CreateRecordAction extends AuditableActionExecuterAbstractBase
if (nodeRef == null)
{
throw new AlfrescoRuntimeException("Unable to execute " + NAME + " action, because the destination path could not be resolved.");
throw new AlfrescoRuntimeException("Unable to execute " + NAME + " action, because the destination path could not be found.");
}
else
{
@@ -251,8 +251,11 @@ public class CreateRecordAction extends AuditableActionExecuterAbstractBase
// if the file plan is still null, raise an exception
if (filePlan == null)
{
LOGGER.debug("Unable to execute " + NAME + " action, because the fileplan path could not be determined. Make sure at least one file plan has been created.");
throw new AlfrescoRuntimeException("Unable to execute " + NAME + " action, because the fileplan path could not be determined.");
if (LOGGER.isDebugEnabled())
{
LOGGER.debug("Unable to execute " + NAME + " action, because the fileplan path could not be determined. Make sure at least one file plan has been created.");
throw new AlfrescoRuntimeException("Unable to execute " + NAME + " action, because the fileplan path could not be determined.");
}
}
return filePlan;
}

View File

@@ -881,7 +881,7 @@ public class RecordServiceImpl extends BaseBehaviourBean
public void createRecord(final NodeRef filePlan, final NodeRef nodeRef, final NodeRef destinationNodeRef, final boolean isLinked)
{
// filePlan can be null. In this case the default RM site will be used.
// locationNodeRef can be null. In this case the unfiled record container will be used
// destinationNodeRef can be null. In this case the unfiled record container will be used
ParameterCheck.mandatory("nodeRef", nodeRef);
ParameterCheck.mandatory("isLinked", isLinked);
@@ -909,7 +909,7 @@ public class RecordServiceImpl extends BaseBehaviourBean
newRecordContainer = filePlanService.getUnfiledContainer(checkedFilePlan);
if (newRecordContainer == null)
{
throw new AlfrescoRuntimeException("Unable to create record, because new record container could not be found.");
throw new AlfrescoRuntimeException("Unable to create record, because record container could not be found.");
}
}
// if optional location supplied, check that it is a valid record folder

View File

@@ -475,10 +475,10 @@ public class RecordServiceImplUnitTest extends BaseUnitTest
/**
* Given a file that is not yet a record
* When I create the record without specifying a location
* Then the record is created in the unfiled record folder
* Then the record is created in the unfiled record container
*/
@Test
public void createRecordIntoUnfiledRecordFolder()
public void createRecordIntoUnfiledRecordContainer()
{
mocksForRecordCreation();
@@ -495,18 +495,18 @@ public class RecordServiceImplUnitTest extends BaseUnitTest
/**
* Given a file that is not yet a record
* When I create the record specifying the unfiled record folder
* Then the record is created in the unfiled record folder
* When I create the record specifying the unfiled record container
* Then the record is created in the unfiled record container
*/
@Test
public void createRecordIntoSpecifiedUnfiledRecordFolder()
public void createRecordIntoSpecifiedUnfiledRecordContainer()
{
mocksForRecordCreation();
// create the record
recordService.createRecord(nonStandardFilePlan, dmNodeRef, unfiledRecordFolder);
recordService.createRecord(filePlan, dmNodeRef, unfiledRecordFolder);
// verify record was created in specified record folder
// verify record was created in specified unfiled record container
verify(mockedNodeService, times(1)).moveNode(
dmNodeRef,
unfiledRecordFolder,
@@ -525,7 +525,7 @@ public class RecordServiceImplUnitTest extends BaseUnitTest
mocksForRecordCreation();
// create the record
recordService.createRecord(nonStandardFilePlan, dmNodeRef, recordFolder);
recordService.createRecord(filePlan, dmNodeRef, recordFolder);
// verify record was created in specified record folder
verify(mockedNodeService, times(1)).moveNode(
@@ -547,7 +547,7 @@ public class RecordServiceImplUnitTest extends BaseUnitTest
NodeRef recordCategory = generateNodeRef(TYPE_RECORD_CATEGORY);
// create the record
recordService.createRecord(nonStandardFilePlan, dmNodeRef, recordCategory);
recordService.createRecord(filePlan, dmNodeRef, recordCategory);
}
/* Helper method to set up the mocks for record creation */