JcrRepositoryFileUtils { public static void checkinNearestVersionableNodeIfNecessary( final Session session, final PentahoJcrConstants pentahoJcrConstants, final Node node, final String versionMessage ) throws RepositoryException { checkinNearestVersionableNodeIfNecessary( session, pentahoJcrConstants, node, versionMessage, null, false ); }  static RepositoryFile getFileById( final Session session, final PentahoJcrConstants pentahoJcrConstants,
      final IPathConversionHelper pathConversionHelper, final ILockHelper lockHelper, final Serializable fileId ); static RepositoryFile nodeToFile( final Session session, final PentahoJcrConstants pentahoJcrConstants,
      final IPathConversionHelper pathConversionHelper, final ILockHelper lockHelper, final Node node ); static RepositoryFile nodeToFileOld( final Session session, final PentahoJcrConstants pentahoJcrConstants,
      final IPathConversionHelper pathConversionHelper, final ILockHelper lockHelper, final Node node,
      final boolean loadMaps, IPentahoLocale pentahoLocale ); static RepositoryFile nodeToFile( final Session session, final PentahoJcrConstants pentahoJcrConstants,
      final IPathConversionHelper pathConversionHelper, final ILockHelper lockHelper, final Node node,
      final boolean loadMaps, IPentahoLocale pentahoLocale ); static String getLocalizedString( final Session session, final PentahoJcrConstants pentahoJcrConstants,
      final Node localizedStringNode, IPentahoLocale pentahoLocale ); static Map<String, Properties> getLocalePropertiesMap( final Session session,
      final PentahoJcrConstants pentahoJcrConstants, final Node localesNode ); static String getAbsolutePath( final Session session, final PentahoJcrConstants pentahoJcrConstants,
      final Node node ); static Serializable getNodeId( final Session session, final PentahoJcrConstants pentahoJcrConstants,
      final Node node ); static String getNodeName( final Session session, final PentahoJcrConstants pentahoJcrConstants,
      final Node node ); static String getVersionId( final Session session, final PentahoJcrConstants pentahoJcrConstants,
      final Node node ); static Node createFolderNode( final Session session, final PentahoJcrConstants pentahoJcrConstants,
      final Serializable parentFolderId, final RepositoryFile folder ); static Node createFileNode( final Session session, final PentahoJcrConstants pentahoJcrConstants,
      final Serializable parentFolderId, final RepositoryFile file, final IRepositoryFileData content,
      final ITransformer<IRepositoryFileData> transformer ); static Node updateFileNode( final Session session, final PentahoJcrConstants pentahoJcrConstants,
      final RepositoryFile file, final IRepositoryFileData content,
      final ITransformer<IRepositoryFileData> transformer ); static Node updateFolderNode( final Session session, final PentahoJcrConstants pentahoJcrConstants,
      final RepositoryFile folder ); static IRepositoryFileData getContent( final Session session, final PentahoJcrConstants pentahoJcrConstants,
      final Serializable fileId, final Serializable versionId, final ITransformer<IRepositoryFileData> transformer ); static List<RepositoryFile> getChildren( final Session session, final PentahoJcrConstants pentahoJcrConstants,
      final IPathConversionHelper pathConversionHelper, final ILockHelper lockHelper,
      final RepositoryRequest repositoryRequest ); @Deprecated static List<RepositoryFile> getChildren( final Session session, final PentahoJcrConstants pentahoJcrConstants,
      final IPathConversionHelper pathConversionHelper, final ILockHelper lockHelper, final Serializable folderId,
      final String filter ); @Deprecated static List<RepositoryFile> getChildren( final Session session, final PentahoJcrConstants pentahoJcrConstants,
      final IPathConversionHelper pathConversionHelper, final ILockHelper lockHelper, final Serializable folderId,
      final String filter, Boolean showHiddenFiles ); static boolean isPentahoFolder( final PentahoJcrConstants pentahoJcrConstants, final Node node ); static boolean isPentahoHierarchyNode( final Session session, final PentahoJcrConstants pentahoJcrConstants,
      final Node node ); static boolean isLocked( final PentahoJcrConstants pentahoJcrConstants, final Node node ); static boolean isPentahoFile( final PentahoJcrConstants pentahoJcrConstants, final Node node ); static boolean isVersioned( final Session session, final PentahoJcrConstants pentahoJcrConstants,
      final Node node ); static boolean isSupportedNodeType( final PentahoJcrConstants pentahoJcrConstants, final Node node ); static void checkoutNearestVersionableFileIfNecessary( final Session session,
      final PentahoJcrConstants pentahoJcrConstants, final Serializable fileId ); static void checkoutNearestVersionableNodeIfNecessary( final Session session,
      final PentahoJcrConstants pentahoJcrConstants, final Node node ); static void checkinNearestVersionableFileIfNecessary( final Session session,
      final PentahoJcrConstants pentahoJcrConstants, final Serializable fileId, final String versionMessage ); static void checkinNearestVersionableFileIfNecessary( final Session session,
      final PentahoJcrConstants pentahoJcrConstants, final Serializable fileId, final String versionMessage,
      final Date versionDate, final boolean aclOnlyChange ); static void checkinNearestVersionableNodeIfNecessary( final Session session,
      final PentahoJcrConstants pentahoJcrConstants, final Node node, final String versionMessage ); static void checkinNearestVersionableNodeIfNecessary( final Session session,
      final PentahoJcrConstants pentahoJcrConstants, final Node node, final String versionMessage, Date versionDate,
      final boolean aclOnlyChange ); static void deleteFile( final Session session, final PentahoJcrConstants pentahoJcrConstants,
      final Serializable fileId, final ILockHelper lockTokenHelper ); static RepositoryFile nodeIdToFile( final Session session, final PentahoJcrConstants pentahoJcrConstants,
      final IPathConversionHelper pathConversionHelper, final ILockHelper lockHelper, final Serializable fileId ); static Object getVersionSummaries( final Session session, final PentahoJcrConstants pentahoJcrConstants,
      final Serializable fileId, final boolean includeAclOnlyChanges ); static RepositoryFile getFileAtVersion( final Session session, final PentahoJcrConstants pentahoJcrConstants,
      final IPathConversionHelper pathConversionHelper, final ILockHelper lockHelper, final Serializable fileId,
      final Serializable versionId ); static String getFileContentType( final Session session, final PentahoJcrConstants pentahoJcrConstants,
      final Serializable fileId, final Serializable versionId ); static Serializable getParentId( final Session session, final Serializable fileId ); static Serializable getBaseVersionId( final Session session, final Serializable fileId ); static Object getVersionSummary( final Session session, final PentahoJcrConstants pentahoJcrConstants,
      final Serializable fileId, final Serializable versionId ); static RepositoryFileTree getTree( final Session session, final PentahoJcrConstants pentahoJcrConstants,
      final IPathConversionHelper pathConversionHelper, final ILockHelper lockHelper, final String absPath,
      final RepositoryRequest repositoryRequest, IRepositoryAccessVoterManager accessVoterManager ); static Node updateFileLocaleProperties( final Session session, final Serializable fileId, String locale,
      Properties properties ); static Node deleteFileLocaleProperties( final Session session, final Serializable fileId, String locale ); static void setFileMetadata( final Session session, final Serializable fileId,
      Map<String, Serializable> metadataMap ); static Map<String, Serializable> getFileMetadata( final Session session, final Serializable fileId ); static List<Character> getReservedChars(); static void checkName( final String name ); static RepositoryFile createFolder( final Session session,
      final CredentialsStrategySessionFactory sessionFactory, final RepositoryFile parentFolder,
      final RepositoryFile folder, final boolean inheritAces, final RepositoryFileSid ownerSid,
      final IPathConversionHelper pathConversionHelper, final String versionMessage ); static RepositoryFile getFileByAbsolutePath( final Session session, final String absPath,
      final IPathConversionHelper pathConversionHelper, final ILockHelper lockHelper, final boolean loadMaps,
      final IPentahoLocale locale ); static IRepositoryVersionManager getRepositoryVersionManager(); static void setRepositoryVersionManager( IRepositoryVersionManager repositoryVersionManager );  }
