Java Code Examples for org.alfresco.repo.security.authentication.AuthenticationUtil.setAdminUserAsFullyAuthenticatedUser()

The following are Jave code examples for showing how to use setAdminUserAsFullyAuthenticatedUser() of the org.alfresco.repo.security.authentication.AuthenticationUtil class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: alfresco-repository   File: FullTest.java   View Source Code Vote up 7 votes
@Test
public void canGuessMimeType()
{
    AuthenticationUtil.setAdminUserAsFullyAuthenticatedUser();
    
    ContentService contentService = (ContentService) ctx.getBean("ContentService");
    NodeService nodeService = (NodeService) ctx.getBean("NodeService");
    StoreRef storeRef = nodeService.createStore("workspace", getClass().getName()+UUID.randomUUID());
    NodeRef rootNodeRef = nodeService.getRootNode(storeRef);
    NodeRef nodeRef = nodeService.createNode(
                rootNodeRef,
                ContentModel.ASSOC_CHILDREN,
                QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, getClass().getSimpleName()),
                ContentModel.TYPE_CONTENT).getChildRef();

    ContentWriter writer = contentService.getWriter(nodeRef, ContentModel.PROP_CONTENT, true);
    // Pre-condition of test is that we're testing with a potentially problematic BackingStoreAwareCacheWriter
    // rather than a FileContentWriter, which we would expect to work.
    assertTrue(writer instanceof BackingStoreAwareCacheWriter);
    
    String content = "This is some content";
    writer.putContent(content);
    writer.guessMimetype("myfile.txt");
    
    assertEquals("text/plain", writer.getMimetype());
}
 
Example 2
Project: alfresco-repository   File: CustomModelRepoRestartTest.java   View Source Code Vote up 6 votes
private void getCtxAndSetBeans()
{
    ApplicationContext ctx = ApplicationContextHelper.getApplicationContext();
    this.customModelService = ctx.getBean("customModelService", CustomModelService.class);
    this.transactionHelper = ctx.getBean("retryingTransactionHelper", RetryingTransactionHelper.class);
    AuthenticationUtil.setAdminUserAsFullyAuthenticatedUser();
}
 
Example 3
Project: alfresco-remote-api   File: NodeApiTest.java   View Source Code Vote up 6 votes
/**
 * Creates authority context
 *
 * @param user
 * @return
 */
private void createAuthorityContext(String user)
{
    String groupName = "Group_ROOT" + GUID.generate();

    AuthenticationUtil.setRunAsUser(user);
    if (rootGroupName == null)
    {
        rootGroupName = authorityService.getName(AuthorityType.GROUP, groupName);
    }

    if (!authorityService.authorityExists(rootGroupName))
    {
        AuthenticationUtil.setAdminUserAsFullyAuthenticatedUser();
        rootGroupName = authorityService.createAuthority(AuthorityType.GROUP, groupName);
        groupA = authorityService.createAuthority(AuthorityType.GROUP, "Test_GroupA");
        authorityService.addAuthority(rootGroupName, groupA);
        groupB = authorityService.createAuthority(AuthorityType.GROUP, "Test_GroupB");
        authorityService.addAuthority(rootGroupName, groupB);
        authorityService.addAuthority(groupA, user1);
        authorityService.addAuthority(groupB, user2);
    }
}
 
Example 4
Project: alfresco-repository   File: FileFolderLoaderTest.java   View Source Code Vote up 6 votes
@Test
public void testFolderMissing() throws Exception
{
    try
    {
        AuthenticationUtil.pushAuthentication();
        AuthenticationUtil.setAdminUserAsFullyAuthenticatedUser();
        fileFolderLoader.createFiles(
                sharedHomePath + "/Missing",
                0, 256, 1024L, 1024L, Long.MAX_VALUE, false,
                10, 256L);
        fail("Folder does not exist");
    }
    catch (AlfrescoRuntimeException e)
    {
        // Expected
        assertTrue(e.getCause() instanceof FileNotFoundException);
    }
    finally
    {
        AuthenticationUtil.popAuthentication();
    }
}
 
Example 5
Project: alfresco-repository   File: FileFolderLoaderTest.java   View Source Code Vote up 6 votes
/**
 * Zero files
 */
