Search in sources :

Example 6 with RepositoryFileProxyFactory

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

the class MetadataRepositoryLifecycleManagerIT method beforeTest.

@Before
public void beforeTest() throws PlatformInitializationException {
    System.setProperty(SYSTEM_PROPERTY, "MODE_INHERITABLETHREADLOCAL");
    mp = new MicroPlatform();
    mp.defineInstance("tenantedUserNameUtils", tenantedUserNameUtils);
    mp.define(IPluginManager.class, DefaultPluginManager.class, Scope.GLOBAL);
    mp.defineInstance(IAuthorizationPolicy.class, authorizationPolicy);
    mp.defineInstance(ITenantManager.class, tenantManager);
    mp.define(ITenant.class, Tenant.class);
    mp.defineInstance("roleAuthorizationPolicyRoleBindingDaoTarget", roleBindingDaoTarget);
    mp.defineInstance(IRoleAuthorizationPolicyRoleBindingDao.class, roleBindingDaoTarget);
    mp.defineInstance("tenantedUserNameUtils", tenantedUserNameUtils);
    mp.defineInstance("tenantedRoleNameUtils", tenantedRoleNameUtils);
    mp.defineInstance("repositoryAdminUsername", repositoryAdminUsername);
    mp.define(IConfiguration.class, SystemConfig.class);
    mp.defineInstance("RepositoryFileProxyFactory", new RepositoryFileProxyFactory(this.jcrTemplate, this.repositoryFileDao));
    mp.defineInstance("useMultiByteEncoding", new Boolean(false));
    UserRoleDaoUserDetailsService userDetailsService = new UserRoleDaoUserDetailsService();
    userDetailsService.setUserRoleDao(userRoleDao);
    List<String> systemRoles = new ArrayList<String>();
    systemRoles.add("Administrator");
    List<String> extraRoles = Arrays.asList(new String[] { "Authenticated", "Anonymous" });
    String adminRole = "Admin";
    userRoleListService = new UserRoleDaoUserRoleListService(userRoleDao, userDetailsService, tenantedUserNameUtils, systemRoles, extraRoles, adminRole);
    ((UserRoleDaoUserRoleListService) userRoleListService).setUserRoleDao(userRoleDao);
    ((UserRoleDaoUserRoleListService) userRoleListService).setUserDetailsService(userDetailsService);
    mp.defineInstance(IUserRoleListService.class, userRoleListService);
    mp.start();
    loginAsRepositoryAdmin();
    setAclManagement();
    logout();
    startupCalled = true;
}
Also used : UserRoleDaoUserDetailsService(org.pentaho.platform.security.userroledao.service.UserRoleDaoUserDetailsService) UserRoleDaoUserRoleListService(org.pentaho.platform.security.userroledao.service.UserRoleDaoUserRoleListService) MicroPlatform(org.pentaho.test.platform.engine.core.MicroPlatform) ArrayList(java.util.ArrayList) RepositoryFileProxyFactory(org.pentaho.platform.repository2.unified.jcr.RepositoryFileProxyFactory) Before(org.junit.Before)

Example 7 with RepositoryFileProxyFactory

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

the class UserRoleDaoEncodeIT method setUp.

@Before
public void setUp() throws Exception {
    mp = new MicroPlatform();
    // used by DefaultPentahoJackrabbitAccessControlHelper
    mp.defineInstance(IAuthorizationPolicy.class, authorizationPolicy);
    mp.defineInstance(ITenantManager.class, tenantManager);
    mp.define(ITenant.class, Tenant.class);
    mp.defineInstance("tenantedUserNameUtils", tenantedUserNameUtils);
    mp.defineInstance("tenantedRoleNameUtils", tenantedRoleNameUtils);
    mp.defineInstance("roleAuthorizationPolicyRoleBindingDaoTarget", roleBindingDaoTarget);
    mp.defineInstance("repositoryAdminUsername", repositoryAdminUsername);
    mp.defineInstance("RepositoryFileProxyFactory", new RepositoryFileProxyFactory(this.jcrTemplate, this.repositoryFileDao));
    mp.defineInstance("useMultiByteEncoding", new Boolean(false));
    // Start the micro-platform
    mp.start();
    loginAsRepositoryAdmin();
    setAclManagement();
    logout();
    startupCalled = true;
}
Also used : MicroPlatform(org.pentaho.test.platform.engine.core.MicroPlatform) RepositoryFileProxyFactory(org.pentaho.platform.repository2.unified.jcr.RepositoryFileProxyFactory) Before(org.junit.Before)

Example 8 with RepositoryFileProxyFactory

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

the class UserRoleDaoIT method setUp.

@Before
public void setUp() throws Exception {
    mp = new MicroPlatform();
    // used by DefaultPentahoJackrabbitAccessControlHelper
    mp.defineInstance(IAuthorizationPolicy.class, authorizationPolicy);
    mp.defineInstance(ITenantManager.class, tenantManager);
    mp.define(ITenant.class, Tenant.class);
    mp.defineInstance("tenantedUserNameUtils", tenantedUserNameUtils);
    mp.defineInstance("tenantedRoleNameUtils", tenantedRoleNameUtils);
    mp.defineInstance("roleAuthorizationPolicyRoleBindingDaoTarget", roleBindingDaoTarget);
    mp.defineInstance("repositoryAdminUsername", repositoryAdminUsername);
    mp.defineInstance("RepositoryFileProxyFactory", new RepositoryFileProxyFactory(this.jcrTemplate, this.repositoryFileDao));
    mp.defineInstance("useMultiByteEncoding", new Boolean(false));
    // Start the micro-platform
    mp.start();
    loginAsRepositoryAdmin();
    setAclManagement();
    logout();
    startupCalled = true;
}
Also used : MicroPlatform(org.pentaho.test.platform.engine.core.MicroPlatform) RepositoryFileProxyFactory(org.pentaho.platform.repository2.unified.jcr.RepositoryFileProxyFactory) Before(org.junit.Before)

