use of org.pentaho.platform.engine.core.system.objfac.StandaloneSpringPentahoObjectFactory 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.objfac.StandaloneSpringPentahoObjectFactory in project pentaho-platform by pentaho.
the class MicroPlatform method setSpringConfig.
/**
* Sets the StandaloneSpringPentahoObjectFactory for the Pentaho platform by xml path
*
* @return
*/
public void setSpringConfig(String cfgFile) {
IPentahoObjectFactory pentahoObjectFactory = new StandaloneSpringPentahoObjectFactory();
pentahoObjectFactory.init(cfgFile, null);
setFactory(pentahoObjectFactory);
}
use of org.pentaho.platform.engine.core.system.objfac.StandaloneSpringPentahoObjectFactory 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.objfac.StandaloneSpringPentahoObjectFactory in project pentaho-platform by pentaho.
the class StandaloneSpringPentahoObjectFactoryTest method testGetAll.
public void testGetAll() throws Exception {
StandaloneSession session = new StandaloneSession();
StandaloneSpringPentahoObjectFactory factory = new StandaloneSpringPentahoObjectFactory();
factory.init("src/test/resources/solution/system/pentahoObjects.spring.xml", null);
PentahoSystem.registerObjectFactory(factory);
List<MimeTypeListener> mimes = PentahoSystem.getAll(MimeTypeListener.class, session);
assertNotNull(mimes);
assertEquals(5, mimes.size());
assertNotSame(mimes.get(0), mimes.get(1));
}
use of org.pentaho.platform.engine.core.system.objfac.StandaloneSpringPentahoObjectFactory in project pentaho-platform by pentaho.
the class StandaloneSpringPentahoObjectFactoryTest method testNoInit.
public void testNoInit() throws Exception {
StandaloneSession session = new StandaloneSession();
StandaloneSpringPentahoObjectFactory factory = new StandaloneSpringPentahoObjectFactory();
try {
GoodObject obj = factory.get(GoodObject.class, session);
assertNotNull(obj);
assertFalse(true);
} catch (ObjectFactoryException e) {
assertTrue(true);
}
}
Aggregations