use of org.pentaho.platform.engine.core.system.StandaloneApplicationContext 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");
}
use of org.pentaho.platform.engine.core.system.StandaloneApplicationContext in project pentaho-platform by pentaho.
the class GenericPentahoTest method getSolutionEngine.
public ISolutionEngine getSolutionEngine(String path) {
// $NON-NLS-1$
StandaloneApplicationContext applicationContext = new StandaloneApplicationContext(path, "");
if (!PentahoSystem.getInitializedOK()) {
PentahoSystem.init(applicationContext);
// $NON-NLS-1$
assertTrue("PentahoSystem did not initialize", PentahoSystem.getInitializedOK());
}
// $NON-NLS-1$
IPentahoSession session = new StandaloneSession("system");
ISolutionEngine solutionEngine = PentahoSystem.get(ISolutionEngine.class, session);
// $NON-NLS-1$
assertNotNull("SolutionEngine is null", solutionEngine);
solutionEngine.setLoggingLevel(ILogger.ERROR);
solutionEngine.init(session);
try {
solutionEngine.setSession(session);
return solutionEngine;
} catch (Exception e) {
// we should not get here
e.printStackTrace();
assertTrue(e.getMessage(), false);
}
return null;
}
use of org.pentaho.platform.engine.core.system.StandaloneApplicationContext in project pentaho-platform by pentaho.
the class SystemSettingsTest method init.
public boolean init() {
PentahoSystem.setSystemSettingsService(new PathBasedSystemSettings());
File file = new File(SOLUTION_PATH + PENTAHO_XML_PATH);
StandaloneApplicationContext applicationContext = null;
if (file.exists()) {
// $NON-NLS-1$
applicationContext = new StandaloneApplicationContext(SystemSettingsTest.SOLUTION_PATH, "");
} else {
// $NON-NLS-1$
applicationContext = new StandaloneApplicationContext(SystemSettingsTest.ALT_SOLUTION_PATH, "");
}
// $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);
return PentahoSystem.init(applicationContext);
}
use of org.pentaho.platform.engine.core.system.StandaloneApplicationContext in project pentaho-platform by pentaho.
the class MessageFormatterTest method before.
@Before
public void before() {
mockedRuntimeRepository = mock(IRuntimeRepository.class);
mockedSolutionEngine = mock(ISolutionEngine.class);
mockedPentahoSystem = new MockUp<PentahoSystem>() {
@Mock
public IApplicationContext getApplicationContext() {
final String solutionPath = ".";
final String applicationPath = "";
return new StandaloneApplicationContext(solutionPath, applicationPath);
}
};
runtimeCtx = spy(new RuntimeContext("id", mockedSolutionEngine, "solutionName", makeRuntimeData(session), session, null, "processId", urlFactory, makeParameterProviders(session), new ArrayList<String>(), null));
}
use of org.pentaho.platform.engine.core.system.StandaloneApplicationContext in project pentaho-platform by pentaho.
the class PluginManagerNotConfiguredIT method setUp.
public void setUp() {
List<?> messages = TestManager.getMessagesList();
if (messages == null) {
messages = new ArrayList<String>();
}
if (initOk) {
return;
}
PentahoSystem.setSystemSettingsService(new PathBasedSystemSettings());
if (PentahoSystem.getApplicationContext() == null) {
// $NON-NLS-1$
StandaloneApplicationContext applicationContext = new StandaloneApplicationContext(getSolutionPath(), "");
// $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", "/");
}
ApplicationContext springApplicationContext = getSpringApplicationContext();
IPentahoObjectFactory pentahoObjectFactory = new StandaloneSpringPentahoObjectFactory();
pentahoObjectFactory.init(null, springApplicationContext);
PentahoSystem.registerObjectFactory(pentahoObjectFactory);
// force Spring to populate PentahoSystem
// $NON-NLS-1$
springApplicationContext.getBean("pentahoSystemProxy");
initOk = PentahoSystem.init(applicationContext);
} else {
initOk = true;
}
initOk = true;
}
Aggregations