Merged HEAD-MNT-2904 to HEAD (5.0.0)

89796: Merged DEV to HEAD-MNT-2904
      88615: ACE-2904: Localised labels for type, aspect and property definitions are no longer returned
         - Fix for side effect of ACE-1996, when initial title/description resolving was removed. Now, it will be resolved, when we are going to get type definition for the first time. Appropriate unit test was added.
      89240: ACE-3322: CMIS Types have lost display names - breaks workbench
         - Update child definitions.
      89482: ACE-2904: Localised labels for type, aspect and property definitions are no longer returned
         - Fix that updates property\properties of type definition. Unit test was added that checks for update children type defs and properties.
      89775:  ACE-2904: Localised labels for type, aspect and property definitions are no longer returned
         - Fix that won't update property\properties of type definition on initialization phase (resolveInheritance method invocation).


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@89836 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Pavel Yurke
2014-11-04 08:23:57 +00:00
parent 0b341095ec
commit 4e57f75adf

View File

@@ -24,7 +24,6 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull; import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import java.io.File; import java.io.File;
@@ -44,6 +43,7 @@ import java.util.Set;
import org.alfresco.model.ContentModel; import org.alfresco.model.ContentModel;
import org.alfresco.opencmis.dictionary.CMISDictionaryService; import org.alfresco.opencmis.dictionary.CMISDictionaryService;
import org.alfresco.opencmis.dictionary.PropertyDefinitionWrapper;
import org.alfresco.opencmis.dictionary.TypeDefinitionWrapper; import org.alfresco.opencmis.dictionary.TypeDefinitionWrapper;
import org.alfresco.opencmis.search.CMISQueryOptions; import org.alfresco.opencmis.search.CMISQueryOptions;
import org.alfresco.opencmis.search.CMISQueryOptions.CMISQueryMode; import org.alfresco.opencmis.search.CMISQueryOptions.CMISQueryMode;
@@ -2659,4 +2659,81 @@ public class CMISTest
AuthenticationUtil.popAuthentication(); AuthenticationUtil.popAuthentication();
} }
} }
/**
* ACE-2904
*/
@Test
public void testACE2904()
{ // Basic CMIS Types // Additional types from Content Model
final String[] types = { "cmis:document", "cmis:relationship", "cmis:folder", "cmis:policy", "cmis:item", "R:cm:replaces", "P:cm:author", "I:cm:cmobject" };
final String[] displayNames = { "Document", "Relationship", "Folder", "Policy", "Item Type", "Replaces", "Author", "Object" };
final String[] descriptions = { "Document Type", "Relationship Type", "Folder Type", "Policy Type", "CMIS Item", "Replaces", "Author", "I:cm:cmobject" };
CmisServiceCallback<String> callback = new CmisServiceCallback<String>()
{
@Override
public String execute(CmisService cmisService)
{
List<RepositoryInfo> repositories = cmisService.getRepositoryInfos(null);
assertTrue(repositories.size() > 0);
RepositoryInfo repo = repositories.get(0);
String repositoryId = repo.getId();
for (int i = 0; i < types.length; i++)
{
TypeDefinition def = cmisService.getTypeDefinition(repositoryId, types[i], null);
assertNotNull("The " + types[i] + " type is not defined", def);
assertNotNull("The display name is incorrect. Please, refer to ACE-2904.", def.getDisplayName());
assertEquals("The display name is incorrect. Please, refer to ACE-2904.", def.getDisplayName(), displayNames[i]);
assertEquals("The description is incorrect. Please, refer to ACE-2904.", def.getDescription(), descriptions[i]);
}
return "";
};
};
// Lets test types for cmis 1.1 and cmis 1.0
withCmisService(callback, CmisVersion.CMIS_1_1);
withCmisService(callback, CmisVersion.CMIS_1_0);
}
/**
* ACE-3322
*/
@Test
public void testACE3322()
{
final String[] types = { "cmis:document", "cmis:relationship", "cmis:folder", "cmis:item" };
CmisServiceCallback<String> callback = new CmisServiceCallback<String>()
{
@Override
public String execute(CmisService cmisService)
{
for (int i = 0; i < types.length; i++)
{
List<TypeDefinitionWrapper> children = cmisDictionaryService.getChildren(types[i]);
assertNotNull(children);
// Check that children were updated
for (TypeDefinitionWrapper child : children)
{
assertNotNull("Type definition was not updated. Please refer to ACE-3322", child.getTypeDefinition(false).getDisplayName());
assertNotNull("Type definition was not updated. Please refer to ACE-3322", child.getTypeDefinition(false).getDescription());
// Check that property's display name and description were updated
for (PropertyDefinitionWrapper property : child.getProperties())
{
assertNotNull("Display name is null", property.getPropertyDefinition().getDisplayName());
assertNotNull("Description is null", property.getPropertyDefinition().getDescription());
}
}
}
return "";
};
};
withCmisService(callback, CmisVersion.CMIS_1_1);
}
} }