@Test public void testCheckinNearestVersionableNodeIfNecessary() throws Exception { String versionMessage = "Version message"; String username = "admin"; Date curDate = new Date(); Node mockNode = mock( Node.class ); Node parentNode = mock( Node.class ); IPentahoSession pentahoSession = mock( IPentahoSession.class ); when( pentahoSession.getName() ).thenReturn( username ); JcrRepositoryFileUtils.setRepositoryVersionManager( repositoryVersionManagerMockTrue ); VersionManagerImpl versionManager = mock( VersionManagerImpl.class ); when( workspaceMock.getVersionManager() ).thenReturn( versionManager ); when( mockNode.getParent() ).thenReturn( parentNode ); PentahoJcrConstants pentahoJcrConstants = new PentahoJcrConstants( sessionMock ); when( mockNode.isNodeType( pentahoJcrConstants.getPHO_MIX_VERSIONABLE() ) ).thenReturn( Boolean.TRUE ); PentahoSessionHolder.setSession( pentahoSession ); JcrRepositoryFileUtils .checkinNearestVersionableNodeIfNecessary( sessionMock, pentahoJcrConstants, mockNode, versionMessage, curDate, true ); Calendar cal = Calendar.getInstance(); if ( curDate != null ) { cal.setTime( curDate ); } else { cal.setTime( new Date() ); } verify( versionManager ).checkin( mockNode.getPath(), cal ); }