Search in sources :

Example 6 with PathBasedSystemSettings

use of org.pentaho.platform.engine.core.system.PathBasedSystemSettings in project pdi-platform-plugin by pentaho.

the class PdiActionTest method init.

@Before
public void init() throws SchedulerException, PlatformInitializationException {
    // $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);
    scheduler = new QuartzScheduler();
    scheduler.start();
    mp.define(IUserRoleListService.class, StubUserRoleListService.class);
    mp.define(UserDetailsService.class, StubUserDetailService.class);
    mp.defineInstance(IAuthorizationPolicy.class, new TestAuthorizationPolicy());
    mp.setSettingsProvider(new PathBasedSystemSettings());
    mp.defineInstance(IScheduler.class, scheduler);
    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) QuartzScheduler(org.pentaho.platform.scheduler2.quartz.QuartzScheduler) 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 7 with PathBasedSystemSettings

use of org.pentaho.platform.engine.core.system.PathBasedSystemSettings 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 PathBasedSystemSettings

use of org.pentaho.platform.engine.core.system.PathBasedSystemSettings in project data-access by pentaho.

the class DataSourcePublishIT method setUpClass.

@BeforeClass
public static void setUpClass() throws Exception {
    // folder cannot be deleted at teardown shutdown hooks have not yet necessarily completed
    // parent folder must match jcrRepository.homeDir bean property in repository-test-override.spring.xml
    FileUtils.deleteDirectory(new File("/tmp/repository-future/jackrabbit-test-TRUNK"));
    PentahoSessionHolder.setStrategyName(PentahoSessionHolder.MODE_GLOBAL);
    // register repository spring context for correct work of <pen:list>
    final StandaloneSpringPentahoObjectFactory pentahoObjectFactory = new StandaloneSpringPentahoObjectFactory();
    GenericApplicationContext appCtx = new GenericApplicationContext();
    XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(appCtx);
    xmlReader.loadBeanDefinitions("classpath:/repository.spring.xml");
    xmlReader.loadBeanDefinitions("classpath:/solutionACL/system/repository-test-override.spring.xml");
    xmlReader.loadBeanDefinitions("classpath:/solutionACL/system/importExport.xml");
    xmlReader.loadBeanDefinitions("classpath:/solutionACL/system/pentahoObjects.spring.xml");
    xmlReader.loadBeanDefinitions("classpath:/jackrabbit-test-repo.xml");
    pentahoObjectFactory.init(null, appCtx);
    PentahoSystem.registerObjectFactory(pentahoObjectFactory);
    PentahoSystem.setSystemSettingsService(new PathBasedSystemSettings());
    FileUtils.deleteDirectory(new File("/tmp/data-access/jackrabbit-test-TRUNK"));
}
Also used : GenericApplicationContext(org.springframework.context.support.GenericApplicationContext) XmlBeanDefinitionReader(org.springframework.beans.factory.xml.XmlBeanDefinitionReader) RepositoryFile(org.pentaho.platform.api.repository2.unified.RepositoryFile) File(java.io.File) PathBasedSystemSettings(org.pentaho.platform.engine.core.system.PathBasedSystemSettings) StandaloneSpringPentahoObjectFactory(org.pentaho.platform.engine.core.system.objfac.StandaloneSpringPentahoObjectFactory) BeforeClass(org.junit.BeforeClass)

Example 9 with PathBasedSystemSettings

use of org.pentaho.platform.engine.core.system.PathBasedSystemSettings in project pentaho-platform by pentaho.

the class BaseTestCase method init.

