How to use ParseXmlaResponse method of NBi.Core.Structure.StructureDiscoveryFactoryProvider class

Best NBi code snippet using NBi.Core.Structure.StructureDiscoveryFactoryProvider.ParseXmlaResponse

StructureDiscoveryFactoryProviderTest.cs

Source:StructureDiscoveryFactoryProviderTest.cs Github

copy

Full Screen

...25 protected override string InquireFurtherAnalysisService(string connectionString)26 {27 return result;28 }29 public new string ParseXmlaResponse(XmlDocument doc)30 {31 return base.ParseXmlaResponse(doc);32 }33 }34 [Test]35 public void Instantiate_EmptyConnectionString_GetDatabaseStructureDiscoveryFactory()36 {37 var connectionString = string.Empty;38 var provider = new StructureDiscoveryFactoryProvider();39 Assert.Throws<ArgumentNullException>(() => provider.Instantiate(connectionString));40 }41 [Test]42 public void Instantiate_SqlConnection_GetDatabaseStructureDiscoveryFactory()43 {44 var connectionString = ConnectionStringReader.GetSqlClient();45 46 var provider = new StructureDiscoveryFactoryProvider();47 var factory = provider.Instantiate(connectionString);48 Assert.That(factory, Is.TypeOf<RelationalStructureDiscoveryFactory>());49 }50 [Test]51 public void Instantiate_AdomdConnectionOlap_GetDatabaseStructureDiscoveryFactory()52 {53 var connectionString = ConnectionStringReader.GetAdomd();54 var provider = new FakeStructureDiscoveryFactoryProvider(StructureDiscoveryFactoryProvider.Olap);55 var factory = provider.Instantiate(connectionString);56 Assert.That(factory, Is.TypeOf<OlapStructureDiscoveryFactory>());57 }58 [Test]59 public void Instantiate_AdomdConnectionTabular_GetDatabaseStructureDiscoveryFactory()60 {61 var connectionString = ConnectionStringReader.GetAdomd();62 var provider = new FakeStructureDiscoveryFactoryProvider(StructureDiscoveryFactoryProvider.Tabular);63 var factory = provider.Instantiate(connectionString);64 Assert.That(factory, Is.TypeOf<TabularStructureDiscoveryFactory>());65 }66 67 [Test]68 [TestCase("Multidimensional")]69 [TestCase("Tabular")]70 [TestCase("Sharepoint")]71 [TestCase("Default")]72 public void ParseXmlaResponse_Tabular_GetCorrectServerMode(string serverMode)73 {74 var xml = ""75 + "<Server xmlns=\"http://schemas.microsoft.com/analysisservices/2003/engine\"> "76 + " <Name>XXX\\SQL2014</Name> "77 + " <ID>XXX\\SQL2014</ID> "78 + " <CreatedTimestamp>2015-07-02T21:56:04.076667</CreatedTimestamp> "79 + " <LastSchemaUpdate>2015-07-02T21:56:04.093333</LastSchemaUpdate> "80 + " <Version>12.0.2000.8</Version> "81 + " <Edition>Developer64</Edition> "82 + " <EditionID>2176971986</EditionID> "83 + " <ddl300:ServerMode xmlns:ddl300=\"http://schemas.microsoft.com/analysisservices/2011/engine/300\">$value$</ddl300:ServerMode>"84 + " <ddl400:ServerLocation xmlns:ddl400=\"http://schemas.microsoft.com/analysisservices/2012/engine/400\">OnPremise</ddl400:ServerLocation>"85 + " <ddl400:DefaultCompatibilityLevel xmlns:ddl400=\"http://schemas.microsoft.com/analysisservices/2012/engine/400\">1100</ddl400:DefaultCompatibilityLevel>"86 + "</Server> ";87 xml = xml.Replace("$value$", serverMode);88 var doc = new XmlDocument();89 90 doc.LoadXml(xml);91 var provider = new FakeStructureDiscoveryFactoryProvider(null);92 var parsedServerMode = provider.ParseXmlaResponse(doc);93 Assert.That(parsedServerMode, Is.EqualTo(serverMode));94 }95 [Test]96 [TestCase("10.0.200.12")]97 [TestCase("9.1.200")]98 public void ParseXmlaResponse_VersionBefore11_GetCorrectServerMode(string version)99 {100 var xml = ""101 + "<Server xmlns=\"http://schemas.microsoft.com/analysisservices/2003/engine\"> "102 + " <Name>XXX\\SQL2014</Name> "103 + " <ID>XXX\\SQL2014</ID> "104 + " <CreatedTimestamp>2015-07-02T21:56:04.076667</CreatedTimestamp> "105 + " <LastSchemaUpdate>2015-07-02T21:56:04.093333</LastSchemaUpdate> "106 + " <Version>$value$</Version> "107 + " <Edition>Developer64</Edition> "108 + " <EditionID>2176971986</EditionID> "109 + "</Server> ";110 xml = xml.Replace("$value$", version);111 var doc = new XmlDocument();112 doc.LoadXml(xml);113 var provider = new FakeStructureDiscoveryFactoryProvider(null);114 var parsedServerMode = provider.ParseXmlaResponse(doc);115 Assert.That(parsedServerMode, Is.EqualTo("Multidimensional"));116 }117 [Test]118 [TestCase("12.0.200.12")]119 [TestCase("11.1.200")]120 public void ParseXmlaResponse_VersionAfter11_ThrowExceptionImpossibleToGuess(string version)121 {122 var xml = ""123 + "<Server xmlns=\"http://schemas.microsoft.com/analysisservices/2003/engine\"> "124 + " <Name>XXX\\SQL2014</Name> "125 + " <ID>XXX\\SQL2014</ID> "126 + " <CreatedTimestamp>2015-07-02T21:56:04.076667</CreatedTimestamp> "127 + " <LastSchemaUpdate>2015-07-02T21:56:04.093333</LastSchemaUpdate> "128 + " <Version>$value$</Version> "129 + " <Edition>Developer64</Edition> "130 + " <EditionID>2176971986</EditionID> "131 + "</Server> ";132 xml = xml.Replace("$value$", version);133 var doc = new XmlDocument();134 doc.LoadXml(xml);135 var provider = new FakeStructureDiscoveryFactoryProvider(null);136 Assert.Throws<ArgumentException>(delegate { provider.ParseXmlaResponse(doc); });137 }138 }139}...

