Search in sources :

Example 1 with StandaloneApplicationContext

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

the class PentahoSystemBoot method createApplicationContext.

/**
 * Override this method if you want to change the type and state of the application context used to initialize
 * the system.
 *
 * @return an application context for system initialization
 */
protected IApplicationContext createApplicationContext() {
    // $NON-NLS-1$
    StandaloneApplicationContext appCtxt = new StandaloneApplicationContext(getFilePath(), "");
    appCtxt.setFullyQualifiedServerURL(fullyQualifiedServerUrl);
    return appCtxt;
}
Also used : StandaloneApplicationContext(org.pentaho.platform.engine.core.system.StandaloneApplicationContext)

Example 2 with StandaloneApplicationContext

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

the class HttpMimeTypeListenerIT method setUp.

public void setUp() {
    // $NON-NLS-1$
    StandaloneApplicationContext applicationContext = new StandaloneApplicationContext(getSolutionPath(), "");
    PentahoSystem.init(applicationContext, getRequiredListeners());
}
Also used : StandaloneApplicationContext(org.pentaho.platform.engine.core.system.StandaloneApplicationContext)

Example 3 with StandaloneApplicationContext

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

the class ProxyServletIT method setUp.

public void setUp() {
    // $NON-NLS-1$
    StandaloneApplicationContext applicationContext = new StandaloneApplicationContext(getSolutionPath(), "");
    PentahoSystem.init(applicationContext, getRequiredListeners());
}
Also used : StandaloneApplicationContext(org.pentaho.platform.engine.core.system.StandaloneApplicationContext)

Example 4 with StandaloneApplicationContext

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

the class UIServletIT method setUp.

public void setUp() {
    // $NON-NLS-1$
    StandaloneApplicationContext applicationContext = new StandaloneApplicationContext(getSolutionPath(), "");
    PentahoSystem.init(applicationContext, getRequiredListeners());
    IMessageFormatter msgFormatter = new MessageFormatter();
    PentahoSystem.registerObject(msgFormatter);
}
Also used : IMessageFormatter(org.pentaho.platform.api.engine.IMessageFormatter) StandaloneApplicationContext(org.pentaho.platform.engine.core.system.StandaloneApplicationContext) IMessageFormatter(org.pentaho.platform.api.engine.IMessageFormatter) MessageFormatter(org.pentaho.platform.engine.services.MessageFormatter)

Example 5 with StandaloneApplicationContext

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

the class StandaloneSessionTest method testTempFileDeleter.

public void testTempFileDeleter() throws Exception {
    // get one with an id. //$NON-NLS-1$
    StandaloneSession session = new StandaloneSession("tempfiledeleter", UUIDUtil.getUUIDAsString());
    StandaloneTempFileDeleter deleter = new StandaloneTempFileDeleter();
    // $NON-NLS-1$ //$NON-NLS-2$
    StandaloneApplicationContext appContext = new StandaloneApplicationContext(getSolutionRoot(), "");
    // $NON-NLS-1$ //$NON-NLS-2$
    File file1 = appContext.createTempFile(session, "testTempFileDeleter", "txt", true);
    // File object was returned
    assertNotNull(file1);
    // File exists
    assertTrue(file1.exists());
    // Deleter wasn't bound to session, so no delete
    assertFalse(deleter.hasTempFile(file1.getName()));
    // Bind deleter to the session
    session.setAttribute(ITempFileDeleter.DELETER_SESSION_VARIABLE, deleter);
    // $NON-NLS-1$ //$NON-NLS-2$
    File file2 = appContext.createTempFile(session, "testTempFileDeleter", "txt", true);
    // File object was returned
    assertNotNull(file2);
    // File exists
    assertTrue(file2.exists());
    // Deleter is bound to session
    assertTrue(deleter.hasTempFile(file2.getName()));
    // File names should be unique
    assertFalse(file1.getName().equals(file2.getName()));
    deleter.doTempFileCleanup();
    // This file will be left over
    assertTrue(file1.exists());
    // The deleter should have removed this
    assertFalse(file2.exists());
    // After doTempFileCleanup() the list should be empty
    assertFalse(deleter.hasTempFile(file2.getName()));
    // The tearDown should blow away everything else...
    // Add known deleted file to the deleter
    deleter.trackTempFile(file2);
    // Validates cleanup doesn't choke on missing files
    deleter.doTempFileCleanup();
    // Test that IllegalArgumentException if passed a null
    try {
        deleter.trackTempFile(null);
        fail();
    } catch (IllegalArgumentException expected) {
    // ignored
    }
}
Also used : StandaloneSession(org.pentaho.platform.engine.core.system.StandaloneSession) StandaloneApplicationContext(org.pentaho.platform.engine.core.system.StandaloneApplicationContext) StandaloneTempFileDeleter(org.pentaho.platform.engine.core.system.StandaloneTempFileDeleter) File(java.io.File)

Aggregations

StandaloneApplicationContext (org.pentaho.platform.engine.core.system.StandaloneApplicationContext)23 StandaloneSpringPentahoObjectFactory (org.pentaho.platform.engine.core.system.objfac.StandaloneSpringPentahoObjectFactory)8 IPentahoObjectFactory (org.pentaho.platform.api.engine.IPentahoObjectFactory)7 PathBasedSystemSettings (org.pentaho.platform.engine.core.system.PathBasedSystemSettings)7 StandaloneSession (org.pentaho.platform.engine.core.system.StandaloneSession)5 File (java.io.File)4 ApplicationContext (org.springframework.context.ApplicationContext)4 GenericApplicationContext (org.springframework.context.support.GenericApplicationContext)4 Properties (java.util.Properties)3 Before (org.junit.Before)3 Test (org.junit.Test)3 IApplicationContext (org.pentaho.platform.api.engine.IApplicationContext)3 ISolutionEngine (org.pentaho.platform.api.engine.ISolutionEngine)3 ArrayList (java.util.ArrayList)2 Mock (mockit.Mock)2 IPentahoSession (org.pentaho.platform.api.engine.IPentahoSession)2 IRuntimeContext (org.pentaho.platform.api.engine.IRuntimeContext)2 IRuntimeRepository (org.pentaho.platform.api.repository.IRuntimeRepository)2 PentahoSystem (org.pentaho.platform.engine.core.system.PentahoSystem)2 FileInputStream (java.io.FileInputStream)1