@Test
public void testLoad_ZeroFiles() throws Exception
{
    try
    {
        AuthenticationUtil.pushAuthentication();
        AuthenticationUtil.setAdminUserAsFullyAuthenticatedUser();
        int created = fileFolderLoader.createFiles(
                writeFolderPath,
                0, 256, 1024L, 1024L, Long.MAX_VALUE, false,
                10, 256L);
        assertEquals("Incorrect number of files generated.", 0, created);
        // Count
        assertEquals(0, nodeService.countChildAssocs(writeFolderNodeRef, true));
    }
    finally
    {
        AuthenticationUtil.popAuthentication();
    }
}
 
Example 6
Project: alfresco-repository   File: FileFolderLoaderTest.java   View Source Code Vote up 6 votes
/**
 * 100 files; 10 per txn
 */
@Test
public void testLoad_02() throws Exception
{
    try
    {
        AuthenticationUtil.pushAuthentication();
        AuthenticationUtil.setAdminUserAsFullyAuthenticatedUser();
        int created = fileFolderLoader.createFiles(
                writeFolderPath,
                100, 10, 1024L, 1024L, Long.MAX_VALUE, false,
                10, 256L);
        assertEquals("Incorrect number of files generated.", 100, created);
        // Count
        assertEquals(100, nodeService.countChildAssocs(writeFolderNodeRef, true));
    }
    finally
    {
        AuthenticationUtil.popAuthentication();
    }
}
 
Example 7
Project: alfresco-remote-api   File: DictionaryRestApiTest.java   View Source Code Vote up 5 votes
@Override
protected void setUp() throws Exception 
{ 
	super.setUp();
	getServer();
	AuthenticationUtil.setAdminUserAsFullyAuthenticatedUser();
}
 
Example 8
Project: alfresco-test-assertions   File: NodeAssertTest.java   View Source Code Vote up 5 votes
@Before
public void setUp() {
    AuthenticationUtil.setAdminUserAsFullyAuthenticatedUser();
    final String nodeName = "NodeAssertTest-" + UUID.randomUUID();
    final PropertyMap propertyMap = new PropertyMap();
    propertyMap.put(ContentModel.PROP_NAME, nodeName);
    nodeRef = nodeService.createNode(repository.getCompanyHome(), ContentModel.ASSOC_CONTAINS, QName.createQName(ContentModel.USER_MODEL_URI, nodeName),
            ContentModel.TYPE_CONTENT, propertyMap).getChildRef();
}
 
Example 9
Project: alfresco-remote-api   File: CommentsApiTest.java   View Source Code Vote up 5 votes
@Override
protected void tearDown() throws Exception
{
    super.tearDown();
    
    // admin user required to delete user
    authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
    
    // delete the discussions users
    if(personService.personExists(USER_TEST))
    {
        // delete invite site
       personService.deletePerson(USER_TEST);

    // delete the users
    }
    if (authenticationService.authenticationExists(USER_TEST))
    {
       authenticationService.deleteAuthentication(USER_TEST);
    }
    
    AuthenticationUtil.setAdminUserAsFullyAuthenticatedUser();
    
    SiteInfo siteInfo = this.siteService.getSite(SITE_SHORT_NAME);
    if (siteInfo != null)
    {
        // delete invite site
        siteService.deleteSite(SITE_SHORT_NAME);
        nodeArchiveService.purgeArchivedNode(nodeArchiveService.getArchivedNode(siteInfo.getNodeRef()));
    }

    // delete the users
    deleteUser(USER_ONE);
    deleteUser(USER_TWO);
    deleteUser(USER_THREE);
    deleteUser(USER_FOUR);
}
 
Example 10
Project: alfresco-remote-api   File: ContentGetTest.java   View Source Code Vote up 5 votes
@Override
protected void setUp() throws Exception
{
    super.setUp();

    this.authenticationService = (MutableAuthenticationService) getServer().getApplicationContext()
            .getBean("AuthenticationService");
    this.personService = (PersonService) getServer().getApplicationContext().getBean("PersonService");
    this.nodeService = (NodeService) getServer().getApplicationContext().getBean("NodeService");
    this.contentService = (ContentService) getServer().getApplicationContext().getBean("ContentService");
    AuthenticationUtil.setAdminUserAsFullyAuthenticatedUser();
    createUser(USER_ONE);
}
 
