();
for (AccessPermission ap : permissionService.getAllSetPermissions(site.getNodeRef()))
{
if (ap.getAccessStatus() == AccessStatus.ALLOWED)
{
perms.put(ap.getAuthority(), ap.getPermission());
}
}
return perms;
}
/**
* ALF-10343 - When the default public group for sites isn't EVERYBODY,
* check that creating and altering sites results in the correct permissions
*/
public void testNonDefaultPublicGroupPermissions() throws Exception
{
// Sanity check the current permissions
assertEquals(PermissionService.ALL_AUTHORITIES, sysAdminParams.getSitePublicGroup());
// Change the public site group
SysAdminParamsImpl sp = new SysAdminParamsImpl();
sp.setSitePublicGroup(groupFour);
siteServiceImpl.setSysAdminParams(sp);
// Create sites of the three types
SiteInfo s1 = this.siteService.createSite(TEST_SITE_PRESET, "SiteTest_priv", "priv", "priv", SiteVisibility.PRIVATE);
SiteInfo s2 = this.siteService.createSite(TEST_SITE_PRESET, "SiteTest_mod", "mod", "mod", SiteVisibility.MODERATED);
SiteInfo s3 = this.siteService.createSite(TEST_SITE_PRESET, "SiteTest_pub", "pub", "pub", SiteVisibility.PUBLIC);
// Check the permissions on them
// Everyone has read permissions only, not Consumer
assertEquals("ReadPermissions", getAllowedPermissionsMap(s1).get(PermissionService.ALL_AUTHORITIES));
assertEquals("ReadPermissions", getAllowedPermissionsMap(s2).get(PermissionService.ALL_AUTHORITIES));
assertEquals("ReadPermissions", getAllowedPermissionsMap(s3).get(PermissionService.ALL_AUTHORITIES));
// On the public + moderated sites, the special group will be a Consumer
assertEquals(null, getAllowedPermissionsMap(s1).get(groupFour));
assertEquals(SiteModel.SITE_CONSUMER, getAllowedPermissionsMap(s2).get(groupFour));
assertEquals(SiteModel.SITE_CONSUMER, getAllowedPermissionsMap(s3).get(groupFour));
// Our current user will be Manager
assertEquals(SiteModel.SITE_MANAGER, siteService.getMembersRole(s1.getShortName(), USER_ONE));
assertEquals(SiteModel.SITE_MANAGER, siteService.getMembersRole(s2.getShortName(), USER_ONE));
assertEquals(SiteModel.SITE_MANAGER, siteService.getMembersRole(s3.getShortName(), USER_ONE));
// Swap the visibilites around, private+moderated -> public, public -> private
s1.setVisibility(SiteVisibility.PUBLIC);
s2.setVisibility(SiteVisibility.PUBLIC);
s3.setVisibility(SiteVisibility.PRIVATE);
siteService.updateSite(s1);
siteService.updateSite(s2);
siteService.updateSite(s3);
// Check the permissions now
// Everyone still has read permissions everywhere, but nothing more
assertEquals("ReadPermissions", getAllowedPermissionsMap(s1).get(PermissionService.ALL_AUTHORITIES));
assertEquals("ReadPermissions", getAllowedPermissionsMap(s2).get(PermissionService.ALL_AUTHORITIES));
assertEquals("ReadPermissions", getAllowedPermissionsMap(s3).get(PermissionService.ALL_AUTHORITIES));
// The site public group has consumer permissions on mod+public
assertEquals(SiteModel.SITE_CONSUMER, getAllowedPermissionsMap(s1).get(groupFour));
assertEquals(SiteModel.SITE_CONSUMER, getAllowedPermissionsMap(s2).get(groupFour));
assertEquals(null, getAllowedPermissionsMap(s3).get(groupFour));
// Our user is still the manager
assertEquals(SiteModel.SITE_MANAGER, siteService.getMembersRole(s1.getShortName(), USER_ONE));
assertEquals(SiteModel.SITE_MANAGER, siteService.getMembersRole(s2.getShortName(), USER_ONE));
assertEquals(SiteModel.SITE_MANAGER, siteService.getMembersRole(s3.getShortName(), USER_ONE));
// Swap them back again
s1.setVisibility(SiteVisibility.PRIVATE);
s2.setVisibility(SiteVisibility.MODERATED);
s3.setVisibility(SiteVisibility.PUBLIC);
siteService.updateSite(s1);
siteService.updateSite(s2);
siteService.updateSite(s3);
// Check the permissions have restored
// Everyone only has read permissions
assertEquals("ReadPermissions", getAllowedPermissionsMap(s1).get(PermissionService.ALL_AUTHORITIES));
assertEquals("ReadPermissions", getAllowedPermissionsMap(s2).get(PermissionService.ALL_AUTHORITIES));
assertEquals("ReadPermissions", getAllowedPermissionsMap(s3).get(PermissionService.ALL_AUTHORITIES));
// The site public group has consumer permissions on mod+public
assertEquals(null, getAllowedPermissionsMap(s1).get(groupFour));
assertEquals(SiteModel.SITE_CONSUMER, getAllowedPermissionsMap(s2).get(groupFour));
assertEquals(SiteModel.SITE_CONSUMER, getAllowedPermissionsMap(s3).get(groupFour));
// Our user is still the manager
assertEquals(SiteModel.SITE_MANAGER, siteService.getMembersRole(s1.getShortName(), USER_ONE));
assertEquals(SiteModel.SITE_MANAGER, siteService.getMembersRole(s2.getShortName(), USER_ONE));
assertEquals(SiteModel.SITE_MANAGER, siteService.getMembersRole(s3.getShortName(), USER_ONE));
}
private SiteInfo createTestSiteWithContent(String siteShortName, String componentId, SiteVisibility visibility)
{
return this.createTestSiteWithContent(siteShortName, componentId, visibility, "");
}
/**
* Creates a site with a simple content tree within it.
* The content looks like
*
* [site] {siteShortName}
* |
* --- [siteContainer] {componentId}
* |
* --- [cm:content] fileFolderPrefix + "file.txt"
* |
* |-- [folder] fileFolderPrefix + "folder"
* |
* |-- [cm:content] fileFolderPrefix + "fileInFolder.txt"
* |
* |-- [folder] fileFolderPrefix + "subfolder"
* |
* |-- [cm:content] fileFolderPrefix + "fileInSubfolder.txt"
*
*
* @param siteShortName short name for the site
* @param componentId the component id for the container
* @param visibility visibility for the site.
* @param fileFolderPrefix a prefix String to put on all folders/files created.
*/
private SiteInfo createTestSiteWithContent(String siteShortName, String componentId, SiteVisibility visibility, String fileFolderPrefix)
{
// Create a public site
SiteInfo siteInfo = this.siteService.createSite(TEST_SITE_PRESET,
siteShortName,
TEST_TITLE,
TEST_DESCRIPTION,
visibility);
NodeRef siteContainer = this.siteService.createContainer(siteShortName, componentId, ContentModel.TYPE_FOLDER, null);
FileInfo fileInfo = this.fileFolderService.create(siteContainer, fileFolderPrefix + "file.txt", ContentModel.TYPE_CONTENT);
ContentWriter writer = this.fileFolderService.getWriter(fileInfo.getNodeRef());
writer.putContent("Just some old content that doesn't mean anything");
FileInfo folder1Info = this.fileFolderService.create(siteContainer, fileFolderPrefix + "folder", ContentModel.TYPE_FOLDER);
FileInfo fileInfo2 = this.fileFolderService.create(folder1Info.getNodeRef(), fileFolderPrefix + "fileInFolder.txt", ContentModel.TYPE_CONTENT);
ContentWriter writer2 = this.fileFolderService.getWriter(fileInfo2.getNodeRef());
writer2.putContent("Just some old content that doesn't mean anything");
FileInfo folder2Info = this.fileFolderService.create(folder1Info.getNodeRef(), fileFolderPrefix + "subfolder", ContentModel.TYPE_FOLDER);
FileInfo fileInfo3 = this.fileFolderService.create(folder2Info.getNodeRef(), fileFolderPrefix + "fileInSubfolder.txt", ContentModel.TYPE_CONTENT);
ContentWriter writer3 = this.fileFolderService.getWriter(fileInfo3.getNodeRef());
writer3.putContent("Just some old content that doesn't mean anything");
return siteInfo;
}
private void testVisibilityPermissions(String message, String userName, SiteInfo siteInfo, boolean listSite, boolean readSite)
{
String holdUser = this.authenticationComponent.getCurrentUserName();
this.authenticationComponent.setCurrentUser(userName);
try
{
// Can the site be seen in the list sites by the user?
List sites = this.siteService.listSites(null, null);
boolean siteInList = sites.contains(siteInfo);
if (listSite == true && siteInList == false)
{
fail(message + ": The site '" + siteInfo.getShortName() + "' was expected in the list of sites for user '" + userName + "'");
}
else if (listSite == false && siteInList == true)
{
fail(message + ": The site '" + siteInfo.getShortName() + "' was NOT expected in the list of sites for user '" + userName + "'");
}
if (siteInList == true)
{
try
{
// Can site content be read by the user?
NodeRef folder = this.siteService.getContainer(siteInfo.getShortName(), "testComp");
List files = null;
files = this.fileFolderService.listFiles(folder);
if (readSite == false)
{
fail(message + ": Content of the site '" + siteInfo.getShortName() + "' was NOT expected to be read by user '" + userName + "'");
}
}
catch (Exception exception)
{
if (readSite == true)
{
fail(message + ": Content of the site '" + siteInfo.getShortName() + "' was expected to be read by user '" + userName + "'");
}
}
}
}
finally
{
this.authenticationComponent.setCurrentUser(holdUser);
}
}
/**
* Create a site with a USER manager.
* Add Group manager membership.
*
* Lower User membership - should be O.K. because of Group Membership
* Lower Group membership - should be prevented (last manager)
*
* Reset User membership to Manager
*
* Lower Group membership - should be O.K. because of User Membership
* Lower User membership - should be prevented (last manager)
*
*/
public void testALFCOM_3109()
{
// USER_ONE - SiteManager
// GROUP_TWO - Manager
String siteName = "testALFCOM_3019";
// Create a site as user one
this.siteService.createSite(TEST_SITE_PRESET, siteName, TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.MODERATED);
Map members = this.siteService.listMembers(siteName, null, null, 0);
String managerName = members.keySet().iterator().next();
/**
* Add a group (GROUP_TWO) with role Manager
*/
this.siteService.setMembership(siteName, this.groupTwo, SiteModel.SITE_MANAGER);
// Should be allowed
this.siteService.setMembership(siteName, managerName, SiteModel.SITE_CONTRIBUTOR);
/**
* Should not be allowed to delete last group
*/
try
{
this.siteService.setMembership(siteName, this.groupTwo, SiteModel.SITE_CONTRIBUTOR);
fail();
}
catch (Exception e)
{
// Should go here
}
this.siteService.setMembership(siteName, managerName, SiteModel.SITE_MANAGER);
this.siteService.setMembership(siteName, this.groupTwo, SiteModel.SITE_CONTRIBUTOR);
/**
* Should not be allowed to delete last user
*/
try
{
this.siteService.setMembership(siteName, managerName, SiteModel.SITE_CONTRIBUTOR);
fail();
}
catch (Exception e)
{
// Should go here
}
}
/**
* Create a site with a USER manager.
* Add Group manager membership.
*
* Remove User membership - should be O.K. because of Group Membership
* Remove Group membership - should be prevented (last manager)
*
* Add User membership to Manager
*
* Remove Group membership - should be O.K. because of User Membership
* Remove User membership - should be prevented (last manager)
*
*/
public void testALFCOM_3111()
{
// USER_ONE - SiteManager
// GROUP_TWO - Manager
String siteName = "testALFCOM_3019";
// Create a site as user one
this.siteService.createSite(TEST_SITE_PRESET, siteName, TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.MODERATED);
Map members = this.siteService.listMembers(siteName, null, null, 0);
String managerName = members.keySet().iterator().next();
/**
* Add a group (GROUP_TWO) with role Manager
*/
this.siteService.setMembership(siteName, this.groupTwo, SiteModel.SITE_MANAGER);
// Should be allowed
this.siteService.removeMembership(siteName, managerName);
/**
* Should not be allowed to delete last group
*/
try
{
this.siteService.removeMembership(siteName, this.groupTwo);
fail();
}
catch (Exception e)
{
// Should go here
}
this.siteService.setMembership(siteName, managerName, SiteModel.SITE_MANAGER);
this.siteService.removeMembership(siteName, this.groupTwo);
/**
* Should not be allowed to delete last user
*/
try
{
this.siteService.removeMembership(siteName, managerName);
fail();
}
catch (Exception e)
{
// Should go here
}
}
/**
* Create a private site.
*
* Attempt to access a private site by someone that is not a consumer of that site.
*
*/
public void testETHREEOH_1268()
{
// USER_ONE - SiteManager
// GROUP_TWO - Manager
String siteName = "testALFCOM_XXXX";
// Create a site as user one
this.siteService.createSite(TEST_SITE_PRESET, siteName, TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.PRIVATE);
SiteInfo si = this.siteService.getSite(siteName);
assertNotNull("site info is null", si);
authenticationComponent.setCurrentUser(USER_TWO);
si = this.siteService.getSite(siteName);
assertNull("site info is not null", si);
}
/**
* ALF-3200
* You shouldn't be able to rename a Site using the normal node service
* type operations, because the relationship between a site and its
* authorities is based on a pattern that uses the site name.
* However, you are free to change a site's display name.
*/
public void testALF_3200() throws Exception
{
// Create the site
String siteName = "testALF_3200";
SiteInfo siteInfo = this.siteService.createSite(
TEST_SITE_PRESET, siteName, TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.MODERATED);
// Grab the details
NodeRef siteNodeRef = siteInfo.getNodeRef();
// Try to rename it
try
{
fileFolderService.rename(siteNodeRef, "RenamedName");
fail("Shouldn't be able to rename a site but did");
}
catch(SiteServiceException e)
{
// expected
}
// Now just try to change the display name (title) via the node service
assertEquals(TEST_TITLE, nodeService.getProperty(siteNodeRef, ContentModel.PROP_TITLE));
String newName = "ChangedTitleName";
String newName2 = "Changed2Title2Name";
nodeService.setProperty(siteNodeRef, ContentModel.PROP_TITLE, newName);
assertEquals(newName, nodeService.getProperty(siteNodeRef, ContentModel.PROP_TITLE));
// And also via the site info
siteInfo = this.siteService.getSite(siteNodeRef);
assertEquals(newName, siteInfo.getTitle());
siteInfo.setTitle(newName2);
siteService.updateSite(siteInfo);
assertEquals(newName2, siteInfo.getTitle());
assertEquals(newName2, nodeService.getProperty(siteNodeRef, ContentModel.PROP_TITLE));
}
public void testALF_5556() throws Exception
{
String siteName = "testALF_5556";
SiteInfo siteInfo = this.siteService.createSite(
TEST_SITE_PRESET, siteName, TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.MODERATED);
// create a container for the site
NodeRef container = this.siteService.createContainer(siteInfo.getShortName(), "folder.component", null, null);
// Try to rename the container
try
{
fileFolderService.rename(container, "RenamedContainer");
fail("Shouldn't be able to rename a container but was able to");
}
catch (SiteServiceException e)
{
// expected
}
}
public void testALF8036_PermissionsAfterCopyingFolderBetweenSites() throws Exception
{
alf8036Impl(true);
}
private void alf8036Impl(boolean copyNotMove)
{
// Create two test sites
SiteInfo fromSite = this.createTestSiteWithContent("fromSite", "doclib", SiteVisibility.PUBLIC, "FROM");
SiteInfo toSite = this.createTestSiteWithContent("toSite", "doclib", SiteVisibility.PUBLIC, "TO");
// Find the folder to be copied/moved.
NodeRef fromDoclibContainer = nodeService.getChildByName(fromSite.getNodeRef(), ContentModel.ASSOC_CONTAINS, "doclib");
assertNotNull(fromDoclibContainer);
NodeRef fromFolder = nodeService.getChildByName(fromDoclibContainer, ContentModel.ASSOC_CONTAINS, "FROMfolder");
assertNotNull(fromFolder);
NodeRef fromSubFolder = nodeService.getChildByName(fromFolder, ContentModel.ASSOC_CONTAINS, "FROMsubfolder");
assertNotNull(fromSubFolder);
// The bug is only observed if we set some specific permissions on the folder.
// We'll demote contributors to consumer-level permissions.
permissionService.setPermission(fromFolder, siteServiceImpl.getSiteRoleGroup(fromSite.getShortName(), SiteModel.SITE_CONTRIBUTOR, true), SiteModel.SITE_CONSUMER, false);
// And we'll change permissions on a subfolder too
permissionService.setPermission(fromSubFolder, siteServiceImpl.getSiteRoleGroup(fromSite.getShortName(), SiteModel.SITE_COLLABORATOR, true), SiteModel.SITE_CONSUMER, false);
// Find the folder to copy/move it to.
NodeRef toDoclibContainer = nodeService.getChildByName(toSite.getNodeRef(), ContentModel.ASSOC_CONTAINS, "doclib");
assertNotNull(toDoclibContainer);
NodeRef toFolder = nodeService.getChildByName(toDoclibContainer, ContentModel.ASSOC_CONTAINS, "TOfolder");
assertNotNull(toFolder);
// Copy/move it
NodeRef relocatedNode;
if (copyNotMove)
{
relocatedNode = copyService.copy(fromFolder, toFolder, ContentModel.ASSOC_CONTAINS, ContentModel.ASSOC_CONTAINS, true);
}
else
{
relocatedNode = nodeService.moveNode(fromFolder, toDoclibContainer, ContentModel.ASSOC_CONTAINS, ContentModel.ASSOC_CONTAINS).getChildRef();
}
siteService.cleanSitePermissions(relocatedNode, null);
// Ensure the permissions on the copied/moved node are those of the target site and not those of the source site.
Map expectedPermissions = new HashMap();
expectedPermissions.put(siteService.getSiteRoleGroup(toSite.getShortName(), SiteModel.SITE_MANAGER), SiteModel.SITE_MANAGER);
expectedPermissions.put(siteService.getSiteRoleGroup(toSite.getShortName(), SiteModel.SITE_COLLABORATOR), SiteModel.SITE_COLLABORATOR);
expectedPermissions.put(siteService.getSiteRoleGroup(toSite.getShortName(), SiteModel.SITE_CONTRIBUTOR), SiteModel.SITE_CONTRIBUTOR);
expectedPermissions.put(siteService.getSiteRoleGroup(toSite.getShortName(), SiteModel.SITE_CONSUMER), SiteModel.SITE_CONSUMER);
validatePermissionsOnRelocatedNode(fromSite, toSite, relocatedNode, expectedPermissions);
// Get the subfolder and check its permissions too.
NodeRef copyOfSubFolder = nodeService.getChildByName(relocatedNode, ContentModel.ASSOC_CONTAINS, "FROMsubfolder");
assertNotNull(copyOfSubFolder);
validatePermissionsOnRelocatedNode(fromSite, toSite, copyOfSubFolder, expectedPermissions);
}
/**
* ALF-1017 - Non sites in the Sites Space container shouldn't
* break the listing methods
*/
public void testALF_1017_nonSitesInSitesSpace() throws Exception
{
final String testTitlePrefix = TEST_TITLE.substring(0, 9);
// Initially listing is fine
List sites = this.siteService.listSites(null, null);
assertNotNull("sites list was null.", sites);
final int preexistingSitesCount = sites.size();
// Create some sites
SiteInfo site1 = this.siteService.createSite(TEST_SITE_PRESET, "mySiteOne", TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.PUBLIC);
SiteInfo site2 = this.siteService.createSite(TEST_SITE_PRESET, "mySiteTwo", TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.PRIVATE);
// Listing is still ok
sites = this.siteService.listSites(null, null);
assertNotNull("sites list was null.", sites);
assertEquals(preexistingSitesCount+2, sites.size());
// Now add a random folder, and a random document to the sites root
final NodeRef sitesSpace = this.nodeService.getPrimaryParent(site1.getNodeRef()).getParentRef();
final NodeRef folder = AuthenticationUtil.runAsSystem(new RunAsWork() {
@Override
public NodeRef doWork() throws Exception {
return nodeService.createNode(
sitesSpace, ContentModel.ASSOC_CONTAINS,
QName.createQName("Folder"), ContentModel.TYPE_FOLDER
).getChildRef();
}
});
final NodeRef document = AuthenticationUtil.runAsSystem(new RunAsWork() {
@Override
public NodeRef doWork() throws Exception {
return nodeService.createNode(
sitesSpace, ContentModel.ASSOC_CONTAINS,
QName.createQName("Document"), ContentModel.TYPE_CONTENT
).getChildRef();
}
});
// Listing should still be fine, and count won't have increased
sites = this.siteService.listSites(null, null);
assertNotNull("sites list was null.", sites);
assertEquals(preexistingSitesCount+2, sites.size());
// Delete one site, listing still ok
this.siteService.deleteSite(site2.getShortName());
sites = this.siteService.listSites(null, null);
assertNotNull("sites list was null.", sites);
assertEquals(preexistingSitesCount+1, sites.size());
// Tidy up the random nodes, listing still fine
this.nodeService.deleteNode(folder);
this.nodeService.deleteNode(document);
sites = this.siteService.listSites(null, null);
assertNotNull("sites list was null.", sites);
assertEquals(preexistingSitesCount+1, sites.size());
}
private SiteInfo createSite(String siteShortName, String componentId, SiteVisibility visibility)
{
// Create a public site
SiteInfo siteInfo = this.siteService.createSite(TEST_SITE_PRESET,
siteShortName,
TEST_TITLE,
TEST_DESCRIPTION,
visibility);
NodeRef siteContainer = this.siteService.createContainer(siteShortName, componentId, ContentModel.TYPE_FOLDER, null);
return siteInfo;
}
public void testRenameSite()
{
// test that changing the name of a site generates an appropriate exception
try
{
String siteName = GUID.generate();
SiteInfo siteInfo = createSite(siteName, "doclib", SiteVisibility.PUBLIC);
NodeRef childRef = siteInfo.getNodeRef();
Map props = new HashMap();
props.put(ContentModel.PROP_NAME, siteName + "Renamed");
nodeService.addProperties(childRef, props);
fail("Should have caught rename");
}
catch(SiteServiceException e)
{
assertTrue(e.getMessage().contains("can not be renamed"));
}
}
private void validatePermissionsOnRelocatedNode(SiteInfo fromSite,
SiteInfo toSite, NodeRef relocatedNode, Map expectedPermissions)
{
Set permissions = permissionService.getAllSetPermissions(relocatedNode);
// None of the 'from' site permissions should be there.
for (String sitePermission : SiteModel.STANDARD_PERMISSIONS)
{
String siteRoleGroup = siteServiceImpl.getSiteRoleGroup(fromSite.getShortName(), sitePermission, true);
AccessPermission ap = getPermission(permissions, siteRoleGroup);
assertNull("Permission " + siteRoleGroup + " was unexpectedly present", ap);
}
// All of the 'to' site permissions should be there.
for (String authority : expectedPermissions.keySet())
{
AccessPermission ap = getPermission(permissions, authority);
assertNotNull("Permission " + authority + " missing", ap);
assertEquals(authority, ap.getAuthority());
assertEquals("Wrong permission for " + authority, expectedPermissions.get(authority), ap.getPermission());
assertTrue(ap.isInherited());
}
}
private AccessPermission getPermission(Set permissions, String expectedAuthority)
{
AccessPermission result = null;
for (AccessPermission ap : permissions)
{
if (expectedAuthority.equals(ap.getAuthority()))
{
result = ap;
}
}
return result;
}
public void testPermissionsAfterMovingFolderBetweenSites() throws Exception
{
alf8036Impl(false);
}
// == Test the JavaScript API ==
public void testJSAPI() throws Exception
{
// Create a site with a custom property
SiteInfo siteInfo = this.siteService.createSite(TEST_SITE_PRESET, "mySiteWithCustomProperty", TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.PUBLIC);
NodeRef siteNodeRef = siteInfo.getNodeRef();
Map properties = new HashMap(1);
properties.put(QName.createQName(SiteModel.SITE_CUSTOM_PROPERTY_URL, "additionalInformation"), "information");
this.nodeService.addAspect(siteNodeRef, QName.createQName(SiteModel.SITE_MODEL_URL, "customSiteProperties"), properties);
// Create a model to pass to the unit test scripts
Map model = new HashMap();
model.put("customSiteName", "mySiteWithCustomProperty");
model.put("preexistingSiteCount", siteService.listSites(null, null).size());
// Execute the unit test script
ScriptLocation location = new ClasspathScriptLocation("org/alfresco/repo/site/script/test_siteService.js");
this.scriptService.executeScript(location, model);
}
}