String publicFolderPath = ClientRepositoryPaths.getPublicFolderPath();
createTestFile( publicFolderPath.replaceAll( "/", ":" ) + ":" + "aclFile.txt", "abcdefg" );
WebResource webResource = resource();
RepositoryFileAclDto fileAcls =
webResource.path( "repo/files/public:aclFile.txt/acl" ).accept( APPLICATION_XML ).get(
RepositoryFileAclDto.class );
List<RepositoryFileAclAceDto> aces = fileAcls.getAces();
assertEquals( 2, aces.size() );
RepositoryFileAclAceDto ace = aces.get( 0 );
assertEquals( authenticatedAuthorityName, ace.getRecipient() );
List<Integer> permissions = ace.getPermissions();
assertEquals( 1, permissions.size() );
Assert.assertTrue( permissions.contains( new Integer( 0 ) ) );
String authenticated = authenticatedAuthorityName;
aces = new ArrayList<RepositoryFileAclAceDto>();
ace = new RepositoryFileAclAceDto();
ace.setRecipient( authenticated );
ace.setRecipientType( 1 );
permissions = new ArrayList<Integer>();
permissions.add( 2 );
ace.setPermissions( permissions );
aces.add( ace );
fileAcls.setAces( aces );
ClientResponse putResponse2 =
webResource.path( "repo/files/public:aclFile.txt/acl" ).type( APPLICATION_XML ).put( ClientResponse.class,
fileAcls );
assertResponse( putResponse2, Status.OK );