Fix for RM-2549. The copyAspect implementation needs to be very careful to use addProperties not setPropertiesand it also needs to not copy inherited properties.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@110844 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Neil McErlean
2015-08-25 16:12:45 +00:00
parent eee581c814
commit 7b87cf446e
2 changed files with 16 additions and 6 deletions

View File

@@ -27,6 +27,8 @@ import static org.mockito.Mockito.mock;
import static org.alfresco.module.org_alfresco_module_rm.test.util.ExceptionUtils.expectedException;
import static org.junit.Assert.assertEquals;
import static java.util.Arrays.asList;
import org.alfresco.service.cmr.dictionary.AspectDefinition;
import org.alfresco.service.cmr.dictionary.DictionaryException;
import org.alfresco.service.cmr.dictionary.DictionaryService;
@@ -97,9 +99,15 @@ public class CoreServicesExtrasUnitTest
final NodeService mockNS = mock(NodeService.class);
final AspectDefinition mockAspect = mock(AspectDefinition.class);
when(mockAspect.getName()).thenReturn(testAspect);
final Map<QName, PropertyDefinition> props = new HashMap<>();
final PropertyDefinition mockProp1 = mock(PropertyDefinition.class);
final PropertyDefinition mockProp2 = mock(PropertyDefinition.class);
for (PropertyDefinition p : asList(mockProp1, mockProp2))
{
when(p.getContainerClass()).thenReturn(mockAspect);
}
props.put(testProp1, mockProp1);
props.put(testProp2, mockProp2);
when(mockAspect.getProperties()).thenReturn(props);