use of org.pentaho.platform.plugin.services.metadata.PentahoMetadataDomainRepository in project pentaho-platform by pentaho.
the class SolutionFolderIT method testNoLocaleFileDiscovery.
/**
* Tests MetadataDomainRepository.getLocalePropertyFilenames() where one xmi resource and no property file exists in
* the metadata folder.
*/
@Test
public void testNoLocaleFileDiscovery() {
PentahoMetadataDomainRepository domainRepository;
IUnifiedRepository repository = new FileSystemBackedUnifiedRepository();
repository = new FileSystemBackedUnifiedRepository(BI_DEVELOPERS_FULL_PATH);
domainRepository = new PentahoMetadataDomainRepository(repository);
File metadataXmiFile = null;
try {
metadataXmiFile = localeTestUtil.createFile(BI_DEVELOPERS_FULL_PATH, XMI_FILENAME_EXTENSION);
Map<String, InputStream> localizationFiles = domainRepository.getDomainFilesData("metadata");
assertEquals(0, localizationFiles.size());
} catch (IOException ioe) {
fail(ioe.getMessage());
} catch (Exception e) {
e.printStackTrace();
} finally {
if (metadataXmiFile != null) {
metadataXmiFile.delete();
}
}
}
use of org.pentaho.platform.plugin.services.metadata.PentahoMetadataDomainRepository in project data-access by pentaho.
the class MetadataServiceTest method testSetMetadataDatasourceAclNoAcl.
@Test
public void testSetMetadataDatasourceAclNoAcl() throws Exception {
String domainId = DOMAIN_ID;
doReturn(true).when(metadataService).canManageACL();
final Map<String, InputStream> domainFilesData = mock(Map.class);
when(domainFilesData.isEmpty()).thenReturn(false);
when(((PentahoMetadataDomainRepository) metadataService.metadataDomainRepository).getDomainFilesData(domainId)).thenReturn(domainFilesData);
metadataService.setMetadataAcl(domainId, null);
verify(metadataService.aclAwarePentahoMetadataDomainRepositoryImporter).setAclFor(eq(domainId), (RepositoryFileAcl) isNull());
}
use of org.pentaho.platform.plugin.services.metadata.PentahoMetadataDomainRepository in project data-access by pentaho.
the class MetadataServiceTest method testSetMetadataDatasourceAcl.
@Test
public void testSetMetadataDatasourceAcl() throws Exception {
String domainId = DOMAIN_ID;
final RepositoryFileAclDto aclDto = new RepositoryFileAclDto();
aclDto.setOwner("owner");
aclDto.setOwnerType(RepositoryFileSid.Type.USER.ordinal());
doReturn(true).when(metadataService).canManageACL();
final Map<String, InputStream> domainFilesData = mock(Map.class);
when(domainFilesData.isEmpty()).thenReturn(false);
when(((PentahoMetadataDomainRepository) metadataService.metadataDomainRepository).getDomainFilesData(domainId)).thenReturn(domainFilesData);
metadataService.setMetadataAcl(domainId, aclDto);
verify(metadataService.aclAwarePentahoMetadataDomainRepositoryImporter).setAclFor(eq(domainId), eq(new RepositoryFileAclAdapter().unmarshal(aclDto)));
}
use of org.pentaho.platform.plugin.services.metadata.PentahoMetadataDomainRepository 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.plugin.services.metadata.PentahoMetadataDomainRepository 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;
}
Aggregations