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());
}
}
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;
}
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);
}
Aggregations