Search in sources :

Example 31 with MicroPlatform

use of org.pentaho.test.platform.engine.core.MicroPlatform in project pentaho-platform by pentaho.

the class EmailResourceTest method setUp.

@Override
protected void setUp() throws Exception {
    // Setup the temp email config file
    mp = new MicroPlatform();
    mp.defineInstance(IAuthorizationPolicy.class, new TestAuthorizationPolicy());
    mp.start();
    defaultConfigFile = File.createTempFile("email_config_", ".xml");
    this.emailResource = new EmailResource(new EmailService(defaultConfigFile));
}
Also used : MicroPlatform(org.pentaho.test.platform.engine.core.MicroPlatform) EmailService(org.pentaho.platform.plugin.services.email.EmailService)

Example 32 with MicroPlatform

use of org.pentaho.test.platform.engine.core.MicroPlatform in project pentaho-platform by pentaho.

the class RepositoryCleanerSystemListenerTest method prepareMp.

private void prepareMp() throws Exception {
    mp = new MicroPlatform();
    mp.defineInstance(IScheduler.class, scheduler);
    mp.start();
}
Also used : MicroPlatform(org.pentaho.test.platform.engine.core.MicroPlatform)

Example 33 with MicroPlatform

use of org.pentaho.test.platform.engine.core.MicroPlatform in project pentaho-platform by pentaho.

the class AgileBITests method init.

/**
 * Creates the files system that mimicks a BI Server solution. Also creates a LocaleTestUtility that is used to create
 * the files needed for the tests.
 * <p/>
 * A MicroPlatform is also created as it is needed for filtering the property files that may exist in the metadata
 * folder.
 *
 * @throws Exception
 */
@Before
public void init() throws Exception {
    // create the solution folder
    SOLUTION_PATH = System.getProperty("java.io.tmpdir") + "/" + SOLUTION_FOLDER_NAME;
    METADATA_PATH = RESOURCE_FOLDER_NAME + "/" + METADATA_FOLDER_NAME;
    File solutionFolder = new File(SOLUTION_PATH);
    if (!solutionFolder.exists()) {
        if (!solutionFolder.mkdir()) {
            throw new Exception("Unable to create " + SOLUTION_PATH);
        }
    }
    // Create the resource folder
    String resourcePath = SOLUTION_PATH + "/" + RESOURCE_FOLDER_NAME;
    File resourceFolder = new File(resourcePath);
    if (!resourceFolder.exists()) {
        if (!resourceFolder.mkdir()) {
            throw new Exception("Unable to create " + resourcePath);
        }
    }
    // Create the resource metadata folder
    String metadataPath = SOLUTION_PATH + "/" + RESOURCE_FOLDER_NAME + "/" + METADATA_FOLDER_NAME;
    File metadataFolder = new File(metadataPath);
    if (!metadataFolder.exists()) {
        if (!metadataFolder.mkdir()) {
            throw new Exception("Unable to create " + metadataPath);
        }
    }
    localeTestUtil = new LocaleTestUtil();
    MicroPlatform mp = new MicroPlatform(SOLUTION_PATH);
    try {
        mp.start();
    } catch (PlatformInitializationException pie) {
        pie.printStackTrace();
    }
}
Also used : PlatformInitializationException(org.pentaho.platform.engine.core.system.boot.PlatformInitializationException) MicroPlatform(org.pentaho.test.platform.engine.core.MicroPlatform) File(java.io.File) PlatformInitializationException(org.pentaho.platform.engine.core.system.boot.PlatformInitializationException) Before(org.junit.Before)

Example 34 with MicroPlatform

use of org.pentaho.test.platform.engine.core.MicroPlatform in project pentaho-platform by pentaho.

the class UserDetailsRoleListWebServiceBase method init0.

@Before
public void init0() {
    microPlatform = new MicroPlatform(getSolutionPath());
    microPlatform.define(IUserRoleListService.class, MockUserRoleListService.class);
    microPlatform.defineInstance("useMultiByteEncoding", new Boolean(false));
}
Also used : MicroPlatform(org.pentaho.test.platform.engine.core.MicroPlatform) Before(org.junit.Before)

Example 35 with MicroPlatform

use of org.pentaho.test.platform.engine.core.MicroPlatform in project pentaho-platform by pentaho.

the class UserRoleWebServiceBase method init0.

@Before
public void init0() {
    microPlatform = new MicroPlatform(getSolutionPath());
    microPlatform.define(USER_ROLE_DAO_TXN, UserRoleDaoMock.class);
    mockPolicy = mock(IAuthorizationPolicy.class);
    mockUserAsAdmin(false);
    microPlatform.define(IAuthorizationPolicy.class.getSimpleName(), mockPolicy);
    microPlatform.define("passwordEncoder", PasswordEncoderMock.class);
    UserRoleDaoMock userRoleDao = PentahoSystem.get(UserRoleDaoMock.class, USER_ROLE_DAO_TXN, null);
    users.clear();
    roles.clear();
    userRoleDao.createUser(null, "test1", "test", "test", null);
    userRoleDao.createUser(null, "test2", "test", "test", null);
    userRoleDao.createRole(null, "testRole1", "test role", new String[] { "test1" });
    userRoleDao.createRole(null, "testRole2", "test role", new String[] { "test2" });
}
Also used : IAuthorizationPolicy(org.pentaho.platform.api.engine.IAuthorizationPolicy) MicroPlatform(org.pentaho.test.platform.engine.core.MicroPlatform) Before(org.junit.Before)

Aggregations

MicroPlatform (org.pentaho.test.platform.engine.core.MicroPlatform)64 Before (org.junit.Before)40 File (java.io.File)15 Test (org.junit.Test)12 IAuthorizationPolicy (org.pentaho.platform.api.engine.IAuthorizationPolicy)10 IUnifiedRepository (org.pentaho.platform.api.repository2.unified.IUnifiedRepository)10 RepositoryFile (org.pentaho.platform.api.repository2.unified.RepositoryFile)10 RepositoryFileProxyFactory (org.pentaho.platform.repository2.unified.jcr.RepositoryFileProxyFactory)9 StandaloneSession (org.pentaho.platform.engine.core.system.StandaloneSession)8 FileSystemBackedUnifiedRepository (org.pentaho.platform.repository2.unified.fs.FileSystemBackedUnifiedRepository)8 BeforeClass (org.junit.BeforeClass)7 IPluginResourceLoader (org.pentaho.platform.api.engine.IPluginResourceLoader)6 ArrayList (java.util.ArrayList)5 IUserRoleListService (org.pentaho.platform.api.engine.IUserRoleListService)5 SystemSettings (org.pentaho.platform.engine.core.system.SystemSettings)5 PluginResourceLoader (org.pentaho.platform.plugin.services.pluginmgr.PluginResourceLoader)5 Serializable (java.io.Serializable)4 HashMap (java.util.HashMap)4 Matchers.anyString (org.mockito.Matchers.anyString)4 ITenant (org.pentaho.platform.api.mt.ITenant)4