use of org.springframework.extensions.jcr.JcrTemplate 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");
}
use of org.springframework.extensions.jcr.JcrTemplate in project pentaho-kettle by pentaho.
the class UIEERepositoryDirectoryIT 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");
}
use of org.springframework.extensions.jcr.JcrTemplate in project pentaho-platform by pentaho.
the class DefaultUnifiedRepositoryBase method setApplicationContext.
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
SessionFactory jcrSessionFactory = (SessionFactory) applicationContext.getBean("jcrSessionFactory");
testJcrTemplate = new JcrTemplate(jcrSessionFactory);
testJcrTemplate.setAllowCreate(true);
testJcrTemplate.setExposeNativeSession(true);
jcrTemplate = (JcrTemplate) applicationContext.getBean("jcrTemplate");
repositoryAdminUsername = (String) applicationContext.getBean("repositoryAdminUsername");
singleTenantAdminUserName = (String) applicationContext.getBean("singleTenantAdminUserName");
superAdminRoleName = (String) applicationContext.getBean("superAdminAuthorityName");
sysAdminUserName = (String) applicationContext.getBean("superAdminUserName");
tenantAuthenticatedRoleName = (String) applicationContext.getBean("singleTenantAuthenticatedAuthorityName");
tenantAdminRoleName = (String) applicationContext.getBean("singleTenantAdminAuthorityName");
tenantManager = (ITenantManager) applicationContext.getBean("tenantMgrProxy");
pathConversionHelper = (IPathConversionHelper) applicationContext.getBean("pathConversionHelper");
roleBindingDao = (IRoleAuthorizationPolicyRoleBindingDao) applicationContext.getBean("roleAuthorizationPolicyRoleBindingDaoTxn");
roleBindingDaoTarget = (IRoleAuthorizationPolicyRoleBindingDao) applicationContext.getBean("roleAuthorizationPolicyRoleBindingDaoTarget");
authorizationPolicy = (IAuthorizationPolicy) applicationContext.getBean("authorizationPolicy");
repo = (IUnifiedRepository) applicationContext.getBean("unifiedRepository");
userRoleDao = (IUserRoleDao) applicationContext.getBean("userRoleDao");
jcrTransactionTemplate = (TransactionTemplate) applicationContext.getBean("jcrTransactionTemplate");
defaultBackingRepositoryLifecycleManager = (IBackingRepositoryLifecycleManager) applicationContext.getBean("defaultBackingRepositoryLifecycleManager");
repositoryFileDao = (IRepositoryFileDao) applicationContext.getBean("repositoryFileDao");
repositoryFileAclDao = (IRepositoryFileAclDao) applicationContext.getBean("repositoryFileAclDao");
testUserRoleDao = userRoleDao;
txnTemplate = (TransactionTemplate) applicationContext.getBean("jcrTransactionTemplate");
TestPrincipalProvider.userRoleDao = testUserRoleDao;
TestPrincipalProvider.adminCredentialsStrategy = (CredentialsStrategy) applicationContext.getBean("jcrAdminCredentialsStrategy");
TestPrincipalProvider.repository = (Repository) applicationContext.getBean("jcrRepository");
}
use of org.springframework.extensions.jcr.JcrTemplate in project pentaho-platform by pentaho.
the class JcrRepositoryFileDaoTest method setUp.
@Before
public void setUp() throws RepositoryException {
Node node = mock(Node.class);
Node nodeParent = mock(Node.class);
when(node.getIdentifier()).thenReturn("");
when(nodeParent.getIdentifier()).thenReturn("");
when(node.getParent()).thenReturn(nodeParent);
when(node.isNodeType("null:pentahoFile")).thenReturn(true);
when(node.isNodeType("null:pentahoVersionable")).thenReturn(true);
VersionManagerImpl versionManager = mock(VersionManagerImpl.class);
Workspace workspace = mock(Workspace.class);
when(workspace.getVersionManager()).thenReturn(versionManager);
Session session = mock(Session.class);
when(session.getWorkspace()).thenReturn(workspace);
when(session.getNodeByIdentifier(anyString())).thenReturn(node);
when(session.getItem(anyString())).thenReturn(node);
pentahoSession = mock(IPentahoSession.class);
PentahoSessionHolder.setSession(pentahoSession);
IRepositoryVersionManager repositoryVersionManager = mock(IRepositoryVersionManager.class);
when(repositoryVersionManager.isVersioningEnabled(anyString())).thenReturn(true);
PentahoSystem.registerObject(repositoryVersionManager);
JcrTemplate jcrTemplate = new JcrTemplate() {
@Override
public Object execute(JcrCallback callback) throws DataAccessException {
try {
return callback.doInJcr(session);
} catch (Exception e) {
// wrapping exception to comply overriding rules
throw new RuntimeException(e);
}
}
};
List<ITransformer<IRepositoryFileData>> transformerList = Collections.emptyList();
IPathConversionHelper pathConversionHelper = new DefaultPathConversionHelper();
IRepositoryFileAclDao aclDao = mock(IRepositoryFileAclDao.class);
accessVoterManager = mock(IRepositoryAccessVoterManager.class);
JcrRepositoryFileDao jcrDao = new JcrRepositoryFileDao(jcrTemplate, transformerList, null, null, pathConversionHelper, aclDao, null, accessVoterManager);
dao = spy(jcrDao);
}
use of org.springframework.extensions.jcr.JcrTemplate in project pentaho-platform by pentaho.
the class UserRoleDaoEncodeIT 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");
authenticatedRoleName = (String) applicationContext.getBean("singleTenantAuthenticatedAuthorityName");
adminRoleName = (String) applicationContext.getBean("singleTenantAdminAuthorityName");
roleBindingDaoTarget = (IRoleAuthorizationPolicyRoleBindingDao) applicationContext.getBean("roleAuthorizationPolicyRoleBindingDaoTarget");
sysAdminRoleName = (String) applicationContext.getBean("superAdminAuthorityName");
sysAdminUserName = (String) applicationContext.getBean("superAdminUserName");
authorizationPolicy = (IAuthorizationPolicy) applicationContext.getBean("authorizationPolicy");
tenantManager = (ITenantManager) applicationContext.getBean("tenantMgrProxy");
repositoryFileDao = (IRepositoryFileDao) applicationContext.getBean("repositoryFileDao");
userRoleDaoProxy = (IUserRoleDao) applicationContext.getBean("userRoleDaoTxn");
userRoleDaoTestProxy = (IUserRoleDao) applicationContext.getBean("userRoleDaoTxn");
tenantedUserNameUtils = (ITenantedPrincipleNameResolver) applicationContext.getBean("tenantedUserNameUtils");
tenantedRoleNameUtils = (ITenantedPrincipleNameResolver) applicationContext.getBean("tenantedRoleNameUtils");
TestPrincipalProvider.userRoleDao = (IUserRoleDao) applicationContext.getBean("userRoleDaoTxn");
TestPrincipalProvider.adminCredentialsStrategy = (CredentialsStrategy) applicationContext.getBean("jcrAdminCredentialsStrategy");
TestPrincipalProvider.repository = (Repository) applicationContext.getBean("jcrRepository");
jcrTemplate = (JcrTemplate) applicationContext.getBean("jcrTemplate");
}
Aggregations