mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-21 18:09:20 +00:00
REPO-2520: Community: SiteMembership Java API calls should tell which site resulted in errors
Changed tests asserts from (actual value, expected value) to (expected value, actual value) as recommended in the Junit Assert Javadoc. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@137771 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -272,27 +272,18 @@ function main()
|
||||
|
||||
if (updateNameAndMimetype)
|
||||
{
|
||||
//update node name with the new extension if type is changed
|
||||
var existingFileName = updateNode.getName(),
|
||||
dotIndexExistingFile = existingFileName.lastIndexOf("."),
|
||||
dotIndexNewFile = filename.lastIndexOf(".");
|
||||
|
||||
var existingFileExtension = (dotIndexExistingFile !== -1) ? existingFileName.substring(dotIndexExistingFile) : "",
|
||||
newFileExtension = (dotIndexNewFile !== -1) ? filename.substring(dotIndexNewFile) : "";
|
||||
if (existingFileExtension != newFileExtension)
|
||||
{
|
||||
var newFileName = ((dotIndexExistingFile !== -1) ? existingFileName.substring(0, dotIndexExistingFile) : existingFileName) + newFileExtension;
|
||||
var alreadyExistsFile = updateNode.getParent().childByNamePath(newFileName);
|
||||
|
||||
var existingFileNodeRef = (alreadyExistsFile !== null) ? String(alreadyExistsFile.nodeRef) : '',
|
||||
//check to see if name is already used in folder
|
||||
var existingFile = updateNode.getParent().childByNamePath(filename),
|
||||
newFilename = filename;
|
||||
var existingFileNodeRef = (existingFile !== null) ? String(existingFile.nodeRef) : '',
|
||||
updateFileNodeRef = String(updateNodeRef);
|
||||
if (alreadyExistsFile !== null && existingFileNodeRef !== updateFileNodeRef)
|
||||
if (existingFile !== null && existingFileNodeRef !== updateFileNodeRef)
|
||||
{
|
||||
//name it's already used for other than node to update; create a new one
|
||||
newFileName = createUniqueNameInFolder(newFileName, updateNode.getParent());
|
||||
}
|
||||
updateNode.setName(newFileName);
|
||||
newFilename = createUniqueNameInFolder(filename, updateNode.getParent());
|
||||
}
|
||||
//update node name
|
||||
updateNode.setName(newFilename);
|
||||
}
|
||||
|
||||
var workingcopy = updateNode.hasAspect("cm:workingcopy");
|
||||
|
@@ -30,6 +30,7 @@ import org.alfresco.repo.activities.SiteActivityTestCaseInsensitivity;
|
||||
import org.alfresco.repo.site.SiteServiceImplMoreTest;
|
||||
import org.alfresco.repo.site.SiteServiceImplTest;
|
||||
import org.alfresco.service.cmr.site.SiteService;
|
||||
import org.alfresco.repo.site.SiteMembershipTest;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Suite;
|
||||
|
||||
@@ -48,7 +49,8 @@ import org.junit.runners.Suite;
|
||||
SiteServiceTest.class,
|
||||
SiteExportServiceTest.class,
|
||||
SiteActivityTestCaseSensitivity.class,
|
||||
SiteActivityTestCaseInsensitivity.class
|
||||
SiteActivityTestCaseInsensitivity.class,
|
||||
SiteMembershipTest.class
|
||||
})
|
||||
public class AllSiteTests
|
||||
{
|
||||
|
@@ -788,6 +788,7 @@ public class TestNodeComments extends EnterpriseTestApi
|
||||
Comments commentsProxy = publicApiClient.comments();
|
||||
|
||||
// locked node - cannot add/edit/delete comments (MNT-14945, MNT-16446)
|
||||
// only the lock owner can (ALF-21907)
|
||||
|
||||
try
|
||||
{
|
||||
@@ -805,12 +806,12 @@ public class TestNodeComments extends EnterpriseTestApi
|
||||
repoService.lockNode(nodeRef1);
|
||||
return null;
|
||||
}
|
||||
}, person11.getId(), network1.getId());
|
||||
}, person13.getId(), network1.getId());
|
||||
|
||||
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person11.getId()));
|
||||
// change to not lock owner
|
||||
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person14.getId()));
|
||||
|
||||
// test GET for a locked node
|
||||
|
||||
int skipCount = 0;
|
||||
int maxItems = Integer.MAX_VALUE;
|
||||
Paging paging = getPaging(skipCount, maxItems);
|
||||
@@ -853,8 +854,27 @@ public class TestNodeComments extends EnterpriseTestApi
|
||||
}
|
||||
catch (PublicApiException e)
|
||||
{
|
||||
assertEquals(HttpStatus.SC_CONFLICT, e.getHttpResponse().getStatusCode());
|
||||
assertEquals(HttpStatus.SC_FORBIDDEN, e.getHttpResponse().getStatusCode());
|
||||
}
|
||||
|
||||
// change to lock owner
|
||||
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person13.getId()));
|
||||
|
||||
// test GET for a locked node
|
||||
commentsProxy.getNodeComments(nodeRef1.getId(), createParams(paging, null));
|
||||
|
||||
// test POST for a locked node
|
||||
comment = new Comment();
|
||||
comment.setContent("my other comment");
|
||||
createdComment = commentsProxy.createNodeComment(nodeRef1.getId(), comment);
|
||||
|
||||
// test PUT for a locked node
|
||||
Comment updatedComment = new Comment();
|
||||
updatedComment.setContent("my comment");
|
||||
commentsProxy.updateNodeComment(nodeRef1.getId(), createdComment.getId(), updatedComment);
|
||||
|
||||
// test DELETE for a locked node
|
||||
commentsProxy.removeNodeComment(nodeRef1.getId(), createdComment.getId());
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
Reference in New Issue
Block a user