use of org.pentaho.platform.api.repository2.unified.RepositoryRequest in project pentaho-platform by pentaho.
the class DefaultUnifiedRepositoryContentIT method testGetTree.
@Test
public void testGetTree() throws Exception {
loginAsSysTenantAdmin();
ITenant tenantAcme = tenantManager.createTenant(systemTenant, TENANT_ID_ACME, tenantAdminRoleName, tenantAuthenticatedRoleName, ANONYMOUS_ROLE_NAME);
userRoleDao.createUser(tenantAcme, USERNAME_ADMIN, PASSWORD, "", new String[] { tenantAdminRoleName });
login(USERNAME_ADMIN, tenantAcme, new String[] { tenantAdminRoleName, tenantAuthenticatedRoleName });
userRoleDao.createUser(tenantAcme, USERNAME_SUZY, PASSWORD, "", null);
login(USERNAME_SUZY, tenantAcme, new String[] { tenantAuthenticatedRoleName });
RepositoryFileTree root = repo.getTree(new RepositoryRequest(ClientRepositoryPaths.getRootFolderPath(), true, 0, null));
assertNotNull(root.getFile());
assertNull(root.getChildren());
root = repo.getTree(new RepositoryRequest(ClientRepositoryPaths.getRootFolderPath(), true, 1, null));
assertNotNull(root.getFile());
assertNotNull(root.getChildren());
assertFalse(root.getChildren().isEmpty());
assertNull(root.getChildren().get(0).getChildren());
root = repo.getTree(new RepositoryRequest(ClientRepositoryPaths.getHomeFolderPath(), true, -1, null));
assertNotNull(root.getFile());
assertNotNull(root.getChildren());
assertFalse(root.getChildren().isEmpty());
assertTrue(root.getChildren().get(0).getChildren().isEmpty());
root = repo.getTree(new RepositoryRequest(ClientRepositoryPaths.getHomeFolderPath(), true, -1, "*uz*"));
assertEquals(1, root.getChildren().size());
}
use of org.pentaho.platform.api.repository2.unified.RepositoryRequest in project pentaho-platform by pentaho.
the class DefaultUnifiedRepositoryContentIT method testListHomeFolders.
/**
* A user should only be able to see his home folder (unless your the admin).
*/
// @Test
public void testListHomeFolders() throws Exception {
loginAsSysTenantAdmin();
ITenant tenantAcme = tenantManager.createTenant(systemTenant, TENANT_ID_ACME, tenantAdminRoleName, tenantAuthenticatedRoleName, ANONYMOUS_ROLE_NAME);
userRoleDao.createUser(tenantAcme, USERNAME_ADMIN, PASSWORD, "", new String[] { tenantAdminRoleName });
login(USERNAME_ADMIN, tenantAcme, new String[] { tenantAdminRoleName, tenantAuthenticatedRoleName });
userRoleDao.createUser(tenantAcme, USERNAME_SUZY, PASSWORD, "", null);
userRoleDao.createUser(tenantAcme, USERNAME_TIFFANY, PASSWORD, "", null);
login(USERNAME_TIFFANY, tenantAcme, new String[] { tenantAuthenticatedRoleName });
List<RepositoryFile> children = repo.getChildren(new RepositoryRequest(String.valueOf(repo.getFile(ClientRepositoryPaths.getHomeFolderPath()).getId()), true, -1, null));
assertEquals(1, children.size());
}
use of org.pentaho.platform.api.repository2.unified.RepositoryRequest in project pentaho-metaverse by pentaho.
the class LocatorTestUtils method getTree.
/**
* ************ end -- load job and trans methods for the mock diRepo ****************
*/
public static RepositoryFileTree getTree(RepositoryRequest req) {
File root = new File(SOLUTION_PATH);
RepositoryFileTree rft = createFileTree(root);
return rft;
}
use of org.pentaho.platform.api.repository2.unified.RepositoryRequest in project pentaho-kettle by pentaho.
the class RepositoryFileProvider method populateFilesLazy.
public void populateFilesLazy(RepositoryDirectory repositoryDirectory, String filter) {
RepositoryRequest repositoryRequest = new RepositoryRequest();
repositoryRequest.setPath(repositoryDirectory.getPath());
repositoryRequest.setDepth(1);
repositoryRequest.setShowHidden(true);
repositoryRequest.setTypes(RepositoryRequest.FILES_TYPE_FILTER.FILES);
repositoryRequest.setChildNodeFilter(filter);
RepositoryFileTree tree = getRepository().getUnderlyingRepository().getTree(repositoryRequest);
for (RepositoryFileTree repositoryFileTree : tree.getChildren()) {
org.pentaho.platform.api.repository2.unified.RepositoryFile repositoryFile = repositoryFileTree.getFile();
RepositoryFile repositoryFile1 = RepositoryFile.build(repositoryDirectory.getPath(), repositoryFile, isAdmin());
repositoryDirectory.addChild(repositoryFile1);
}
}
use of org.pentaho.platform.api.repository2.unified.RepositoryRequest in project pentaho-kettle by pentaho.
the class RepositoryBrowserController method populateFilesLazy.
public void populateFilesLazy(RepositoryDirectory repositoryDirectory, String filter) {
RepositoryRequest repositoryRequest = new RepositoryRequest();
repositoryRequest.setPath(repositoryDirectory.getPath());
repositoryRequest.setDepth(1);
repositoryRequest.setShowHidden(true);
repositoryRequest.setTypes(RepositoryRequest.FILES_TYPE_FILTER.FILES);
repositoryRequest.setChildNodeFilter(filter);
RepositoryFileTree tree = getRepository().getUnderlyingRepository().getTree(repositoryRequest);
for (RepositoryFileTree repositoryFileTree : tree.getChildren()) {
org.pentaho.platform.api.repository2.unified.RepositoryFile repositoryFile = repositoryFileTree.getFile();
RepositoryFile repositoryFile1 = RepositoryFile.build(repositoryDirectory.getPath(), repositoryFile, isAdmin());
repositoryDirectory.addChild(repositoryFile1);
}
}
Aggregations