3326 Kusto HTTPS url fix (#1086)

* 3326 Removed sqlConnection.Open from CreateSqlConnection in ConnectionService.

* 3326 Removed unused variables and functions from ConnectedBindingContext, ConnectedBindingQueue, IBindingContext, and IConnectedBindingQueue

* 3326 Removed unused constant SqlAzureEdition and unused functions CreateSqlConnection and CreateServerConnection from ConnectionService. Removed ServerConnection, MetadataDisplayInfoProvider, Binder, and SmoMetaDataProvider from ConnectedBindingContext. Deleted SqlConnectionOpener and ISqlConnectionOpener.
This commit is contained in:
Justin M
2020-10-05 00:56:40 -07:00
committed by GitHub
parent 164ca951da
commit 2b022d2e48
10 changed files with 15 additions and 461 deletions

View File

@@ -66,9 +66,8 @@ namespace Microsoft.Kusto.ServiceLayer.UnitTests.LanguageServices
[Test]
public void AddConnectionContext_Returns_EmptyString_For_NullConnectionInfo()
{
var connectionOpenerMock = new Mock<ISqlConnectionOpener>();
var dataSourceFactory = new Mock<IDataSourceFactory>();
var connectedBindingQueue = new ConnectedBindingQueue(connectionOpenerMock.Object, dataSourceFactory.Object);
var connectedBindingQueue = new ConnectedBindingQueue(dataSourceFactory.Object);
var connectionKey = connectedBindingQueue.AddConnectionContext(null, false);
Assert.AreEqual(string.Empty, connectionKey);
@@ -81,9 +80,8 @@ namespace Microsoft.Kusto.ServiceLayer.UnitTests.LanguageServices
var connectionFactory = new Mock<IDataSourceConnectionFactory>();
var connectionInfo = new ConnectionInfo(connectionFactory.Object, "ownerUri", connectionDetails);
var connectionOpenerMock = new Mock<ISqlConnectionOpener>();
var dataSourceFactory = new Mock<IDataSourceFactory>();
var connectedBindingQueue = new ConnectedBindingQueue(connectionOpenerMock.Object, dataSourceFactory.Object);
var connectedBindingQueue = new ConnectedBindingQueue(dataSourceFactory.Object);
var connectionKey = connectedBindingQueue.AddConnectionContext(connectionInfo, false, "featureName");
Assert.AreEqual("NULL_NULL_NULL_NULL", connectionKey);
@@ -96,12 +94,6 @@ namespace Microsoft.Kusto.ServiceLayer.UnitTests.LanguageServices
var connectionFactory = new Mock<IDataSourceConnectionFactory>();
var connectionInfo = new ConnectionInfo(connectionFactory.Object, "ownerUri", connectionDetails);
var connectionOpenerMock = new Mock<ISqlConnectionOpener>();
var fakeServerConnection = new ServerConnection();
connectionOpenerMock
.Setup(x => x.OpenServerConnection(It.IsAny<ConnectionInfo>(), It.IsAny<string>()))
.Returns(fakeServerConnection);
var dataSourceFactory = new Mock<IDataSourceFactory>();
var dataSourceMock = new Mock<IDataSource>();
dataSourceFactory
@@ -109,18 +101,14 @@ namespace Microsoft.Kusto.ServiceLayer.UnitTests.LanguageServices
.Returns(dataSourceMock.Object);
var connectedBindingQueue =
new ConnectedBindingQueue(connectionOpenerMock.Object, dataSourceFactory.Object);
new ConnectedBindingQueue(dataSourceFactory.Object);
var connectionKey =
connectedBindingQueue.AddConnectionContext(connectionInfo, needsMetadata, "featureName");
var bindingContext = connectedBindingQueue.GetOrCreateBindingContext(connectionKey);
Assert.AreEqual(fakeServerConnection, bindingContext.ServerConnection);
Assert.AreEqual(dataSourceMock.Object, bindingContext.DataSource);
Assert.AreEqual(500, bindingContext.BindingTimeout);
Assert.AreEqual(true, bindingContext.IsConnected);
Assert.AreEqual(CasingStyle.Uppercase, bindingContext.MetadataDisplayInfoProvider.BuiltInCasing);
Assert.IsNull(bindingContext.SmoMetadataProvider);
Assert.IsNull(bindingContext.Binder);
}
[Test]
@@ -130,12 +118,10 @@ namespace Microsoft.Kusto.ServiceLayer.UnitTests.LanguageServices
var connectionFactory = new Mock<IDataSourceConnectionFactory>();
var connectionInfo = new ConnectionInfo(connectionFactory.Object, "ownerUri", connectionDetails);
var connectionOpenerMock = new Mock<ISqlConnectionOpener>();
var dataSourceFactory = new Mock<IDataSourceFactory>();
var connectedBindingQueue = new ConnectedBindingQueue(connectionOpenerMock.Object, dataSourceFactory.Object);
var connectedBindingQueue = new ConnectedBindingQueue(dataSourceFactory.Object);
var connectionKey = connectedBindingQueue.AddConnectionContext(connectionInfo, false, "featureName");
connectedBindingQueue.RemoveBindingContext(connectionInfo);
Assert.IsFalse(connectedBindingQueue.BindingContextMap.ContainsKey(connectionKey));