Search in sources :

Example 1 with SessionFactory

use of org.springframework.extensions.jcr.SessionFactory in project pentaho-kettle by pentaho.

the class PurRepositoryIT method setApplicationContext.

@Override
public void setApplicationContext(final ApplicationContext applicationContext) throws BeansException {
    SessionFactory jcrSessionFactory = (SessionFactory) applicationContext.getBean("jcrSessionFactory");
    testJcrTemplate = new JcrTemplate(jcrSessionFactory);
    testJcrTemplate.setAllowCreate(true);
    testJcrTemplate.setExposeNativeSession(true);
    repositoryAdminUsername = (String) applicationContext.getBean("repositoryAdminUsername");
    superAdminRoleName = (String) applicationContext.getBean("superAdminAuthorityName");
    sysAdminUserName = (String) applicationContext.getBean("superAdminUserName");
    tenantAuthenticatedRoleName = (String) applicationContext.getBean("singleTenantAuthenticatedAuthorityName");
    singleTenantAdminRoleName = (String) applicationContext.getBean("singleTenantAdminAuthorityName");
    tenantManager = (ITenantManager) applicationContext.getBean("tenantMgrProxy");
    roleBindingDaoTarget = (IRoleAuthorizationPolicyRoleBindingDao) applicationContext.getBean("roleAuthorizationPolicyRoleBindingDaoTarget");
    authorizationPolicy = (IAuthorizationPolicy) applicationContext.getBean("authorizationPolicy");
    repo = (IUnifiedRepository) applicationContext.getBean("unifiedRepository");
    userRoleDao = (IUserRoleDao) applicationContext.getBean("userRoleDao");
    repositoryFileDao = (IRepositoryFileDao) applicationContext.getBean("repositoryFileDao");
    testUserRoleDao = userRoleDao;
    repositoryLifecyleManager = (IBackingRepositoryLifecycleManager) applicationContext.getBean("defaultBackingRepositoryLifecycleManager");
    txnTemplate = (TransactionTemplate) applicationContext.getBean("jcrTransactionTemplate");
    TestPrincipalProvider.userRoleDao = testUserRoleDao;
    TestPrincipalProvider.adminCredentialsStrategy = (CredentialsStrategy) applicationContext.getBean("jcrAdminCredentialsStrategy");
    TestPrincipalProvider.repository = (Repository) applicationContext.getBean("jcrRepository");
}
Also used : SessionFactory(org.springframework.extensions.jcr.SessionFactory) JcrTemplate(org.springframework.extensions.jcr.JcrTemplate)

Example 2 with SessionFactory

use of org.springframework.extensions.jcr.SessionFactory in project pentaho-kettle by pentaho.

the class PurRepositoryTestBase method setApplicationContext.

@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
    unifiedRepository = applicationContext.getBean("unifiedRepository", IUnifiedRepository.class);
    tenantManager = applicationContext.getBean("tenantMgrProxy", ITenantManager.class);
    userRoleDao = applicationContext.getBean("userRoleDao", IUserRoleDao.class);
    authorizationPolicy = applicationContext.getBean("authorizationPolicy", IAuthorizationPolicy.class);
    roleBindingDaoTarget = (IRoleAuthorizationPolicyRoleBindingDao) applicationContext.getBean("roleAuthorizationPolicyRoleBindingDaoTarget");
    SessionFactory jcrSessionFactory = (SessionFactory) applicationContext.getBean("jcrSessionFactory");
    testJcrTemplate = new JcrTemplate(jcrSessionFactory);
    testJcrTemplate.setAllowCreate(true);
    testJcrTemplate.setExposeNativeSession(true);
    txnTemplate = applicationContext.getBean("jcrTransactionTemplate", TransactionTemplate.class);
    repositoryFileDao = (IRepositoryFileDao) applicationContext.getBean("repositoryFileDao");
    superAdminRole = applicationContext.getBean("superAdminAuthorityName", String.class);
    repositoryAdmin = applicationContext.getBean("repositoryAdminUsername", String.class);
    systemAdmin = (String) applicationContext.getBean("superAdminUserName");
    tenantAdminRole = applicationContext.getBean("singleTenantAdminAuthorityName", String.class);
    tenantAuthenticatedRole = applicationContext.getBean("singleTenantAuthenticatedAuthorityName", String.class);
    TestPrincipalProvider.userRoleDao = userRoleDao;
    TestPrincipalProvider.adminCredentialsStrategy = (CredentialsStrategy) applicationContext.getBean("jcrAdminCredentialsStrategy");
    TestPrincipalProvider.repository = (Repository) applicationContext.getBean("jcrRepository");
    doSetApplicationContext(applicationContext);
}
Also used : SessionFactory(org.springframework.extensions.jcr.SessionFactory) IAuthorizationPolicy(org.pentaho.platform.api.engine.IAuthorizationPolicy) JcrTemplate(org.springframework.extensions.jcr.JcrTemplate) ITenantManager(org.pentaho.platform.api.mt.ITenantManager) TransactionTemplate(org.springframework.transaction.support.TransactionTemplate) Matchers.anyString(org.mockito.Matchers.anyString) IUserRoleDao(org.pentaho.platform.api.engine.security.userroledao.IUserRoleDao) IUnifiedRepository(org.pentaho.platform.api.repository2.unified.IUnifiedRepository)

