use of org.pentaho.platform.repository2.unified.webservices.RepositoryFileDto in project pentaho-platform by pentaho.
the class FileResourceIT method testFileCreator.
@Test
public void testFileCreator() {
loginAsRepositoryAdmin();
ITenant systemTenant = tenantManager.createTenant(null, ServerRepositoryPaths.getPentahoRootFolderName(), adminAuthorityName, authenticatedAuthorityName, "Anonymous");
userRoleDao.createUser(systemTenant, sysAdminUserName, "password", "", new String[] { adminAuthorityName });
ITenant mainTenant_1 = tenantManager.createTenant(systemTenant, MAIN_TENANT_1, adminAuthorityName, authenticatedAuthorityName, "Anonymous");
userRoleDao.createUser(mainTenant_1, "admin", "password", "", new String[] { adminAuthorityName });
try {
login("admin", mainTenant_1, new String[] { authenticatedAuthorityName });
// set object in PentahoSystem
mp.defineInstance(IUnifiedRepository.class, repo);
WebResource webResource = resource();
String publicFolderPath = ClientRepositoryPaths.getPublicFolderPath();
createTestFile(publicFolderPath.replaceAll("/", ":") + ":" + "file1.txt", "abcdefg");
RepositoryFile file1 = repo.getFile(publicFolderPath + "/" + "file1.txt");
RepositoryFileDto file2 = new RepositoryFileDto();
file2.setId(file1.getId().toString());
webResource.path("repo/files/public:file1.txt/creator").entity(file2).put();
} catch (Throwable ex) {
TestCase.fail();
} finally {
cleanupUserAndRoles(mainTenant_1);
cleanupUserAndRoles(systemTenant);
logout();
}
}
Aggregations