Search in sources :

Example 6 with FileSystemBackedUnifiedRepository

use of org.pentaho.platform.repository2.unified.fs.FileSystemBackedUnifiedRepository in project pdi-platform-plugin by pentaho.

the class PdiContentGeneratorTest method setUp.

@Before
public void setUp() throws Exception {
    // $NON-NLS-1$ //$NON-NLS-2$
    System.setProperty("java.naming.factory.initial", "org.osjava.sj.SimpleContextFactory");
    // $NON-NLS-1$ //$NON-NLS-2$
    System.setProperty("org.osjava.sj.root", SOLUTION_REPOSITORY);
    // $NON-NLS-1$ //$NON-NLS-2$
    System.setProperty("org.osjava.sj.delimiter", "/");
    // $NON-NLS-2$
    System.setProperty("PENTAHO_SYS_CFG_PATH", new File(SOLUTION_REPOSITORY + "/pentaho.xml").getAbsolutePath());
    IPentahoSession session = new StandaloneSession();
    PentahoSessionHolder.setSession(session);
    pdiContentGenerator = new PdiContentGenerator();
    pdiAction = new PdiAction();
    pdiAction.setRepositoryName(KettleFileRepositoryMeta.REPOSITORY_TYPE_ID);
    pdiContentGenerator.setPdiAction(pdiAction);
    outputStream = mock(OutputStream.class);
    repositoryFile = mock(RepositoryFile.class);
    pdiContentGenerator.setOutputStream(outputStream);
    pdiContentGenerator.setRepositoryFile(repositoryFile);
    scheduler = new QuartzScheduler();
    scheduler.start();
    mp.define(IUserRoleListService.class, StubUserRoleListService.class);
    mp.define(UserDetailsService.class, StubUserDetailService.class);
    mp.defineInstance(IAuthorizationPolicy.class, new TestAuthorizationPolicy());
    mp.defineInstance(IScheduler.class, scheduler);
    mp.define(ISolutionEngine.class, SolutionEngine.class);
    FileSystemBackedUnifiedRepository repo = new FileSystemBackedUnifiedRepository(SOLUTION_REPOSITORY);
    mp.defineInstance(IUnifiedRepository.class, repo);
    mp.start();
}
Also used : StandaloneSession(org.pentaho.platform.engine.core.system.StandaloneSession) IPentahoSession(org.pentaho.platform.api.engine.IPentahoSession) OutputStream(java.io.OutputStream) QuartzScheduler(org.pentaho.platform.scheduler2.quartz.QuartzScheduler) RepositoryFile(org.pentaho.platform.api.repository2.unified.RepositoryFile) File(java.io.File) RepositoryFile(org.pentaho.platform.api.repository2.unified.RepositoryFile) FileSystemBackedUnifiedRepository(org.pentaho.platform.repository2.unified.fs.FileSystemBackedUnifiedRepository) Before(org.junit.Before)

Example 7 with FileSystemBackedUnifiedRepository

use of org.pentaho.platform.repository2.unified.fs.FileSystemBackedUnifiedRepository in project pdi-platform-plugin by pentaho.

the class UserParametersTest method init.

@Before
public void init() throws PlatformInitializationException {
    System.setProperty("java.naming.factory.initial", "org.osjava.sj.SimpleContextFactory");
    System.setProperty("org.osjava.sj.root", "test-src/simple-jndi");
    System.setProperty("org.osjava.sj.delimiter", "/");
    System.setProperty("PENTAHO_SYS_CFG_PATH", new File(SOLUTION_REPOSITORY + "/pentaho.xml").getAbsolutePath());
    IPentahoSession session = new StandaloneSession();
    PentahoSessionHolder.setSession(session);
    mp.define(IUserRoleListService.class, StubUserRoleListService.class);
    mp.define(UserDetailsService.class, StubUserDetailService.class);
    mp.defineInstance(IAuthorizationPolicy.class, new TestAuthorizationPolicy());
    mp.setSettingsProvider(new PathBasedSystemSettings());
    mp.define(ISolutionEngine.class, SolutionEngine.class);
    FileSystemBackedUnifiedRepository repo = new FileSystemBackedUnifiedRepository(SOLUTION_REPOSITORY);
    mp.defineInstance(IUnifiedRepository.class, repo);
    mp.start();
    SecurityHelper.getInstance().becomeUser(TEST_USER);
}
Also used : StandaloneSession(org.pentaho.platform.engine.core.system.StandaloneSession) IPentahoSession(org.pentaho.platform.api.engine.IPentahoSession) File(java.io.File) PathBasedSystemSettings(org.pentaho.platform.engine.core.system.PathBasedSystemSettings) FileSystemBackedUnifiedRepository(org.pentaho.platform.repository2.unified.fs.FileSystemBackedUnifiedRepository) Before(org.junit.Before)

