Search in sources :

Example 51 with MicroPlatform

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

the class SolutionFolderIT method init.

/**
 * Creates the files system that mimics a BI Server solution. Also creates a LocaleTestUtility that is used to create
 * the files needed for the tests.
 *
 * 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() {
    // create solution paths
    SOLUTION_PATH = System.getProperty("java.io.tmpdir");
    BI_DEVELOPERS_FULL_PATH = SOLUTION_PATH + "/" + BI_DEVELOPERS_FOLDER_NAME;
    // BI_DEVELOPERS_FULL_PATH = SOLUTION_PATH + BI_DEVELOPERS_FOLDER_NAME;
    biDevelopersSolutionFolder = new File(BI_DEVELOPERS_FULL_PATH);
    if (!biDevelopersSolutionFolder.exists()) {
        biDevelopersSolutionFolder.delete();
        biDevelopersSolutionFolder.mkdir();
    }
    // utility to make this testing a bit easier
    localeTestUtil = new LocaleTestUtil();
    // create a platform
    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) Before(org.junit.Before)

Example 52 with MicroPlatform

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

the class UserRoleDaoEncodeIT method setUp.

@Before
public void setUp() throws Exception {
    mp = new MicroPlatform();
    // used by DefaultPentahoJackrabbitAccessControlHelper
    mp.defineInstance(IAuthorizationPolicy.class, authorizationPolicy);
    mp.defineInstance(ITenantManager.class, tenantManager);
    mp.define(ITenant.class, Tenant.class);
    mp.defineInstance("tenantedUserNameUtils", tenantedUserNameUtils);
    mp.defineInstance("tenantedRoleNameUtils", tenantedRoleNameUtils);
    mp.defineInstance("roleAuthorizationPolicyRoleBindingDaoTarget", roleBindingDaoTarget);
    mp.defineInstance("repositoryAdminUsername", repositoryAdminUsername);
    mp.defineInstance("RepositoryFileProxyFactory", new RepositoryFileProxyFactory(this.jcrTemplate, this.repositoryFileDao));
    mp.defineInstance("useMultiByteEncoding", new Boolean(false));
    // Start the micro-platform
    mp.start();
    loginAsRepositoryAdmin();
    setAclManagement();
    logout();
    startupCalled = true;
}
Also used : MicroPlatform(org.pentaho.test.platform.engine.core.MicroPlatform) RepositoryFileProxyFactory(org.pentaho.platform.repository2.unified.jcr.RepositoryFileProxyFactory) Before(org.junit.Before)

Example 53 with MicroPlatform

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

the class UserRoleDaoIT method setUp.

@Before
public void setUp() throws Exception {
    mp = new MicroPlatform();
    // used by DefaultPentahoJackrabbitAccessControlHelper
    mp.defineInstance(IAuthorizationPolicy.class, authorizationPolicy);
    mp.defineInstance(ITenantManager.class, tenantManager);
    mp.define(ITenant.class, Tenant.class);
    mp.defineInstance("tenantedUserNameUtils", tenantedUserNameUtils);
    mp.defineInstance("tenantedRoleNameUtils", tenantedRoleNameUtils);
    mp.defineInstance("roleAuthorizationPolicyRoleBindingDaoTarget", roleBindingDaoTarget);
    mp.defineInstance("repositoryAdminUsername", repositoryAdminUsername);
    mp.defineInstance("RepositoryFileProxyFactory", new RepositoryFileProxyFactory(this.jcrTemplate, this.repositoryFileDao));
    mp.defineInstance("useMultiByteEncoding", new Boolean(false));
    // Start the micro-platform
    mp.start();
    loginAsRepositoryAdmin();
    setAclManagement();
    logout();
    startupCalled = true;
}
Also used : MicroPlatform(org.pentaho.test.platform.engine.core.MicroPlatform) RepositoryFileProxyFactory(org.pentaho.platform.repository2.unified.jcr.RepositoryFileProxyFactory) Before(org.junit.Before)

Example 54 with MicroPlatform

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

the class FileResourceIT method beforeTest.

@Before
public void beforeTest() throws PlatformInitializationException {
    mp = new MicroPlatform();
    // used by DefaultPentahoJackrabbitAccessControlHelper
    mp.defineInstance(IAuthorizationPolicy.class, authorizationPolicy);
    mp.defineInstance(ITenantManager.class, tenantManager);
    mp.define(ITenant.class, Tenant.class);
    mp.defineInstance("roleAuthorizationPolicyRoleBindingDaoTarget", roleBindingDaoTarget);
    mp.defineInstance(IRoleAuthorizationPolicyRoleBindingDao.class, roleBindingDaoTarget);
    mp.defineInstance("tenantedUserNameUtils", tenantedUserNameUtils);
    mp.defineInstance("tenantedRoleNameUtils", tenantedRoleNameUtils);
    mp.defineInstance("repositoryAdminUsername", repositoryAdminUsername);
    mp.define(IRoleAuthorizationPolicyRoleBindingDao.class, RoleAuthorizationPolicy.class, Scope.GLOBAL);
    mp.define(ITenantManager.class, RepositoryTenantManager.class, Scope.GLOBAL);
    mp.defineInstance("singleTenantAdminAuthorityName", new String("Administrator"));
    mp.defineInstance("RepositoryFileProxyFactory", new RepositoryFileProxyFactory(this.testJcrTemplate, this.repositoryFileDao));
    DefaultRepositoryVersionManager defaultRepositoryVersionManager = new DefaultRepositoryVersionManager();
    defaultRepositoryVersionManager.setPlatformMimeResolver(new NameBaseMimeResolver());
    mp.defineInstance(IRepositoryVersionManager.class, defaultRepositoryVersionManager);
    UserRoleDaoUserDetailsService userDetailsService = new UserRoleDaoUserDetailsService();
    userDetailsService.setUserRoleDao(userRoleDao);
    List<String> systemRoles = new ArrayList<String>();
    systemRoles.add("Admin");
    List<String> extraRoles = Arrays.asList(new String[] { "Authenticated", "Anonymous" });
    String adminRole = "Admin";
    userRoleListService = new UserRoleDaoUserRoleListService(userRoleDao, userDetailsService, tenantedUserNameUtils, systemRoles, extraRoles, adminRole);
    ((UserRoleDaoUserRoleListService) userRoleListService).setUserRoleDao(userRoleDao);
    ((UserRoleDaoUserRoleListService) userRoleListService).setUserDetailsService(userDetailsService);
    mp.defineInstance(IUserRoleListService.class, userRoleListService);
    mp.start();
    logout();
    startupCalled = true;
    SecurityContextHolder.setStrategyName(SecurityContextHolder.MODE_GLOBAL);
}
Also used : NameBaseMimeResolver(org.pentaho.platform.plugin.services.importer.NameBaseMimeResolver) UserRoleDaoUserDetailsService(org.pentaho.platform.security.userroledao.service.UserRoleDaoUserDetailsService) UserRoleDaoUserRoleListService(org.pentaho.platform.security.userroledao.service.UserRoleDaoUserRoleListService) MicroPlatform(org.pentaho.test.platform.engine.core.MicroPlatform) ArrayList(java.util.ArrayList) DefaultRepositoryVersionManager(org.pentaho.platform.repository2.unified.DefaultRepositoryVersionManager) RepositoryFileProxyFactory(org.pentaho.platform.repository2.unified.jcr.RepositoryFileProxyFactory) Before(org.junit.Before)

Example 55 with MicroPlatform

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

the class SystemPathPluginProviderIT method init.

@Before
public void init() {
    microPlatform = new MicroPlatform(TestResourceLocation.TEST_RESOURCES + "/SystemPathPluginProviderTest/");
    microPlatform.define(ISolutionEngine.class, SolutionEngine.class);
    microPlatform.define(IPluginPerspectiveManager.class, DefaultPluginPerspectiveManager.class);
    provider = new SystemPathXmlPluginProvider();
}
Also used : SystemPathXmlPluginProvider(org.pentaho.platform.plugin.services.pluginmgr.SystemPathXmlPluginProvider) 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