AbstractJcrBackedUserRoleDao implements IUserRoleDao { protected static SessionImpl getSessionImpl( Session session ) { if ( session instanceof SessionImpl ) { return (SessionImpl) session; } else if ( Proxy.isProxyClass( session.getClass() ) ) { InvocationHandler invocationHandler = Proxy.getInvocationHandler( session ); if ( invocationHandler instanceof CredentialsStrategySessionFactory.LogoutSuppressingInvocationHandler ) { return ( (CredentialsStrategySessionFactory.LogoutSuppressingInvocationHandler) invocationHandler ) .getSession(); } } throw new IllegalStateException( "Session is not a SessionImpl or a proxy of one." ); } AbstractJcrBackedUserRoleDao( ITenantedPrincipleNameResolver userNameUtils,
                                       ITenantedPrincipleNameResolver roleNameUtils, String authenticatedRoleName,
                                       String tenantAdminRoleName,
                                       String repositoryAdminUsername, IRepositoryFileAclDao repositoryFileAclDao,
                                       IRepositoryFileDao repositoryFileDao,
                                       final IPathConversionHelper pathConversionHelper, final ILockHelper lockHelper,
                                       final IRepositoryDefaultAclHandler defaultAclHandler,
                                       final List<String> systemRoles,
                                       final List<String> extraRoles, UserCache userDetailsCache ); void setRoleMembers( Session session, final ITenant theTenant, final String roleName,
                              final String[] memberUserNames ); void setUserRoles( Session session, final ITenant theTenant, final String userName, final String[] roles ); IPentahoRole createRole( Session session, final ITenant theTenant, final String roleName,
                                  final String description, final String[] memberUserNames ); IPentahoUser createUser( Session session, final ITenant theTenant, final String userName,
                                  final String password, final String description, final String[] roles ); void deleteRole( Session session, final IPentahoRole role ); void deleteUser( Session session, final IPentahoUser user ); List<IPentahoRole> getRoles( Session session ); List<IPentahoUser> getUsers( Session session ); void setRoleDescription( Session session, final ITenant theTenant, final String roleName,
                                  final String description ); void setUserDescription( Session session, final ITenant theTenant, final String userName,
                                  final String description ); void setPassword( Session session, final ITenant theTenant, final String userName, final String password ); ITenantedPrincipleNameResolver getTenantedUserNameUtils(); ITenantedPrincipleNameResolver getTenantedRoleNameUtils(); List<IPentahoRole> getRoles( Session session, ITenant tenant ); List<IPentahoRole> getRoles( Session session, ITenant theTenant, boolean includeSubtenants ); List<IPentahoUser> getUsers( Session session, ITenant tenant ); List<IPentahoUser> getUsers( Session session, ITenant theTenant, boolean includeSubtenants ); IPentahoRole getRole( Session session, final ITenant tenant, final String name ); IPentahoUser getUser( Session session, final ITenant tenant, final String name ); List<IPentahoUser> getRoleMembers( Session session, final ITenant theTenant, final String roleName ); List<IPentahoRole> getUserRoles( Session session, final ITenant theTenant, final String userName ); boolean isUseJackrabbitUserCache(); void setUseJackrabbitUserCache( boolean useJackrabbitUserCache );  }
@Test public void getSessionImplTest() throws Exception { CredentialsStrategySessionFactory factory = new CredentialsStrategySessionFactory( mock( Repository.class ), mock( CredentialsStrategy.class ) ); Session sessionProxy = factory.createSessionProxy( mock( SessionImpl.class ) ); SessionImpl sessionImpl = AbstractJcrBackedUserRoleDao.getSessionImpl( sessionProxy ); assertThat( sessionImpl, is( notNullValue() ) ); }