use of org.alfresco.service.cmr.site.SiteInfo in project alfresco-repository by Alfresco.
the class AbstractInvitationServiceImplTest method test_MNT15614.
/**
* MNT-15614 Site with name "IT" cannot be managed properly
*
* @throws Exception
*/
public void test_MNT15614() throws Exception {
String[] siteNames = { "it", "site", "GROUP" };
String inviteeUserName = USER_ONE;
Invitation.ResourceType resourceType = Invitation.ResourceType.WEB_SITE;
String inviteeRole = SiteModel.SITE_COLLABORATOR;
String acceptUrl = "froob";
String rejectUrl = "marshmallow";
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
for (String siteName : siteNames) {
SiteInfo siteInfoRed = siteService.getSite(siteName);
if (siteInfoRed == null) {
siteService.createSite("InviteSitePreset", siteName, "InviteSiteTitle", "InviteSiteDescription", SiteVisibility.MODERATED);
}
assertEquals(SiteModel.SITE_MANAGER, siteService.getMembersRole(siteName, AuthenticationUtil.getAdminUserName()));
// Invite user
NominatedInvitation nominatedInvitation = invitationService.inviteNominated(inviteeUserName, resourceType, siteName, inviteeRole, acceptUrl, rejectUrl);
assertNotNull("nominated invitation is null", nominatedInvitation);
}
}
use of org.alfresco.service.cmr.site.SiteInfo in project alfresco-repository by Alfresco.
the class MultiTDemoTest method createSite.
private SiteInfo createSite(String siteId) {
SiteInfo siteInfo = siteService.createSite(null, siteId, "title - " + siteId, "description - " + siteId, SiteVisibility.PRIVATE);
// ensure that the Document Library folder is pre-created so that test code can start creating content straight away.
// At the time of writing V4.1 does not create this folder automatically, but Thor does.
NodeRef result = siteService.getContainer(siteId, SiteService.DOCUMENT_LIBRARY);
if (result == null) {
result = siteService.createContainer(siteId, SiteService.DOCUMENT_LIBRARY, ContentModel.TYPE_FOLDER, null);
}
return siteInfo;
}
use of org.alfresco.service.cmr.site.SiteInfo in project alfresco-repository by Alfresco.
the class SubscriptionServiceActivitiesTest method deleteSite.
private void deleteSite(String siteShortName) {
SiteInfo siteInfo = siteService.getSite(siteShortName);
if (siteInfo != null) {
log.debug("Deleting site: " + siteShortName);
siteService.deleteSite(siteShortName);
nodeArchiveService.purgeArchivedNode(nodeArchiveService.getArchivedNode(siteInfo.getNodeRef()));
} else {
log.debug("Not deleting site: " + siteShortName + ", as it doesn't appear to exist");
}
}
use of org.alfresco.service.cmr.site.SiteInfo in project alfresco-repository by Alfresco.
the class TaggingServiceImplTest method createSite.
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);
this.siteService.createContainer(siteShortName, componentId, ContentModel.TYPE_FOLDER, null);
return siteInfo;
}
use of org.alfresco.service.cmr.site.SiteInfo in project alfresco-repository by Alfresco.
the class TaggingServiceImplTest method testTagScopeIfUrlNull.
/**
* ALF-21875
*/
@Test
public void testTagScopeIfUrlNull() {
TagScopePropertyMethodInterceptor.setEnabled(Boolean.TRUE);
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
String siteName = GUID.generate();
this.transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>() {
@SuppressWarnings("unchecked")
@Override
public Void execute() throws Throwable {
// STEP1 CreateSite
SiteInfo siteInfo = createSite(siteName, "doclib", SiteVisibility.PUBLIC);
// STEP2 upload a document in documentLibrary
NodeRef documentLibraryOfSite = siteService.getContainer(siteInfo.getShortName(), "doclib");
NodeRef containerTagScope = fileFolderService.create(documentLibraryOfSite, "containerTagScope" + GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef();
// STEP4 create tag
String tagName = GUID.generate();
taggingService.createTag(storeRef, tagName);
// Add some tag scopes
taggingService.addTagScope(containerTagScope);
NodeRef file = fileFolderService.create(containerTagScope, "_test_" + GUID.generate() + ".text", ContentModel.TYPE_CONTENT).getNodeRef();
taggingService.addTag(file, tagName);
fileFolderService.delete(file);
return null;
}
});
this.transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>() {
@SuppressWarnings("unchecked")
@Override
public Void execute() throws Throwable {
// STEP5 start job taggingStartupJobDetail
// Fire off the quartz bean, this time it can really work
final UpdateTagScopesActionExecuter updateTagsAction = (UpdateTagScopesActionExecuter) applicationContext.getBean("update-tagscope");
UpdateTagScopesQuartzJob job = new UpdateTagScopesQuartzJob();
job.execute(actionService, updateTagsAction);
return null;
}
});
// STEP6 execute script
// Create a model to pass to the unit test scripts
Map<String, Object> model = new HashMap<String, Object>();
model.put("customSiteName", siteName);
// Execute the unit test script
ScriptLocation location = new ClasspathScriptLocation("org/alfresco/repo/site/script/test_tagScopeALF_21875.js");
this.scriptService.executeScript(location, model);
TagScopePropertyMethodInterceptor.setEnabled(Boolean.FALSE);
}
Aggregations