use of org.pentaho.test.platform.repository2.unified.MockUnifiedRepository.SpringSecurityCurrentUserProvider in project pentaho-platform by pentaho.
the class RepositoryUtilsTest method testGetFolder.
@Test
public void testGetFolder() throws Exception {
final MockUnifiedRepository repository = new MockUnifiedRepository(new SpringSecurityCurrentUserProvider());
final RepositoryUtils repositoryUtils = new RepositoryUtils(repository);
RepositoryFile test = repositoryUtils.getFolder("/public/one/two/three", true, true, null);
assertNotNull(test);
assertEquals("The folder name is invalid", "three", test.getName());
assertEquals("The path is invalid", "/public/one/two/three", test.getPath());
assertTrue("The folder should be defined as a folder", test.isFolder());
// Make sure it created the parents
RepositoryFile one = repositoryUtils.getFolder("/public/one", false, false, null);
assertNotNull(one);
RepositoryFile two = repositoryUtils.getFolder("/public/one/two", false, false, null);
assertNotNull(two);
}
use of org.pentaho.test.platform.repository2.unified.MockUnifiedRepository.SpringSecurityCurrentUserProvider in project pentaho-platform by pentaho.
the class RepositoryUtilsTest method testGetFile.
@Test
public void testGetFile() throws Exception {
final MockUnifiedRepository repository = new MockUnifiedRepository(new SpringSecurityCurrentUserProvider());
final RepositoryUtils repositoryUtils = new RepositoryUtils(repository);
final SimpleRepositoryFileData data = new SimpleRepositoryFileData(new ByteArrayInputStream("Test".getBytes()), "UTF-8", "text/plain");
RepositoryFile test = repositoryUtils.getFile("/public/one/two/three.prpt", data, true, true, null);
assertNotNull(test);
assertEquals("The filename is invalid", "three.prpt", test.getName());
assertEquals("The path is invalid", "/public/one/two/three.prpt", test.getPath());
assertFalse("The file should not be defined as a folder", test.isFolder());
// Make sure it created the parents
RepositoryFile one = repositoryUtils.getFolder("/public/one", false, false, null);
assertNotNull(one);
RepositoryFile two = repositoryUtils.getFolder("/public/one/two", false, false, null);
assertNotNull(two);
}
Aggregations