示例#1
0
        public void TestADOTabularCSDLVisitor()
        {
            ADOTabularConnection c = new ADOTabularConnection("Data Source=localhost", AdomdType.AnalysisServices);
            MetaDataVisitorCSDL v = new MetaDataVisitorCSDL(c);
            ADOTabularModel m = new ADOTabularModel(c, "Test","Test", "Test Description", "");
            System.Xml.XmlReader xr = new System.Xml.XmlTextReader(@"..\..\data\csdl.xml");
            var tabs = new ADOTabularTableCollection(c,m);

            v.GenerateTablesFromXmlReader(tabs, xr);

            Assert.AreEqual(4, tabs.Count);
            Assert.AreEqual(8, tabs["Sales"].Columns.Count());
        }
        public ADOTabularConnection(string connectionString, AdomdType connectionType, bool showHiddenObjects, ADOTabularMetadataDiscovery vistorType)
        {
            ShowHiddenObjects = showHiddenObjects;
            ConnectionString  = connectionString;
            _adomdConn        = new AdomdConnection(ConnectionString, connectionType);
            _connectionType   = connectionType;
            //   _adomdConn.ConnectionString = connectionString;

            //_adomdConn.Open();
            if (vistorType == ADOTabularMetadataDiscovery.Adomd)
            {
                Visitor = new MetaDataVisitorADOMD(this);
            }
            else
            {
                Visitor = new MetaDataVisitorCSDL(this);
            }
            ConnectionChanged?.Invoke(this, new EventArgs());
        }
示例#3
0
        public void TestADOTabularCSDLVisitorHierarchies()
        {
            ADOTabularConnection c = new ADOTabularConnection("Data Source=localhost", AdomdType.AnalysisServices);
            MetaDataVisitorCSDL v = new MetaDataVisitorCSDL(c);
            System.Xml.XmlReader xr = new System.Xml.XmlTextReader(@"..\..\data\AdvWrks.xml");
            ADOTabularModel m = new ADOTabularModel(c, "Test","Test", "Test Description", "");
            var tabs = new ADOTabularTableCollection(c,m);
            v.GenerateTablesFromXmlReader(tabs, xr);

            Assert.AreEqual(15, tabs.Count);
            Assert.AreEqual(24, tabs["Sales Territory"].Columns.Count());
            Assert.AreEqual(1, tabs["Sales Territory"].Columns.Where((t) => t.ColumnType == ADOTabularColumnType.Hierarchy).Count());
            var h = (ADOTabularHierarchy) (tabs["Sales Territory"].Columns.Where((t) => t.ColumnType == ADOTabularColumnType.Hierarchy).First());
            Assert.AreEqual(3, h.Levels.Count);
            Assert.AreEqual("Group", h.Levels[0].LevelName);
            Assert.AreEqual("Country", h.Levels[1].LevelName);
            Assert.AreEqual("Region", h.Levels[2].LevelName);
        }
示例#4
0
        public void TestCSDLTablesWithSpaces()
        {
            ADOTabularConnection c = new ADOTabularConnection("Data Source=localhost", AdomdType.AnalysisServices);
            MetaDataVisitorCSDL v = new MetaDataVisitorCSDL(c);
            ADOTabularModel m = new ADOTabularModel(c, "Test","Test Caption", "Test Description", "");
            System.Xml.XmlReader xr = new System.Xml.XmlTextReader(@"..\..\data\advwrkscsdl.xml");
            var tabs = new ADOTabularTableCollection(c, m);
            v.GenerateTablesFromXmlReader(tabs, xr);
            var cmpyTab = tabs["Sales Quota"];

            Assert.AreEqual("Sales Quota", cmpyTab.Caption, "Table Name is translated");
        }
示例#5
0
        public void TestADOTabularCSDLVisitorKPI()
        {
            ADOTabularConnection c = new ADOTabularConnection("Data Source=localhost", AdomdType.AnalysisServices);
            MetaDataVisitorCSDL v = new MetaDataVisitorCSDL(c);
            System.Xml.XmlReader xr = new System.Xml.XmlTextReader(@"..\..\data\AdvWrks.xml");
            ADOTabularModel m = new ADOTabularModel(c, "Test", "Test Caption","Test Description", "");
            var tabs = new ADOTabularTableCollection(c, m);
            v.GenerateTablesFromXmlReader(tabs, xr);

            Assert.AreEqual(15, tabs.Count);
            Assert.AreEqual(24, tabs["Sales Territory"].Columns.Count());
            Assert.AreEqual(1, tabs["Sales Territory"].Columns.Where((t) => t.ColumnType == ADOTabularColumnType.Hierarchy).Count());
            var k = tabs["Sales Territory"].Columns["Total Current Quarter Sales Performance"] as ADOTabularKpi;
            Assert.AreEqual("Total Current Quarter Sales Performance", k.Caption);
            Assert.AreEqual("_Total Current Quarter Sales Performance Goal", k.Goal.Caption);
            Assert.AreEqual("_Total Current Quarter Sales Performance Status", k.Status.Caption);
        }
        public ADOTabularConnection(string connectionString, AdomdType connectionType, bool showHiddenObjects, ADOTabularMetadataDiscovery vistorType)
        {
            ShowHiddenObjects = showHiddenObjects;
            ConnectionString = connectionString;
            _adomdConn = new AdomdConnection(ConnectionString,connectionType);
            _connectionType = connectionType;
             //   _adomdConn.ConnectionString = connectionString;

            //_adomdConn.Open();
            if (vistorType == ADOTabularMetadataDiscovery.Adomd)
            {
                Visitor = new MetaDataVisitorADOMD(this);
            }
            else
            {
                Visitor = new MetaDataVisitorCSDL(this);
            }
            if (ConnectionChanged != null)
                ConnectionChanged(this, new EventArgs());
        }