mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged HEAD-BUG-FIX (4.3/Cloud) to HEAD (4.3/Cloud)
60935: Merged V4.2-BUG-FIX (4.2.2) to HEAD-BUG-FIX (Cloud/4.3) 60808: Merged V4.2.1 (4.2.1) to V4.2-BUG-FIX (4.2.2) 60776: MNT-10529: NPE when requesting Number of Items for current Page 'orderBy' statement analyzing has been fixed in 'AlfrescoCmisServiceImpl.getChildren()'. Leading spaces are causing additional empty string part on splitting 'orderBy' element if query-able names are separated by a comma and a space. Test case for 'orderBy' parameter has been added git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@62370 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -60,6 +60,7 @@ import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.service.transaction.TransactionService;
|
||||
import org.alfresco.util.ApplicationContextHelper;
|
||||
import org.alfresco.util.Pair;
|
||||
import org.apache.chemistry.opencmis.commons.PropertyIds;
|
||||
import org.apache.chemistry.opencmis.commons.data.AllowableActions;
|
||||
import org.apache.chemistry.opencmis.commons.data.CmisExtensionElement;
|
||||
@@ -1372,6 +1373,7 @@ public class CMISTest
|
||||
assertTrue(repositories.size() > 0);
|
||||
RepositoryInfo repo = repositories.get(0);
|
||||
String repositoryId = repo.getId();
|
||||
|
||||
String objectId = cmisService.create(repositoryId, properties, repositoryHelper.getCompanyHome().getId(), contentStream, VersioningState.MINOR, null, null);
|
||||
|
||||
ObjectData cmidDoc = cmisService.getObject(repositoryId, objectId, null, true, IncludeRelationships.NONE, null, false, false, null);
|
||||
@@ -1397,4 +1399,87 @@ public class CMISTest
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMNT10529() throws Exception
|
||||
{
|
||||
AuthenticationUtil.pushAuthentication();
|
||||
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
|
||||
|
||||
try
|
||||
{
|
||||
final Pair<FileInfo, FileInfo> folderAndDocument = transactionService.getRetryingTransactionHelper().doInTransaction(
|
||||
new RetryingTransactionCallback<Pair<FileInfo, FileInfo>>()
|
||||
{
|
||||
@Override
|
||||
public Pair<FileInfo, FileInfo> execute() throws Throwable
|
||||
{
|
||||
NodeRef companyHomeNodeRef = repositoryHelper.getCompanyHome();
|
||||
|
||||
String folderName = GUID.generate();
|
||||
FileInfo folderInfo = fileFolderService.create(companyHomeNodeRef, folderName, ContentModel.TYPE_FOLDER);
|
||||
nodeService.setProperty(folderInfo.getNodeRef(), ContentModel.PROP_NAME, folderName);
|
||||
assertNotNull(folderInfo);
|
||||
|
||||
String docName = GUID.generate();
|
||||
FileInfo document = fileFolderService.create(folderInfo.getNodeRef(), docName, ContentModel.TYPE_CONTENT);
|
||||
assertNotNull(document);
|
||||
nodeService.setProperty(document.getNodeRef(), ContentModel.PROP_NAME, docName);
|
||||
|
||||
return new Pair<FileInfo, FileInfo>(folderInfo, document);
|
||||
}
|
||||
});
|
||||
|
||||
withCmisService(new CmisServiceCallback<Void>()
|
||||
{
|
||||
@Override
|
||||
public Void execute(CmisService cmisService)
|
||||
{
|
||||
List<RepositoryInfo> repositories = cmisService.getRepositoryInfos(null);
|
||||
assertNotNull(repositories);
|
||||
assertTrue(repositories.size() > 0);
|
||||
RepositoryInfo repo = repositories.iterator().next();
|
||||
String repositoryId = repo.getId();
|
||||
|
||||
String objectIdStr = folderAndDocument.getFirst().getNodeRef().toString();
|
||||
|
||||
ObjectInFolderList children = cmisService.getChildren(repositoryId, objectIdStr, null, "cmis:name ASC", false, IncludeRelationships.NONE, null, false, null,
|
||||
null, null);
|
||||
assertChildren(folderAndDocument, children);
|
||||
|
||||
children = cmisService.getChildren(repositoryId, objectIdStr, null, "cmis:name ASC, cmis:creationDate ASC", false, IncludeRelationships.NONE, null, false,
|
||||
null, null, null);
|
||||
assertChildren(folderAndDocument, children);
|
||||
|
||||
children = cmisService.getChildren(repositoryId, objectIdStr, null, " cmis:name ASC", false, IncludeRelationships.NONE, null, false, null, null, null);
|
||||
assertChildren(folderAndDocument, children);
|
||||
|
||||
children = cmisService.getChildren(repositoryId, objectIdStr, null, " cmis:name ASC, cmis:creationDate ASC ", false, IncludeRelationships.NONE, null,
|
||||
false, null, null, null);
|
||||
assertChildren(folderAndDocument, children);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void assertChildren(final Pair<FileInfo, FileInfo> folderAndDocument, ObjectInFolderList children)
|
||||
{
|
||||
assertNotNull(children);
|
||||
assertTrue(1 == children.getNumItems().longValue());
|
||||
|
||||
PropertyData<?> nameData = children.getObjects().iterator().next().getObject().getProperties().getProperties().get("cmis:name");
|
||||
assertNotNull(nameData);
|
||||
Object name = nameData.getValues().iterator().next();
|
||||
assertEquals(folderAndDocument.getSecond().getName(), name);
|
||||
}
|
||||
}, CmisVersion.CMIS_1_0);
|
||||
}
|
||||
catch (CmisConstraintException e)
|
||||
{
|
||||
fail(e.toString());
|
||||
}
|
||||
finally
|
||||
{
|
||||
AuthenticationUtil.popAuthentication();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user