Search in sources :

Example 26 with MondrianCatalog

use of org.pentaho.platform.plugin.action.mondrian.catalog.MondrianCatalog in project data-access by pentaho.

the class AnalysisServiceTest method testImportingSkipsRemoveWhenNotPresent.

@Test
public void testImportingSkipsRemoveWhenNotPresent() throws Exception {
    MondrianCatalog otherCatalog = new MondrianCatalog("other", "", "", null);
    when(catalogService.listCatalogs(any(IPentahoSession.class), eq(false))).thenReturn(Collections.singletonList(otherCatalog));
    putMondrianSchemaWithSchemaFileName("stubFileName", "overwrite=true");
    verify(importer).importFile(argThat(matchBundle(true, acl)));
    verify(catalogService, never()).removeCatalog(eq("sales"), any(IPentahoSession.class));
}
Also used : MondrianCatalog(org.pentaho.platform.plugin.action.mondrian.catalog.MondrianCatalog) IPentahoSession(org.pentaho.platform.api.engine.IPentahoSession) Test(org.junit.Test)

Example 27 with MondrianCatalog

use of org.pentaho.platform.plugin.action.mondrian.catalog.MondrianCatalog in project data-access by pentaho.

the class AnalysisServiceTest method testSetAnalysisDatasourceAcl.

@Test
public void testSetAnalysisDatasourceAcl() throws Exception {
    allAccess();
    final String catalogName = "catalogName";
    final RepositoryFileAclDto aclDto = new RepositoryFileAclDto();
    aclDto.setOwner("owner");
    aclDto.setOwnerType(RepositoryFileSid.Type.USER.ordinal());
    final MondrianCatalog mondrianCatalog = mock(MondrianCatalog.class);
    when(catalogService.getCatalog(eq(catalogName), any(IPentahoSession.class))).thenReturn(mondrianCatalog);
    analysisService.setAnalysisDatasourceAcl(catalogName, aclDto);
    verify(catalogService).setAclFor(eq(catalogName), eq(new RepositoryFileAclAdapter().unmarshal(aclDto)));
}
Also used : MondrianCatalog(org.pentaho.platform.plugin.action.mondrian.catalog.MondrianCatalog) IPentahoSession(org.pentaho.platform.api.engine.IPentahoSession) RepositoryFileAclDto(org.pentaho.platform.repository2.unified.webservices.RepositoryFileAclDto) RepositoryFileAclAdapter(org.pentaho.platform.repository2.unified.webservices.RepositoryFileAclAdapter) Test(org.junit.Test)

Example 28 with MondrianCatalog

use of org.pentaho.platform.plugin.action.mondrian.catalog.MondrianCatalog in project data-access by pentaho.

the class AnalysisServiceTest method testGetAnalysisDatasourceAcl.

@Test
public void testGetAnalysisDatasourceAcl() throws Exception {
    allAccess();
    final String catalogName = "SampleData";
    final RepositoryFileAcl expectedAcl = new RepositoryFileAcl.Builder("owner").build();
    when(catalogService.getAclFor(catalogName)).thenReturn(expectedAcl);
    final MondrianCatalog mondrianCatalog = mock(MondrianCatalog.class);
    when(catalogService.getCatalog(eq(catalogName), any(IPentahoSession.class))).thenReturn(mondrianCatalog);
    final RepositoryFileAclDto actualAcl = analysisService.getAnalysisDatasourceAcl(catalogName);
    assertEquals(expectedAcl, new RepositoryFileAclAdapter().unmarshal(actualAcl));
}
Also used : MondrianCatalog(org.pentaho.platform.plugin.action.mondrian.catalog.MondrianCatalog) IPentahoSession(org.pentaho.platform.api.engine.IPentahoSession) RepositoryFileAclDto(org.pentaho.platform.repository2.unified.webservices.RepositoryFileAclDto) RepositoryFileAcl(org.pentaho.platform.api.repository2.unified.RepositoryFileAcl) RepositoryFileAclAdapter(org.pentaho.platform.repository2.unified.webservices.RepositoryFileAclAdapter) Test(org.junit.Test)

Aggregations

MondrianCatalog (org.pentaho.platform.plugin.action.mondrian.catalog.MondrianCatalog)28 IPentahoSession (org.pentaho.platform.api.engine.IPentahoSession)13 IMondrianCatalogService (org.pentaho.platform.plugin.action.mondrian.catalog.IMondrianCatalogService)13 Test (org.junit.Test)12 ArrayList (java.util.ArrayList)4 Properties (java.util.Properties)4 InputStream (java.io.InputStream)3 SQLException (java.sql.SQLException)3 MondrianException (mondrian.olap.MondrianException)3 IPentahoConnection (org.pentaho.commons.connection.IPentahoConnection)3 MondrianSchema (org.pentaho.platform.plugin.action.mondrian.catalog.MondrianSchema)3 MDXConnection (org.pentaho.platform.plugin.services.connections.mondrian.MDXConnection)3 IOException (java.io.IOException)2 ZipOutputStream (java.util.zip.ZipOutputStream)2 GET (javax.ws.rs.GET)2 Path (javax.ws.rs.Path)2 Produces (javax.ws.rs.Produces)2 Connection (mondrian.olap.Connection)2 Util (mondrian.olap.Util)2 RolapConnection (mondrian.rolap.RolapConnection)2