use of org.pentaho.test.platform.engine.core.MicroPlatform in project pentaho-platform by pentaho.
the class PentahoBlockoutManagerIT method setUp.
/**
* @throws java.lang.Exception
*/
@Before
public void setUp() throws Exception {
MicroPlatform mp = new MicroPlatform();
mp.define(IPluginManager.class, TstPluginManager.class);
// $NON-NLS-1$
mp.define("IScheduler2", TestQuartzScheduler.class);
mp.define(IUserRoleListService.class, StubUserRoleListService.class);
mp.define(UserDetailsService.class, StubUserDetailsService.class);
mp.define(IBlockoutManager.class, PentahoBlockoutManager.class);
mp.start();
blockOutManager = new PentahoBlockoutManager();
// $NON-NLS-1$;
scheduler = PentahoSystem.get(IScheduler.class, "IScheduler2", null);
jobIdsToClear.clear();
}
use of org.pentaho.test.platform.engine.core.MicroPlatform in project pentaho-platform by pentaho.
the class QuartzSchedulerIT method init.
@Before
public void init() throws SchedulerException, PlatformInitializationException {
scheduler = new QuartzScheduler();
scheduler.start();
TestAction.reset();
TestAction2.reset();
TestAction3.reset();
TestActionCustomParam.reset();
MicroPlatform mp = new MicroPlatform();
// $NON-NLS-1$
mp.define("IScheduler2", TestQuartzScheduler.class);
mp.define(IUserRoleListService.class, StubUserRoleListService.class);
mp.define(UserDetailsService.class, StubUserDetailsService.class);
mp.define(IAuditEntry.class, TestAuditEntry.class);
mp.start();
SecurityHelper.getInstance().becomeUser(TEST_USER);
jobParams = new HashMap<String, Serializable>();
}
use of org.pentaho.test.platform.engine.core.MicroPlatform in project pentaho-platform by pentaho.
the class DefaultUnifiedRepositoryBase method initialize.
public void initialize(boolean multiByteEncoding) throws Exception {
loginAsRepositoryAdmin();
SimpleJcrTestUtils.deleteItem(testJcrTemplate, ServerRepositoryPaths.getPentahoRootFolderPath());
mp = new MicroPlatform(getSolutionPath());
// used by DefaultPentahoJackrabbitAccessControlHelper
mp.defineInstance("tenantedUserNameUtils", userNameUtils);
mp.defineInstance("tenantedRoleNameUtils", roleNameUtils);
mp.defineInstance("ILockHelper", new DefaultLockHelper(userNameUtils));
mp.defineInstance(IAuthorizationPolicy.class, authorizationPolicy);
mp.defineInstance(ITenantManager.class, tenantManager);
mp.defineInstance("roleAuthorizationPolicyRoleBindingDaoTarget", roleBindingDaoTarget);
mp.defineInstance("repositoryAdminUsername", repositoryAdminUsername);
mp.defineInstance("RepositoryFileProxyFactory", new RepositoryFileProxyFactory(this.jcrTemplate, this.repositoryFileDao));
mp.defineInstance("ITenantedPrincipleNameResolver", new DefaultTenantedPrincipleNameResolver());
mp.defineInstance("useMultiByteEncoding", multiByteEncoding);
mp.defineInstance(IUnifiedRepository.class, repo);
mp.defineInstance(IRepositoryFileAclDao.class, repositoryFileAclDao);
IUserRoleListService userRoleListService = mock(IUserRoleListService.class);
when(userRoleListService.getRolesForUser(any(ITenant.class), anyString())).thenReturn(Arrays.asList(tenantAdminRoleName, AUTHENTICATED_ROLE_NAME));
mp.defineInstance(IUserRoleListService.class, userRoleListService);
mp.defineInstance("singleTenantAdminUserName", singleTenantAdminUserName);
mp.defineInstance("singleTenantAdminAuthorityName", tenantAdminRoleName);
// Start the micro-platform
mp.start();
loginAsRepositoryAdmin();
setAclManagement();
systemTenant = tenantManager.createTenant(null, ServerRepositoryPaths.getPentahoRootFolderName(), tenantAdminRoleName, tenantAuthenticatedRoleName, ANONYMOUS_ROLE_NAME);
userRoleDao.createUser(systemTenant, sysAdminUserName, PASSWORD, "", new String[] { tenantAdminRoleName });
logout();
}
use of org.pentaho.test.platform.engine.core.MicroPlatform in project pentaho-platform by pentaho.
the class DefaultDeleteHelperTest method setUp.
@Before
public void setUp() throws Exception {
mp = new MicroPlatform(getSolutionPath());
IPentahoSession pentahoSession = mock(IPentahoSession.class);
when(pentahoSession.getName()).thenReturn("test");
PentahoSessionHolder.setSession(pentahoSession);
session = mock(Session.class);
final Node rootNode = mock(Node.class);
when(session.getRootNode()).thenReturn(rootNode);
when(session.getNamespacePrefix(anyString())).thenReturn("prefix:");
pentahoJcrConstants = new PentahoJcrConstants(session);
pathConversionHelper = mock(IPathConversionHelper.class);
lockHelper = mock(ILockHelper.class);
defaultDeleteHelper = new DefaultDeleteHelper(lockHelper, pathConversionHelper);
final RepositoryFileProxy repositoryFileProxy = mock(RepositoryFileProxy.class);
final RepositoryFileProxyFactory repositoryFileProxyFactory = mock(RepositoryFileProxyFactory.class);
when(repositoryFileProxyFactory.getProxy(Matchers.<Node>anyObject(), Matchers.<IPentahoLocale>anyObject())).thenReturn(repositoryFileProxy);
// set file ID to random value to make different files not equal
when(repositoryFileProxy.getId()).thenAnswer(new Answer<Object>() {
@Override
public Object answer(InvocationOnMock invocation) throws Throwable {
return String.valueOf(new Random().nextDouble());
}
});
when(repositoryFileProxy.getTitle()).thenReturn("title");
mp.defineInstance(RepositoryFileProxyFactory.class, repositoryFileProxyFactory);
mp.start();
}
use of org.pentaho.test.platform.engine.core.MicroPlatform in project pentaho-platform by pentaho.
the class JcrStringHelperTest method testFilePath_1EncodeUsingMultiByteEncoding.
@Test
public void testFilePath_1EncodeUsingMultiByteEncoding() throws PlatformInitializationException {
MicroPlatform mp = new MicroPlatform(getSolutionPath());
mp.defineInstance("useMultiByteEncoding", new Boolean(true));
// Start the micro-platform
mp.start();
JcrStringHelper.setMultiByteEncodingEnabled(true);
String path = "/asdf/3err";
String encodedPath = JcrStringHelper.pathEncode(path);
assertFalse(path.equals(encodedPath));
assertEquals("/asdf/_x0033_err", encodedPath);
}
Aggregations