/** * Opens a {@link CoreSession} for the currently logged-in user. * <p> * The session must be closed using {@link CloseableCoreSession#close}. * * @param repositoryName the repository name, or {@code null} for the default repository * @return the session * @since 5.9.3 */ public static CloseableCoreSession openCoreSession(String repositoryName) { return openCoreSession(repositoryName, getPrincipal(null)); }
/** * MUST ONLY BE USED IN UNIT TESTS to open a {@link CoreSession} for the given user. * <p> * The session must be closed using {@link CloseableCoreSession#close}. * * @param repositoryName the repository name, or {@code null} for the default repository * @param username the user name * @return the session * @since 5.9.3 */ public static CloseableCoreSession openCoreSession(String repositoryName, String username) { return openCoreSession(repositoryName, getPrincipal(username)); }