use of mondrian.server.UrlRepositoryContentFinder in project mondrian by pentaho.
the class MondrianServerTest method testRepository.
/**
* Tests a server that reads its repository from a file URL.
*/
public void testRepository() throws MalformedURLException, SQLException {
final XmlaTestContext xmlaTestContext = new XmlaTestContext();
final MondrianServer server = MondrianServer.createWithRepository(new UrlRepositoryContentFinder("inline:" + xmlaTestContext.getDataSourcesString()), null);
final int id = server.getId();
assertNotNull(id);
OlapConnection connection = server.getConnection("FoodMart", "FoodMart", null);
final NamedList<Catalog> catalogs = connection.getOlapCatalogs();
assertEquals(1, catalogs.size());
assertEquals("FoodMart", catalogs.get(0).getName());
server.shutdown();
}
use of mondrian.server.UrlRepositoryContentFinder in project mondrian by pentaho.
the class MondrianServerTest method testRepositoryWithBadCatalog.
/**
* Tests a server that reads its repository from a file URL.
*/
public void testRepositoryWithBadCatalog() throws Exception {
final XmlaTestContext xmlaTestContext = new XmlaTestContext() {
Util.PropertyList connectProperties = Util.parseConnectString(getConnectString());
String catalogUrl = connectProperties.get(RolapConnectionProperties.Catalog.name());
public String getDataSourcesString() {
return super.getDataSourcesString().replace("</Catalog>", "</Catalog>\n" + "<Catalog name='__1'>\n" + "<DataSourceInfo>Provider=mondrian;Jdbc='jdbc:derby:non-existing-db'</DataSourceInfo>\n" + "<Definition>" + catalogUrl + "</Definition>\n" + "</Catalog>\n");
}
};
final MondrianServer server = MondrianServer.createWithRepository(new UrlRepositoryContentFinder("inline:" + xmlaTestContext.getDataSourcesString()), null);
final int id = server.getId();
assertNotNull(id);
OlapConnection connection = server.getConnection("FoodMart", "FoodMart", null);
final NamedList<Catalog> catalogs = connection.getOlapCatalogs();
assertEquals(1, catalogs.size());
assertEquals("FoodMart", catalogs.get(0).getName());
server.shutdown();
}
Aggregations