Search in sources :

Example 76 with SiteInfo

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);
    }
}
Also used : SiteInfo(org.alfresco.service.cmr.site.SiteInfo) NominatedInvitation(org.alfresco.service.cmr.invitation.NominatedInvitation) ModeratedInvitation(org.alfresco.service.cmr.invitation.ModeratedInvitation) NominatedInvitation(org.alfresco.service.cmr.invitation.NominatedInvitation) Invitation(org.alfresco.service.cmr.invitation.Invitation) ResourceType(org.alfresco.service.cmr.invitation.Invitation.ResourceType)

Example 77 with SiteInfo

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;
}
Also used : SiteInfo(org.alfresco.service.cmr.site.SiteInfo) NodeRef(org.alfresco.service.cmr.repository.NodeRef)

Example 78 with 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");
    }
}
Also used : SiteInfo(org.alfresco.service.cmr.site.SiteInfo)

Example 79 with SiteInfo

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;
}
Also used : SiteInfo(org.alfresco.service.cmr.site.SiteInfo)

Example 80 with 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);
}
Also used : SiteInfo(org.alfresco.service.cmr.site.SiteInfo) ClasspathScriptLocation(org.alfresco.repo.jscript.ClasspathScriptLocation) ClasspathScriptLocation(org.alfresco.repo.jscript.ClasspathScriptLocation) BaseSpringTest(org.alfresco.util.BaseSpringTest) Test(org.junit.Test)

Aggregations

SiteInfo (org.alfresco.service.cmr.site.SiteInfo)190 NodeRef (org.alfresco.service.cmr.repository.NodeRef)83 Test (org.junit.Test)48 FilterPropString (org.alfresco.repo.node.getchildren.FilterPropString)45 ArrayList (java.util.ArrayList)32 QName (org.alfresco.service.namespace.QName)29 AlfrescoRuntimeException (org.alfresco.error.AlfrescoRuntimeException)27 BaseAlfrescoSpringTest (org.alfresco.util.BaseAlfrescoSpringTest)26 HashMap (java.util.HashMap)22 Serializable (java.io.Serializable)20 RelationshipResourceNotFoundException (org.alfresco.rest.framework.core.exceptions.RelationshipResourceNotFoundException)18 EntityNotFoundException (org.alfresco.rest.framework.core.exceptions.EntityNotFoundException)17 ChildAssociationRef (org.alfresco.service.cmr.repository.ChildAssociationRef)17 BaseUnitTest (org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest)15 InvalidArgumentException (org.alfresco.rest.framework.core.exceptions.InvalidArgumentException)15 AccessDeniedException (org.alfresco.repo.security.permissions.AccessDeniedException)14 RetryingTransactionCallback (org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback)14 WebScriptException (org.springframework.extensions.webscripts.WebScriptException)12 Date (java.util.Date)9 PagingRequest (org.alfresco.query.PagingRequest)9