use of org.pentaho.platform.engine.core.system.StandaloneSession in project pentaho-platform by pentaho.
the class BaseTest method run.
public IRuntimeContext run(String actionPath, IParameterProvider parameterProvider, String testName, String fileExtension) {
assertTrue(initOk);
OutputStream outputStream = null;
if (testName != null && fileExtension != null) {
outputStream = getOutputStream(testName, fileExtension);
}
IOutputHandler outputHandler = null;
if (outputStream != null) {
outputHandler = getOutputHandler(outputStream);
} else {
outputHandler = getOutputHandler((OutputStream) null);
}
String instanceId = null;
StandaloneSession initialSession = // $NON-NLS-1$
new StandaloneSession(Messages.getInstance().getString("BaseTest.DEBUG_JUNIT_SESSION"));
IPentahoSession session = sessionStartup(initialSession);
if (outputHandler != null) {
outputHandler.setSession(session);
}
return run(actionPath, instanceId, false, parameterProvider, outputHandler, session);
}
use of org.pentaho.platform.engine.core.system.StandaloneSession in project pentaho-platform by pentaho.
the class SolutionPublisherTest method testSolutionPublishI18N.
public void testSolutionPublishI18N() {
startTest();
Locale tmpLocale = LocaleHelper.getLocale();
// Try a different locale from the default
// $NON-NLS-1$
String localeLanguage = "fr";
// $NON-NLS-1$
String localeCountry = "FR";
Locale[] locales = Locale.getAvailableLocales();
if (locales != null) {
for (int i = 0; i < locales.length; i++) {
if (locales[i].getLanguage().equals(localeLanguage) && locales[i].getCountry().equals(localeCountry)) {
LocaleHelper.setLocale(locales[i]);
break;
}
}
}
SolutionPublisher publisher = new SolutionPublisher();
publisher.setLoggingLevel(getLoggingLevel());
StandaloneSession session = new StandaloneSession(Messages.getInstance().getString("BaseTest.DEBUG_JUNIT_SESSION"));
String result = publisher.publish(session, getLoggingLevel());
assertEquals(Messages.getInstance().getString("SolutionPublisher.USER_SOLUTION_REPOSITORY_UPDATED"), result);
// now set the locale back again
LocaleHelper.setLocale(tmpLocale);
finishTest();
}
use of org.pentaho.platform.engine.core.system.StandaloneSession 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);
}
use of org.pentaho.platform.engine.core.system.StandaloneSession 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();
}
use of org.pentaho.platform.engine.core.system.StandaloneSession 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);
}
Aggregations