Full Screen

Full Screen

StructureDiscoveryFactoryProvider.cs

Source:StructureDiscoveryFactoryProvider.cs Github

copy

Full Screen

...82 var ds = conn.GetSchemaDataSet("DISCOVER_XML_METADATA", restrictions);83 var xml = ds.Tables[0].Rows[0].ItemArray[0].ToString();84 var doc = new XmlDocument();85 doc.LoadXml(xml);86 parsedMode = ParseXmlaResponse(doc);87 }888990 switch (parsedMode)91 {92 case "Default": return Olap;93 case "Multidimensional": return Olap;94 case "SharePoint": return Tabular;95 case "Tabular": return Tabular;96 }97 }98 catch (Exception ex)99 {100 Trace.WriteLineIf(Extensibility.NBiTraceSwitch.TraceWarning,"Can't detect server mode for SSAS, using Olap. Initial message:" + ex.Message);101 return Olap;102 }103 return Olap;104105 }106107 protected string ParseXmlaResponse(XmlDocument doc)108 {109 var root = doc.DocumentElement;110111 var nm = new XmlNamespaceManager(doc.NameTable);112 nm.AddNamespace("ddl300", "http://schemas.microsoft.com/analysisservices/2011/engine/300");113 nm.AddNamespace("default", "http://schemas.microsoft.com/analysisservices/2003/engine");114 var serverModeNode = root.SelectSingleNode("//ddl300:ServerMode", nm);115 if (serverModeNode == null)116 {117 Trace.WriteLineIf(Extensibility.NBiTraceSwitch.TraceVerbose, "Trying to detect the server mode for SSAS but the server doesn't return this information. Trying to get it from version.");118 var versionNode = root.SelectSingleNode("//default:Version", nm);119 if (versionNode != null)120 {121 var splitVersion = versionNode.InnerText.Split('.'); ...

Full Screen

Full Screen

ParseXmlaResponse

Using AI Code Generation

copy

Full Screen

1using NBi.Core.Structure;2using NBi.Xml;3using NBi.Xml.Constraints;4using NBi.Xml.Items;5using NBi.Xml.Items.Calculation;6using NBi.Xml.Items.ResultSet;7using NBi.Xml.Items.ResultSet.Lookup;8using NBi.Xml.Items.ResultSet.Lookup.Vendor;9using NBi.Xml.Items.ResultSet.Lookup.Vendor.Csv;10using NBi.Xml.Items.ResultSet.Lookup.Vendor.Excel;11using NBi.Xml.Items.ResultSet.Lookup.Vendor.Xmla;12using NBi.Xml.Items.ResultSet.Lookup.Vendor.Xmla.Rowset;13using NBi.Xml.Items.ResultSet.Lookup.Vendor.Xmla.Rowset.Column;14using NBi.Xml.Items.ResultSet.Lookup.Vendor.Xmla.Rowset.Column.Combination;15using NBi.Xml.Items.ResultSet.Lookup.Vendor.Xmla.Rowset.Column.Combination.Comparison;16using NBi.Xml.Items.ResultSet.Lookup.Vendor.Xmla.Rowset.Column.Combination.Comparison.Case;17using NBi.Xml.Items.ResultSet.Lookup.Vendor.Xmla.Rowset.Column.Combination.Comparison.Case.Combination;18using NBi.Xml.Items.ResultSet.Lookup.Vendor.Xmla.Rowset.Column.Combination.Comparison.Case.Combination.Comparison;19using NBi.Xml.Items.ResultSet.Lookup.Vendor.Xmla.Rowset.Column.Combination.Comparison.Case.Combination.Comparison.Case;20using NBi.Xml.Items.ResultSet.Lookup.Vendor.Xmla.Rowset.Column.Combination.Comparison.Case.Combination.Comparison.Case.Combination;21using NBi.Xml.Items.ResultSet.Lookup.Vendor.Xmla.Rowset.Column.Combination.Comparison.Case.Combination.Comparison.Case.Combination.Comparison;22using NBi.Xml.Items.ResultSet.Lookup.Vendor.Xmla.Rowset.Column.Combination.Comparison.Case.Combination.Comparison.Case.Combination.Comparison.Case;23using NBi.Xml.Items.ResultSet.Lookup.Vendor.Xmla.Rowset.Column.Combination.Comparison.Case.Combination.Comparison.Case.Combination.Comparison.Case.Combination;24using NBi.Xml.Items.ResultSet.Lookup.Vendor.Xmla.Rowset.Column.Combination.Comparison.Case.Combination.Comparison.Case.Combination.Comparison.Case.Combination.Comparison;25using NBi.Xml.Items.ResultSet.Lookup.Vendor.Xmla.Rowset.Column.Combination.Comparison.Case.Combination.Comparison.Case.Combination.Comparison.Case.Combination.Comparison.Case;

Full Screen

Full Screen

ParseXmlaResponse

Using AI Code Generation

copy

Full Screen

1using System;2using System.Collections.Generic;3using System.Linq;4using System.Text;5using System.Threading.Tasks;6using System.Xml;7using NBi.Core.Structure;8{9 {10 static void Main(string[] args)11 {12 </root>";13 var xmlDoc = new XmlDocument();14 xmlDoc.LoadXml(xmla);15 var factory = new StructureDiscoveryFactoryProvider();16 var result = factory.ParseXmlaResponse(xmlDoc);17 Console.WriteLine(result);18 }19 }20}21using System;22using System.Collections.Generic;23using System.Linq;24using System.Text;25using System.Threading.Tasks;26using System.Xml;

Full Screen

Full Screen

ParseXmlaResponse

Using AI Code Generation

copy

Full Screen

1using NBi.Core.Structure;2using NBi.Core.Structure.Olap;3using NBi.Core.Structure.Xml;4using System;5using System.Collections.Generic;6using System.Linq;7using System.Text;8using System.Threading.Tasks;9{10 {11 static void Main(string[] args)12 {

Full Screen

Full Screen

ParseXmlaResponse

Using AI Code Generation

copy

Full Screen

1using System;2using System.Collections.Generic;3using System.Linq;4using System.Text;5using System.Threading.Tasks;6using NBi.Core.Structure;7{8 {9 public StructureDiscoveryFactory ParseXmlaResponse(string xmlaResponse)10 {11 StructureDiscoveryFactory factory = new StructureDiscoveryFactory();12 factory.ParseXmlaResponse(xmlaResponse);13 return factory;14 }15 }16}17using System;18using System.Collections.Generic;19using System.Linq;20using System.Text;21using System.Threading.Tasks;22using NBi.Core.Structure;23{24 {25 public StructureDiscoveryCommand GetStructure()26 {27 StructureDiscoveryCommand command = new StructureDiscoveryCommand();28 return command;29 }30 }31}32using System;33using System.Collections.Generic;34using System.Linq;35using System.Text;36using System.Threading.Tasks;37using NBi.Core.Structure;38{39 {40 public void Execute()41 {42 }43 }44}45using System;46using System.Collections.Generic;47using System.Linq;48using System.Text;49using System.Threading.Tasks;50using NBi.Core.Structure;51{52 {53 public IEnumerable<ICube> GetCubes()54 {55 List<ICube> cubes = new List<ICube>();56 return cubes;57 }58 }59}60using System;61using System.Collections.Generic;62using System.Linq;63using System.Text;64using System.Threading.Tasks;65using NBi.Core.Structure;66{67 {68 public IEnumerable<IHierarchy> GetHierarchies(ICube cube)69 {70 List<IHierarchy> hierarchies = new List<IHierarchy>();

Full Screen

Full Screen

ParseXmlaResponse

Using AI Code Generation

copy

Full Screen

1using System;2using NBi.Core.Structure;3using NBi.Core.Structure.Olap;4using NBi.Core.Structure.Relational;5{6 {7 static void Main(string[] args)8 {

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run NBi automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful