use of org.pentaho.platform.repository2.unified.RepositoryUtils in project pentaho-platform by pentaho.
the class PentahoMetadataDomainRepositoryTest method testInitialization.
@Test
public void testInitialization() {
try {
createDomainRepository(null);
fail("An exception should be thrown");
} catch (Exception success) {
// ignored
}
try {
createDomainRepository(null, null, null, null);
fail("An exception should be thrown");
} catch (Exception success) {
// ignored
}
final RepositoryUtils repositoryUtils = new RepositoryUtils(repository);
final XmiParser xmiParser = new XmiParser();
final LocalizationUtil localizationUtil = new LocalizationUtil();
final PentahoMetadataDomainRepository repo = createDomainRepository(repository, repositoryUtils, xmiParser, localizationUtil);
assertEquals(repository, repo.getRepository());
assertEquals(repositoryUtils, repo.getRepositoryUtils());
assertEquals(xmiParser, repo.getXmiParser());
assertEquals(localizationUtil, repo.getLocalizationUtil());
}
use of org.pentaho.platform.repository2.unified.RepositoryUtils in project data-access by pentaho.
the class SerializeMultiTableServiceIT method createMetadataDomainRepository.
public PentahoMetadataDomainRepository createMetadataDomainRepository() throws Exception {
IUnifiedRepository repository = new FileSystemBackedUnifiedRepository("target/test-classes/solution1");
booter.defineInstance(IUnifiedRepository.class, repository);
Assert.assertNotNull(new RepositoryUtils(repository).getFolder("/etc/metadata", true, true, null));
Assert.assertNotNull(new RepositoryUtils(repository).getFolder("/etc/mondrian", true, true, null));
Assert.assertNotNull(new RepositoryUtils(repository).getFolder("/savetest", true, true, null));
PentahoMetadataDomainRepository pentahoMetadataDomainRepository = new PentahoMetadataDomainRepository(repository);
return pentahoMetadataDomainRepository;
}
use of org.pentaho.platform.repository2.unified.RepositoryUtils in project data-access by pentaho.
the class SerializeServiceIT method createMetadataDomainRepository.
public PentahoMetadataDomainRepository createMetadataDomainRepository() throws Exception {
IUnifiedRepository repository = new FileSystemBackedUnifiedRepository("target/test-classes/solution1");
booter.defineInstance(IUnifiedRepository.class, repository);
Assert.assertNotNull(new RepositoryUtils(repository).getFolder("/etc/metadata", true, true, null));
Assert.assertNotNull(new RepositoryUtils(repository).getFolder("/etc/mondrian", true, true, null));
Assert.assertNotNull(new RepositoryUtils(repository).getFolder("/savetest", true, true, null));
PentahoMetadataDomainRepository pentahoMetadataDomainRepository = new PentahoMetadataDomainRepository(repository);
return pentahoMetadataDomainRepository;
}
use of org.pentaho.platform.repository2.unified.RepositoryUtils in project pentaho-platform by pentaho.
the class PentahoMetadataDomainRepositoryTest method setUp.
@Before
public void setUp() throws Exception {
// File tempDir = File.createTempFile("test", "");
// tempDir.delete();
// tempDir.mkdir();
// System.err.println("tempDir = " + tempDir.getAbsolutePath());
// repository = new FileSystemBackedUnifiedRepository(tempDir);
// new RepositoryUtils(repository).getFolder("/etc/metadata", true, true, null);
final IPentahoSession mockSession = Mockito.mock(IPentahoSession.class);
PentahoSessionHolder.setSession(mockSession);
repository = new FileSystemBackedUnifiedRepository();
repository.deleteFile(new RepositoryUtils(repository).getFolder("/etc/metadata", true, true, null).getId(), true, null);
assertNotNull(new RepositoryUtils(repository).getFolder("/etc/metadata", true, true, null));
final MockXmiParser xmiParser = new MockXmiParser();
domainRepository = createDomainRepository(repository, null, xmiParser, null);
domainRepositorySpy = spy(domainRepository);
aclNodeHelper = mock(IAclNodeHelper.class);
doReturn(aclNodeHelper).when(domainRepositorySpy).getAclHelper();
doNothing().when(aclNodeHelper).removeAclFor(any(RepositoryFile.class));
when(aclNodeHelper.canAccess(any(RepositoryFile.class), any(EnumSet.class))).thenReturn(true);
while (domainRepositorySpy.getDomainIds().size() > 0) {
domainRepositorySpy.removeDomain(domainRepositorySpy.getDomainIds().iterator().next());
}
}
use of org.pentaho.platform.repository2.unified.RepositoryUtils in project data-access by pentaho.
the class DatasourceResourceIT method createMetadataDomainRepository.
private static PentahoMetadataDomainRepository createMetadataDomainRepository() throws Exception {
IUnifiedRepository repository = new FileSystemBackedUnifiedRepository("target/test-classes/dsw");
mp.defineInstance(IUnifiedRepository.class, repository);
Assert.assertNotNull(new RepositoryUtils(repository).getFolder("/etc/metadata", true, true, null));
Assert.assertNotNull(new RepositoryUtils(repository).getFolder("/etc/mondrian", true, true, null));
PentahoMetadataDomainRepository pentahoMetadataDomainRepository = new PentahoMetadataDomainRepository(repository);
return pentahoMetadataDomainRepository;
}
Aggregations