Example 8 with FileSystemBackedUnifiedRepository

use of org.pentaho.platform.repository2.unified.fs.FileSystemBackedUnifiedRepository in project data-access by pentaho.

the class AnalysisServiceTest method initPlatform.

@BeforeClass
public static void initPlatform() throws Exception {
    MicroPlatform platform = new MicroPlatform();
    metadataRepository = mock(IMetadataDomainRepository.class);
    platform.defineInstance(IMetadataDomainRepository.class, metadataRepository);
    importer = mock(IPlatformImporter.class);
    platform.defineInstance(IPlatformImporter.class, importer);
    policy = mock(IAuthorizationPolicy.class);
    platform.defineInstance(IAuthorizationPolicy.class, policy);
    catalogService = mock(IAclAwareMondrianCatalogService.class);
    platform.defineInstance(IMondrianCatalogService.class, catalogService);
    permissionHandler = mock(IDataAccessPermissionHandler.class);
    platform.defineInstance(IDataAccessPermissionHandler.class, permissionHandler);
    final IUnifiedRepository unifiedRepository = new FileSystemBackedUnifiedRepository("target/test-classes/solution1");
    platform.defineInstance(IUnifiedRepository.class, unifiedRepository);
    platform.start();
    acl.setOwner("owner");
    acl.setOwnerType(RepositoryFileSid.Type.USER.ordinal());
}
Also used : IAuthorizationPolicy(org.pentaho.platform.api.engine.IAuthorizationPolicy) IDataAccessPermissionHandler(org.pentaho.platform.dataaccess.datasource.wizard.service.impl.IDataAccessPermissionHandler) IAclAwareMondrianCatalogService(org.pentaho.platform.plugin.action.mondrian.catalog.IAclAwareMondrianCatalogService) MicroPlatform(org.pentaho.test.platform.engine.core.MicroPlatform) IMetadataDomainRepository(org.pentaho.metadata.repository.IMetadataDomainRepository) IPlatformImporter(org.pentaho.platform.plugin.services.importer.IPlatformImporter) IUnifiedRepository(org.pentaho.platform.api.repository2.unified.IUnifiedRepository) FileSystemBackedUnifiedRepository(org.pentaho.platform.repository2.unified.fs.FileSystemBackedUnifiedRepository) BeforeClass(org.junit.BeforeClass)

Example 9 with FileSystemBackedUnifiedRepository

use of org.pentaho.platform.repository2.unified.fs.FileSystemBackedUnifiedRepository 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 10 with FileSystemBackedUnifiedRepository

use of org.pentaho.platform.repository2.unified.fs.FileSystemBackedUnifiedRepository 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)

Aggregations

FileSystemBackedUnifiedRepository (org.pentaho.platform.repository2.unified.fs.FileSystemBackedUnifiedRepository)19 IUnifiedRepository (org.pentaho.platform.api.repository2.unified.IUnifiedRepository)12 File (java.io.File)11 Before (org.junit.Before)10 MicroPlatform (org.pentaho.test.platform.engine.core.MicroPlatform)8 StandaloneSession (org.pentaho.platform.engine.core.system.StandaloneSession)7 IPentahoSession (org.pentaho.platform.api.engine.IPentahoSession)5 RepositoryFile (org.pentaho.platform.api.repository2.unified.RepositoryFile)4 RepositoryUtils (org.pentaho.platform.repository2.unified.RepositoryUtils)4 InputStream (java.io.InputStream)3 Test (org.junit.Test)3 IMetadataDomainRepository (org.pentaho.metadata.repository.IMetadataDomainRepository)3 PentahoMetadataDomainRepository (org.pentaho.platform.plugin.services.metadata.PentahoMetadataDomainRepository)3 FileInputStream (java.io.FileInputStream)2 IOException (java.io.IOException)2 OutputStream (java.io.OutputStream)2 EnumSet (java.util.EnumSet)2 HashMap (java.util.HashMap)2 IAuthorizationPolicy (org.pentaho.platform.api.engine.IAuthorizationPolicy)2 IAclNodeHelper (org.pentaho.platform.api.repository2.unified.IAclNodeHelper)2