Search in sources :

Example 1 with DefaultLockHelper

use of org.pentaho.platform.repository2.unified.jcr.DefaultLockHelper in project pentaho-platform by pentaho.

the class DefaultUnifiedRepositoryBase method initialize.

public void initialize(boolean multiByteEncoding) throws Exception {
    loginAsRepositoryAdmin();
    SimpleJcrTestUtils.deleteItem(testJcrTemplate, ServerRepositoryPaths.getPentahoRootFolderPath());
    mp = new MicroPlatform(getSolutionPath());
    // used by DefaultPentahoJackrabbitAccessControlHelper
    mp.defineInstance("tenantedUserNameUtils", userNameUtils);
    mp.defineInstance("tenantedRoleNameUtils", roleNameUtils);
    mp.defineInstance("ILockHelper", new DefaultLockHelper(userNameUtils));
    mp.defineInstance(IAuthorizationPolicy.class, authorizationPolicy);
    mp.defineInstance(ITenantManager.class, tenantManager);
    mp.defineInstance("roleAuthorizationPolicyRoleBindingDaoTarget", roleBindingDaoTarget);
    mp.defineInstance("repositoryAdminUsername", repositoryAdminUsername);
    mp.defineInstance("RepositoryFileProxyFactory", new RepositoryFileProxyFactory(this.jcrTemplate, this.repositoryFileDao));
    mp.defineInstance("ITenantedPrincipleNameResolver", new DefaultTenantedPrincipleNameResolver());
    mp.defineInstance("useMultiByteEncoding", multiByteEncoding);
    mp.defineInstance(IUnifiedRepository.class, repo);
    mp.defineInstance(IRepositoryFileAclDao.class, repositoryFileAclDao);
    IUserRoleListService userRoleListService = mock(IUserRoleListService.class);
    when(userRoleListService.getRolesForUser(any(ITenant.class), anyString())).thenReturn(Arrays.asList(tenantAdminRoleName, AUTHENTICATED_ROLE_NAME));
    mp.defineInstance(IUserRoleListService.class, userRoleListService);
    mp.defineInstance("singleTenantAdminUserName", singleTenantAdminUserName);
    mp.defineInstance("singleTenantAdminAuthorityName", tenantAdminRoleName);
    // Start the micro-platform
    mp.start();
    loginAsRepositoryAdmin();
    setAclManagement();
    systemTenant = tenantManager.createTenant(null, ServerRepositoryPaths.getPentahoRootFolderName(), tenantAdminRoleName, tenantAuthenticatedRoleName, ANONYMOUS_ROLE_NAME);
    userRoleDao.createUser(systemTenant, sysAdminUserName, PASSWORD, "", new String[] { tenantAdminRoleName });
    logout();
}
Also used : ITenant(org.pentaho.platform.api.mt.ITenant) DefaultLockHelper(org.pentaho.platform.repository2.unified.jcr.DefaultLockHelper) MicroPlatform(org.pentaho.test.platform.engine.core.MicroPlatform) DefaultTenantedPrincipleNameResolver(org.pentaho.platform.security.userroledao.DefaultTenantedPrincipleNameResolver) IUserRoleListService(org.pentaho.platform.api.engine.IUserRoleListService) RepositoryFileProxyFactory(org.pentaho.platform.repository2.unified.jcr.RepositoryFileProxyFactory)

Aggregations

IUserRoleListService (org.pentaho.platform.api.engine.IUserRoleListService)1 ITenant (org.pentaho.platform.api.mt.ITenant)1 DefaultLockHelper (org.pentaho.platform.repository2.unified.jcr.DefaultLockHelper)1 RepositoryFileProxyFactory (org.pentaho.platform.repository2.unified.jcr.RepositoryFileProxyFactory)1 DefaultTenantedPrincipleNameResolver (org.pentaho.platform.security.userroledao.DefaultTenantedPrincipleNameResolver)1 MicroPlatform (org.pentaho.test.platform.engine.core.MicroPlatform)1