Example 9 with RepositoryFileProxyFactory

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

the class FileResourceIT method beforeTest.

@Before
public void beforeTest() throws PlatformInitializationException {
    mp = new MicroPlatform();
    // used by DefaultPentahoJackrabbitAccessControlHelper
    mp.defineInstance(IAuthorizationPolicy.class, authorizationPolicy);
    mp.defineInstance(ITenantManager.class, tenantManager);
    mp.define(ITenant.class, Tenant.class);
    mp.defineInstance("roleAuthorizationPolicyRoleBindingDaoTarget", roleBindingDaoTarget);
    mp.defineInstance(IRoleAuthorizationPolicyRoleBindingDao.class, roleBindingDaoTarget);
    mp.defineInstance("tenantedUserNameUtils", tenantedUserNameUtils);
    mp.defineInstance("tenantedRoleNameUtils", tenantedRoleNameUtils);
    mp.defineInstance("repositoryAdminUsername", repositoryAdminUsername);
    mp.define(IRoleAuthorizationPolicyRoleBindingDao.class, RoleAuthorizationPolicy.class, Scope.GLOBAL);
    mp.define(ITenantManager.class, RepositoryTenantManager.class, Scope.GLOBAL);
    mp.defineInstance("singleTenantAdminAuthorityName", new String("Administrator"));
    mp.defineInstance("RepositoryFileProxyFactory", new RepositoryFileProxyFactory(this.testJcrTemplate, this.repositoryFileDao));
    DefaultRepositoryVersionManager defaultRepositoryVersionManager = new DefaultRepositoryVersionManager();
    defaultRepositoryVersionManager.setPlatformMimeResolver(new NameBaseMimeResolver());
    mp.defineInstance(IRepositoryVersionManager.class, defaultRepositoryVersionManager);
    UserRoleDaoUserDetailsService userDetailsService = new UserRoleDaoUserDetailsService();
    userDetailsService.setUserRoleDao(userRoleDao);
    List<String> systemRoles = new ArrayList<String>();
    systemRoles.add("Admin");
    List<String> extraRoles = Arrays.asList(new String[] { "Authenticated", "Anonymous" });
    String adminRole = "Admin";
    userRoleListService = new UserRoleDaoUserRoleListService(userRoleDao, userDetailsService, tenantedUserNameUtils, systemRoles, extraRoles, adminRole);
    ((UserRoleDaoUserRoleListService) userRoleListService).setUserRoleDao(userRoleDao);
    ((UserRoleDaoUserRoleListService) userRoleListService).setUserDetailsService(userDetailsService);
    mp.defineInstance(IUserRoleListService.class, userRoleListService);
    mp.start();
    logout();
    startupCalled = true;
    SecurityContextHolder.setStrategyName(SecurityContextHolder.MODE_GLOBAL);
}
Also used : NameBaseMimeResolver(org.pentaho.platform.plugin.services.importer.NameBaseMimeResolver) UserRoleDaoUserDetailsService(org.pentaho.platform.security.userroledao.service.UserRoleDaoUserDetailsService) UserRoleDaoUserRoleListService(org.pentaho.platform.security.userroledao.service.UserRoleDaoUserRoleListService) MicroPlatform(org.pentaho.test.platform.engine.core.MicroPlatform) ArrayList(java.util.ArrayList) DefaultRepositoryVersionManager(org.pentaho.platform.repository2.unified.DefaultRepositoryVersionManager) RepositoryFileProxyFactory(org.pentaho.platform.repository2.unified.jcr.RepositoryFileProxyFactory) Before(org.junit.Before)

Aggregations

RepositoryFileProxyFactory (org.pentaho.platform.repository2.unified.jcr.RepositoryFileProxyFactory)9 MicroPlatform (org.pentaho.test.platform.engine.core.MicroPlatform)9 Before (org.junit.Before)7 ArrayList (java.util.ArrayList)3 ITenant (org.pentaho.platform.api.mt.ITenant)3 UserRoleDaoUserDetailsService (org.pentaho.platform.security.userroledao.service.UserRoleDaoUserDetailsService)3 UserRoleDaoUserRoleListService (org.pentaho.platform.security.userroledao.service.UserRoleDaoUserRoleListService)3 Serializable (java.io.Serializable)2 UserInfo (org.pentaho.di.repository.UserInfo)2 RepositoryFile (org.pentaho.platform.api.repository2.unified.RepositoryFile)2 NameBaseMimeResolver (org.pentaho.platform.plugin.services.importer.NameBaseMimeResolver)2 DefaultRepositoryVersionManager (org.pentaho.platform.repository2.unified.DefaultRepositoryVersionManager)2 TestContextManager (org.springframework.test.context.TestContextManager)2 PurRepository (org.pentaho.di.repository.pur.PurRepository)1 PurRepositoryConnector (org.pentaho.di.repository.pur.PurRepositoryConnector)1 PurRepositoryMeta (org.pentaho.di.repository.pur.PurRepositoryMeta)1 IUserRoleListService (org.pentaho.platform.api.engine.IUserRoleListService)1 IRepositoryVersionManager (org.pentaho.platform.api.repository2.unified.IRepositoryVersionManager)1 DefaultLockHelper (org.pentaho.platform.repository2.unified.jcr.DefaultLockHelper)1 DefaultTenantedPrincipleNameResolver (org.pentaho.platform.security.userroledao.DefaultTenantedPrincipleNameResolver)1