public void testInvalidCustomDefinitions() throws RepositoryException, FileSystemException, IOException { // setup the custom privilege file with cyclic references FileSystem fs = ((RepositoryImpl) superuser.getRepository()).getConfig().getFileSystem(); FileSystemResource resource = new FileSystemResource(fs, "/privileges/custom_privileges.xml"); if (!resource.exists()) { resource.makeParentDirs(); } StringBuilder sb = new StringBuilder(); sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?><privileges><privilege isAbstract=\"false\" name=\"test\"><contains name=\"test2\"/></privilege></privileges>"); Writer writer = new OutputStreamWriter(resource.getOutputStream(), "utf-8"); writer.write(sb.toString()); writer.flush(); writer.close(); try { new PrivilegeRegistry(superuser.getWorkspace().getNamespaceRegistry(), fs); fail("Invalid names must be detected upon registry startup."); } catch (RepositoryException e) { // success } finally { fs.deleteFolder("/privileges"); } }
public void testCustomDefinitionsWithCyclicReferences() throws RepositoryException, FileSystemException, IOException { FileSystem fs = ((RepositoryImpl) superuser.getRepository()).getConfig().getFileSystem(); FileSystemResource resource = new FileSystemResource(fs, "/privileges/custom_privileges.xml"); if (!resource.exists()) {
@Override protected void setUp() throws Exception { super.setUp(); resolver = ((SessionImpl) superuser); // setup the custom privilege file with cyclic references fs = ((RepositoryImpl) superuser.getRepository()).getConfig().getFileSystem(); FileSystemResource resource = new FileSystemResource(fs, "/privileges/custom_privileges.xml"); if (!resource.exists()) { resource.makeParentDirs(); } privilegeRegistry = new PrivilegeRegistry(superuser.getWorkspace().getNamespaceRegistry(), fs); }
public void testCustomEquivalentDefinitions() throws RepositoryException, FileSystemException, IOException { FileSystem fs = ((RepositoryImpl) superuser.getRepository()).getConfig().getFileSystem(); FileSystemResource resource = new FileSystemResource(fs, "/privileges/custom_privileges.xml"); if (!resource.exists()) {
this.repConfig = repConfig; context.setFileSystem(repConfig.getFileSystem());
this.repConfig = repConfig; context.setFileSystem(repConfig.getFileSystem());