Example 11
Project: alfresco-remote-api   File: ContentGetTest.java   View Source Code Vote up 5 votes
@Override
protected void tearDown() throws Exception
{
    super.tearDown();

    nodeService.deleteNode(rootFolder);
    AuthenticationUtil.setAdminUserAsFullyAuthenticatedUser();
    // Clear the user
    deleteUser(USER_ONE);
}
 
Example 12
Project: alfresco-repository   File: ArchiveAndRestoreTest.java   View Source Code Vote up 5 votes
/**
 * <a href="https://issues.alfresco.com/jira/browse/MNT-2777">MNT-2777</a>
 */
public void testALF17554ArchiveAndRestoreCheckPermission() throws Exception
{
    permissionService.setInheritParentPermissions(a, false);
    // Set the permission for the node for user USER_C
    AuthenticationUtil.setFullyAuthenticatedUser(USER_C);
    assertTrue(
            "The user should not have the permission set on the node yet.",
            permissionService.hasPermission(a, PermissionService.COORDINATOR) == AccessStatus.DENIED);
    AuthenticationUtil.setAdminUserAsFullyAuthenticatedUser();
    permissionService.setPermission(a, USER_C, PermissionService.COORDINATOR, true);
    assertTrue(
            "The user should have the permission set on the node.",
            permissionService.hasPermission(a, PermissionService.COORDINATOR) == AccessStatus.ALLOWED);
    commitAndBeginNewTransaction();
    nodeService.deleteNode(a);
    verifyNodeExistence(a, false);
    nodeService.restoreNode(a_, null, null, null);
    // Check the permission
    AuthenticationUtil.setFullyAuthenticatedUser(USER_C);
    assertTrue(
            "The user should have the same permission after restoring the node.",
            permissionService.hasPermission(a, PermissionService.COORDINATOR) == AccessStatus.ALLOWED);
    assertFalse(
            "The node should have InheritParentPermissions set to false.",
            permissionService.getInheritParentPermissions(a));
}
 
Example 13
Project: alfresco-remote-api   File: RemoteFileFolderLoaderTest.java   View Source Code Vote up 5 votes
@Override
protected void setUp() throws Exception
{
    super.setUp();
    
    this.repositoryHelper = (Repository)getServer().getApplicationContext().getBean("repositoryHelper");
    this.nodeService = (NodeService)getServer().getApplicationContext().getBean("nodeService");
    this.transactionService = (TransactionService) getServer().getApplicationContext().getBean("TransactionService");
    this.fileFolderService = (FileFolderService) getServer().getApplicationContext().getBean("FileFolderService");

    // Get the path of the shared folder home
    final NodeRef companyHomeNodeRef = repositoryHelper.getCompanyHome();
    final NodeRef sharedHomeNodeRef = repositoryHelper.getSharedHome();
    RetryingTransactionCallback<NodeRef> createFolderWork = new RetryingTransactionCallback<NodeRef>()
    {
        @Override
        public NodeRef execute() throws Throwable
        {
            List<FileInfo> sharedHomeFileInfos = fileFolderService.getNamePath(companyHomeNodeRef, sharedHomeNodeRef);
            sharedHomePath = "/" + sharedHomeFileInfos.get(0).getName();

            String folderName = UUID.randomUUID().toString();
            // Create a folder
            FileInfo folderInfo = fileFolderService.create(sharedHomeNodeRef, folderName, ContentModel.TYPE_FOLDER);
            loadHomePath = sharedHomePath + "/" + folderName;
            // Done
            return folderInfo.getNodeRef();
        }
    };
    AuthenticationUtil.pushAuthentication();            // Will be cleared later
    AuthenticationUtil.setAdminUserAsFullyAuthenticatedUser();

    loadHomeNodeRef = transactionService.getRetryingTransactionHelper().doInTransaction(createFolderWork);
}
 
Example 14
Project: alfresco-repository   File: ArchiveAndRestoreTest.java   View Source Code Vote up 5 votes
public void testMNT8916RestoreWithoutPermissionsSet() throws Exception
{
    permissionService.setInheritParentPermissions(a, false);
    AuthenticationUtil.setAdminUserAsFullyAuthenticatedUser();
    commitAndBeginNewTransaction();
    nodeService.deleteNode(a);
    verifyNodeExistence(a, false);
    nodeService.restoreNode(a_, null, null, null);
    // Check the permission
    AuthenticationUtil.setAdminUserAsFullyAuthenticatedUser();
    assertTrue("Restored node shouldn't have any permissions set", permissionService.getAllSetPermissions(a).isEmpty());
    assertFalse("Restored node shouldn't inherit parent permissions", permissionService.getInheritParentPermissions(a));
}
 