Example 3 with SessionFactory

use of org.springframework.extensions.jcr.SessionFactory in project pentaho-platform by pentaho.

the class DirectoryResourceIT method setApplicationContext.

public void setApplicationContext(final ApplicationContext applicationContext) throws BeansException {
    manager = (IBackingRepositoryLifecycleManager) applicationContext.getBean("backingRepositoryLifecycleManager");
    SessionFactory jcrSessionFactory = (SessionFactory) applicationContext.getBean("jcrSessionFactory");
    testJcrTemplate = new JcrTemplate(jcrSessionFactory);
    testJcrTemplate.setAllowCreate(true);
    testJcrTemplate.setExposeNativeSession(true);
    repositoryAdminUsername = (String) applicationContext.getBean("repositoryAdminUsername");
    authenticatedAuthorityName = (String) applicationContext.getBean("singleTenantAuthenticatedAuthorityName");
    adminAuthorityName = (String) applicationContext.getBean("singleTenantAdminAuthorityName");
    sysAdminAuthorityName = (String) applicationContext.getBean("superAdminAuthorityName");
    sysAdminUserName = (String) applicationContext.getBean("superAdminUserName");
    authorizationPolicy = (IAuthorizationPolicy) applicationContext.getBean("authorizationPolicy");
    roleBindingDaoTarget = (IRoleAuthorizationPolicyRoleBindingDao) applicationContext.getBean("roleAuthorizationPolicyRoleBindingDaoTarget");
    tenantManager = (ITenantManager) applicationContext.getBean("tenantMgrTxn");
    repositoryFileDao = (IRepositoryFileDao) applicationContext.getBean("repositoryFileDao");
    userRoleDao = (IUserRoleDao) applicationContext.getBean("userRoleDaoTxn");
    tenantedUserNameUtils = (ITenantedPrincipleNameResolver) applicationContext.getBean("tenantedUserNameUtils");
    tenantedRoleNameUtils = (ITenantedPrincipleNameResolver) applicationContext.getBean("tenantedRoleNameUtils");
    repo = (IUnifiedRepository) applicationContext.getBean("unifiedRepository");
    TestPrincipalProvider.userRoleDao = (IUserRoleDao) applicationContext.getBean("userRoleDaoTxn");
    TestPrincipalProvider.adminCredentialsStrategy = (CredentialsStrategy) applicationContext.getBean("jcrAdminCredentialsStrategy");
    TestPrincipalProvider.repository = (Repository) applicationContext.getBean("jcrRepository");
}
Also used : SessionFactory(org.springframework.extensions.jcr.SessionFactory) JcrTemplate(org.springframework.extensions.jcr.JcrTemplate)

Example 4 with SessionFactory

use of org.springframework.extensions.jcr.SessionFactory in project pentaho-platform by pentaho.

the class FileResourceIT method setApplicationContext.

public void setApplicationContext(final ApplicationContext applicationContext) throws BeansException {
    manager = (IBackingRepositoryLifecycleManager) applicationContext.getBean("backingRepositoryLifecycleManager");
    SessionFactory jcrSessionFactory = (SessionFactory) applicationContext.getBean("jcrSessionFactory");
    testJcrTemplate = new JcrTemplate(jcrSessionFactory);
    testJcrTemplate.setAllowCreate(true);
    testJcrTemplate.setExposeNativeSession(true);
    repositoryAdminUsername = (String) applicationContext.getBean("repositoryAdminUsername");
    authenticatedAuthorityName = (String) applicationContext.getBean("singleTenantAuthenticatedAuthorityName");
    adminAuthorityName = (String) applicationContext.getBean("singleTenantAdminAuthorityName");
    sysAdminAuthorityName = (String) applicationContext.getBean("superAdminAuthorityName");
    sysAdminUserName = (String) applicationContext.getBean("superAdminUserName");
    authorizationPolicy = (IAuthorizationPolicy) applicationContext.getBean("authorizationPolicy");
    roleBindingDaoTarget = (IRoleAuthorizationPolicyRoleBindingDao) applicationContext.getBean("roleAuthorizationPolicyRoleBindingDaoTarget");
    tenantManager = (ITenantManager) applicationContext.getBean("tenantMgrTxn");
    repositoryFileDao = (IRepositoryFileDao) applicationContext.getBean("repositoryFileDao");
    userRoleDao = (IUserRoleDao) applicationContext.getBean("userRoleDaoTxn");
    tenantedUserNameUtils = (ITenantedPrincipleNameResolver) applicationContext.getBean("tenantedUserNameUtils");
    tenantedRoleNameUtils = (ITenantedPrincipleNameResolver) applicationContext.getBean("tenantedRoleNameUtils");
    repo = (IUnifiedRepository) applicationContext.getBean("unifiedRepository");
    TestPrincipalProvider.userRoleDao = (IUserRoleDao) applicationContext.getBean("userRoleDaoTxn");
    TestPrincipalProvider.adminCredentialsStrategy = (CredentialsStrategy) applicationContext.getBean("jcrAdminCredentialsStrategy");
    TestPrincipalProvider.repository = (Repository) applicationContext.getBean("jcrRepository");
}
Also used : SessionFactory(org.springframework.extensions.jcr.SessionFactory) JcrTemplate(org.springframework.extensions.jcr.JcrTemplate)

