public void testSharedObjectsCreateDefaultAcl() {
// default behavior is to inherit everything but database connections
SharedObjectsDefaultAclHandler aclHandler = new SharedObjectsDefaultAclHandler();
RepositoryFile f = mock( RepositoryFile.class );
when( f.getPath() ).thenReturn( "/pentaho/tenant0/etc/pdi/databases/Test.kdb" );
RepositoryFileAcl acl = aclHandler.createDefaultAcl( f );
assertTrue( !acl.isEntriesInheriting() );
assertTrue( acl.getAces().size() == 1 );
assertTrue( "Authenticated".equals( acl.getAces().get( 0 ).getSid().getName().toString() ) );
assertTrue( RepositoryFileSid.Type.ROLE.equals( acl.getAces().get( 0 ).getSid().getType() ) );
assertTrue( acl.getAces().get( 0 ).getPermissions().size() == 1 );
assertTrue( acl.getAces().get( 0 ).getPermissions().contains( RepositoryFilePermission.ALL ) );
acl = aclHandler.createDefaultAcl( repositoryFile );
assertTrue( acl.isEntriesInheriting() );
// null role tells the acl handler to default to no aces
List<String> paths = new ArrayList<String>();
paths.add( "{0}/etc/pdi/databases" );
aclHandler = new SharedObjectsDefaultAclHandler( null, paths );
acl = aclHandler.createDefaultAcl( f );
assertTrue( !acl.isEntriesInheriting() );
System.out.println( acl.getAces() );
assertTrue( acl.getAces().size() == 0 );
acl = aclHandler.createDefaultAcl( repositoryFile );
assertTrue( acl.isEntriesInheriting() );
}