/*********************************************************************************
* The contents of this file are subject to the OpenI Public License Version 1.0
* ("License"); You may not use this file except in compliance with the
* License. You may obtain a copy of the License at
* http://www.openi.org/docs/LICENSE.txt
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
* the specific language governing rights and limitations under the License.
*
* The Original Code is: OpenI Open Source
*
* The Initial Developer of the Original Code is Loyalty Matrix, Inc.
* Portions created by Loyalty Matrix, Inc. are
* Copyright (C) 2005 - 2006 Loyalty Matrix, Inc.; All Rights Reserved.
*
* Contributor(s): ______________________________________.
*
********************************************************************************/
package org.openi.analysis;
import com.tonbeller.jpivot.olap.model.OlapException;
import com.tonbeller.jpivot.olap.model.OlapItem;
import com.tonbeller.jpivot.xmla.XMLA_SOAP;
import junit.framework.TestCase;
import org.apache.log4j.Logger;
import org.openi.project.ProjectContext;
import org.openi.test.Util;
import org.openi.xmla.XmlaConnector;
import java.io.IOException;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
public class AnalysisGeneratorTest extends TestCase {
private static Logger logger = Logger.getLogger(AnalysisGeneratorTest.class);
String uri = "http://sql2005host/olap/msmdpump.dll";
String catalog = "Foodmart";
String cube = "Foodmart 2005";
String dimension = "Product";
/*
String uri = "http://sql200host/xmla/msxisapi.dll";
String catalog = "FoodMart 2000";
String cube = "Budget";
String dimension = "Account";
*/
private ProjectContext projectContext;
/**
* Constructor for AnalysisGeneratorTest.
* @param arg0
*/
public AnalysisGeneratorTest(String arg0) {
super(arg0);
}
public static void main(String[] args) {
junit.textui.TestRunner.run(AnalysisGeneratorTest.class);
}
/*
* @see TestCase#setUp()
*/
protected void setUp() throws Exception {
super.setUp();
Util.setupLog4j();
projectContext = Util.createTestProjectContext("projectUser");
}
/*
* @see TestCase#tearDown()
*/
protected void tearDown() throws Exception {
super.tearDown();
}
public void testGenerateMdxForDimensions() throws Exception {
AnalysisGenerator gen = new AnalysisGenerator();
Datasource datasource = new Datasource(uri, catalog);
assertTrue(gen.generateMdxForDimensions(datasource, cube).size() > 0);
}
public void testCreateAnalyses() throws OlapException, IOException {
String relativeDir = "generated/" + cube;
projectContext.autogenerate("projectdefault", cube, relativeDir, null);
}
public void testDiscoverHierarchies() throws OlapException{
Datasource datasource = new Datasource(uri, catalog);
XmlaConnector xmla = new XmlaConnector();
logger.debug(xmla.discoverHier(datasource, cube, dimension));
}
public void testCreateMdx() throws OlapException {
Datasource datasource = new Datasource(uri, catalog);
XmlaConnector xmla = new XmlaConnector();
logger.debug(xmla.createDefaultMdx(datasource, cube, dimension, null));
}
}
|