Search in sources :

Example 56 with RepositoryFileAclDto

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

the class FileResourceTest method usersOrRolesExist_OwnerIsRepositoryAdmin.

@Test
public void usersOrRolesExist_OwnerIsRepositoryAdmin() {
    RepositoryFileAclDto acl = new RepositoryFileAclDto();
    acl.setOwner(REPOSITORY_ADMIN_USERNAME);
    assertTrue(fileResource.validateUsersAndRoles(acl));
}
Also used : RepositoryFileAclDto(org.pentaho.platform.api.repository2.unified.webservices.RepositoryFileAclDto) Test(org.junit.Test)

Example 57 with RepositoryFileAclDto

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

the class FileResourceTest method usersOrRolesExist_OwnerExists.

@Test
public void usersOrRolesExist_OwnerExists() {
    RepositoryFileAclDto acl = new RepositoryFileAclDto();
    acl.setOwner(ACL_OWNER);
    assertTrue(fileResource.validateUsersAndRoles(acl));
}
Also used : RepositoryFileAclDto(org.pentaho.platform.api.repository2.unified.webservices.RepositoryFileAclDto) Test(org.junit.Test)

Example 58 with RepositoryFileAclDto

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

the class FileResourceTest method testSetFileAclsErrorNoOwner.

/*
   * [BISERVER-14294] Validating the ACL empty owner is tested against.
   */
@Test
public void testSetFileAclsErrorNoOwner() {
    RepositoryFileAclDto repository = mock(RepositoryFileAclDto.class);
    doReturn(mock(Messages.class)).when(fileResource).getMessagesInstance();
    doCallRealMethod().when(fileResource).validateUsersAndRoles(any());
    assertEquals(FORBIDDEN.getStatusCode(), fileResource.setFileAcls(PATH_ID, repository).getStatus());
}
Also used : Messages(org.pentaho.platform.web.http.messages.Messages) RepositoryFileAclDto(org.pentaho.platform.api.repository2.unified.webservices.RepositoryFileAclDto) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)41 RepositoryFileAclDto (org.pentaho.platform.repository2.unified.webservices.RepositoryFileAclDto)26 RepositoryFileAclDto (org.pentaho.platform.api.repository2.unified.webservices.RepositoryFileAclDto)20 Matchers.anyString (org.mockito.Matchers.anyString)16 InputStream (java.io.InputStream)14 IPentahoSession (org.pentaho.platform.api.engine.IPentahoSession)13 RepositoryFileAcl (org.pentaho.platform.api.repository2.unified.RepositoryFileAcl)11 RepositoryFileAclAceDto (org.pentaho.platform.api.repository2.unified.webservices.RepositoryFileAclAceDto)11 FileInputStream (java.io.FileInputStream)9 IPlatformImportBundle (org.pentaho.platform.api.repository2.unified.IPlatformImportBundle)9 RepositoryFileDto (org.pentaho.platform.api.repository2.unified.webservices.RepositoryFileDto)9 ArrayList (java.util.ArrayList)8 RepositoryFileAclAdapter (org.pentaho.platform.repository2.unified.webservices.RepositoryFileAclAdapter)8 ByteArrayInputStream (java.io.ByteArrayInputStream)7 FileNotFoundException (java.io.FileNotFoundException)7 Serializable (java.io.Serializable)7 GeneralSecurityException (java.security.GeneralSecurityException)6 IPlatformImporter (org.pentaho.platform.plugin.services.importer.IPlatformImporter)6 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)5 ClientResponse (com.sun.jersey.api.client.ClientResponse)4