Search in sources :

Example 76 with RepositoryFileAcl

use of org.pentaho.platform.api.repository2.unified.RepositoryFileAcl in project pentaho-platform by pentaho.

the class RepositoryFileImportFileHandlerTest method testImportNewFileWithManifestOwnerApplied.

@Test
public void testImportNewFileWithManifestOwnerApplied() throws Exception {
    ImportTestBuilder importTesterBuilder = new ImportTestBuilder();
    importTesterBuilder.hasManifest(true).applyAclSettings(false).overwriteAclSettings(true).retainOwnership(false).build().initialSetup().execute();
    RepositoryFile repositoryFile = mockRepository.getFile(PATH + "/" + TARGET_RESOURCE_NAME);
    assertNotNull(repositoryFile);
    RepositoryFileAcl acl = mockRepository.getAcl(repositoryFile.getId());
    assertHasDefaultPermissions(acl);
    assertHasManifestOwner(acl);
}
Also used : RepositoryFile(org.pentaho.platform.api.repository2.unified.RepositoryFile) RepositoryFileAcl(org.pentaho.platform.api.repository2.unified.RepositoryFileAcl) Test(org.junit.Test)

Example 77 with RepositoryFileAcl

use of org.pentaho.platform.api.repository2.unified.RepositoryFileAcl in project pentaho-platform by pentaho.

the class RepositoryFileImportFileHandlerTest method testImportNewFolderWithNoManifest.

@Test
public void testImportNewFolderWithNoManifest() throws Exception {
    ImportTestBuilder importTesterBuilder = new ImportTestBuilder();
    importTesterBuilder.folder(true).path("/").build().initialSetup().execute();
    RepositoryFile repositoryFile = mockRepository.getFile("/" + TARGET_RESOURCE_NAME);
    assertNotNull(repositoryFile);
    assertTrue(repositoryFile.isFolder());
    RepositoryFileAcl acl = mockRepository.getAcl(repositoryFile.getId());
    assertHasDefaultPermissions(acl);
    assertHasDefaultOwner(acl);
}
Also used : RepositoryFile(org.pentaho.platform.api.repository2.unified.RepositoryFile) RepositoryFileAcl(org.pentaho.platform.api.repository2.unified.RepositoryFileAcl) Test(org.junit.Test)

Example 78 with RepositoryFileAcl

use of org.pentaho.platform.api.repository2.unified.RepositoryFileAcl in project pentaho-platform by pentaho.

the class RepositoryFileImportFileHandlerTest method testImportExistingFileWithManifestPermissions.

@Test
public void testImportExistingFileWithManifestPermissions() throws Exception {
    ImportTestBuilder importTesterBuilder = new ImportTestBuilder();
    importTesterBuilder.fileExists(true).hasManifest(true).overwriteFileIfExists(true).retainOwnership(true).applyAclSettings(true).overwriteAclSettings(true).build().initialSetup().execute();
    RepositoryFile repositoryFile = mockRepository.getFile(PATH + "/" + TARGET_RESOURCE_NAME);
    assertNotNull(repositoryFile);
    RepositoryFileAcl acl = mockRepository.getAcl(repositoryFile.getId());
    assertHasManifestPermissions(acl);
    assertHasDefaultOwner(acl);
}
Also used : RepositoryFile(org.pentaho.platform.api.repository2.unified.RepositoryFile) RepositoryFileAcl(org.pentaho.platform.api.repository2.unified.RepositoryFileAcl) Test(org.junit.Test)

Example 79 with RepositoryFileAcl

use of org.pentaho.platform.api.repository2.unified.RepositoryFileAcl in project pentaho-platform by pentaho.

the class RepositoryFileImportFileHandlerTest method testImportExistingFileWithManifestNotApplied.

@Test
public void testImportExistingFileWithManifestNotApplied() throws Exception {
    ImportTestBuilder importTesterBuilder = new ImportTestBuilder();
    importTesterBuilder.fileExists(true).hasManifest(true).retainOwnership(true).overwriteFileIfExists(true).build().initialSetup().execute();
    RepositoryFile repositoryFile = mockRepository.getFile(PATH + "/" + TARGET_RESOURCE_NAME);
    assertNotNull(repositoryFile);
    RepositoryFileAcl acl = mockRepository.getAcl(repositoryFile.getId());
    assertHasDefaultPermissions(acl);
    assertHasDefaultOwner(acl);
}
Also used : RepositoryFile(org.pentaho.platform.api.repository2.unified.RepositoryFile) RepositoryFileAcl(org.pentaho.platform.api.repository2.unified.RepositoryFileAcl) Test(org.junit.Test)

Example 80 with RepositoryFileAcl

use of org.pentaho.platform.api.repository2.unified.RepositoryFileAcl in project pentaho-platform by pentaho.

the class RepositoryFileImportFileHandlerTest method testImportNewFileWithManifestPermissionsApplied.

@Test
public void testImportNewFileWithManifestPermissionsApplied() throws Exception {
    ImportTestBuilder importTesterBuilder = new ImportTestBuilder();
    importTesterBuilder.hasManifest(true).applyAclSettings(true).overwriteAclSettings(true).retainOwnership(true).build().initialSetup().execute();
    RepositoryFile repositoryFile = mockRepository.getFile(PATH + "/" + TARGET_RESOURCE_NAME);
    assertNotNull(repositoryFile);
    RepositoryFileAcl acl = mockRepository.getAcl(repositoryFile.getId());
    assertHasManifestPermissions(acl);
    assertHasDefaultOwner(acl);
}
Also used : RepositoryFile(org.pentaho.platform.api.repository2.unified.RepositoryFile) RepositoryFileAcl(org.pentaho.platform.api.repository2.unified.RepositoryFileAcl) Test(org.junit.Test)

Aggregations

RepositoryFileAcl (org.pentaho.platform.api.repository2.unified.RepositoryFileAcl)99 RepositoryFile (org.pentaho.platform.api.repository2.unified.RepositoryFile)73 Test (org.junit.Test)50 ITenant (org.pentaho.platform.api.mt.ITenant)25 RepositoryFileSid (org.pentaho.platform.api.repository2.unified.RepositoryFileSid)23 RepositoryFileAce (org.pentaho.platform.api.repository2.unified.RepositoryFileAce)15 Node (javax.jcr.Node)13 Matchers.anyString (org.mockito.Matchers.anyString)13 UnifiedRepositoryException (org.pentaho.platform.api.repository2.unified.UnifiedRepositoryException)13 Serializable (java.io.Serializable)12 Session (javax.jcr.Session)12 JcrCallback (org.springframework.extensions.jcr.JcrCallback)12 ArrayList (java.util.ArrayList)11 RepositoryException (javax.jcr.RepositoryException)10 ByteArrayInputStream (java.io.ByteArrayInputStream)9 IOException (java.io.IOException)9 DataNode (org.pentaho.platform.api.repository2.unified.data.node.DataNode)9 IPentahoSession (org.pentaho.platform.api.engine.IPentahoSession)8 RepositoryFilePermission (org.pentaho.platform.api.repository2.unified.RepositoryFilePermission)8 InputStream (java.io.InputStream)7