1 package com.tonbeller.jpivot.mondrian; 2 3 import java.util.List ; 4 5 import junit.framework.TestCase; 6 7 import com.tonbeller.jpivot.olap.model.Axis; 8 import com.tonbeller.jpivot.olap.model.Result; 9 import com.tonbeller.jpivot.olap.query.ResultBase; 10 import com.tonbeller.jpivot.tags.MondrianModelFactory; 11 12 public class EmptyResultTest extends TestCase { 13 14 18 public EmptyResultTest(String arg0) { 19 super(arg0); 20 } 21 22 public void testEmptyResult() throws Exception { 23 24 29 String mdxQuery = "select NON EMPTY {[Measures].[Unit Sales], [Measures].[Store Cost]} ON columns, " 30 + "NON EMPTY Filter([Product].[Brand Name].Members, ([Measures].[Unit Sales] > 100000.0)) ON rows " 31 + "from [Sales] where [Time].[1997]"; 32 33 String renderFile = null; int renderNum = 0; 35 36 Result result; 37 38 MondrianModel model = MondrianModelFactory.instance(); 39 model.setMdxQuery(mdxQuery); 40 TestConnection.initModel(model); 41 42 result = model.getResult(); 44 if (renderFile != null) 45 ResultBase.renderHtml(result, model.getCurrentMdx(), renderFile + renderNum++ + ".html"); 46 Axis[] axes = result.getAxes(); 47 List positions = axes[0].getPositions(); 48 assertEquals(positions.size(), 0); 49 positions = axes[1].getPositions(); 50 assertEquals(positions.size(), 0); 51 } 52 53 } | Popular Tags |