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