protected void init(String solnPath) {
    PentahoSystem.setSystemSettingsService(new PathBasedSystemSettings());
    // $NON-NLS-1$
    applicationContext = new StandaloneApplicationContext(solnPath, "");
    applicationContext.setFullyQualifiedServerURL(getFullyQualifiedServerURL());
    // $NON-NLS-1$ //$NON-NLS-2$
    String inContainer = System.getProperty("incontainer", "false");
    if (inContainer.equalsIgnoreCase("false")) {
        // $NON-NLS-1$
        // Setup simple-jndi for datasources
        // $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", getSolutionPath() + "/system/simple-jndi");
        // $NON-NLS-1$ //$NON-NLS-2$
        System.setProperty("org.osjava.sj.delimiter", "/");
    }
    // $NON-NLS-1$
    String objectFactoryCreatorCfgFile = getSolutionPath() + SYSTEM_FOLDER + "/" + DEFAULT_SPRING_CONFIG_FILE_NAME;
    IPentahoObjectFactory pentahoObjectFactory = new StandaloneSpringPentahoObjectFactory();
    pentahoObjectFactory.init(objectFactoryCreatorCfgFile, null);
    PentahoSystem.registerObjectFactory(pentahoObjectFactory);
    PentahoSystem.init(applicationContext);
    // $NON-NLS-1$
    session = new StandaloneSession("system");
}
Also used : IPentahoObjectFactory(org.pentaho.platform.api.engine.IPentahoObjectFactory) StandaloneSession(org.pentaho.platform.engine.core.system.StandaloneSession) StandaloneApplicationContext(org.pentaho.platform.engine.core.system.StandaloneApplicationContext) PathBasedSystemSettings(org.pentaho.platform.engine.core.system.PathBasedSystemSettings) StandaloneSpringPentahoObjectFactory(org.pentaho.platform.engine.core.system.objfac.StandaloneSpringPentahoObjectFactory)

Example 10 with PathBasedSystemSettings

use of org.pentaho.platform.engine.core.system.PathBasedSystemSettings in project pentaho-platform by pentaho.

the class MicroPlatform method start.

@Override
public boolean start() throws PlatformInitializationException {
    PentahoSystem.setSystemSettingsService(new PathBasedSystemSettings());
    // initialize log4j to write to the console
    BasicConfigurator.configure();
    boolean ret = super.start();
    // and other errors, not to mention it's inefficient
    try {
        Object o = PentahoSystem.get(ISolutionEngine.class);
        if (o != null && o instanceof ILogger) {
            ((ILogger) o).setLoggingLevel(ILogger.DEBUG);
        }
    } catch (Throwable e) {
        logger.error("Failed to set DEBUG log level due to ISolutionEngine not being available in MicroPlatform");
    }
    return ret;
}
Also used : ILogger(org.pentaho.platform.api.engine.ILogger) PathBasedSystemSettings(org.pentaho.platform.engine.core.system.PathBasedSystemSettings)

Aggregations

PathBasedSystemSettings (org.pentaho.platform.engine.core.system.PathBasedSystemSettings)13 StandaloneApplicationContext (org.pentaho.platform.engine.core.system.StandaloneApplicationContext)7 StandaloneSpringPentahoObjectFactory (org.pentaho.platform.engine.core.system.objfac.StandaloneSpringPentahoObjectFactory)7 IPentahoObjectFactory (org.pentaho.platform.api.engine.IPentahoObjectFactory)6 File (java.io.File)5 StandaloneSession (org.pentaho.platform.engine.core.system.StandaloneSession)5 GenericApplicationContext (org.springframework.context.support.GenericApplicationContext)4 ApplicationContext (org.springframework.context.ApplicationContext)3 Before (org.junit.Before)2 BeforeClass (org.junit.BeforeClass)2 IPentahoSession (org.pentaho.platform.api.engine.IPentahoSession)2 FileSystemBackedUnifiedRepository (org.pentaho.platform.repository2.unified.fs.FileSystemBackedUnifiedRepository)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Properties (java.util.Properties)1 Test (org.junit.Test)1 KettleException (org.pentaho.di.core.exception.KettleException)1 KettlePluginException (org.pentaho.di.core.exception.KettlePluginException)1 MetaverseException (org.pentaho.metaverse.api.MetaverseException)1 MetaverseUtil (org.pentaho.metaverse.util.MetaverseUtil)1