simpleFileData = repo.getDataAtVersionForRead( simpleFile.getId(), simpleVersion, SimpleRepositoryFileData.class );
assertNotNull( simpleFileData );
assertEquals( "Hello World!", IOUtils.toString( simpleFileData.getInputStream(), simpleFileData.getEncoding() ) );
logger.info( "getChildren" );
List<RepositoryFile> folder1Children = repo.getChildren( new RepositoryRequest( String.valueOf( folder1.getId() ), true, -1, null ) );
assertNotNull( folder1Children );
assertEquals( 2, folder1Children.size() );
logger.info( "getChildren" );
List<RepositoryFile> folder1ChildrenFiltered = repo.getChildren( new RepositoryRequest( String.valueOf( folder1.getId() ), true, -1, "*.sample" ) );
assertNotNull( folder1ChildrenFiltered );
assertEquals( 0, folder1ChildrenFiltered.size() );
logger.info( "getDeletedFiles" );
assertEquals( 0, repo.getDeletedFiles().size() );
logger.info( "deleteFile" );
repo.deleteFile( file1.getId(), null );
logger.info( "getDeletedFiles" );
assertEquals( 0, repo.getDeletedFiles( folder1.getPath(), "*.sample" ).size() );
logger.info( "hasAccess" );
assertFalse( repo.hasAccess( "/pentaho", EnumSet.of( RepositoryFilePermission.WRITE ) ) );
logger.info( "getEffectiveAces" );
List<RepositoryFileAce> folder1EffectiveAces = repo.getEffectiveAces( folder1.getId() );
assertEquals( 1, folder1EffectiveAces.size() );
logger.info( "getAcl" );
RepositoryFileAcl folder1Acl = repo.getAcl( folder1.getId() );
assertEquals( USERNAME_SUZY, folder1Acl.getOwner().getName() );
logger.info( "updateAcl" );
userRoleDao.createUser( tenantAcme, USERNAME_TIFFANY, PASSWORD, "", null );
RepositoryFileAcl updatedFolder1Acl =
repo.updateAcl( new RepositoryFileAcl.Builder( folder1Acl ).entriesInheriting( false ).ace(
userNameUtils.getPrincipleId( tenantAcme, USERNAME_TIFFANY ), RepositoryFileSid.Type.USER,
RepositoryFilePermission.ALL ).build() );
assertNotNull( updatedFolder1Acl );
assertEquals( 1, updatedFolder1Acl.getAces().size() );
logger.info( "lockFile" );
assertFalse( file1.isLocked() );
repo.lockFile( file1.getId(), "I locked this file" );
logger.info( "canUnlockFile" );
assertTrue( repo.canUnlockFile( file1.getId() ) );
logger.info( "unlockFile" );
repo.unlockFile( file1.getId() );
logger.info( "moveFile" );
repo.moveFile( file1.getId(), ClientRepositoryPaths.getUserHomeFolderPath( USERNAME_SUZY ) + "/folder1", null );
logger.info( "copyFile" );
repo.copyFile( file1.getId(), ClientRepositoryPaths.getUserHomeFolderPath( USERNAME_SUZY )
+ "/folder1/fileB.whatever", null );
RepositoryFile copiedFile = repo.getFile( ClientRepositoryPaths.getUserHomeFolderPath( USERNAME_SUZY )
+ "/folder1/fileB.whatever" );
copiedFile = repo.updateFile( copiedFile, data, null );
logger.info( "getVersionSummaries" );
List<VersionSummary> versionSummaries = repo.getVersionSummaries( file1.getId() );
assertNotNull( versionSummaries );
// copy doesn't increase version number
assertTrue( versionSummaries.size() >= 1 );
assertEquals( USERNAME_SUZY, versionSummaries.get( 0 ).getAuthor() );
logger.info( "getVersionSummary" );
VersionSummary versionSummary = repo.getVersionSummary( file1.getId(), null );
assertNotNull( versionSummary );
assertNotNull( versionSummary.getId() );
logger.info( "getFileAtVersion" );
RepositoryFile file1AtVersion = repo.getFileAtVersion( file1.getId(), versionSummary.getId() );
assertNotNull( file1AtVersion );
assertEquals( versionSummary.getId(), file1AtVersion.getVersionId() );
logger.info( "getTree" );
RepositoryFileTree tree = repo.getTree( new RepositoryRequest( ClientRepositoryPaths.getRootFolderPath(), true, -1, null ) );
assertNotNull( tree.getFile().getId() );
logger.info( "getDataForReadInBatch" );
List<NodeRepositoryFileData> result =
repo.getDataForReadInBatch( Arrays.asList( file1, copiedFile ), NodeRepositoryFileData.class );