use of org.pentaho.platform.repository2.unified.DefaultRepositoryVersionManager in project pentaho-platform by pentaho.
the class DirectoryResourceIT 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);
}
use of org.pentaho.platform.repository2.unified.DefaultRepositoryVersionManager 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);
}
Aggregations