Search in sources :

Example 1 with GeoContextPropertiesProvider

use of org.pentaho.agilebi.modeler.geo.GeoContextPropertiesProvider 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();
}
Also used : IAuthorizationPolicy(org.pentaho.platform.api.engine.IAuthorizationPolicy) GeoContextPropertiesProvider(org.pentaho.agilebi.modeler.geo.GeoContextPropertiesProvider) IMetadataDomainRepository(org.pentaho.metadata.repository.IMetadataDomainRepository) IMondrianCatalogService(org.pentaho.platform.plugin.action.mondrian.catalog.IMondrianCatalogService) IPluginResourceLoader(org.pentaho.platform.api.engine.IPluginResourceLoader) GeoContext(org.pentaho.agilebi.modeler.geo.GeoContext) IAclAwareMondrianCatalogService(org.pentaho.platform.plugin.action.mondrian.catalog.IAclAwareMondrianCatalogService) MicroPlatform(org.pentaho.test.platform.engine.core.MicroPlatform) IPlatformImporter(org.pentaho.platform.plugin.services.importer.IPlatformImporter) IUserRoleListService(org.pentaho.platform.api.engine.IUserRoleListService) IUnifiedRepository(org.pentaho.platform.api.repository2.unified.IUnifiedRepository) FileSystemBackedUnifiedRepository(org.pentaho.platform.repository2.unified.fs.FileSystemBackedUnifiedRepository) Before(org.junit.Before)

Example 2 with GeoContextPropertiesProvider

use of org.pentaho.agilebi.modeler.geo.GeoContextPropertiesProvider in project data-access by pentaho.

the class InMemoryDSWDatasourceServiceImpl method getGeoContext.

public GeoContext getGeoContext() throws DatasourceServiceException {
    try {
        Properties props = new Properties();
        props.load(new FileInputStream(new File("target/test-classes/geoContextSample.properties")));
        GeoContext geo = GeoContextFactory.create(new GeoContextPropertiesProvider(props));
        return geo;
    } catch (ModelerException e) {
        throw new DatasourceServiceException(e);
    } catch (FileNotFoundException e) {
        throw new DatasourceServiceException(e);
    } catch (IOException e) {
        // To change body of catch statement use File | Settings | File Templates.
        e.printStackTrace();
    }
    return null;
}
Also used : ModelerException(org.pentaho.agilebi.modeler.ModelerException) GeoContextPropertiesProvider(org.pentaho.agilebi.modeler.geo.GeoContextPropertiesProvider) FileNotFoundException(java.io.FileNotFoundException) IOException(java.io.IOException) Properties(java.util.Properties) File(java.io.File) FileInputStream(java.io.FileInputStream) GeoContext(org.pentaho.agilebi.modeler.geo.GeoContext) DatasourceServiceException(org.pentaho.platform.dataaccess.datasource.wizard.service.DatasourceServiceException)

Aggregations

GeoContext (org.pentaho.agilebi.modeler.geo.GeoContext)2 GeoContextPropertiesProvider (org.pentaho.agilebi.modeler.geo.GeoContextPropertiesProvider)2 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 Properties (java.util.Properties)1 Before (org.junit.Before)1 ModelerException (org.pentaho.agilebi.modeler.ModelerException)1 IMetadataDomainRepository (org.pentaho.metadata.repository.IMetadataDomainRepository)1 IAuthorizationPolicy (org.pentaho.platform.api.engine.IAuthorizationPolicy)1 IPluginResourceLoader (org.pentaho.platform.api.engine.IPluginResourceLoader)1 IUserRoleListService (org.pentaho.platform.api.engine.IUserRoleListService)1 IUnifiedRepository (org.pentaho.platform.api.repository2.unified.IUnifiedRepository)1 DatasourceServiceException (org.pentaho.platform.dataaccess.datasource.wizard.service.DatasourceServiceException)1 IAclAwareMondrianCatalogService (org.pentaho.platform.plugin.action.mondrian.catalog.IAclAwareMondrianCatalogService)1 IMondrianCatalogService (org.pentaho.platform.plugin.action.mondrian.catalog.IMondrianCatalogService)1 IPlatformImporter (org.pentaho.platform.plugin.services.importer.IPlatformImporter)1 FileSystemBackedUnifiedRepository (org.pentaho.platform.repository2.unified.fs.FileSystemBackedUnifiedRepository)1 MicroPlatform (org.pentaho.test.platform.engine.core.MicroPlatform)1