use of org.pentaho.platform.repository2.unified.fs.FileSystemBackedUnifiedRepository in project pentaho-platform by pentaho.
the class BootIT method testBoot.
public void testBoot() throws PlatformInitializationException {
PentahoBoot boot = new PentahoBoot();
boot.setFilePath(TestResourceLocation.TEST_RESOURCES + "/solution");
boot.enableReporting();
// create a user session
IPentahoSession session = new StandaloneSession("test");
PentahoSessionHolder.setSession(session);
FileSystemBackedUnifiedRepository repo = (FileSystemBackedUnifiedRepository) PentahoSystem.get(IUnifiedRepository.class);
repo.setRootDir(new File(TestResourceLocation.TEST_RESOURCES + "/solution"));
boolean ok = boot.start();
assertTrue(ok);
String outputType = "pdf";
OutputStream outputStream = null;
try {
// create an output stream to write the report into
File outputFile = new File("report." + outputType);
outputStream = new FileOutputStream(outputFile);
// pass the outputType parameter
Map parameters = new HashMap();
parameters.put("output-type", outputType);
SolutionHelper.execute("test report", session, "boot/report.xaction", parameters, outputStream);
} catch (FileNotFoundException e) {
e.printStackTrace();
return;
} finally {
if (outputStream != null) {
try {
// close the output stream
outputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
boot.stop();
}
use of org.pentaho.platform.repository2.unified.fs.FileSystemBackedUnifiedRepository in project pentaho-platform by pentaho.
the class UserRoleMapperIT method init0.
@Before
public void init0() {
IAclNodeHelper aclHelper = mock(IAclNodeHelper.class);
when(aclHelper.canAccess(any(RepositoryFile.class), any(EnumSet.class))).thenReturn(true);
MondrianCatalogHelper catalogService = new MondrianCatalogHelper(aclHelper);
microPlatform = new MicroPlatform(TestResourceLocation.TEST_RESOURCES + "/solution");
microPlatform.define(ISolutionEngine.class, SolutionEngine.class);
microPlatform.define(IUnifiedRepository.class, FileSystemBackedUnifiedRepository.class, Scope.GLOBAL);
microPlatform.defineInstance(IMondrianCatalogService.class, catalogService);
microPlatform.define("connection-SQL", SQLConnection.class);
microPlatform.define("connection-MDX", MDXConnection.class);
microPlatform.define(IDBDatasourceService.class, JndiDatasourceService.class, Scope.GLOBAL);
microPlatform.define(IUserRoleListService.class, TestUserRoleListService.class, Scope.GLOBAL);
microPlatform.define(UserDetailsService.class, TestUserDetailsService.class, Scope.GLOBAL);
FileSystemBackedUnifiedRepository repo = (FileSystemBackedUnifiedRepository) PentahoSystem.get(IUnifiedRepository.class);
repo.setRootDir(new File(TestResourceLocation.TEST_RESOURCES + "/solution"));
try {
microPlatform.start();
} catch (PlatformInitializationException ex) {
Assert.fail();
}
catalogService.setDataSourcesConfig("file:" + PentahoSystem.getApplicationContext().getSolutionPath("test/analysis/test-datasources.xml"));
// JNDI
System.setProperty("java.naming.factory.initial", "org.osjava.sj.SimpleContextFactory");
System.setProperty("org.osjava.sj.root", TestResourceLocation.TEST_RESOURCES + "/solution/system/simple-jndi");
System.setProperty("org.osjava.sj.delimiter", "/");
}
use of org.pentaho.platform.repository2.unified.fs.FileSystemBackedUnifiedRepository in project data-access by pentaho.
the class DatasourceResourceIT method createMetadataDomainRepository.
private static PentahoMetadataDomainRepository createMetadataDomainRepository() throws Exception {
IUnifiedRepository repository = new FileSystemBackedUnifiedRepository("target/test-classes/dsw");
mp.defineInstance(IUnifiedRepository.class, repository);
Assert.assertNotNull(new RepositoryUtils(repository).getFolder("/etc/metadata", true, true, null));
Assert.assertNotNull(new RepositoryUtils(repository).getFolder("/etc/mondrian", true, true, null));
PentahoMetadataDomainRepository pentahoMetadataDomainRepository = new PentahoMetadataDomainRepository(repository);
return pentahoMetadataDomainRepository;
}
use of org.pentaho.platform.repository2.unified.fs.FileSystemBackedUnifiedRepository in project data-access by pentaho.
the class DataAccessServiceTestBase method setUp.
@Before
public void setUp() throws Exception {
platform = new MicroPlatform();
metadataRepository = mock(IMetadataDomainRepository.class);
platform.defineInstance(IMetadataDomainRepository.class, metadataRepository);
importer = mock(IPlatformImporter.class);
platform.defineInstance(IPlatformImporter.class, importer);
policy = mock(IAuthorizationPolicy.class);
platform.defineInstance(IAuthorizationPolicy.class, policy);
catalogService = mock(IAclAwareMondrianCatalogService.class);
platform.defineInstance(IMondrianCatalogService.class, catalogService);
permissionHandler = mock(IDataAccessPermissionHandler.class);
platform.defineInstance(IDataAccessPermissionHandler.class, permissionHandler);
userRoleListService = mock(IUserRoleListService.class);
platform.defineInstance(IUserRoleListService.class, userRoleListService);
pluginResourceLoader = mock(IPluginResourceLoader.class);
platform.defineInstance(IPluginResourceLoader.class, pluginResourceLoader);
mondrianCatalogService = mock(IMondrianCatalogService.class);
platform.defineInstance(IMondrianCatalogService.class, mondrianCatalogService);
final IUnifiedRepository unifiedRepository = new FileSystemBackedUnifiedRepository("target/test-classes/solution1");
platform.defineInstance(IUnifiedRepository.class, unifiedRepository);
platform.defineInstance(String.class, "admin");
config = new GeoContextPropertiesProvider(getGeoProps());
GeoContext geo = GeoContextFactory.create(config);
platform.start();
acl.setOwner("owner");
acl.setOwnerType(RepositoryFileSid.Type.USER.ordinal());
modelerService = new ModelerService();
datasourceService = mock(DSWDatasourceServiceImpl.class);
when(datasourceService.getGeoContext()).thenReturn(geo);
modelerService.setDatasourceService(datasourceService);
domain = getDomain();
}
Aggregations