Example 5 with SessionFactory

use of org.springframework.extensions.jcr.SessionFactory in project pentaho-platform by pentaho.

the class MetadataRepositoryLifecycleManagerIT method setApplicationContext.

@Override
public void setApplicationContext(final ApplicationContext applicationContext) throws BeansException {
    manager = (IBackingRepositoryLifecycleManager) applicationContext.getBean("backingRepositoryLifecycleManager");
    SessionFactory jcrSessionFactory = (SessionFactory) applicationContext.getBean("jcrSessionFactory");
    testJcrTemplate = new JcrTemplate(jcrSessionFactory);
    testJcrTemplate.setAllowCreate(true);
    testJcrTemplate.setExposeNativeSession(true);
    repositoryAdminUsername = (String) applicationContext.getBean("repositoryAdminUsername");
    tenantAuthenticatedAuthorityName = (String) applicationContext.getBean("singleTenantAuthenticatedAuthorityName");
    adminAuthorityName = (String) applicationContext.getBean("singleTenantAdminAuthorityName");
    sysAdminAuthorityName = (String) applicationContext.getBean("superAdminAuthorityName");
    sysAdminUserName = (String) applicationContext.getBean("superAdminUserName");
    superAdminRoleName = (String) applicationContext.getBean("superAdminAuthorityName");
    authorizationPolicy = (IAuthorizationPolicy) applicationContext.getBean("authorizationPolicy");
    roleBindingDaoTarget = (IRoleAuthorizationPolicyRoleBindingDao) applicationContext.getBean("roleAuthorizationPolicyRoleBindingDaoTarget");
    tenantManager = (ITenantManager) applicationContext.getBean("tenantMgrTxn");
    repositoryFileDao = (IRepositoryFileDao) applicationContext.getBean("repositoryFileDao");
    userRoleDao = (IUserRoleDao) applicationContext.getBean("userRoleDao");
    tenantedUserNameUtils = (ITenantedPrincipleNameResolver) applicationContext.getBean("tenantedUserNameUtils");
    tenantedRoleNameUtils = (ITenantedPrincipleNameResolver) applicationContext.getBean("tenantedRoleNameUtils");
    metadataRepositoryLifecycleManager = (IBackingRepositoryLifecycleManager) applicationContext.getBean("metadataRepositoryLifecycleManager");
    jcrTransactionTemplate = (TransactionTemplate) applicationContext.getBean("jcrTransactionTemplate");
    repo = (IUnifiedRepository) applicationContext.getBean("unifiedRepository");
    TestPrincipalProvider.userRoleDao = userRoleDao;
    TestPrincipalProvider.adminCredentialsStrategy = (CredentialsStrategy) applicationContext.getBean("jcrAdminCredentialsStrategy");
    TestPrincipalProvider.repository = (Repository) applicationContext.getBean("jcrRepository");
    jcrTemplate = (JcrTemplate) applicationContext.getBean("jcrTemplate");
}
Also used : SessionFactory(org.springframework.extensions.jcr.SessionFactory) JcrTemplate(org.springframework.extensions.jcr.JcrTemplate)

Aggregations

SessionFactory (org.springframework.extensions.jcr.SessionFactory)11 JcrTemplate (org.springframework.extensions.jcr.JcrTemplate)9 XAResource (javax.transaction.xa.XAResource)2 XASession (org.apache.jackrabbit.api.XASession)2 Test (org.junit.Test)2 TransactionDefinition (org.springframework.transaction.TransactionDefinition)2 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 Matchers.anyString (org.mockito.Matchers.anyString)1 IAuthorizationPolicy (org.pentaho.platform.api.engine.IAuthorizationPolicy)1 IUserRoleDao (org.pentaho.platform.api.engine.security.userroledao.IUserRoleDao)1 ITenantManager (org.pentaho.platform.api.mt.ITenantManager)1 IUnifiedRepository (org.pentaho.platform.api.repository2.unified.IUnifiedRepository)1 TransactionTemplate (org.springframework.transaction.support.TransactionTemplate)1