Search in sources :

Example 1 with RepositoryUtils

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());
}
Also used : RepositoryUtils(org.pentaho.platform.repository2.unified.RepositoryUtils) LocalizationUtil(org.pentaho.metadata.util.LocalizationUtil) XmiParser(org.pentaho.metadata.util.XmiParser) DomainStorageException(org.pentaho.metadata.repository.DomainStorageException) DomainIdNullException(org.pentaho.metadata.repository.DomainIdNullException) DomainAlreadyExistsException(org.pentaho.metadata.repository.DomainAlreadyExistsException) IOException(java.io.IOException) Test(org.junit.Test)

Example 2 with RepositoryUtils

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;
}
Also used : RepositoryUtils(org.pentaho.platform.repository2.unified.RepositoryUtils) PentahoMetadataDomainRepository(org.pentaho.platform.plugin.services.metadata.PentahoMetadataDomainRepository) IUnifiedRepository(org.pentaho.platform.api.repository2.unified.IUnifiedRepository) FileSystemBackedUnifiedRepository(org.pentaho.platform.repository2.unified.fs.FileSystemBackedUnifiedRepository)

Example 3 with RepositoryUtils

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;
}
Also used : RepositoryUtils(org.pentaho.platform.repository2.unified.RepositoryUtils) PentahoMetadataDomainRepository(org.pentaho.platform.plugin.services.metadata.PentahoMetadataDomainRepository) IUnifiedRepository(org.pentaho.platform.api.repository2.unified.IUnifiedRepository) FileSystemBackedUnifiedRepository(org.pentaho.platform.repository2.unified.fs.FileSystemBackedUnifiedRepository)

Example 4 with RepositoryUtils

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());
    }
}
Also used : RepositoryUtils(org.pentaho.platform.repository2.unified.RepositoryUtils) IPentahoSession(org.pentaho.platform.api.engine.IPentahoSession) IAclNodeHelper(org.pentaho.platform.api.repository2.unified.IAclNodeHelper) EnumSet(java.util.EnumSet) RepositoryFile(org.pentaho.platform.api.repository2.unified.RepositoryFile) FileSystemBackedUnifiedRepository(org.pentaho.platform.repository2.unified.fs.FileSystemBackedUnifiedRepository) Before(org.junit.Before)

Example 5 with RepositoryUtils

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;
}
Also used : RepositoryUtils(org.pentaho.platform.repository2.unified.RepositoryUtils) PentahoMetadataDomainRepository(org.pentaho.platform.plugin.services.metadata.PentahoMetadataDomainRepository) IUnifiedRepository(org.pentaho.platform.api.repository2.unified.IUnifiedRepository) FileSystemBackedUnifiedRepository(org.pentaho.platform.repository2.unified.fs.FileSystemBackedUnifiedRepository)

Aggregations

RepositoryUtils (org.pentaho.platform.repository2.unified.RepositoryUtils)5 FileSystemBackedUnifiedRepository (org.pentaho.platform.repository2.unified.fs.FileSystemBackedUnifiedRepository)4 IUnifiedRepository (org.pentaho.platform.api.repository2.unified.IUnifiedRepository)3 PentahoMetadataDomainRepository (org.pentaho.platform.plugin.services.metadata.PentahoMetadataDomainRepository)3 IOException (java.io.IOException)1 EnumSet (java.util.EnumSet)1 Before (org.junit.Before)1 Test (org.junit.Test)1 DomainAlreadyExistsException (org.pentaho.metadata.repository.DomainAlreadyExistsException)1 DomainIdNullException (org.pentaho.metadata.repository.DomainIdNullException)1 DomainStorageException (org.pentaho.metadata.repository.DomainStorageException)1 LocalizationUtil (org.pentaho.metadata.util.LocalizationUtil)1 XmiParser (org.pentaho.metadata.util.XmiParser)1 IPentahoSession (org.pentaho.platform.api.engine.IPentahoSession)1 IAclNodeHelper (org.pentaho.platform.api.repository2.unified.IAclNodeHelper)1 RepositoryFile (org.pentaho.platform.api.repository2.unified.RepositoryFile)1