Search in sources :

Example 1 with RolapSchema

use of mondrian.rolap.RolapSchema in project mondrian by pentaho.

the class SchemaTest method testMondrian1275.

public void testMondrian1275() throws Exception {
    final TestContext tc = getTestContext().withSchema("<?xml version=\"1.0\"?>\n" + "<Schema name=\"FoodMart\">\n" + "  <Dimension name=\"Store Type\">\n" + "    <Annotations>\n" + "      <Annotation name=\"foo\">bar</Annotation>\n" + "    </Annotations>\n" + "    <Hierarchy hasAll=\"true\" primaryKey=\"store_id\">\n" + "      <Table name=\"store\"/>\n" + "      <Level name=\"Store Type\" column=\"store_type\" uniqueMembers=\"true\"/>\n" + "    </Hierarchy>\n" + "  </Dimension>\n" + "<Cube name=\"Sales\" defaultMeasure=\"Unit Sales\">\n" + "  <Table name=\"sales_fact_1997\">\n" + "    <AggExclude name=\"agg_c_special_sales_fact_1997\" />\n" + "    <AggExclude name=\"agg_lc_100_sales_fact_1997\" />\n" + "    <AggExclude name=\"agg_lc_10_sales_fact_1997\" />\n" + "    <AggExclude name=\"agg_pc_10_sales_fact_1997\" />\n" + "  </Table>\n" + "  <DimensionUsage name=\"Store Type\" source=\"Store Type\" foreignKey=\"store_id\"/>\n" + "  <Measure name=\"Unit Sales\" column=\"unit_sales\" aggregator=\"sum\"\n" + "      formatString=\"Standard\"/>\n" + "</Cube>\n" + "</Schema>\n");
    final RolapConnection rolapConn = tc.getOlap4jConnection().unwrap(RolapConnection.class);
    final SchemaReader schemaReader = rolapConn.getSchemaReader();
    final RolapSchema schema = schemaReader.getSchema();
    for (RolapCube cube : schema.getCubeList()) {
        Dimension dim = cube.getDimensions()[1];
        final Map<String, Annotation> annotations = dim.getAnnotationMap();
        Assert.assertEquals(1, annotations.size());
        Assert.assertEquals("bar", annotations.get("foo").getValue());
    }
}
Also used : RolapConnection(mondrian.rolap.RolapConnection) RolapSchema(mondrian.rolap.RolapSchema) RolapCube(mondrian.rolap.RolapCube)

Example 2 with RolapSchema

use of mondrian.rolap.RolapSchema in project mondrian by pentaho.

the class GroupingSetsListTest method getStarMock.

private static RolapStar getStarMock() {
    RolapStar mock = mock(RolapStar.class);
    RolapStar.Table tableMock = mock(RolapStar.Table.class);
    RolapSchema schemaMock = mock(RolapSchema.class);
    ByteString md5 = new ByteString("test schema".getBytes());
    when(mock.getSchema()).thenReturn(schemaMock);
    when(schemaMock.getChecksum()).thenReturn(md5);
    when(mock.getFactTable()).thenReturn(tableMock);
    when(tableMock.getAlias()).thenReturn("Table Mock");
    return mock;
}
Also used : RolapSchema(mondrian.rolap.RolapSchema) RolapStar(mondrian.rolap.RolapStar) ByteString(mondrian.util.ByteString)

Example 3 with RolapSchema

use of mondrian.rolap.RolapSchema in project pentaho-platform by pentaho.

the class OlapServiceImplTest method flushSingleSchemaCache.

@Test
public void flushSingleSchemaCache() throws Exception {
    OlapConnection connection = mock(OlapConnection.class);
    doReturn(connection).when(olapService).getConnection("schemaX", session);
    RolapConnection rc = mock(RolapConnection.class);
    doReturn(rc).when(connection).unwrap(RolapConnection.class);
    doReturn(cacheControl).when(rc).getCacheControl(any(PrintWriter.class));
    RolapSchema schema = mock(RolapSchema.class);
    doReturn(schema).when(rc).getSchema();
    olapService.flush(session, "schemaX");
    verify(cacheControl, times(1)).flushSchema(schema);
}
Also used : RolapConnection(mondrian.rolap.RolapConnection) RolapSchema(mondrian.rolap.RolapSchema) OlapConnection(org.olap4j.OlapConnection) PrintWriter(java.io.PrintWriter) Test(org.junit.Test)

Aggregations

RolapSchema (mondrian.rolap.RolapSchema)3 RolapConnection (mondrian.rolap.RolapConnection)2 PrintWriter (java.io.PrintWriter)1 RolapCube (mondrian.rolap.RolapCube)1 RolapStar (mondrian.rolap.RolapStar)1 ByteString (mondrian.util.ByteString)1 Test (org.junit.Test)1 OlapConnection (org.olap4j.OlapConnection)1