Example 15
Project: alfresco-repository   File: ArchiveAndRestoreTest.java   View Source Code Vote up 5 votes
/**
 * Use a custom node ref because it isn't auditable.  Tests restoring it correctly
 * @throws Exception
 */
public synchronized void testMNT15211ArchiveAndRestoreNotAuditable() throws Exception
{
    Map<QName, Serializable> properties = new HashMap<QName, Serializable>(1);

    properties.put(ContentModel.PROP_NODE_UUID, "r");
    NodeRef r = nodeService.createNode(
            workStoreRootNodeRef,
            ContentModel.ASSOC_CHILDREN,
            QNAME_A,
            TYPE_QNAME_TEST_CONTENT,
            properties).getChildRef();
    NodeRef r_ = new NodeRef(archiveStoreRef, r.getId());

    AuthenticationUtil.setAdminUserAsFullyAuthenticatedUser();
    verifyAspectExistence(r, ContentModel.ASPECT_AUDITABLE, false);

    nodeService.deleteNode(r);
    verifyNodeExistence(r, false);
    verifyNodeExistence(r_, true);

    commitAndBeginNewTransaction();

    RestoreNodeReport report = nodeArchiveService.restoreArchivedNode(r_);
    assertEquals("Restore failed", RestoreStatus.SUCCESS, report.getStatus());

    commitAndBeginNewTransaction();

    //It is restored, still with no AUDITABLE ASPECT
    verifyNodeExistence(r, true);
    verifyAspectExistence(r, ContentModel.ASPECT_AUDITABLE, false);

    nodeService.deleteNode(r);
}
 
Example 16
Project: alfresco-remote-api   File: SiteServiceTest.java   View Source Code Vote up 5 votes
public void testCheckPermissionsAfterCopy()
        throws Exception
{
    AuthenticationUtil.pushAuthentication();
    AuthenticationUtil.setAdminUserAsFullyAuthenticatedUser();
    String groupName = AuthorityType.GROUP.getPrefixString() + "_" + GUID.generate().substring(0, 5).trim();
    String createdAuth = authorityService.createAuthority(AuthorityType.GROUP, groupName);
    NodeRef fileNode = null, 
            siteDocLib = null, 
            copiedNode = null, 
            movedNode = null;
    try
    {
        fileNode = createRepoFile();
        siteDocLib = createTestSite();
        addPermissionsToFile(fileNode, createdAuth, SiteModel.SITE_CONTRIBUTOR, true);
        checkPermissions(fileNode, createdAuth, SiteModel.SITE_CONTRIBUTOR, "before copy");
        
        copiedNode = copyToSite(fileNode, siteDocLib);
        checkPermissions(copiedNode, createdAuth, SiteModel.SITE_CONTRIBUTOR, "after copy");
        
        nodeService.deleteNode(copiedNode);
        copiedNode = null;
        checkPermissions(fileNode, createdAuth, SiteModel.SITE_CONTRIBUTOR, "before move");
        movedNode = moveToSite(fileNode, siteDocLib);
        checkPermissions(movedNode, createdAuth, SiteModel.SITE_CONTRIBUTOR, "after move");
    }
    finally
    {
        if (fileNode != null)
        {
            nodeService.deleteNode(fileNode);
        }
        if (siteDocLib != null)
        {
            nodeService.deleteNode(siteDocLib);
        }
        AuthenticationUtil.popAuthentication();
    }
}
 
Example 17
Project: alfresco-remote-api   File: GroupsTest.java   View Source Code Vote up 4 votes
/**
 * Creates authority context.
 *
 * @param userName
 *            The user to run as.
 */
