use of org.pentaho.platform.engine.services.MockDataSourceService in project pentaho-platform by pentaho.
the class DynamicallyPooledDatasourceSystemListenerTest method testGetDataSource.
@Test
public void testGetDataSource() {
when(listener.getDatasourceService()).thenReturn(new MockDataSourceService(false));
DataSource ds = listener.getDataSource(connection);
assertNotNull(ds);
}
use of org.pentaho.platform.engine.services.MockDataSourceService in project data-access by pentaho.
the class ConnectionServiceImplIT method setUpClass.
@BeforeClass
public static void setUpClass() throws PlatformInitializationException, DuplicateDatasourceException, DatasourceMgmtServiceException {
MockDataSourceService dataSourceService = new MockDataSourceService(false);
IAuthorizationPolicy mockAuthorizationPolicy = mock(IAuthorizationPolicy.class);
when(mockAuthorizationPolicy.isAllowed(anyString())).thenReturn(true);
booter = new MicroPlatform("target/test-classes/solution1");
booter.define(IPentahoConnection.class, SQLConnection.class);
booter.defineInstance(IDBDatasourceService.class, dataSourceService);
booter.defineInstance(IAuthorizationPolicy.class, mockAuthorizationPolicy);
booter.defineInstance(IPluginResourceLoader.class, new PluginResourceLoader() {
protected PluginClassLoader getOverrideClassloader() {
return new PluginClassLoader(new File(".", "target/test-classes/solution1/system/simple-jndi"), this);
}
});
booter.defineInstance(IDatasourceMgmtService.class, mgmtService);
booter.start();
PentahoSessionHolder.setStrategyName(PentahoSessionHolder.MODE_GLOBAL);
SecurityContextHolder.setStrategyName(SecurityContextHolder.MODE_GLOBAL);
connectionServiceImpl = new ConnectionServiceImpl();
}
Aggregations