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,29 +272,20 @@ function main()
|
|||||||
|
|
||||||
if (updateNameAndMimetype)
|
if (updateNameAndMimetype)
|
||||||
{
|
{
|
||||||
//update node name with the new extension if type is changed
|
//check to see if name is already used in folder
|
||||||
var existingFileName = updateNode.getName(),
|
var existingFile = updateNode.getParent().childByNamePath(filename),
|
||||||
dotIndexExistingFile = existingFileName.lastIndexOf("."),
|
newFilename = filename;
|
||||||
dotIndexNewFile = filename.lastIndexOf(".");
|
var existingFileNodeRef = (existingFile !== null) ? String(existingFile.nodeRef) : '',
|
||||||
|
updateFileNodeRef = String(updateNodeRef);
|
||||||
var existingFileExtension = (dotIndexExistingFile !== -1) ? existingFileName.substring(dotIndexExistingFile) : "",
|
if (existingFile !== null && existingFileNodeRef !== updateFileNodeRef)
|
||||||
newFileExtension = (dotIndexNewFile !== -1) ? filename.substring(dotIndexNewFile) : "";
|
|
||||||
if (existingFileExtension != newFileExtension)
|
|
||||||
{
|
{
|
||||||
var newFileName = ((dotIndexExistingFile !== -1) ? existingFileName.substring(0, dotIndexExistingFile) : existingFileName) + newFileExtension;
|
//name it's already used for other than node to update; create a new one
|
||||||
var alreadyExistsFile = updateNode.getParent().childByNamePath(newFileName);
|
newFilename = createUniqueNameInFolder(filename, updateNode.getParent());
|
||||||
|
|
||||||
var existingFileNodeRef = (alreadyExistsFile !== null) ? String(alreadyExistsFile.nodeRef) : '',
|
|
||||||
updateFileNodeRef = String(updateNodeRef);
|
|
||||||
if (alreadyExistsFile !== 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);
|
|
||||||
}
|
}
|
||||||
|
//update node name
|
||||||
|
updateNode.setName(newFilename);
|
||||||
}
|
}
|
||||||
|
|
||||||
var workingcopy = updateNode.hasAspect("cm:workingcopy");
|
var workingcopy = updateNode.hasAspect("cm:workingcopy");
|
||||||
if (!workingcopy && updateNode.isLocked)
|
if (!workingcopy && updateNode.isLocked)
|
||||||
{
|
{
|
||||||
|
@@ -29,7 +29,8 @@ import org.alfresco.repo.activities.SiteActivityTestCaseSensitivity;
|
|||||||
import org.alfresco.repo.activities.SiteActivityTestCaseInsensitivity;
|
import org.alfresco.repo.activities.SiteActivityTestCaseInsensitivity;
|
||||||
import org.alfresco.repo.site.SiteServiceImplMoreTest;
|
import org.alfresco.repo.site.SiteServiceImplMoreTest;
|
||||||
import org.alfresco.repo.site.SiteServiceImplTest;
|
import org.alfresco.repo.site.SiteServiceImplTest;
|
||||||
import org.alfresco.service.cmr.site.SiteService;
|
import org.alfresco.service.cmr.site.SiteService;
|
||||||
|
import org.alfresco.repo.site.SiteMembershipTest;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.junit.runners.Suite;
|
import org.junit.runners.Suite;
|
||||||
|
|
||||||
@@ -48,7 +49,8 @@ import org.junit.runners.Suite;
|
|||||||
SiteServiceTest.class,
|
SiteServiceTest.class,
|
||||||
SiteExportServiceTest.class,
|
SiteExportServiceTest.class,
|
||||||
SiteActivityTestCaseSensitivity.class,
|
SiteActivityTestCaseSensitivity.class,
|
||||||
SiteActivityTestCaseInsensitivity.class
|
SiteActivityTestCaseInsensitivity.class,
|
||||||
|
SiteMembershipTest.class
|
||||||
})
|
})
|
||||||
public class AllSiteTests
|
public class AllSiteTests
|
||||||
{
|
{
|
||||||
|
@@ -788,6 +788,7 @@ public class TestNodeComments extends EnterpriseTestApi
|
|||||||
Comments commentsProxy = publicApiClient.comments();
|
Comments commentsProxy = publicApiClient.comments();
|
||||||
|
|
||||||
// locked node - cannot add/edit/delete comments (MNT-14945, MNT-16446)
|
// locked node - cannot add/edit/delete comments (MNT-14945, MNT-16446)
|
||||||
|
// only the lock owner can (ALF-21907)
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -805,15 +806,15 @@ public class TestNodeComments extends EnterpriseTestApi
|
|||||||
repoService.lockNode(nodeRef1);
|
repoService.lockNode(nodeRef1);
|
||||||
return null;
|
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
|
// test GET for a locked node
|
||||||
|
int skipCount = 0;
|
||||||
int skipCount = 0;
|
int maxItems = Integer.MAX_VALUE;
|
||||||
int maxItems = Integer.MAX_VALUE;
|
Paging paging = getPaging(skipCount, maxItems);
|
||||||
Paging paging = getPaging(skipCount, maxItems);
|
|
||||||
commentsProxy.getNodeComments(nodeRef1.getId(), createParams(paging, null));
|
commentsProxy.getNodeComments(nodeRef1.getId(), createParams(paging, null));
|
||||||
|
|
||||||
// test POST for a locked node
|
// test POST for a locked node
|
||||||
@@ -853,8 +854,27 @@ public class TestNodeComments extends EnterpriseTestApi
|
|||||||
}
|
}
|
||||||
catch (PublicApiException e)
|
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
|
finally
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user