private void createAuthorityContext(String userName) throws PublicApiException
{
    String groupName = "Group_ROOT" + GUID.generate();

    AuthenticationUtil.setRunAsUser(userName);
    if (rootGroupName == null)
    {
        rootGroupName = authorityService.getName(AuthorityType.GROUP, groupName);
    }

    if (!authorityService.authorityExists(rootGroupName))
    {
        AuthenticationUtil.setAdminUserAsFullyAuthenticatedUser();

        rootGroupName = authorityService.createAuthority(AuthorityType.GROUP, groupName);
        authorityService.addAuthorityToZones(rootGroupName, zoneSet("APITEST.MYZONE"));
        authorityService.setAuthorityDisplayName(rootGroupName, "Root Group");

        String groupBAuthorityName = authorityService.createAuthority(AuthorityType.GROUP, "Test_GroupB" + GUID.generate());
        authorityService.setAuthorityDisplayName(groupBAuthorityName, "B Group");
        authorityService.addAuthority(rootGroupName, groupBAuthorityName);
        authorityService.addAuthorityToZones(groupBAuthorityName, zoneSet("APITEST.MYZONE"));
        when(groupBResultSetRow.getNodeRef()).thenReturn(authorityService.getAuthorityNodeRef(groupBAuthorityName));

        String groupAAuthorityName = authorityService.createAuthority(AuthorityType.GROUP, "Test_GroupA" + GUID.generate());
        authorityService.setAuthorityDisplayName(groupAAuthorityName, "A Group");
        authorityService.addAuthority(rootGroupName, groupAAuthorityName);
        authorityService.addAuthorityToZones(groupAAuthorityName, zoneSet("APITEST.MYZONE", "APITEST.ANOTHER"));
        when(groupAResultSetRow.getNodeRef()).thenReturn(authorityService.getAuthorityNodeRef(groupAAuthorityName));

        authorityService.addAuthority(groupAAuthorityName, user1);
        authorityService.addAuthority(groupBAuthorityName, user2);

        rootGroup = new Group();
        rootGroup.setId(rootGroupName);
        rootGroup.setDisplayName("Root Group");

        groupA = new Group();
        groupA.setId(groupAAuthorityName);
        groupA.setDisplayName("A Group");

        groupB = new Group();
        groupB.setId(groupBAuthorityName);
        groupB.setDisplayName("B Group");

        groupMemberA = new GroupMember();
        groupMemberA.setId(groupAAuthorityName);
        groupMemberA.setMemberType(AuthorityType.GROUP.toString());

        groupMemberB = new GroupMember();
        groupMemberB.setId(groupBAuthorityName);
        groupMemberB.setMemberType(AuthorityType.GROUP.toString());
    }

    {
        publicApiClient.setRequestContext(new RequestContext(networkOne.getId(), networkAdmin, "admin"));
        Person personAlice = new Person();
        String aliceId = "alice-" + UUID.randomUUID() + "@" + networkOne.getId();
        personAlice.setUserName(aliceId);
        personAlice.setId(aliceId);
        personAlice.setFirstName("Alice");
        personAlice.setEmail("[email protected]");
        personAlice.setPassword("password");
        personAlice.setEnabled(true);
        PublicApiClient.People people = publicApiClient.people();
        people.create(personAlice);
        personMember = new GroupMember();
        personMember.setId(personAlice.getId());
        personMember.setMemberType(MEMBER_TYPE_PERSON);
    }
}
 
Example 18
Project: alfresco-repository   File: AuditComponentTest.java   View Source Code Vote up 4 votes
/**
 * Test for MNT-10070 and MNT-14136
 */
