Search in sources :

Example 1 with OlapServiceImpl

use of org.pentaho.platform.plugin.action.olap.impl.OlapServiceImpl in project pentaho-platform by pentaho.

the class OlapServiceImplTest method setUp.

@Before
public void setUp() throws Exception {
    // Stub /etc/mondrian
    mondrianFolderPath = ClientRepositoryPaths.getEtcFolderPath() + RepositoryFile.SEPARATOR + "mondrian";
    stubGetFolder(repository, mondrianFolderPath);
    // Stub /etc/olap-servers
    olapFolderPath = ClientRepositoryPaths.getEtcFolderPath() + RepositoryFile.SEPARATOR + "olap-servers";
    stubGetFolder(repository, olapFolderPath);
    // Create a session as admin.
    session = new StandaloneSession("admin");
    doReturn(aggManager).when(server).getAggregationManager();
    doReturn(cacheControl).when(aggManager).getCacheControl(any(RolapConnection.class), any(PrintWriter.class));
    // Create the olap service. Make sure to override hasAccess with the
    // mock version.
    olapService = spy(new OlapServiceImpl(repository, server) {

        public boolean hasAccess(String path, EnumSet<RepositoryFilePermission> perms, IPentahoSession session) {
            return accessMock.hasAccess(path, perms, session);
        }

        @Override
        protected XmlaHandler.XmlaExtra getXmlaExtra(final OlapConnection connection) throws SQLException {
            return mockXmlaExtra;
        }
    });
}
Also used : RolapConnection(mondrian.rolap.RolapConnection) OlapServiceImpl(org.pentaho.platform.plugin.action.olap.impl.OlapServiceImpl) StandaloneSession(org.pentaho.platform.engine.core.system.StandaloneSession) IPentahoSession(org.pentaho.platform.api.engine.IPentahoSession) OlapConnection(org.olap4j.OlapConnection) EnumSet(java.util.EnumSet) XmlaHandler(mondrian.xmla.XmlaHandler) Matchers.anyString(org.mockito.Matchers.anyString) PrintWriter(java.io.PrintWriter) Before(org.junit.Before)

Aggregations

PrintWriter (java.io.PrintWriter)1 EnumSet (java.util.EnumSet)1 RolapConnection (mondrian.rolap.RolapConnection)1 XmlaHandler (mondrian.xmla.XmlaHandler)1 Before (org.junit.Before)1 Matchers.anyString (org.mockito.Matchers.anyString)1 OlapConnection (org.olap4j.OlapConnection)1 IPentahoSession (org.pentaho.platform.api.engine.IPentahoSession)1 StandaloneSession (org.pentaho.platform.engine.core.system.StandaloneSession)1 OlapServiceImpl (org.pentaho.platform.plugin.action.olap.impl.OlapServiceImpl)1