mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Fix failing tests
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@90354 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -18,6 +18,7 @@
|
|||||||
<property name="authenticationUtil" ref="rm.authenticationUtil" />
|
<property name="authenticationUtil" ref="rm.authenticationUtil" />
|
||||||
<property name="relationshipService" ref="RelationshipService" />
|
<property name="relationshipService" ref="RelationshipService" />
|
||||||
<property name="recordService" ref="RecordService" />
|
<property name="recordService" ref="RecordService" />
|
||||||
|
<property name="modelSecurityService" ref="ModelSecurityService" />
|
||||||
</bean>
|
</bean>
|
||||||
<bean class="org.alfresco.util.BeanExtender">
|
<bean class="org.alfresco.util.BeanExtender">
|
||||||
<property name="beanName" value="versionService" />
|
<property name="beanName" value="versionService" />
|
||||||
|
@@ -29,6 +29,7 @@ import java.util.Map;
|
|||||||
import org.alfresco.error.AlfrescoRuntimeException;
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
|
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
|
||||||
|
import org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.record.RecordService;
|
import org.alfresco.module.org_alfresco_module_rm.record.RecordService;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService;
|
import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil;
|
import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil;
|
||||||
@@ -78,6 +79,9 @@ public class RecordableVersionServiceImpl extends Version2ServiceImpl
|
|||||||
|
|
||||||
/** record service */
|
/** record service */
|
||||||
private RecordService recordService;
|
private RecordService recordService;
|
||||||
|
|
||||||
|
/** model security service */
|
||||||
|
private ModelSecurityService modelSecurityService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param filePlanService file plan service
|
* @param filePlanService file plan service
|
||||||
@@ -110,6 +114,14 @@ public class RecordableVersionServiceImpl extends Version2ServiceImpl
|
|||||||
{
|
{
|
||||||
this.recordService = recordService;
|
this.recordService = recordService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param modelSecurityService model security service
|
||||||
|
*/
|
||||||
|
public void setModelSecurityService(ModelSecurityService modelSecurityService)
|
||||||
|
{
|
||||||
|
this.modelSecurityService = modelSecurityService;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.alfresco.repo.version.Version2ServiceImpl#createVersion(org.alfresco.service.cmr.repository.NodeRef, java.util.Map, int)
|
* @see org.alfresco.repo.version.Version2ServiceImpl#createVersion(org.alfresco.service.cmr.repository.NodeRef, java.util.Map, int)
|
||||||
@@ -273,6 +285,12 @@ public class RecordableVersionServiceImpl extends Version2ServiceImpl
|
|||||||
// disable other behaviours that we don't want to trigger during this process
|
// disable other behaviours that we don't want to trigger during this process
|
||||||
policyBehaviourFilter.disableBehaviour(ContentModel.ASPECT_MULTILINGUAL_DOCUMENT);
|
policyBehaviourFilter.disableBehaviour(ContentModel.ASPECT_MULTILINGUAL_DOCUMENT);
|
||||||
policyBehaviourFilter.disableBehaviour(ContentModel.TYPE_MULTILINGUAL_CONTAINER);
|
policyBehaviourFilter.disableBehaviour(ContentModel.TYPE_MULTILINGUAL_CONTAINER);
|
||||||
|
|
||||||
|
// disable model security check
|
||||||
|
modelSecurityService.disable();
|
||||||
|
|
||||||
|
// disable property editable check
|
||||||
|
recordService.disablePropertyEditableCheck();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -325,6 +343,12 @@ public class RecordableVersionServiceImpl extends Version2ServiceImpl
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
// enable model security check
|
||||||
|
modelSecurityService.enable();
|
||||||
|
|
||||||
|
// enable property editable check
|
||||||
|
recordService.enablePropertyEditableCheck();
|
||||||
|
|
||||||
// Enable behaviours
|
// Enable behaviours
|
||||||
this.policyBehaviourFilter.enableBehaviour(ContentModel.ASPECT_VERSIONABLE);
|
this.policyBehaviourFilter.enableBehaviour(ContentModel.ASPECT_VERSIONABLE);
|
||||||
this.policyBehaviourFilter.enableBehaviour(ContentModel.ASPECT_MULTILINGUAL_DOCUMENT);
|
this.policyBehaviourFilter.enableBehaviour(ContentModel.ASPECT_MULTILINGUAL_DOCUMENT);
|
||||||
|
@@ -25,6 +25,8 @@ import java.util.Map;
|
|||||||
import org.alfresco.error.AlfrescoRuntimeException;
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.test.util.TestModel;
|
import org.alfresco.module.org_alfresco_module_rm.test.util.TestModel;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionServiceImpl;
|
import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionServiceImpl;
|
||||||
|
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||||
|
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
||||||
import org.alfresco.repo.version.VersionModel;
|
import org.alfresco.repo.version.VersionModel;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.cmr.version.Version;
|
import org.alfresco.service.cmr.version.Version;
|
||||||
@@ -160,13 +162,21 @@ public class AdHocRecordableVersions extends RecordableVersionsBaseTest
|
|||||||
public void when()
|
public void when()
|
||||||
{
|
{
|
||||||
// create version
|
// create version
|
||||||
Version version = versionService.createVersion(dmDocument, versionProperties);
|
final Version version = versionService.createVersion(dmDocument, versionProperties);
|
||||||
|
|
||||||
// add custom meta-data to record
|
AuthenticationUtil.runAs(new RunAsWork<Void>()
|
||||||
NodeRef record = (NodeRef)version.getVersionProperties().get(RecordableVersionServiceImpl.PROP_VERSION_RECORD);
|
{
|
||||||
assertNotNull(record);
|
public Void doWork() throws Exception
|
||||||
recordService.addRecordType(record, TestModel.ASPECT_RECORD_METADATA);
|
{
|
||||||
nodeService.setProperty(record, TestModel.PROPERTY_RECORD_METADATA, "Peter Wetherall");
|
// add custom meta-data to record
|
||||||
|
NodeRef record = (NodeRef)version.getVersionProperties().get(RecordableVersionServiceImpl.PROP_VERSION_RECORD);
|
||||||
|
assertNotNull(record);
|
||||||
|
recordService.addRecordType(record, TestModel.ASPECT_RECORD_METADATA);
|
||||||
|
nodeService.setProperty(record, TestModel.PROPERTY_RECORD_METADATA, "Peter Wetherall");
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}, AuthenticationUtil.getAdminUserName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void then()
|
public void then()
|
||||||
|
Reference in New Issue
Block a user