public void testApplication() throws Exception
{
    // Register the test model
    URL testModelUrl = ResourceUtils.getURL("classpath:alfresco/testaudit/alfresco-audit-test-mnt-10070.xml");
    auditModelRegistry.registerModel(testModelUrl);
    auditModelRegistry.loadAuditModels();
    
    auditModelRegistry.setProperty("audit.enabled", "true");

    auditModelRegistry.setProperty("audit.app1.enabled", "true");
    auditModelRegistry.setProperty("audit.filter.app1.default.enabled", "true");
    auditModelRegistry.setProperty("audit.filter.app1.login.user", "~System;~null;.*");

    auditModelRegistry.setProperty("audit.app2.enabled", "true");
    auditModelRegistry.setProperty("audit.filter.app2.default.enabled", "true");
    auditModelRegistry.setProperty("audit.filter.app2.login.user", "~System;~null;~admin;.*");

    auditModelRegistry.setProperty("audit.app3.enabled", "true");
    auditModelRegistry.setProperty("audit.filter.app3.default.enabled", "true");
    auditModelRegistry.setProperty("audit.filter.app3.login.user", "~System;~null;.*");
    
    auditModelRegistry.afterPropertiesSet();  
    
    AuthenticationUtil.setRunAsUserSystem();
    AuditApplication applicationOne = auditModelRegistry.getAuditApplicationByName(APPLICATION_ONE);
    assertNotNull("Application 'app1' dosn't exist", applicationOne);
    AuditApplication applicationTwo = auditModelRegistry.getAuditApplicationByName(APPLICATION_TWO);
    assertNotNull("Application 'app2' dosn't exist", applicationTwo);
    AuditApplication applicationThree = auditModelRegistry.getAuditApplicationByName(APPLICATION_THREE);
    assertNotNull("Application 'app3' dosn't exist", applicationThree);

    // auditComponent
    AuthenticationUtil.setAdminUserAsFullyAuthenticatedUser();

    PropertyAuditFilter filter = new PropertyAuditFilter();
    Properties properties = new Properties();
    properties.put("audit.enabled", "true");

    properties.put("audit.app1.enabled", "true");
    properties.put("audit.filter.app1.default.enabled", "true");
    properties.put("audit.filter.app1.default.user", "~System;~null;.*");

    properties.put("audit.app2.enabled", "true");
    properties.put("audit.filter.app2.default.enabled", "true");
    properties.put("audit.filter.app2.default.user", "~System;~null;~admin;.*");

    properties.put("audit.app3.enabled", "true");
    properties.put("audit.filter.app3.default.enabled", "true");
    properties.put("audit.filter.app3.default.user", "~System;~null;.*");

    filter.setProperties(properties);
    auditComponent.setAuditFilter(filter);

    Map<String, Serializable> auditMap = new HashMap<String, Serializable>();
    auditMap.put("/transaction/user", AuthenticationUtil.getFullyAuthenticatedUser());
    auditMap.put("/transaction/action", "CREATE");
    auditMap.put("/transaction/type", "cm:content");

    Map<String, Serializable> recordedAuditMap = auditComponent.recordAuditValues("/alfresco-access", auditMap);

    assertFalse("Audit values is empty.", recordedAuditMap.isEmpty());

    Map<String, Serializable> expected = new HashMap<String, Serializable>();
    // There should not be app2
    expected.put("/" + APPLICATION_ONE + "/transaction/action", "CREATE");
    expected.put("/" + APPLICATION_THREE + "/transaction/type", "cm:content");

    String failure = EqualsHelper.getMapDifferenceReport(recordedAuditMap, expected);
    if (failure != null)
    {
        fail(failure);
    }
}
 
Example 19
Project: alfresco-remote-api   File: DeleteMethodTest.java   View Source Code Vote up 4 votes
@After
public void tearDown() throws Exception
{
    method = null;
    request = null;
    response = null;

    if (txn.getStatus() == Status.STATUS_MARKED_ROLLBACK)
    {
        txn.rollback();
    }
    else
    {
        txn.commit();
    }
    
    AuthenticationUtil.setAdminUserAsFullyAuthenticatedUser();
 
    nodeService.deleteNode(versionableDoc);

    // As per MNT-10037 try to create a node and delete it in the next txn
    txn = transactionService.getUserTransaction();
    txn.begin();

    Map<QName, Serializable> properties = new HashMap<QName, Serializable>();
    String nodeName = "leak-session-doc-" + GUID.generate();
    properties.put(ContentModel.PROP_NAME, nodeName);

    NodeRef nodeRef = nodeService.createNode(companyHomeNodeRef, ContentModel.ASSOC_CONTAINS, QName.createQName(ContentModel.USER_MODEL_URI, nodeName),
            ContentModel.TYPE_CONTENT, properties).getChildRef();
    contentService.getWriter(nodeRef, ContentModel.PROP_CONTENT, true).putContent("WebDAVTestContent");

    txn.commit();

    txn = transactionService.getUserTransaction();
    txn.begin();

    nodeService.deleteNode(nodeRef);

    txn.commit();

    AuthenticationUtil.clearCurrentSecurityContext();
}
 
Example 20
Project: alfresco-repository   File: SolrFacetQueriesDisplayHandlersTest.java   View Source Code Vote up 2 votes
/**
 * Perform pre-test initialization.
 *
 * @throws Exception
 *         if the initialization fails for some reason
 *
 */
@Before
public void setUp() throws Exception
{
    AuthenticationUtil.setAdminUserAsFullyAuthenticatedUser();
}